summaryrefslogtreecommitdiff
path: root/util-linux/volume_id/get_devname.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/volume_id/get_devname.c')
-rw-r--r--util-linux/volume_id/get_devname.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index 0686a07..9b5283f 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -260,3 +260,20 @@ char *get_devname_from_uuid(const char *spec)
}
return NULL;
}
+
+int resolve_mount_spec(char **fsname)
+{
+ char *tmp = *fsname;
+
+ if (strncmp(*fsname, "UUID=", 5) == 0)
+ tmp = get_devname_from_uuid(*fsname + 5);
+ else if (strncmp(*fsname, "LABEL=", 6) == 0)
+ tmp = get_devname_from_label(*fsname + 6);
+
+ if (tmp == *fsname)
+ return 0; /* no UUID= or LABEL= prefix found */
+
+ if (tmp)
+ *fsname = tmp;
+ return 1;
+}