/
external_busybox.patch
220 lines (193 loc) · 7.39 KB
/
external_busybox.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
From f5c979ea7a65ac1d0d713efe4383f122ad9d95ac Mon Sep 17 00:00:00 2001
From: xc-racer99 <xc-racer2@live.ca>
Date: Fri, 25 Dec 2015 21:47:46 -0800
Subject: [PATCH 1/3] Revert "mount: address a couple crashes"
This reverts commit 9e941c4d3e5c8c13fa5cdc35b584800b41e493fd.
---
util-linux/mount.c | 5 +++--
util-linux/volume_id/get_devname.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 6f1ce6734..410d028aa 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1790,12 +1790,13 @@ static int singlemount(struct mntent *mp, int ignore_busy)
// Treat fstype "auto" as unspecified
if (mp->mnt_type && !strcmp(mp->mnt_type, "auto"))
mp->mnt_type = NULL;
- } else if (mp->mnt_type) {
+ } else {
// If user didn't specify an fstype and blkid disagrees or the
// fstype is "auto", trust blkid's determination of the fstype.
+
detected_fstype = get_fstype_from_devname(mp->mnt_fsname);
- if (!strcmp(mp->mnt_type, "auto") ||
+ if ((mp->mnt_type && !strcmp(mp->mnt_type, "auto")) ||
(detected_fstype && strcmp(detected_fstype, mp->mnt_type)))
mp->mnt_type = detected_fstype;
}
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index 85b0fad7b..138a0ceed 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -281,7 +281,7 @@ char *get_fstype_from_devname(const char *device)
add_to_uuid_cache(device);
uc = uuidcache_init(0);
- return (uc != NULL ? (char*)uc->type : NULL);
+ return (char*)uc->type;
#else
return NULL;
#endif
--
2.11.0
From 3b1dda44964bb4f68a218f9cd7221942b637187f Mon Sep 17 00:00:00 2001
From: xc-racer99 <xc-racer2@live.ca>
Date: Fri, 25 Dec 2015 21:48:02 -0800
Subject: [PATCH 2/3] Revert "mount: respect a user-specified fstype"
This reverts commit bbfc3392b8e61dd4c63b1926bab20445ac245bd3.
---
util-linux/mount.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 410d028aa..3ff200132 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -341,7 +341,6 @@ struct globals {
unsigned verbose;
#endif
llist_t *fslist;
- int user_fstype;
char getmntent_buf[1];
} FIX_ALIASING;
enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_buf) };
@@ -353,7 +352,6 @@ enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_b
#define verbose 0
#endif
#define fslist (G.fslist )
-#define user_fstype (G.user_fstype )
#define getmntent_buf (G.getmntent_buf )
#define INIT_G() do { } while (0)
@@ -1786,20 +1784,13 @@ static int singlemount(struct mntent *mp, int ignore_busy)
vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
- if (user_fstype) {
- // Treat fstype "auto" as unspecified
- if (mp->mnt_type && !strcmp(mp->mnt_type, "auto"))
- mp->mnt_type = NULL;
- } else {
- // If user didn't specify an fstype and blkid disagrees or the
- // fstype is "auto", trust blkid's determination of the fstype.
-
- detected_fstype = get_fstype_from_devname(mp->mnt_fsname);
+ detected_fstype = get_fstype_from_devname(mp->mnt_fsname);
- if ((mp->mnt_type && !strcmp(mp->mnt_type, "auto")) ||
- (detected_fstype && strcmp(detected_fstype, mp->mnt_type)))
- mp->mnt_type = detected_fstype;
- }
+ // If fstype is auto or disagrees with blkid, trust blkid's
+ // determination of the filesystem type
+ if ((mp->mnt_type && !strcmp(mp->mnt_type, "auto")) ||
+ (detected_fstype && strcmp(detected_fstype, mp->mnt_type)))
+ mp->mnt_type = detected_fstype;
// Might this be a virtual filesystem?
if (ENABLE_FEATURE_MOUNT_HELPERS && strchr(mp->mnt_fsname, '#')) {
@@ -2076,8 +2067,6 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
opt_complementary = "?2o::" IF_FEATURE_MOUNT_VERBOSE("vv");
opt = getopt32(argv, OPTION_STR, &lst_o, &fstype, &O_optmatch
IF_FEATURE_MOUNT_VERBOSE(, &verbose));
-
- if (opt & OPT_t) user_fstype = 1;
while (lst_o) append_mount_options(&cmdopts, llist_pop(&lst_o)); // -o
if (opt & OPT_r) append_mount_options(&cmdopts, "ro"); // -r
if (opt & OPT_w) append_mount_options(&cmdopts, "rw"); // -w
@@ -2291,8 +2280,6 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
append_mount_options(&(mtcur->mnt_opts), cmdopts);
resolve_mount_spec(&mtpair->mnt_fsname);
- if (user_fstype)
- mtcur->mnt_type = fstype;
rc = singlemount(mtcur, /*ignore_busy:*/ 0);
if (ENABLE_FEATURE_CLEAN_UP)
free(mtcur->mnt_opts);
--
2.11.0
From 72b4eea659d50dcfe415518b8893bf12b47b7c24 Mon Sep 17 00:00:00 2001
From: xc-racer99 <xc-racer2@live.ca>
Date: Fri, 25 Dec 2015 21:49:19 -0800
Subject: [PATCH 3/3] Revert "mount: use blkid to determine fstype"
This reverts commit d9ce728dc32b0c4dfe0c748fddc1f1b126be57e1.
Conflicts:
util-linux/volume_id/get_devname.c
Change-Id: Ie7427a9aa37db2e5447a7931f3a8b5c372f7af66
---
include/volume_id.h | 1 -
util-linux/mount.c | 11 +++--------
util-linux/volume_id/get_devname.c | 21 ---------------------
3 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/include/volume_id.h b/include/volume_id.h
index 1f95d3c43..a83da899e 100644
--- a/include/volume_id.h
+++ b/include/volume_id.h
@@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-char *get_fstype_from_devname(const char *device);
char *get_devname_from_label(const char *spec);
char *get_devname_from_uuid(const char *spec);
void display_uuid_cache(int scan_devices);
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 3ff200132..16b58a0cb 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1776,7 +1776,6 @@ static int singlemount(struct mntent *mp, int ignore_busy)
int rc = -1;
unsigned long vfsflags;
char *loopFile = NULL, *filteropts = NULL;
- char *detected_fstype = NULL;
llist_t *fl = NULL;
struct stat st;
@@ -1784,13 +1783,9 @@ static int singlemount(struct mntent *mp, int ignore_busy)
vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
- detected_fstype = get_fstype_from_devname(mp->mnt_fsname);
-
- // If fstype is auto or disagrees with blkid, trust blkid's
- // determination of the filesystem type
- if ((mp->mnt_type && !strcmp(mp->mnt_type, "auto")) ||
- (detected_fstype && strcmp(detected_fstype, mp->mnt_type)))
- mp->mnt_type = detected_fstype;
+ // Treat fstype "auto" as unspecified
+ if (mp->mnt_type && strcmp(mp->mnt_type, "auto") == 0)
+ mp->mnt_type = NULL;
// Might this be a virtual filesystem?
if (ENABLE_FEATURE_MOUNT_HELPERS && strchr(mp->mnt_fsname, '#')) {
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index 138a0ceed..ddf754e82 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -266,27 +266,6 @@ int add_to_uuid_cache(const char *device)
return 0;
}
-char *get_fstype_from_devname(const char *device)
-{
-#if ENABLE_FEATURE_BLKID_TYPE
- struct uuidCache_s *uc;
- struct stat statbuf;
-
- if (stat(device, &statbuf) < 0)
- return NULL;
-
- if (!S_ISBLK(statbuf.st_mode) && !S_ISREG(statbuf.st_mode))
- return NULL;
-
- add_to_uuid_cache(device);
- uc = uuidcache_init(0);
-
- return (char*)uc->type;
-#else
- return NULL;
-#endif
-}
-
/* Used by mount and findfs */
char *get_devname_from_label(const char *spec)
--
2.11.0