diff options
author | Denis Vlasenko | 2008-02-18 21:08:49 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-02-18 21:08:49 +0000 |
commit | de7684a309ad20c1b889d048d741cb1dd52245f7 (patch) | |
tree | efae3387e1978cdd128ff2a922b734d0e9d0180f /util-linux/mount.c | |
parent | 27dd495b98a6135554b1d839fefe436ba3c6ca71 (diff) | |
download | busybox-de7684a309ad20c1b889d048d741cb1dd52245f7.zip busybox-de7684a309ad20c1b889d048d741cb1dd52245f7.tar.gz |
support for mount by label (not yet tested)
Also adds findfs applet. Closes bug 1143.
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r-- | util-linux/mount.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 8b32309..b19c3a3 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -19,10 +19,13 @@ */ #include <mntent.h> -#include "libbb.h" #include <syslog.h> +#include "libbb.h" -/* Needed for nfs support only... */ +/* For FEATURE_MOUNT_LABEL only */ +#include "volume_id.h" + +/* Needed for nfs support only */ #include <sys/utsname.h> #undef TRUE #undef FALSE @@ -245,6 +248,22 @@ static int verbose_mount(const char *source, const char *target, #define verbose_mount(...) mount(__VA_ARGS__) #endif +static int 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; + return 1; + } + return 0; +} + /* Append mount options to string */ static void append_mount_options(char **oldopts, const char *newopts) { @@ -1781,6 +1800,9 @@ int mount_main(int argc, char **argv) mtpair->mnt_dir = argv[1]; mtpair->mnt_type = fstype; mtpair->mnt_opts = cmdopts; + if (ENABLE_FEATURE_MOUNT_LABEL) { + resolve_mount_spec(&mtpair->mnt_fsname); + } rc = singlemount(mtpair, 0); goto clean_up; } @@ -1842,6 +1864,9 @@ int mount_main(int argc, char **argv) mtcur->mnt_opts = xstrdup(mtcur->mnt_opts); append_mount_options(&(mtcur->mnt_opts), cmdopts); + if (ENABLE_FEATURE_MOUNT_LABEL) { + resolve_mount_spec(&mtpair->mnt_fsname); + } rc = singlemount(mtcur, 0); free(mtcur->mnt_opts); } @@ -1884,6 +1909,9 @@ int mount_main(int argc, char **argv) bb_error_msg_and_die(must_be_root); // Mount this thing. + if (ENABLE_FEATURE_MOUNT_LABEL) { + resolve_mount_spec(&mtpair->mnt_fsname); + } // NFS mounts want this to be xrealloc-able mtcur->mnt_opts = xstrdup(mtcur->mnt_opts); |