summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <griebl@gmx.de>2002-07-25 14:17:19 +0000
committerRobert Griebl <griebl@gmx.de>2002-07-25 14:17:19 +0000
commitd0dd3d31e282b9aafaf499e4378cc2f691fea30a (patch)
tree09a40d61d5a3b5733aba2ee235e9c82af85d8449
parent2a4a8d8ffb67407d4701e3501ec680e9a26f99f6 (diff)
downloadbusybox-w32-d0dd3d31e282b9aafaf499e4378cc2f691fea30a.tar.gz
busybox-w32-d0dd3d31e282b9aafaf499e4378cc2f691fea30a.tar.bz2
busybox-w32-d0dd3d31e282b9aafaf499e4378cc2f691fea30a.zip
Fix for bug #1255 -- support for mount -t <type>
-rw-r--r--util-linux/mount.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index f6c647259..df6b3a822 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -347,7 +347,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
347 return (TRUE); 347 return (TRUE);
348} 348}
349 349
350static void show_mounts(void) 350static void show_mounts(char *onlytype)
351{ 351{
352#if defined CONFIG_FEATURE_USE_DEVPS_PATCH 352#if defined CONFIG_FEATURE_USE_DEVPS_PATCH
353 int fd, i, numfilesystems; 353 int fd, i, numfilesystems;
@@ -371,10 +371,12 @@ static void show_mounts(void)
371 perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS"); 371 perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
372 372
373 for( i = 0 ; i < numfilesystems ; i++) { 373 for( i = 0 ; i < numfilesystems ; i++) {
374 printf( "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, 374 if ( !onlytype || ( strcmp ( mntentlist[i].mnt_type, onlytype ) == 0 )) {
375 mntentlist[i].mnt_dir, mntentlist[i].mnt_type, 375 printf( "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
376 mntentlist[i].mnt_opts, mntentlist[i].mnt_freq, 376 mntentlist[i].mnt_dir, mntentlist[i].mnt_type,
377 mntentlist[i].mnt_passno); 377 mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
378 mntentlist[i].mnt_passno);
379 }
378 } 380 }
379#ifdef CONFIG_FEATURE_CLEAN_UP 381#ifdef CONFIG_FEATURE_CLEAN_UP
380 /* Don't bother to close files or free memory. Exit 382 /* Don't bother to close files or free memory. Exit
@@ -394,8 +396,10 @@ static void show_mounts(void)
394 if (strcmp(blockDevice, "/dev/root") == 0) { 396 if (strcmp(blockDevice, "/dev/root") == 0) {
395 blockDevice = find_real_root_device_name(blockDevice); 397 blockDevice = find_real_root_device_name(blockDevice);
396 } 398 }
397 printf("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir, 399 if ( !onlytype || ( strcmp ( m-> mnt_type, onlytype ) == 0 )) {
398 m->mnt_type, m->mnt_opts); 400 printf("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
401 m->mnt_type, m->mnt_opts);
402 }
399#ifdef CONFIG_FEATURE_CLEAN_UP 403#ifdef CONFIG_FEATURE_CLEAN_UP
400 if(blockDevice != m->mnt_fsname) 404 if(blockDevice != m->mnt_fsname)
401 free(blockDevice); 405 free(blockDevice);
@@ -416,6 +420,7 @@ extern int mount_main(int argc, char **argv)
416 char *extra_opts; 420 char *extra_opts;
417 int flags = 0; 421 int flags = 0;
418 char *filesystemType = "auto"; 422 char *filesystemType = "auto";
423 int got_filesystemType = 0;
419 char *device = xmalloc(PATH_MAX); 424 char *device = xmalloc(PATH_MAX);
420 char *directory = xmalloc(PATH_MAX); 425 char *directory = xmalloc(PATH_MAX);
421 struct mntent *m = NULL; 426 struct mntent *m = NULL;
@@ -437,6 +442,7 @@ extern int mount_main(int argc, char **argv)
437 break; 442 break;
438 case 't': 443 case 't':
439 filesystemType = optarg; 444 filesystemType = optarg;
445 got_filesystemType = 1;
440 break; 446 break;
441 case 'w': 447 case 'w':
442 flags &= ~MS_RDONLY; 448 flags &= ~MS_RDONLY;
@@ -458,7 +464,7 @@ extern int mount_main(int argc, char **argv)
458 } 464 }
459 465
460 if (!all && optind == argc) 466 if (!all && optind == argc)
461 show_mounts(); 467 show_mounts(got_filesystemType ? filesystemType : 0);
462 468
463 if (optind < argc) { 469 if (optind < argc) {
464 /* if device is a filename get its real path */ 470 /* if device is a filename get its real path */