summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2007-10-04 15:07:30 +0200
committerKarel Zak2007-10-04 15:07:30 +0200
commitf92dc20fcb9bb9f15ac95e0e3d6ae96ecfb59619 (patch)
treef7db2d29d6abe5c56a61e77e2e5de1434ba37f20
parentrtcwake: fix verbose message (diff)
downloadkernel-qcow2-util-linux-f92dc20fcb9bb9f15ac95e0e3d6ae96ecfb59619.tar.gz
kernel-qcow2-util-linux-f92dc20fcb9bb9f15ac95e0e3d6ae96ecfb59619.tar.xz
kernel-qcow2-util-linux-f92dc20fcb9bb9f15ac95e0e3d6ae96ecfb59619.zip
mount: cleanup "none" fstype usage
* disable to call /sbin/mount.none * rewrite fstype to "none" for MS_BIND and MS_MOVE * add notes about "none" to fstab.5 and mount.8 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--mount/fstab.53
-rw-r--r--mount/mount.85
-rw-r--r--mount/mount.c9
-rw-r--r--mount/umount.c5
4 files changed, 18 insertions, 4 deletions
diff --git a/mount/fstab.5 b/mount/fstab.5
index a7978b5f5..6109b5ee4 100644
--- a/mount/fstab.5
+++ b/mount/fstab.5
@@ -142,6 +142,9 @@ An entry
.I ignore
causes the line to be ignored. This is useful
to show disk partitions which are currently unused.
+An entry
+.I none
+is useful for bind or move mounts.
The fourth field,
.RI ( fs_mntops ),
diff --git a/mount/mount.8 b/mount/mount.8
index 01001ade5..54b11d469 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -108,6 +108,11 @@ file hierarchy somewhere else. The call is
.br
.B "mount --bind olddir newdir"
.RE
+or fstab entry is:
+.RS
+.br
+.B "/olddir /newdir none bind"
+.RE
After this call the same contents is accessible in two places.
One can also remount a single file (on a single file).
diff --git a/mount/mount.c b/mount/mount.c
index 5bc2b30c3..2e458cad0 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -624,7 +624,10 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
if (!external_allowed)
return 0;
- if (type && strlen(type) < 100) {
+ if (type == NULL || strcmp(type, "none") == 0)
+ return 0;
+
+ if (strlen(type) < 100) {
sprintf(mountprog, "/sbin/mount.%s", type);
if (stat(mountprog, &statbuf) == 0) {
if (verbose)
@@ -719,8 +722,8 @@ guess_fstype_and_mount(const char *spec, const char *node, const char **types,
if (*types && strcasecmp (*types, "auto") == 0)
*types = NULL;
- if (!*types && (flags & (MS_BIND | MS_MOVE)))
- *types = "none"; /* random, but not "bind" */
+ if (flags & (MS_BIND | MS_MOVE))
+ *types = "none";
if (!*types && !(flags & MS_REMOUNT)) {
*types = guess_fstype_by_devname(spec);
diff --git a/mount/umount.c b/mount/umount.c
index 322161983..6af43546e 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -94,7 +94,10 @@ check_special_umountprog(const char *spec, const char *node,
if (!external_allowed)
return 0;
- if (type && strlen(type) < 100) {
+ if (type == NULL || strcmp(type, "none") == 0)
+ return 0;
+
+ if (strlen(type) < 100) {
sprintf(umountprog, "/sbin/umount.%s", type);
if (stat(umountprog, &statbuf) == 0) {
res = fork();