Author: imp
Date: Wed Aug 19 17:09:58 2020
New Revision: 364401
URL: https://svnweb.freebsd.org/changeset/base/364401

Log:
  Move the mount name to bit mapping into sys/mount.h so it can be shared with 
the
  kernel.
  
  Discussed with: kib@
  Reviewed by: kirk@ (prior version)
  Sponsored by: Netflix
  Diffential Revision: https://reviews.freebsd.org/D25969

Modified:
  head/sbin/mount/mount.c
  head/sys/sys/mount.h

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c     Wed Aug 19 17:05:30 2020        (r364400)
+++ head/sbin/mount/mount.c     Wed Aug 19 17:09:58 2020        (r364401)
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)mount.c   8.25 (Berkeley) 5/
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
+#define _WANT_MNTOPTNAMES
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -92,36 +93,8 @@ void usage(void);
 char   *flags2opts(int);
 
 /* Map from mount options to printable formats. */
-static struct opt {
-       uint64_t o_opt;
-       const char *o_name;
-} optnames[] = {
-       { MNT_ASYNC,            "asynchronous" },
-       { MNT_EXPORTED,         "NFS exported" },
-       { MNT_LOCAL,            "local" },
-       { MNT_NOATIME,          "noatime" },
-       { MNT_NOEXEC,           "noexec" },
-       { MNT_NOSUID,           "nosuid" },
-       { MNT_NOSYMFOLLOW,      "nosymfollow" },
-       { MNT_QUOTA,            "with quotas" },
-       { MNT_RDONLY,           "read-only" },
-       { MNT_SYNCHRONOUS,      "synchronous" },
-       { MNT_UNION,            "union" },
-       { MNT_NOCLUSTERR,       "noclusterr" },
-       { MNT_NOCLUSTERW,       "noclusterw" },
-       { MNT_SUIDDIR,          "suiddir" },
-       { MNT_SOFTDEP,          "soft-updates" },
-       { MNT_SUJ,              "journaled soft-updates" },
-       { MNT_MULTILABEL,       "multilabel" },
-       { MNT_ACLS,             "acls" },
-       { MNT_NFS4ACLS,         "nfsv4acls" },
-       { MNT_GJOURNAL,         "gjournal" },
-       { MNT_AUTOMOUNTED,      "automounted" },
-       { MNT_VERIFIED,         "verified" },
-       { MNT_UNTRUSTED,        "untrusted" },
-       { MNT_NOCOVER,          "nocover" },
-       { MNT_EMPTYDIR,         "emptydir" },
-       { 0, NULL }
+static struct mntoptnames optnames[] = {
+       MNTOPT_NAMES
 };
 
 /*
@@ -664,7 +637,7 @@ prmount(struct statfs *sfp)
 {
        uint64_t flags;
        unsigned int i;
-       struct opt *o;
+       struct mntoptnames *o;
        struct passwd *pw;
 
        (void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname,

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h        Wed Aug 19 17:05:30 2020        (r364400)
+++ head/sys/sys/mount.h        Wed Aug 19 17:09:58 2020        (r364401)
@@ -294,6 +294,45 @@ void          __mnt_vnode_markerfree_lazy(struct vnode
 
 #endif /* _KERNEL */
 
+#if defined(_WANT_MNTOPTNAMES) || defined(_KERNEL)
+struct mntoptnames {
+       uint64_t o_opt;
+       const char *o_name;
+};
+#define MNTOPT_NAMES                                                   \
+       { MNT_ASYNC,            "asynchronous" },                       \
+       { MNT_EXPORTED,         "NFS exported" },                       \
+       { MNT_LOCAL,            "local" },                              \
+       { MNT_NOATIME,          "noatime" },                            \
+       { MNT_NOEXEC,           "noexec" },                             \
+       { MNT_NOSUID,           "nosuid" },                             \
+       { MNT_NOSYMFOLLOW,      "nosymfollow" },                        \
+       { MNT_QUOTA,            "with quotas" },                        \
+       { MNT_RDONLY,           "read-only" },                          \
+       { MNT_SYNCHRONOUS,      "synchronous" },                        \
+       { MNT_UNION,            "union" },                              \
+       { MNT_NOCLUSTERR,       "noclusterr" },                         \
+       { MNT_NOCLUSTERW,       "noclusterw" },                         \
+       { MNT_SUIDDIR,          "suiddir" },                            \
+       { MNT_SOFTDEP,          "soft-updates" },                       \
+       { MNT_SUJ,              "journaled soft-updates" },             \
+       { MNT_MULTILABEL,       "multilabel" },                         \
+       { MNT_ACLS,             "acls" },                               \
+       { MNT_NFS4ACLS,         "nfsv4acls" },                          \
+       { MNT_GJOURNAL,         "gjournal" },                           \
+       { MNT_AUTOMOUNTED,      "automounted" },                        \
+       { MNT_VERIFIED,         "verified" },                           \
+       { MNT_UNTRUSTED,        "untrusted" },                          \
+       { MNT_NOCOVER,          "nocover" },                            \
+       { MNT_EMPTYDIR,         "emptydir" },                           \
+       { MNT_UPDATE,           "update" },                             \
+       { MNT_DELEXPORT,        "delexport" },                          \
+       { MNT_RELOAD,           "reload" },                             \
+       { MNT_FORCE,            "force" },                              \
+       { MNT_SNAPSHOT,         "snapshot" },                           \
+       { 0, NULL }
+#endif
+
 /*
  * User specifiable flags, stored in mnt_flag.
  */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to