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
This commit is contained in:
Warner Losh 2020-08-19 17:09:58 +00:00
parent 7eee172052
commit 08b242aeee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364401
2 changed files with 43 additions and 31 deletions

View File

@ -42,6 +42,7 @@ static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
__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,

View File

@ -294,6 +294,45 @@ void __mnt_vnode_markerfree_lazy(struct vnode **mvp, struct mount *mp);
#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.
*/