[PATCH] mount: Handle list of comma-separated fs types ("-t" option)
Karol Lewandowski
k.lewandowsk at samsung.com
Wed Nov 2 16:10:01 UTC 2011
This commit 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 at samsung.com>
---
util-linux/mount.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 56276ef..6f1fc5e 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 (supports comma-separated list of types)"
//usage: "\n -O OPT Mount only filesystems with option OPT (-a only)"
//usage: "\n-o OPT:"
//usage: IF_FEATURE_MOUNT_LOOP(
@@ -1823,9 +1823,25 @@ static int singlemount(struct mntent *mp, int ignore_busy)
vfsflags |= MS_BIND;
}
- // 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))) {
+ // Mount filesystem if we know fstype (or list of fstypes)
+ if (mp->mnt_type) {
+ char *fstype, *next;
+
+ mp->mnt_type = fstype = xstrdup(mp->mnt_type);
+
+ do {
+ next = strchr(fstype, ',');
+ if (next != NULL)
+ *next = '\0';
+ rc = mount_it_now(mp, vfsflags, filteropts);
+ if (!rc)
+ break;
+ mp->mnt_type = next + 1;
+ } while (next != NULL);
+
+ free(fstype);
+ } else if (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)) {
+ // Jump straight to the actual mount if possible
rc = mount_it_now(mp, vfsflags, filteropts);
} else {
// Loop through filesystem types until mount succeeds
--
1.7.6.3
--
Karol Lewandowski | Samsung Poland R&D Center | Linux/Platform
More information about the busybox
mailing list