X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fresource.h;h=ae993e83a8c6c1be57e4bd54b42dd97aef3417f1;hp=b7e1a4649dfc7d699faa0aa816f3e3c8e4e9004c;hb=8f09986340e602a69398b2866a265ea3f16609c6;hpb=d170c0ae55daf41c34497b51a5e84f50b76a42b6 diff --git a/discover/resource.h b/discover/resource.h index b7e1a46..ae993e8 100644 --- a/discover/resource.h +++ b/discover/resource.h @@ -3,6 +3,9 @@ #include +struct discover_boot_option; +struct discover_device; +struct device_handler; struct pb_url; /** @@ -19,5 +22,33 @@ struct resource { }; }; +void resolve_resource_against_device(struct resource *res, + struct discover_device *dev, const char *path); + +/** + * devpath resources. + * + * Most resources in config files will be in one of the following formats: + * - URLs + * - device-local filenames (ie, filenames on the currently-discovered dev) + * - other-device filenames (which speficy the device by a string format, + * using a dev:path format). + * + * The following definitions are a generic resource handler for these types + * of resources. By creating resources with create_devpath_resource, + * parsers can use resolve_devpath_resource as their resolve_resouce + * callback. + */ + +struct resource *create_devpath_resource(struct discover_boot_option *opt, + struct discover_device *orig_device, + const char *devpath); + +struct resource *create_url_resource(struct discover_boot_option *opt, + struct pb_url *url); + +bool resolve_devpath_resource(struct device_handler *dev, + struct resource *res); + #endif /* RESOURCE_H */