X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fpaths.c;h=c4036919bdf7e9ff05f4afa9389c96137d5bc8c3;hp=72d07b20c4cee09b354510558e4558e405e4b828;hb=2bc8d5c941717d950cb8c8fff564d9b634bc6215;hpb=5eb7f7bcd3431cd8f634b02b71bd78f6162c2af3 diff --git a/discover/paths.c b/discover/paths.c index 72d07b2..c403691 100644 --- a/discover/paths.c +++ b/discover/paths.c @@ -35,7 +35,7 @@ const char *mount_base(void) char *encode_label(void *alloc_ctx, const char *label) { char *str, *c; - int i; + unsigned int i; /* the label can be expanded by up to four times */ str = talloc_size(alloc_ctx, strlen(label) * 4 + 1); @@ -58,9 +58,9 @@ char *encode_label(void *alloc_ctx, const char *label) } char *parse_device_path(void *alloc_ctx, - const char *dev_str, const char *cur_dev) + const char *dev_str, const char __attribute__((unused)) *cur_dev) { - char *dev, tmp[256], *enc; + char *dev, *enc; if (is_prefix_ignorecase(dev_str, "uuid=")) { dev = talloc_asprintf(alloc_ctx, "/dev/disk/by-uuid/%s", @@ -81,14 +81,6 @@ char *parse_device_path(void *alloc_ctx, if (is_prefix(dev_str, "/dev/")) dev_str += strlen("/dev/"); - /* PS3 hack: if we're reading from a ps3dx device, and we refer to - * a sdx device, remap to ps3dx */ - if (cur_dev && is_prefix(cur_dev, "/dev/ps3d") - && is_prefix(dev_str, "sd")) { - snprintf(tmp, 255, "ps3d%s", dev_str + 2); - dev_str = tmp; - } - return join_paths(alloc_ctx, "/dev", dev_str); } @@ -116,9 +108,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);