Date: Wed, 23 Mar 2011 17:56:39 +0000 (UTC) From: Jaakko Heinonen <jh@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r219925 - head/sys/kern Message-ID: <201103231756.p2NHudeh002688@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jh Date: Wed Mar 23 17:56:38 2011 New Revision: 219925 URL: http://svn.freebsd.org/changeset/base/219925 Log: 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 Discussed on: freebsd-hackers MFC after: 1 month Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Wed Mar 23 17:33:04 2011 (r219924) +++ head/sys/kern/vfs_mount.c Wed Mar 23 17:56:38 2011 (r219925) @@ -175,6 +175,27 @@ 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); + else + return (0); +} + +static int +vfs_isopt_rw(const char *opt) +{ + + if (strcmp(opt, "rw") == 0 || strcmp(opt, "noro") == 0) + return (1); + else + return (0); +} + /* * Check if options are equal (with or without the "no" prefix). */ @@ -203,6 +224,11 @@ 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?201103231756.p2NHudeh002688>