diff options
author | Karol Lewandowski <k.lewandowsk@samsung.com> | 2011-11-03 10:02:31 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-03 10:02:31 +0100 |
commit | b5ebe5fdb3a520114fc4f956687e2c51f3b81429 (patch) | |
tree | d8d018097a76b55473551b800125e3f70d84b67a /util-linux | |
parent | f85554c26525ec2ddc860ccb1aadc05e7a3825f6 (diff) | |
download | busybox-b5ebe5fdb3a520114fc4f956687e2c51f3b81429.tar.gz |
mount: handle list of comma-separated fs types in -t option
Allows one to specify list of filesystem types to be
tried when mounting particular device. E.g.
mount -t vfat,ext2 ...
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/mount.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index fddd7fba9..f94b6e643 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -38,7 +38,7 @@ //usage: ) //usage: "\n -r Read-only mount" //usage: "\n -w Read-write mount (default)" -//usage: "\n -t FSTYPE Filesystem type" +//usage: "\n -t FSTYPE[,...] Filesystem type(s)" //usage: "\n -O OPT Mount only filesystems with option OPT (-a only)" //usage: "\n-o OPT:" //usage: IF_FEATURE_MOUNT_LOOP( @@ -1827,7 +1827,16 @@ static int singlemount(struct mntent *mp, int ignore_busy) // If we know the fstype (or don't need to), jump straight // to the actual mount. if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))) { - rc = mount_it_now(mp, vfsflags, filteropts); + char *next; + for (;;) { + next = mp->mnt_type ? strchr(mp->mnt_type, ',') : NULL; + if (next) + *next = '\0'; + rc = mount_it_now(mp, vfsflags, filteropts); + if (rc == 0 || !next) + break; + mp->mnt_type = next + 1; + } } else { // Loop through filesystem types until mount succeeds // or we run out @@ -1844,7 +1853,7 @@ static int singlemount(struct mntent *mp, int ignore_busy) for (fl = fslist; fl; fl = fl->link) { mp->mnt_type = fl->data; rc = mount_it_now(mp, vfsflags, filteropts); - if (!rc) + if (rc == 0) break; } } |