summaryrefslogtreecommitdiff
path: root/util-linux/mount.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-15 17:33:30 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-15 17:33:30 +0000
commita9c95ea6551eb3d894fcc56822c8aa394972b699 (patch)
tree59359f25ba4bd356c2dfce79735fb66db4bb4151 /util-linux/mount.c
parent80974fad03689b4344888820d89b514d4e4d166b (diff)
downloadbusybox-w32-a9c95ea6551eb3d894fcc56822c8aa394972b699.tar.gz
busybox-w32-a9c95ea6551eb3d894fcc56822c8aa394972b699.tar.bz2
busybox-w32-a9c95ea6551eb3d894fcc56822c8aa394972b699.zip
Updates
Diffstat (limited to '')
-rw-r--r--util-linux/mount.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 827a56f0a..a9463afba 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -92,12 +92,12 @@ static const struct mount_options mount_options[] = {
92}; 92};
93 93
94#if ! defined BB_MTAB 94#if ! defined BB_MTAB
95#define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt) \ 95#define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt, mtab_opts) \
96 mount(specialfile, dir, filesystemtype, flags, string_flags) 96 mount(specialfile, dir, filesystemtype, flags, string_flags)
97#else 97#else
98static int 98static int
99do_mount(char* specialfile, char* dir, char* filesystemtype, 99do_mount(char* specialfile, char* dir, char* filesystemtype,
100 long flags, void* string_flags, int useMtab, int fakeIt) 100 long flags, void* string_flags, int useMtab, int fakeIt, char* mtab_opts)
101{ 101{
102 int status=0; 102 int status=0;
103 103
@@ -106,7 +106,7 @@ do_mount(char* specialfile, char* dir, char* filesystemtype,
106 106
107 if ( status == 0 ) { 107 if ( status == 0 ) {
108 if ( useMtab==TRUE ) 108 if ( useMtab==TRUE )
109 write_mtab(specialfile, dir, filesystemtype, flags, string_flags); 109 write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts);
110 return 0; 110 return 0;
111 } 111 }
112 else 112 else
@@ -157,7 +157,7 @@ parse_mount_options ( char *options, unsigned long *flags, char *strflags)
157 157
158int 158int
159mount_one(char *blockDevice, char *directory, char *filesystemType, 159mount_one(char *blockDevice, char *directory, char *filesystemType,
160 unsigned long flags, char *string_flags, int useMtab, int fakeIt) 160 unsigned long flags, char *string_flags, int useMtab, int fakeIt, char *mtab_opts)
161{ 161{
162 int status = 0; 162 int status = 0;
163 163
@@ -182,7 +182,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
182 filesystemType++; // hop past tab 182 filesystemType++; // hop past tab
183 183
184 status = do_mount (blockDevice, directory, filesystemType, 184 status = do_mount (blockDevice, directory, filesystemType,
185 flags | MS_MGC_VAL, string_flags, useMtab, fakeIt); 185 flags | MS_MGC_VAL, string_flags, useMtab,
186 fakeIt, mtab_opts);
186 if (status == 0) 187 if (status == 0)
187 break; 188 break;
188 } 189 }
@@ -190,7 +191,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
190 fclose (f); 191 fclose (f);
191 } else { 192 } else {
192 status = do_mount (blockDevice, directory, filesystemType, 193 status = do_mount (blockDevice, directory, filesystemType,
193 flags | MS_MGC_VAL, string_flags, useMtab, fakeIt); 194 flags | MS_MGC_VAL, string_flags, useMtab,
195 fakeIt, mtab_opts);
194 } 196 }
195 197
196 if (status) { 198 if (status) {
@@ -203,7 +205,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
203 205
204extern int mount_main (int argc, char **argv) 206extern int mount_main (int argc, char **argv)
205{ 207{
206 char string_flags[1024]=""; 208 char string_flags_buf[1024]="";
209 char *string_flags = string_flags_buf;
210 char *extra_opts = string_flags_buf;
207 unsigned long flags = 0; 211 unsigned long flags = 0;
208 char *filesystemType = "auto"; 212 char *filesystemType = "auto";
209 char *device = NULL; 213 char *device = NULL;
@@ -245,14 +249,13 @@ extern int mount_main (int argc, char **argv)
245 argv++; 249 argv++;
246 while (i > 0 && **argv) { 250 while (i > 0 && **argv) {
247 if (**argv == '-') { 251 if (**argv == '-') {
248 while (i>0 && *++(*argv)) switch (**argv) { 252 char *opt = *argv;
253 while (i>0 && *++opt) switch (*opt) {
249 case 'o': 254 case 'o':
250 if (--i == 0) { 255 if (--i == 0) {
251 goto goodbye; 256 goto goodbye;
252 } 257 }
253 parse_mount_options (*(++argv), &flags, string_flags); 258 parse_mount_options (*(++argv), &flags, string_flags);
254 --i;
255 ++argv;
256 break; 259 break;
257 case 'r': 260 case 'r':
258 flags |= MS_RDONLY; 261 flags |= MS_RDONLY;
@@ -262,8 +265,6 @@ extern int mount_main (int argc, char **argv)
262 goto goodbye; 265 goto goodbye;
263 } 266 }
264 filesystemType = *(++argv); 267 filesystemType = *(++argv);
265 --i;
266 ++argv;
267 break; 268 break;
268 case 'w': 269 case 'w':
269 flags &= ~MS_RDONLY; 270 flags &= ~MS_RDONLY;
@@ -317,14 +318,20 @@ extern int mount_main (int argc, char **argv)
317 *string_flags = '\0'; 318 *string_flags = '\0';
318 parse_mount_options(m->mnt_opts, &flags, string_flags); 319 parse_mount_options(m->mnt_opts, &flags, string_flags);
319 mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type, 320 mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type,
320 flags, string_flags, useMtab, fakeIt); 321 flags, string_flags, useMtab, fakeIt, extra_opts);
321 } 322 }
322 } 323 }
323 endmntent (f); 324 endmntent (f);
324 } else { 325 } else {
325 if (device && directory) { 326 if (device && directory) {
327#ifdef BB_NFSMOUNT
328 if (strcmp(filesystemType, "nfs") == 0) {
329 if (nfsmount(device, directory, &flags, &extra_opts, &string_flags, 1) != 0)
330 exit(FALSE);
331 }
332#endif
326 exit (mount_one (device, directory, filesystemType, 333 exit (mount_one (device, directory, filesystemType,
327 flags, string_flags, useMtab, fakeIt)); 334 flags, string_flags, useMtab, fakeIt, extra_opts));
328 } else { 335 } else {
329 goto goodbye; 336 goto goodbye;
330 } 337 }