diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2010-08-27 16:58:44 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2010-08-27 20:23:19 +0200 |
commit | dc0a335554eafa643c7fd123d99e14df72c515c3 (patch) | |
tree | 846e8d88852d6db9b7b2c6454dad589a7bcf6f4e /mount/mount.c | |
parent | 0828125895f7323e39b87673dbdbef4c70da5fdb (diff) | |
download | util-linux-old-dc0a335554eafa643c7fd123d99e14df72c515c3.tar.gz |
mount: handle filesystems with subtype
Linux can handle filesystem types with "MAINTYPE.SUBTYPE" format,
where the main type determines the actual filesystem driver while the
subtype can be interpreted by the filesystem itself.
When searching for mount helpers mount(8) and umount(8) should also
interpret such types, falling back to (u)mount.MAINTYPE if
(u)mount.MAINTYPE.SUBTYPE doesn't exist.
This patch implements this, passing the type with "-t TYPE"
to the mount program in this case.
Reported-by: Josef Bacik <josef@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=625064
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'mount/mount.c')
-rw-r--r-- | mount/mount.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/mount/mount.c b/mount/mount.c index f2b6ee23..84986e36 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -664,13 +664,22 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in path = strtok(search_path, ":"); while (path) { + int type_opt = 0; + res = snprintf(mountprog, sizeof(mountprog), "%s/mount.%s", path, type); path = strtok(NULL, ":"); if (res >= sizeof(mountprog) || res < 0) continue; - if (stat(mountprog, &statbuf)) + res = stat(mountprog, &statbuf); + if (res == -1 && errno == ENOENT && strchr(type, '.')) { + /* If type ends with ".subtype" try without it */ + *strrchr(mountprog, '.') = '\0'; + type_opt = 1; + res = stat(mountprog, &statbuf); + } + if (res) continue; if (verbose) @@ -678,7 +687,7 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in switch (fork()) { case 0: { /* child */ - char *oo, *mountargs[10]; + char *oo, *mountargs[12]; int i = 0; if (setgid(getgid()) < 0) @@ -703,7 +712,11 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in mountargs[i++] = "-o"; /* 8 */ mountargs[i++] = oo; /* 9 */ } - mountargs[i] = NULL; /* 10 */ + if (type_opt) { + mountargs[i++] = "-t"; /* 10 */ + mountargs[i++] = (char *) type; /* 11 */ + } + mountargs[i] = NULL; /* 12 */ if (verbose > 2) { i = 0; |