Add URL test to resolve_path
authorGeoff Levand <geoffrey.levand@am.sony.com>
Sun, 12 Apr 2009 15:11:47 +0000 (15:11 +0000)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 30 Jun 2009 07:29:14 +0000 (15:29 +0800)
Add a check to discover's resolve_path() to test if the path
is a URL, and if so just return that path.

If the path has "file://", treat it as a local path.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/paths.c

index 5b550fabb2460537a868c33ed784fed1ff7c9582..8e2a3610bee7b00a163bb15619fa6a36121c0962 100644 (file)
@@ -116,9 +116,17 @@ const char *mountpoint_for_device(const char *dev)
 
 char *resolve_path(void *alloc_ctx, const char *path, const char *current_dev)
 {
+       static const char s_file[] = "file://";
        char *ret;
        const char *devpath, *sep;
 
+       /* test for urls */
+
+       if (!strncasecmp(path, s_file, sizeof(s_file) - 1))
+               path += sizeof(s_file) - 1;
+       else if (strstr(path, "://"))
+               return talloc_strdup(alloc_ctx, path);
+
        sep = strchr(path, ':');
        if (!sep) {
                devpath = mountpoint_for_device(current_dev);