From 455b23172de8f1fe8378c7c9470bf7041c242305 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 17 Sep 2009 09:33:59 +0000 Subject: [PATCH 1/2] mount: move resolve_mount_spec() to volume_id/ This is so it can be reused by other applets like swaponoff. Signed-off-by: Natanael Copa --- include/volume_id.h | 6 ++++++ util-linux/mount.c | 17 ----------------- util-linux/volume_id/get_devname.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/include/volume_id.h b/include/volume_id.h index bba32c0..cef5e9a 100644 --- a/include/volume_id.h +++ b/include/volume_id.h @@ -21,3 +21,9 @@ char *get_devname_from_label(const char *spec); char *get_devname_from_uuid(const char *spec); void display_uuid_cache(void); + +#if ENABLE_FEATURE_MOUNT_LABEL +void resolve_mount_spec(char **fsname); +#else +#define resolve_mount_spec(fsname) ((void)0) +#endif diff --git a/util-linux/mount.c b/util-linux/mount.c index 478dc24..0d12506 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -290,23 +290,6 @@ static int verbose_mount(const char *source, const char *target, #define verbose_mount(...) mount(__VA_ARGS__) #endif -#if ENABLE_FEATURE_MOUNT_LABEL -static void resolve_mount_spec(char **fsname) -{ - char *tmp = NULL; - - if (!strncmp(*fsname, "UUID=", 5)) - tmp = get_devname_from_uuid(*fsname + 5); - else if (!strncmp(*fsname, "LABEL=", 6)) - tmp = get_devname_from_label(*fsname + 6); - - if (tmp) - *fsname = tmp; -} -#else -#define resolve_mount_spec(fsname) ((void)0) -#endif - // Append mount options to string static void append_mount_options(char **oldopts, const char *newopts) { diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index 0686a07..a613b85 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c @@ -260,3 +260,19 @@ char *get_devname_from_uuid(const char *spec) } return NULL; } + +#if ENABLE_FEATURE_MOUNT_LABEL +void resolve_mount_spec(char **fsname) +{ + char *tmp = NULL; + + if (!strncmp(*fsname, "UUID=", 5)) + tmp = get_devname_from_uuid(*fsname + 5); + else if (!strncmp(*fsname, "LABEL=", 6)) + tmp = get_devname_from_label(*fsname + 6); + + if (tmp) + *fsname = tmp; +} +#endif + -- 1.6.4.2