discover/resource: Provide resolve_resource_against_device
authorJeremy Kerr <jk@ozlabs.org>
Wed, 8 May 2013 08:39:58 +0000 (16:39 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 16 May 2013 03:56:28 +0000 (11:56 +0800)
Any other implementation of resources will need to resolve againsst
particular devices, so make resolve_devpath_against_device
publically-accessible, and rename to not be devpath-specific.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/resource.c
discover/resource.h

index b4fa9ca3930f350b8622027a793c0a5be427ef55..25fff650db7fabc6bfe805525c38c379a3ce7708 100644 (file)
@@ -34,7 +34,8 @@ static struct discover_device *parse_device_string(
 
        return device_lookup_by_name(handler, devstr);
 }
 
        return device_lookup_by_name(handler, devstr);
 }
-static void resolve_devpath_against_device(struct resource *res,
+
+void resolve_resource_against_device(struct resource *res,
        struct discover_device *dev, const char *path)
 {
        char *resolved_path = join_paths(res, dev->mount_path, path);
        struct discover_device *dev, const char *path)
 {
        char *resolved_path = join_paths(res, dev->mount_path, path);
@@ -67,7 +68,7 @@ struct resource *create_devpath_resource(struct discover_boot_option *opt,
                        /* we've been passed a file:// URL, which has no device
                         * specifier. We can resolve against the original
                         * device */
                        /* we've been passed a file:// URL, which has no device
                         * specifier. We can resolve against the original
                         * device */
-                       resolve_devpath_against_device(res, orig_device,
+                       resolve_resource_against_device(res, orig_device,
                                        url->path);
                        talloc_free(url);
                }
                                        url->path);
                        talloc_free(url);
                }
@@ -76,7 +77,7 @@ struct resource *create_devpath_resource(struct discover_boot_option *opt,
 
        /* if there was no device specified, we can resolve now */
        if (!pos) {
 
        /* if there was no device specified, we can resolve now */
        if (!pos) {
-               resolve_devpath_against_device(res, orig_device, devpath);
+               resolve_resource_against_device(res, orig_device, devpath);
                return res;
        }
 
                return res;
        }
 
@@ -109,7 +110,7 @@ bool resolve_devpath_resource(struct device_handler *handler,
        if (!dev)
                return false;
 
        if (!dev)
                return false;
 
-       resolve_devpath_against_device(res, dev, info->path);
+       resolve_resource_against_device(res, dev, info->path);
        talloc_free(info);
 
        return true;
        talloc_free(info);
 
        return true;
index 3ef13a5160d81dd2b25c7c456ff1a006803d52d1..ae993e83a8c6c1be57e4bd54b42dd97aef3417f1 100644 (file)
@@ -22,6 +22,9 @@ struct resource {
        };
 };
 
        };
 };
 
+void resolve_resource_against_device(struct resource *res,
+       struct discover_device *dev, const char *path);
+
 /**
  * devpath resources.
  *
 /**
  * devpath resources.
  *
@@ -47,7 +50,5 @@ struct resource *create_url_resource(struct discover_boot_option *opt,
 bool resolve_devpath_resource(struct device_handler *dev,
                struct resource *res);
 
 bool resolve_devpath_resource(struct device_handler *dev,
                struct resource *res);
 
-
-
 #endif /* RESOURCE_H */
 
 #endif /* RESOURCE_H */