Last change
on this file since 3839 was 3621, checked in by Bruno Cornec, 8 years ago |
New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.
|
-
Property svn:eol-style
set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | /* vi: set sw=4 ts=4: */
|
---|
2 | /*
|
---|
3 | * Support functions for mounting devices by label/uuid
|
---|
4 | *
|
---|
5 | * Copyright (C) 2006 by Jason Schoon <floydpink@gmail.com>
|
---|
6 | * Some portions cribbed from e2fsprogs, util-linux, dosfstools
|
---|
7 | *
|
---|
8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
9 | */
|
---|
10 |
|
---|
11 | //usage:#define findfs_trivial_usage
|
---|
12 | //usage: "LABEL=label or UUID=uuid"
|
---|
13 | //usage:#define findfs_full_usage "\n\n"
|
---|
14 | //usage: "Find a filesystem device based on a label or UUID"
|
---|
15 | //usage:
|
---|
16 | //usage:#define findfs_example_usage
|
---|
17 | //usage: "$ findfs LABEL=MyDevice"
|
---|
18 |
|
---|
19 | #include "libbb.h"
|
---|
20 | #include "volume_id.h"
|
---|
21 |
|
---|
22 | int findfs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
23 | int findfs_main(int argc UNUSED_PARAM, char **argv)
|
---|
24 | {
|
---|
25 | char *dev = *++argv;
|
---|
26 |
|
---|
27 | if (!dev)
|
---|
28 | bb_show_usage();
|
---|
29 |
|
---|
30 | if (is_prefixed_with(dev, "/dev/")) {
|
---|
31 | /* Just pass any /dev/xxx name right through.
|
---|
32 | * This might aid in some scripts being able
|
---|
33 | * to call this unconditionally */
|
---|
34 | dev = NULL;
|
---|
35 | } else {
|
---|
36 | /* Otherwise, handle LABEL=xxx and UUID=xxx,
|
---|
37 | * fail on anything else */
|
---|
38 | if (!resolve_mount_spec(argv))
|
---|
39 | bb_show_usage();
|
---|
40 | }
|
---|
41 |
|
---|
42 | if (*argv != dev) {
|
---|
43 | puts(*argv);
|
---|
44 | return 0;
|
---|
45 | }
|
---|
46 | return 1;
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.