summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-08-15 17:40:09 +0000
committerjhb <jhb@FreeBSD.org>2007-08-15 17:40:09 +0000
commit7fdc86bfe3a31c1d38be8274457d7f63b3e7c44b (patch)
tree167217e327e9846d087a5fb324dec1ff241929b2
parenta33a12f72a17ac67ef4864fd03cfdaf346a22f9e (diff)
downloadFreeBSD-src-7fdc86bfe3a31c1d38be8274457d7f63b3e7c44b.zip
FreeBSD-src-7fdc86bfe3a31c1d38be8274457d7f63b3e7c44b.tar.gz
On 6.x this works:
% mount | grep home /dev/ad4s1e on /home (ufs, local, noatime, soft-updates) % mount -u -o atime /home % mount | grep home /dev/ad4s1e on /home (ufs, local, soft-updates) Restore this behavior for on 7.x for the following mount options: noatime, noclusterr, noclusterw, noexec, nosuid, nosymfollow In addition, on 7.x, the following are equivalent: mount -u -o atime /home mount -u -o nonoatime /home Ideally, when we introduce new mount options, we should avoid options starting with "no". :) Requested by: jhb Reported by: Karol Kwiat <karol.kwiat gmail com>, Scott Hetzel <swhetzel gmail com> Approved by: re (bmah) Proxy commit for: rodrigc
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c2
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c4
-rw-r--r--sys/kern/vfs_mount.c67
3 files changed, 59 insertions, 14 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index f239c38..cc8b054 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -77,7 +77,7 @@
/* List of mount options we support */
static const char *msdosfs_opts[] = {
"from",
- "atime", "export", "force", "sync",
+ "noatime", "export", "force", "sync",
"uid", "gid", "mask", "dirmask",
"shortname", "shortnames", "longname", "longnames", "nowin95", "win95",
"kiconv", "cs_win", "cs_dos", "cs_local", "large",
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index d5ad6f2..ace6823 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -118,8 +118,8 @@ static int compute_sb_data(struct vnode * devvp,
struct ext2_super_block * es, struct ext2_sb_info * fs);
static const char *ext2_opts[] = { "from", "export", "union", "acls", "exec",
- "atime", "union", "suiddir", "multilabel", "symfollow", "clusterr",
- "clusterw", "force", NULL };
+ "noatime", "union", "suiddir", "multilabel", "nosymfollow",
+ "noclusterr", "noclusterw", "force", NULL };
/*
* VFS Operations.
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 3ae0d1a..5e6a84a 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -137,8 +137,8 @@ static const char *global_opts[] = {
"rdonly",
"ro",
"rw",
- "suid",
- "exec",
+ "nosuid",
+ "noexec",
"update",
NULL
};
@@ -638,16 +638,40 @@ vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
fsflags &= ~MNT_ASYNC;
else if (strcmp(opt->name, "noatime") == 0)
fsflags |= MNT_NOATIME;
+ else if (strcmp(opt->name, "atime") == 0) {
+ free(opt->name, M_MOUNT);
+ opt->name = strdup("nonoatime", M_MOUNT);
+ }
else if (strcmp(opt->name, "noclusterr") == 0)
fsflags |= MNT_NOCLUSTERR;
+ else if (strcmp(opt->name, "clusterr") == 0) {
+ free(opt->name, M_MOUNT);
+ opt->name = strdup("nonoclusterr", M_MOUNT);
+ }
else if (strcmp(opt->name, "noclusterw") == 0)
fsflags |= MNT_NOCLUSTERW;
+ else if (strcmp(opt->name, "clusterw") == 0) {
+ free(opt->name, M_MOUNT);
+ opt->name = strdup("nonoclusterw", M_MOUNT);
+ }
else if (strcmp(opt->name, "noexec") == 0)
fsflags |= MNT_NOEXEC;
+ else if (strcmp(opt->name, "exec") == 0) {
+ free(opt->name, M_MOUNT);
+ opt->name = strdup("nonoexec", M_MOUNT);
+ }
else if (strcmp(opt->name, "nosuid") == 0)
fsflags |= MNT_NOSUID;
+ else if (strcmp(opt->name, "suid") == 0) {
+ free(opt->name, M_MOUNT);
+ opt->name = strdup("nonosuid", M_MOUNT);
+ }
else if (strcmp(opt->name, "nosymfollow") == 0)
fsflags |= MNT_NOSYMFOLLOW;
+ else if (strcmp(opt->name, "symfollow") == 0) {
+ free(opt->name, M_MOUNT);
+ opt->name = strdup("nonosymfollow", M_MOUNT);
+ }
else if (strcmp(opt->name, "noro") == 0) {
fsflags &= ~MNT_RDONLY;
has_noro = 1;
@@ -1760,26 +1784,47 @@ int
vfs_filteropt(struct vfsoptlist *opts, const char **legal)
{
struct vfsopt *opt;
- const char **t, *p;
+ char errmsg[255];
+ const char **t, *p, *q;
+ int ret = 0;
TAILQ_FOREACH(opt, opts, link) {
p = opt->name;
+ q = NULL;
if (p[0] == 'n' && p[1] == 'o')
- p += 2;
- for(t = global_opts; *t != NULL; t++)
- if (!strcmp(*t, p))
+ q = p + 2;
+ for(t = global_opts; *t != NULL; t++) {
+ if (strcmp(*t, p) == 0)
break;
+ if (q != NULL) {
+ if (strcmp(*t, q) == 0)
+ break;
+ }
+ }
if (*t != NULL)
continue;
- for(t = legal; *t != NULL; t++)
- if (!strcmp(*t, p))
+ for(t = legal; *t != NULL; t++) {
+ if (strcmp(*t, p) == 0)
break;
+ if (q != NULL) {
+ if (strcmp(*t, q) == 0)
+ break;
+ }
+ }
if (*t != NULL)
continue;
- printf("mount option <%s> is unknown\n", p);
- return (EINVAL);
+ sprintf(errmsg, "mount option <%s> is unknown", p);
+ printf("%s\n", errmsg);
+ ret = EINVAL;
+ }
+ if (ret != 0) {
+ TAILQ_FOREACH(opt, opts, link) {
+ if (strcmp(opt->name, "errmsg") == 0) {
+ strncpy((char *)opt->value, errmsg, opt->len);
+ }
+ }
}
- return (0);
+ return (ret);
}
/*
OpenPOWER on IntegriCloud