Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2011 16:14:57 +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-7@freebsd.org
Subject:   svn commit: r224449 - stable/7/sys/kern
Message-ID:  <201107261614.p6QGEvRA016462@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Tue Jul 26 16:14:57 2011
New Revision: 224449
URL: http://svn.freebsd.org/changeset/base/224449

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/7/sys/kern/vfs_mount.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/vfs_mount.c
==============================================================================
--- stable/7/sys/kern/vfs_mount.c	Tue Jul 26 14:41:54 2011	(r224448)
+++ stable/7/sys/kern/vfs_mount.c	Tue Jul 26 16:14:57 2011	(r224449)
@@ -195,6 +195,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).
  */
@@ -211,6 +230,10 @@ vfs_equalopts(const char *opt1, const ch
 	/* "opt" vs. "noopt" */
 	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?201107261614.p6QGEvRA016462>