summaryrefslogtreecommitdiffstats
path: root/meta/packages/busybox/busybox-1.01/mount-all-type.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/busybox/busybox-1.01/mount-all-type.patch')
-rw-r--r--meta/packages/busybox/busybox-1.01/mount-all-type.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/packages/busybox/busybox-1.01/mount-all-type.patch b/meta/packages/busybox/busybox-1.01/mount-all-type.patch
new file mode 100644
index 0000000000..476094a804
--- /dev/null
+++ b/meta/packages/busybox/busybox-1.01/mount-all-type.patch
@@ -0,0 +1,84 @@
1--- busybox-1.00/.pc/mount-all-type.patch/util-linux/mount.c 2004-08-02 17:14:02.000000000 -0700
2+++ busybox-1.00/util-linux/mount.c 2005-05-13 00:17:19.054232796 -0700
3@@ -364,6 +364,56 @@
4 exit(EXIT_SUCCESS);
5 }
6
7+/* Does this file system type, from /etc/fstab, match the given
8+ * -t option value?
9+ */
10+static int match_fs(const char *option, const char *type)
11+{
12+ const int len = strlen(type);
13+ const int no = option[0] == 'n' && option[1] == 'o';
14+ const char *optp = option;
15+
16+ if (len > 0) do {
17+ const char *match = strstr(optp, type);
18+
19+ if (match == NULL) {
20+ /* No match, but if the option string starts 'no' no match
21+ * means yes.
22+ */
23+ return no;
24+ }
25+
26+ /* Match, may be partial, check for end-of-type in option string. */
27+ if (match[len] == 0 || match[len] == ',') {
28+ /* Ok, check for type or notype. */
29+ if (match == option) {
30+ /* Exact match at start (can't be 'no') */
31+ return 1;
32+ }
33+ if (match > option+1) {
34+ if (match[-1] == ',') {
35+ /* Exact match in middle, might be 'no' */
36+ return !no;
37+ }
38+ if (match == option+2 && no) {
39+ /* Exact match to 'notype' at start. */
40+ return 0;
41+ }
42+ if (match > option+2 && match[-3] == ',' &&
43+ match[-2] == 'n' && match[-1] == 'o') {
44+ return 0;
45+ }
46+ }
47+ }
48+
49+ /* Look for another match. */
50+ optp = match+1;
51+ } while (1);
52+
53+ /* zero length type in fstab (impossible?), don't match it. */
54+ return 0;
55+}
56+
57 extern int mount_main(int argc, char **argv)
58 {
59 struct stat statbuf;
60@@ -371,6 +421,7 @@
61 char *extra_opts;
62 int flags = 0;
63 char *filesystemType = "auto";
64+ char *filesystemOption = 0;
65 int got_filesystemType = 0;
66 char *device = xmalloc(PATH_MAX);
67 char *directory = xmalloc(PATH_MAX);
68@@ -393,6 +444,7 @@
69 break;
70 case 't':
71 filesystemType = optarg;
72+ filesystemOption = optarg;
73 got_filesystemType = 1;
74 break;
75 case 'w':
76@@ -460,6 +512,8 @@
77
78 strcpy(device, m->mnt_fsname);
79 strcpy(directory, m->mnt_dir);
80+ if (all && filesystemOption != 0 && !match_fs(filesystemOption, m->mnt_type))
81+ continue;
82 filesystemType = bb_xstrdup(m->mnt_type);
83 singlemount:
84 extra_opts = string_flags;