1 /* vi: set sw=4 ts=4: */
3 * Support functions for mounting devices by label/uuid
5 * Copyright (C) 2006 by Jason Schoon <floydpink@gmail.com>
6 * Some portions cribbed from e2fsprogs, util-linux, dosfstools
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 //config:config FINDFS
11 //config: bool "findfs"
13 //config: select PLATFORM_LINUX
14 //config: select VOLUMEID
16 //config: Prints the name of a filesystem with given label or UUID.
18 //config: With all submodules selected, it will add ~8k to busybox.
20 /* Benefits from suid root: better access to /dev/BLOCKDEVs: */
21 //applet:IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE))
23 //kbuild:lib-$(CONFIG_FINDFS) += findfs.o
25 //usage:#define findfs_trivial_usage
26 //usage: "LABEL=label or UUID=uuid"
27 //usage:#define findfs_full_usage "\n\n"
28 //usage: "Find a filesystem device based on a label or UUID"
30 //usage:#define findfs_example_usage
31 //usage: "$ findfs LABEL=MyDevice"
34 #include "volume_id.h"
36 int findfs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
37 int findfs_main(int argc UNUSED_PARAM, char **argv)
44 if (is_prefixed_with(dev, "/dev/")) {
45 /* Just pass any /dev/xxx name right through.
46 * This might aid in some scripts being able
47 * to call this unconditionally */
50 /* Otherwise, handle LABEL=xxx and UUID=xxx,
51 * fail on anything else */
52 if (!resolve_mount_spec(argv))