Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jun 2011 15:53:56 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r223050 - stable/8/sys/kern
Message-ID:  <201106131553.p5DFru0q088851@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Mon Jun 13 15:53:56 2011
New Revision: 223050
URL: http://svn.freebsd.org/changeset/base/223050

Log:
  MFC r219925:
  
  Recognize "ro", "rdonly", "norw", "rw" and "noro" as equal options in
  vfs_equalopts(). This allows vfs_sanitizeopts() to filter redundant
  occurrences of these options. It was possible that for example both "ro"
  and "rw" options became active concurrently.
  
  PR:		kern/133614
  
  MFC r220040:
  
  Fix some style issues in r219925.

Modified:
  stable/8/sys/kern/vfs_mount.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/kern/vfs_mount.c
==============================================================================
--- stable/8/sys/kern/vfs_mount.c	Mon Jun 13 15:38:31 2011	(r223049)
+++ stable/8/sys/kern/vfs_mount.c	Mon Jun 13 15:53:56 2011	(r223050)
@@ -192,6 +192,25 @@ vfs_deleteopt(struct vfsoptlist *opts, c
 	}
 }
 
+static int
+vfs_isopt_ro(const char *opt)
+{
+
+	if (strcmp(opt, "ro") == 0 || strcmp(opt, "rdonly") == 0 ||
+	    strcmp(opt, "norw") == 0)
+		return (1);
+	return (0);
+}
+
+static int
+vfs_isopt_rw(const char *opt)
+{
+
+	if (strcmp(opt, "rw") == 0 || strcmp(opt, "noro") == 0)
+		return (1);
+	return (0);
+}
+
 /*
  * Check if options are equal (with or without the "no" prefix).
  */
@@ -220,6 +239,10 @@ vfs_equalopts(const char *opt1, const ch
 		if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0)
 			return (1);
 	}
+	/* "ro" / "rdonly" / "norw" / "rw" / "noro" */
+	if ((vfs_isopt_ro(opt1) || vfs_isopt_rw(opt1)) &&
+	    (vfs_isopt_ro(opt2) || vfs_isopt_rw(opt2)))
+		return (1);
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106131553.p5DFru0q088851>