diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-06 01:57:47 +0400 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-06 01:57:47 +0400 |
commit | bf295dd5b67c1e192600f3510de2d5d1e686c685 (patch) | |
tree | 652596d819687154790512fc68b2047290c9efc9 /util-linux | |
parent | df5bbb938ae73cf668778d1d54718fddb0f76130 (diff) |
[u]mount: extend -t option (Roy Marples <uberlord@gentoo.org>)
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/mount.c | 5 | ||||
-rw-r--r-- | util-linux/umount.c | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 567514ccb..4a0237196 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -77,6 +77,7 @@ struct { {"defaults", 0}, /* {"quiet", 0}, - do not filter out, vfat wants to see it */ {"noauto", MOUNT_NOAUTO}, + {"sw", MOUNT_SWAP}, {"swap", MOUNT_SWAP}, USE_DESKTOP({"user", MOUNT_USERS},) USE_DESKTOP({"users", MOUNT_USERS},) @@ -1703,9 +1704,7 @@ int mount_main(int argc, char **argv) } else { // Do we need to match a filesystem type? - // TODO: support "-t type1,type2"; "-t notype1,type2" - - if (fstype && strcmp(mtcur->mnt_type, fstype)) continue; + if (fstype && match_fstype(mtcur, fstype)) continue; // Skip noauto and swap anyway. diff --git a/util-linux/umount.c b/util-linux/umount.c index 4ea15d91b..19f13454b 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -12,7 +12,7 @@ #include <mntent.h> #include <getopt.h> -#define OPTION_STRING "flDnravd" +#define OPTION_STRING "flDnravdt:" #define OPT_FORCE 1 #define OPT_LAZY 2 #define OPT_DONTFREELOOP 4 @@ -27,6 +27,7 @@ int umount_main(int argc, char **argv) char path[2*PATH_MAX]; struct mntent me; FILE *fp; + char *fstype = 0; int status = EXIT_SUCCESS; unsigned opt; struct mtab_list { @@ -37,7 +38,7 @@ int umount_main(int argc, char **argv) /* Parse any options */ - opt = getopt32(argc, argv, OPTION_STRING); + opt = getopt32(argc, argv, OPTION_STRING, &fstype); argc -= optind; argv += optind; @@ -61,6 +62,9 @@ int umount_main(int argc, char **argv) bb_error_msg_and_die("cannot open %s", bb_path_mtab_file); } else { while (getmntent_r(fp, &me, path, sizeof(path))) { + /* Match fstype if passed */ + if (fstype && match_fstype(&me, fstype)) + continue; m = xmalloc(sizeof(struct mtab_list)); m->next = mtl; m->device = xstrdup(me.mnt_fsname); @@ -71,7 +75,7 @@ int umount_main(int argc, char **argv) } /* If we're not umounting all, we need at least one argument. */ - if (!(opt & OPT_ALL)) { + if (!(opt & OPT_ALL) && !fstype) { m = 0; if (!argc) bb_show_usage(); } |