aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2023-03-12 19:31:27 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2023-07-05 15:06:30 +0000
commitba8cc6d7271a50fec978a1d3a088aec7985fae48 (patch)
tree9768331f628d9208b936bfa328e8d16ab489338d
parentcebb8646c4ee559aedcbc1b27bf30faa70a1f716 (diff)
vfs: use __enum_uint8 for vtype and vstate
This whacks hackery around only reading v_type once. Bump __FreeBSD_version to 1400093
-rw-r--r--sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h2
-rw-r--r--sys/fs/fuse/fuse_internal.c8
-rw-r--r--sys/fs/fuse/fuse_internal.h8
-rw-r--r--sys/fs/fuse/fuse_node.c8
-rw-r--r--sys/fs/fuse/fuse_node.h4
-rw-r--r--sys/fs/fuse/fuse_vfsops.c2
-rw-r--r--sys/fs/fuse/fuse_vnops.c4
-rw-r--r--sys/fs/nfs/nfs_commonacl.c10
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c4
-rw-r--r--sys/fs/nfs/nfs_var.h6
-rw-r--r--sys/fs/nfsclient/nfs_clcomsubs.c4
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c2
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c4
-rw-r--r--sys/fs/nfsserver/nfs_nfsdserv.c6
-rw-r--r--sys/fs/tarfs/tarfs.h4
-rw-r--r--sys/fs/tarfs/tarfs_subr.c2
-rw-r--r--sys/fs/tmpfs/tmpfs.h4
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c2
-rw-r--r--sys/fs/unionfs/union_subr.c2
-rw-r--r--sys/kern/kern_linker.c2
-rw-r--r--sys/kern/subr_acl_nfs4.c2
-rw-r--r--sys/kern/subr_acl_posix1e.c2
-rw-r--r--sys/kern/vfs_cache.c11
-rw-r--r--sys/kern/vfs_subr.c6
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/vnode.h24
-rw-r--r--sys/ufs/ffs/ffs_alloc.c2
-rw-r--r--sys/ufs/ffs/ffs_extern.h4
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c4
-rw-r--r--sys/ufs/ffs/softdep.h4
30 files changed, 71 insertions, 78 deletions
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h
index ab1727dca0c9..91dadfae6613 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h
@@ -36,7 +36,7 @@ struct xucred;
typedef struct flock flock64_t;
typedef struct vnode vnode_t;
typedef struct vattr vattr_t;
-typedef enum vtype vtype_t;
+#define vtype_t __enum_uint8(vtype)
#include <sys/types.h>
#include <sys/queue.h>
diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c
index 6ac7b4432e23..37394330632c 100644
--- a/sys/fs/fuse/fuse_internal.c
+++ b/sys/fs/fuse/fuse_internal.c
@@ -793,7 +793,7 @@ int
fuse_internal_newentry_core(struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp,
- enum vtype vtyp,
+ __enum_uint8(vtype) vtyp,
struct fuse_dispatcher *fdip)
{
int err = 0;
@@ -834,7 +834,7 @@ fuse_internal_newentry(struct vnode *dvp,
enum fuse_opcode op,
void *buf,
size_t bufsize,
- enum vtype vtype)
+ __enum_uint8(vtype) vtype)
{
int err;
struct fuse_dispatcher fdi;
@@ -899,7 +899,7 @@ fuse_internal_do_getattr(struct vnode *vp, struct vattr *vap,
struct timespec old_atime = fvdat->cached_attrs.va_atime;
struct timespec old_ctime = fvdat->cached_attrs.va_ctime;
struct timespec old_mtime = fvdat->cached_attrs.va_mtime;
- enum vtype vtyp;
+ __enum_uint8(vtype) vtyp;
int err;
ASSERT_VOP_LOCKED(vp, __func__);
@@ -1141,7 +1141,7 @@ int fuse_internal_setattr(struct vnode *vp, struct vattr *vap,
pid_t pid = td->td_proc->p_pid;
struct fuse_data *data;
int err = 0;
- enum vtype vtyp;
+ __enum_uint8(vtype) vtyp;
ASSERT_VOP_ELOCKED(vp, __func__);
diff --git a/sys/fs/fuse/fuse_internal.h b/sys/fs/fuse/fuse_internal.h
index 5d852b420366..3146f6158b9b 100644
--- a/sys/fs/fuse/fuse_internal.h
+++ b/sys/fs/fuse/fuse_internal.h
@@ -90,7 +90,7 @@ vnode_mount(struct vnode *vp)
return (vp->v_mount);
}
-static inline enum vtype
+static inline __enum_uint8(vtype)
vnode_vtype(struct vnode *vp)
{
return (vp->v_type);
@@ -284,7 +284,7 @@ void fuse_internal_clear_suid_on_write(struct vnode *vp, struct ucred *cred,
/* entity creation */
static inline int
-fuse_internal_checkentry(struct fuse_entry_out *feo, enum vtype vtyp)
+fuse_internal_checkentry(struct fuse_entry_out *feo, __enum_uint8(vtype) vtyp)
{
if (vtyp != IFTOVT(feo->attr.mode)) {
return (EINVAL);
@@ -303,14 +303,14 @@ fuse_internal_checkentry(struct fuse_entry_out *feo, enum vtype vtyp)
int fuse_internal_newentry(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, enum fuse_opcode op, void *buf, size_t bufsize,
- enum vtype vtyp);
+ __enum_uint8(vtype) vtyp);
void fuse_internal_newentry_makerequest(struct mount *mp, uint64_t dnid,
struct componentname *cnp, enum fuse_opcode op, void *buf, size_t bufsize,
struct fuse_dispatcher *fdip);
int fuse_internal_newentry_core(struct vnode *dvp, struct vnode **vpp,
- struct componentname *cnp, enum vtype vtyp, struct fuse_dispatcher *fdip);
+ struct componentname *cnp, __enum_uint8(vtype) vtyp, struct fuse_dispatcher *fdip);
/* entity destruction */
diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c
index 1abf6e75cc3e..07695a30d272 100644
--- a/sys/fs/fuse/fuse_node.c
+++ b/sys/fs/fuse/fuse_node.c
@@ -154,7 +154,7 @@ sysctl_fuse_cache_mode(SYSCTL_HANDLER_ARGS)
static void
fuse_vnode_init(struct vnode *vp, struct fuse_vnode_data *fvdat,
- uint64_t nodeid, enum vtype vtyp)
+ uint64_t nodeid, __enum_uint8(vtype) vtyp)
{
fvdat->nid = nodeid;
LIST_INIT(&fvdat->handles);
@@ -189,13 +189,13 @@ fuse_vnode_cmp(struct vnode *vp, void *nidp)
return (VTOI(vp) != *((uint64_t *)nidp));
}
-SDT_PROBE_DEFINE3(fusefs, , node, stale_vnode, "struct vnode*", "enum vtype",
+SDT_PROBE_DEFINE3(fusefs, , node, stale_vnode, "struct vnode*", "uint8_t",
"uint64_t");
static int
fuse_vnode_alloc(struct mount *mp,
struct thread *td,
uint64_t nodeid,
- enum vtype vtyp,
+ __enum_uint8(vtype) vtyp,
struct vnode **vpp)
{
struct fuse_data *data;
@@ -289,7 +289,7 @@ fuse_vnode_get(struct mount *mp,
struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp,
- enum vtype vtyp)
+ __enum_uint8(vtype) vtyp)
{
struct thread *td = curthread;
/*
diff --git a/sys/fs/fuse/fuse_node.h b/sys/fs/fuse/fuse_node.h
index 8eb299361bd0..fe3f3c0cd927 100644
--- a/sys/fs/fuse/fuse_node.h
+++ b/sys/fs/fuse/fuse_node.h
@@ -125,7 +125,7 @@ struct fuse_vnode_data {
struct timespec last_local_modify;
struct vattr cached_attrs;
uint64_t nlookup;
- enum vtype vtype;
+ __enum_uint8(vtype) vtype;
struct vn_clusterw clusterw;
};
@@ -201,7 +201,7 @@ void fuse_vnode_destroy(struct vnode *vp);
int fuse_vnode_get(struct mount *mp, struct fuse_entry_out *feo,
uint64_t nodeid, struct vnode *dvp, struct vnode **vpp,
- struct componentname *cnp, enum vtype vtyp);
+ struct componentname *cnp, __enum_uint8(vtype) vtyp);
void fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags,
struct thread *td);
diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c
index 93916b34be83..c17937178d00 100644
--- a/sys/fs/fuse/fuse_vfsops.c
+++ b/sys/fs/fuse/fuse_vfsops.c
@@ -543,7 +543,7 @@ fuse_vfsop_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
struct fuse_vnode_data *fvdat;
struct timespec now;
const char dot[] = ".";
- enum vtype vtyp;
+ __enum_uint8(vtype) vtyp;
int error;
if (!(data->dataflags & FSESS_EXPORT_SUPPORT)) {
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
index 1bb5b3834c76..6354167ab27f 100644
--- a/sys/fs/fuse/fuse_vnops.c
+++ b/sys/fs/fuse/fuse_vnops.c
@@ -1391,7 +1391,7 @@ struct fuse_lookup_alloc_arg {
struct fuse_entry_out *feo;
struct componentname *cnp;
uint64_t nid;
- enum vtype vtyp;
+ __enum_uint8(vtype) vtyp;
};
/* Callback for vn_get_ino */
@@ -1439,7 +1439,7 @@ fuse_vnop_lookup(struct vop_lookup_args *ap)
struct fuse_dispatcher fdi;
bool did_lookup = false;
struct fuse_entry_out *feo = NULL;
- enum vtype vtyp; /* vnode type of target */
+ __enum_uint8(vtype) vtyp; /* vnode type of target */
uint64_t nid;
diff --git a/sys/fs/nfs/nfs_commonacl.c b/sys/fs/nfs/nfs_commonacl.c
index e47218106186..a7ea072f86d9 100644
--- a/sys/fs/nfs/nfs_commonacl.c
+++ b/sys/fs/nfs/nfs_commonacl.c
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
extern int nfsrv_useacl;
static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
- enum vtype type, acl_perm_t *permp);
+ __enum_uint8(vtype) type, acl_perm_t *permp);
/*
* Handle xdr for an ace.
@@ -188,7 +188,7 @@ nfsmout:
*/
static int
nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
- enum vtype type, acl_perm_t *permp)
+ __enum_uint8(vtype) type, acl_perm_t *permp)
{
acl_perm_t perm = 0x0;
int error = 0;
@@ -278,14 +278,14 @@ out:
/* local functions */
static int nfsrv_buildace(struct nfsrv_descript *, u_char *, int,
- enum vtype, int, int, struct acl_entry *);
+ __enum_uint8(vtype), int, int, struct acl_entry *);
/*
* This function builds an NFS ace.
*/
static int
nfsrv_buildace(struct nfsrv_descript *nd, u_char *name, int namelen,
- enum vtype type, int group, int owner, struct acl_entry *ace)
+ __enum_uint8(vtype) type, int group, int owner, struct acl_entry *ace)
{
u_int32_t *tl, aceflag = 0x0, acemask = 0x0, acetype;
int full_len;
@@ -393,7 +393,7 @@ nfsrv_buildace(struct nfsrv_descript *nd, u_char *name, int namelen,
* Build an NFSv4 ACL.
*/
int
-nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *aclp, enum vtype type,
+nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *aclp, __enum_uint8(vtype) type,
NFSPROC_T *p)
{
int i, entrycnt = 0, retlen;
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index cb12f5a59a6e..e3a61a5f912a 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -62,8 +62,8 @@ u_int32_t newnfs_true, newnfs_false, newnfs_xdrneg1;
/* And other global data */
nfstype nfsv34_type[9] = { NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, NFSOCK,
NFFIFO, NFNON };
-enum vtype newnv2tov_type[8] = { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VNON, VNON };
-enum vtype nv34tov_type[8]={ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO };
+__enum_uint8(vtype) newnv2tov_type[8] = { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VNON, VNON };
+__enum_uint8(vtype) nv34tov_type[8]={ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO };
struct timeval nfsboottime; /* Copy boottime once, so it never changes */
int nfscl_ticks;
int nfsrv_useacl = 1;
diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h
index 8fabe6f92fc6..294cf90fa235 100644
--- a/sys/fs/nfs/nfs_var.h
+++ b/sys/fs/nfs/nfs_var.h
@@ -440,7 +440,7 @@ int nfs_supportsnfsv4acls(vnode_t);
/* nfs_commonacl.c */
int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *,
bool, int *, int *, NFSPROC_T *);
-int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype,
+int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, __enum_uint8(vtype),
NFSPROC_T *);
int nfsrv_compareacl(NFSACL_T *, NFSACL_T *);
@@ -478,7 +478,7 @@ int nfsrpc_read(vnode_t, struct uio *, struct ucred *, NFSPROC_T *,
int nfsrpc_write(vnode_t, struct uio *, int *, int *,
struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, int, int);
int nfsrpc_mknod(vnode_t, char *, int, struct vattr *, u_int32_t,
- enum vtype, struct ucred *, NFSPROC_T *, struct nfsvattr *,
+ __enum_uint8(vtype), struct ucred *, NFSPROC_T *, struct nfsvattr *,
struct nfsvattr *, struct nfsfh **, int *, int *);
int nfsrpc_create(vnode_t, char *, int, struct vattr *, nfsquad_t,
int, struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
@@ -770,7 +770,7 @@ int nfsvno_listxattr(struct vnode *, uint64_t, struct ucred *, struct thread *,
u_char **, uint32_t *, bool *);
void nfsm_trimtrailing(struct nfsrv_descript *, struct mbuf *, char *, int,
int);
-bool nfsrv_checkwrongsec(struct nfsrv_descript *, int, enum vtype);
+bool nfsrv_checkwrongsec(struct nfsrv_descript *, int, __enum_uint8(vtype));
void nfsrv_checknospc(void);
/* nfs_commonkrpc.c */
diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c
index 640d47fed93d..2481c45cab98 100644
--- a/sys/fs/nfsclient/nfs_clcomsubs.c
+++ b/sys/fs/nfsclient/nfs_clcomsubs.c
@@ -45,8 +45,8 @@ __FBSDID("$FreeBSD$");
extern struct nfsstatsv1 nfsstatsv1;
extern int ncl_mbuf_mlen;
-extern enum vtype newnv2tov_type[8];
-extern enum vtype nv34tov_type[8];
+extern __enum_uint8(vtype) newnv2tov_type[8];
+extern __enum_uint8(vtype) nv34tov_type[8];
NFSCLSTATEMUTEX;
/*
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 70c7619e679a..9e53bcc2dc0a 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -2308,7 +2308,7 @@ nfsmout:
*/
int
nfsrpc_mknod(vnode_t dvp, char *name, int namelen, struct vattr *vap,
- u_int32_t rdev, enum vtype vtyp, struct ucred *cred, NFSPROC_T *p,
+ u_int32_t rdev, __enum_uint8(vtype) vtyp, struct ucred *cred, NFSPROC_T *p,
struct nfsvattr *dnap, struct nfsvattr *nnap, struct nfsfh **nfhpp,
int *attrflagp, int *dattrflagp)
{
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 6b5f357ecaf9..40065a01131f 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -1283,7 +1283,7 @@ nfsvno_mknod(struct nameidata *ndp, struct nfsvattr *nvap, struct ucred *cred,
struct thread *p)
{
int error = 0;
- enum vtype vtyp;
+ __enum_uint8(vtype) vtyp;
vtyp = nvap->na_type;
/*
@@ -7034,7 +7034,7 @@ nfsm_trimtrailing(struct nfsrv_descript *nd, struct mbuf *mb, char *bpos,
* be identified by the fact that the file handle's type is VDIR.
*/
bool
-nfsrv_checkwrongsec(struct nfsrv_descript *nd, int nextop, enum vtype vtyp)
+nfsrv_checkwrongsec(struct nfsrv_descript *nd, int nextop, __enum_uint8(vtype) vtyp)
{
if ((nd->nd_flag & ND_NFSV4) == 0)
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index a4fa3a934090..7e53ad63820f 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
/* Global vars */
extern u_int32_t newnfs_false, newnfs_true;
-extern enum vtype nv34tov_type[8];
+extern __enum_uint8(vtype) nv34tov_type[8];
extern struct timeval nfsboottime;
extern int nfsrv_enable_crossmntpt;
extern int nfsrv_statehashsize;
@@ -1156,7 +1156,7 @@ nfsrvd_create(struct nfsrv_descript *nd, __unused int isdgram,
fhandle_t fh;
char *bufp;
u_long *hashp;
- enum vtype vtyp;
+ __enum_uint8(vtype) vtyp;
int32_t cverf[2], tverf[2] = { 0, 0 };
struct thread *p = curthread;
@@ -1320,7 +1320,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram,
struct nameidata named;
int error = 0, dirfor_ret = 1, diraft_ret = 1, pathlen;
u_int32_t major, minor;
- enum vtype vtyp = VNON;
+ __enum_uint8(vtype) vtyp = VNON;
nfstype nfs4type = NFNON;
vnode_t vp, dirp = NULL;
nfsattrbit_t attrbits;
diff --git a/sys/fs/tarfs/tarfs.h b/sys/fs/tarfs/tarfs.h
index 444d7b39941d..ff1985e488cd 100644
--- a/sys/fs/tarfs/tarfs.h
+++ b/sys/fs/tarfs/tarfs.h
@@ -56,7 +56,7 @@ struct tarfs_node {
struct vnode *vnode;
struct tarfs_mount *tmp;
- enum vtype type;
+ __enum_uint8(vtype) type;
ino_t ino;
off_t offset;
size_t size;
@@ -227,7 +227,7 @@ VP_TO_TARFS_NODE(struct vnode *vp)
}
int tarfs_alloc_node(struct tarfs_mount *tmp, const char *name,
- size_t namelen, enum vtype type, off_t off, size_t sz,
+ size_t namelen, __enum_uint8(vtype) type, off_t off, size_t sz,
time_t mtime, uid_t uid, gid_t gid, mode_t mode,
unsigned int flags, const char *linkname, dev_t rdev,
struct tarfs_node *parent, struct tarfs_node **node);
diff --git a/sys/fs/tarfs/tarfs_subr.c b/sys/fs/tarfs/tarfs_subr.c
index a0077c611f25..431aa352cd38 100644
--- a/sys/fs/tarfs/tarfs_subr.c
+++ b/sys/fs/tarfs/tarfs_subr.c
@@ -163,7 +163,7 @@ tarfs_lookup_dir(struct tarfs_node *tnp, off_t cookie)
int
tarfs_alloc_node(struct tarfs_mount *tmp, const char *name, size_t namelen,
- enum vtype type, off_t off, size_t sz, time_t mtime, uid_t uid, gid_t gid,
+ __enum_uint8(vtype) type, off_t off, size_t sz, time_t mtime, uid_t uid, gid_t gid,
mode_t mode, unsigned int flags, const char *linkname, dev_t rdev,
struct tarfs_node *parent, struct tarfs_node **retnode)
{
diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h
index dac77771a2ec..126b99acba6b 100644
--- a/sys/fs/tmpfs/tmpfs.h
+++ b/sys/fs/tmpfs/tmpfs.h
@@ -183,7 +183,7 @@ struct tmpfs_node {
* types instead of a custom enumeration is to make things simpler
* and faster, as we do not need to convert between two types.
*/
- enum vtype tn_type; /* (c) */
+ __enum_uint8(vtype) tn_type; /* (c) */
/*
* See the top comment. Reordered here to fill LP64 hole.
@@ -455,7 +455,7 @@ struct tmpfs_dir_cursor {
*/
void tmpfs_ref_node(struct tmpfs_node *node);
-int tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *, enum vtype,
+int tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *, __enum_uint8(vtype),
uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *,
const char *, dev_t, struct tmpfs_node **);
int tmpfs_fo_close(struct file *fp, struct thread *td);
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 6eee5ade1d9b..28834a96ee9a 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -535,7 +535,7 @@ tmpfs_ref_node(struct tmpfs_node *node)
* Returns zero on success or an appropriate error code on failure.
*/
int
-tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type,
+tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, __enum_uint8(vtype) type,
uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *parent,
const char *target, dev_t rdev, struct tmpfs_node **node)
{
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
index 702b10bb6204..fccc07a1ea76 100644
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -308,7 +308,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp,
u_long hashmask;
int error;
int lkflags;
- enum vtype vt;
+ __enum_uint8(vtype) vt;
error = 0;
ump = MOUNTTOUNIONFSMOUNT(mp);
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 9dc7ff42cc38..8a3a0e5f0681 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -1858,7 +1858,7 @@ linker_lookup_file(const char *path, int pathlen, const char *name,
const char * const *cpp, *sep;
char *result;
int error, len, extlen, reclen, flags;
- enum vtype type;
+ __enum_uint8(vtype) type;
extlen = 0;
for (cpp = linker_ext_list; *cpp; cpp++) {
diff --git a/sys/kern/subr_acl_nfs4.c b/sys/kern/subr_acl_nfs4.c
index 3fc9bb3df61d..ecaf1df4c8c0 100644
--- a/sys/kern/subr_acl_nfs4.c
+++ b/sys/kern/subr_acl_nfs4.c
@@ -170,7 +170,7 @@ _acl_denies(const struct acl *aclp, int access_mask, struct ucred *cred,
}
int
-vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,
+vaccess_acl_nfs4(__enum_uint8(vtype) type, uid_t file_uid, gid_t file_gid,
struct acl *aclp, accmode_t accmode, struct ucred *cred)
{
accmode_t priv_granted = 0;
diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c
index 38239d8c6e65..82d0bcc566f1 100644
--- a/sys/kern/subr_acl_posix1e.c
+++ b/sys/kern/subr_acl_posix1e.c
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
* errno value.
*/
int
-vaccess_acl_posix1e(enum vtype type, uid_t file_uid, gid_t file_gid,
+vaccess_acl_posix1e(__enum_uint8(vtype) type, uid_t file_uid, gid_t file_gid,
struct acl *acl, accmode_t accmode, struct ucred *cred)
{
struct acl_entry *acl_other, *acl_mask;
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 1310800fce4e..d315892953e1 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -3654,7 +3654,7 @@ vn_fullpath_hardlink(struct vnode *vp, struct vnode *dvp,
struct pwd *pwd;
size_t addend;
int error;
- enum vtype type;
+ __enum_uint8(vtype) type;
if (*buflen < 2)
return (EINVAL);
@@ -3676,15 +3676,8 @@ vn_fullpath_hardlink(struct vnode *vp, struct vnode *dvp,
* before we get to evaluate the condition. If this happens, we will
* populate part of the buffer and descend to vn_fullpath_dir with
* vp == vp_crossmp. Prevent the problem by checking for VBAD.
- *
- * This should be atomic_load(&vp->v_type) but it is illegal to take
- * an address of a bit field, even if said field is sized to char.
- * Work around the problem by reading the value into a full-sized enum
- * and then re-reading it with atomic_load which will still prevent
- * the compiler from re-reading down the road.
*/
- type = vp->v_type;
- type = atomic_load_int(&type);
+ type = atomic_load_8(&vp->v_type);
if (type == VBAD) {
error = ENOENT;
goto out_bad;
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 252e0ca60c3b..b7d43863a228 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -145,7 +145,7 @@ SYSCTL_COUNTER_U64(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created,
* Conversion tables for conversion from vnode types to inode formats
* and back.
*/
-enum vtype iftovt_tab[16] = {
+__enum_uint8(vtype) iftovt_tab[16] = {
VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VNON
};
@@ -5259,7 +5259,7 @@ out_error:
* Returns 0 on success, or an errno on failure.
*/
int
-vaccess(enum vtype type, mode_t file_mode, uid_t file_uid, gid_t file_gid,
+vaccess(__enum_uint8(vtype) type, mode_t file_mode, uid_t file_uid, gid_t file_gid,
accmode_t accmode, struct ucred *cred)
{
accmode_t dac_granted;
@@ -7013,7 +7013,7 @@ vn_getsize(struct vnode *vp, off_t *size, struct ucred *cred)
#ifdef INVARIANTS
void
-vn_set_state_validate(struct vnode *vp, enum vstate state)
+vn_set_state_validate(struct vnode *vp, __enum_uint8(vstate) state)
{
switch (vp->v_state) {
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 904eb9825b92..137bd80c77cb 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -76,7 +76,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1400092
+#define __FreeBSD_version 1400093
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 8b108c73b355..e7ebc39ada1d 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -56,7 +56,7 @@
/*
* Vnode types. VNON means no type.
*/
-enum vtype {
+__enum_uint8_decl(vtype) {
VNON,
VREG,
VDIR,
@@ -70,7 +70,7 @@ enum vtype {
VLASTTYPE = VMARKER,
};
-enum vstate {
+__enum_uint8_decl(vstate) {
VSTATE_UNINITIALIZED,
VSTATE_CONSTRUCTED,
VSTATE_DESTROYING,
@@ -129,8 +129,8 @@ struct vnode {
* Fields which define the identity of the vnode. These fields are
* owned by the filesystem (XXX: and vgone() ?)
*/
- enum vtype v_type:8; /* u vnode type */
- enum vstate v_state:8; /* u vnode state */
+ __enum_uint8(vtype) v_type; /* u vnode type */
+ __enum_uint8(vstate) v_state; /* u vnode state */
short v_irflag; /* i frequently read flags */
seqc_t v_seqc; /* i modification count */
uint32_t v_nchash; /* u namecache hash */
@@ -281,7 +281,7 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes");
* is unavailable (getattr) or which is not to be changed (setattr).
*/
struct vattr {
- enum vtype va_type; /* vnode type (for create) */
+ __enum_uint8(vtype) va_type; /* vnode type (for create) */
u_short va_mode; /* files access mode and type */
u_short va_padding0;
uid_t va_uid; /* owner user id */
@@ -405,7 +405,7 @@ extern const u_int io_hold_cnt;
* Convert between vnode types and inode formats (since POSIX.1
* defines mode word of stat structure in terms of inode formats).
*/
-extern enum vtype iftovt_tab[];
+extern __enum_uint8(vtype) iftovt_tab[];
extern int vttoif_tab[];
#define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12])
#define VTTOIF(indx) (vttoif_tab[(int)(indx)])
@@ -720,13 +720,13 @@ int vn_path_to_global_path(struct thread *td, struct vnode *vp,
int vn_path_to_global_path_hardlink(struct thread *td, struct vnode *vp,
struct vnode *dvp, char *path, u_int pathlen, const char *leaf_name,
size_t leaf_length);
-int vaccess(enum vtype type, mode_t file_mode, uid_t file_uid,
+int vaccess(__enum_uint8(vtype) type, mode_t file_mode, uid_t file_uid,
gid_t file_gid, accmode_t accmode, struct ucred *cred);
int vaccess_vexec_smr(mode_t file_mode, uid_t file_uid, gid_t file_gid,
struct ucred *cred);
-int vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,
+int vaccess_acl_nfs4(__enum_uint8(vtype) type, uid_t file_uid, gid_t file_gid,
struct acl *aclp, accmode_t accmode, struct ucred *cred);
-int vaccess_acl_posix1e(enum vtype type, uid_t file_uid,
+int vaccess_acl_posix1e(__enum_uint8(vtype) type, uid_t file_uid,
gid_t file_gid, struct acl *acl, accmode_t accmode,
struct ucred *cred);
void vattr_null(struct vattr *vap);
@@ -1144,11 +1144,11 @@ int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp);
int vn_lktype_write(struct mount *mp, struct vnode *vp);
#ifdef INVARIANTS
-void vn_set_state_validate(struct vnode *vp, enum vstate state);
+void vn_set_state_validate(struct vnode *vp, __enum_uint8(vstate) state);
#endif
static inline void
-vn_set_state(struct vnode *vp, enum vstate state)
+vn_set_state(struct vnode *vp, __enum_uint8(vstate) state)
{
#ifdef INVARIANTS
vn_set_state_validate(vp, state);
@@ -1156,7 +1156,7 @@ vn_set_state(struct vnode *vp, enum vstate state)
vp->v_state = state;
}
-static inline enum vstate
+static inline __enum_uint8(vstate)
vn_get_state(struct vnode *vp)
{
return (vp->v_state);
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 957be753ce15..6ac43b4b84d5 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -2644,7 +2644,7 @@ ffs_blkfree(struct ufsmount *ump,
ufs2_daddr_t bno,
long size,
ino_t inum,
- enum vtype vtype,
+ __enum_uint8(vtype) vtype,
struct workhead *dephd,
u_long key)
{
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index 5bfc88aa5d19..9e8eb7a74980 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -62,7 +62,7 @@ int ffs_balloc_ufs1(struct vnode *a_vp, off_t a_startoffset, int a_size,
int ffs_balloc_ufs2(struct vnode *a_vp, off_t a_startoffset, int a_size,
struct ucred *a_cred, int a_flags, struct buf **a_bpp);
void ffs_blkfree(struct ufsmount *, struct fs *, struct vnode *,
- ufs2_daddr_t, long, ino_t, enum vtype, struct workhead *, u_long);
+ ufs2_daddr_t, long, ino_t, __enum_uint8(vtype), struct workhead *, u_long);
ufs2_daddr_t ffs_blkpref_ufs1(struct inode *, ufs_lbn_t, int, ufs1_daddr_t *);
ufs2_daddr_t ffs_blkpref_ufs2(struct inode *, ufs_lbn_t, int, ufs2_daddr_t *);
void ffs_blkrelease_finish(struct ufsmount *, u_long);
@@ -99,7 +99,7 @@ int ffs_sbput(void *, struct fs *, off_t, int (*)(void *, off_t, void *,
int ffs_sbupdate(struct ufsmount *, int, int);
void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
int ffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t,
- enum vtype, struct workhead *);
+ __enum_uint8(vtype), struct workhead *);
void ffs_snapremove(struct vnode *vp);
int ffs_snapshot(struct mount *mp, char *snapfile);
void ffs_snapshot_mount(struct mount *mp);
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index fa744f0fab79..ec459bb7c2d7 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -91,7 +91,7 @@ ffs_snapblkfree(struct fs *fs,
ufs2_daddr_t bno,
long size,
ino_t inum,
- enum vtype vtype,
+ __enum_uint8(vtype) vtype,
struct workhead *wkhd)
{
return (EINVAL);
@@ -1755,7 +1755,7 @@ ffs_snapblkfree(struct fs *fs,
ufs2_daddr_t bno,
long size,
ino_t inum,
- enum vtype vtype,
+ __enum_uint8(vtype) vtype,
struct workhead *wkhd)
{
struct buf *ibp, *cbp, *savedcbp = NULL;
diff --git a/sys/ufs/ffs/softdep.h b/sys/ufs/ffs/softdep.h
index e45abb9def32..e7caa202a208 100644
--- a/sys/ufs/ffs/softdep.h
+++ b/sys/ufs/ffs/softdep.h
@@ -562,7 +562,7 @@ struct freefrag {
ufs2_daddr_t ff_blkno; /* fragment physical block number */
long ff_fragsize; /* size of fragment being deleted */
ino_t ff_inum; /* owning inode number */
- enum vtype ff_vtype; /* owning inode's file type */
+ __enum_uint8(vtype) ff_vtype; /* owning inode's file type */
int ff_key; /* trim key when deleted */
};
@@ -590,7 +590,7 @@ struct freeblks {
off_t fb_len; /* Length we're truncating to. */
ufs2_daddr_t fb_chkcnt; /* Blocks released. */
ino_t fb_inum; /* inode owner of blocks */
- enum vtype fb_vtype; /* inode owner's file type */
+ __enum_uint8(vtype) fb_vtype; /* inode owner's file type */
uid_t fb_uid; /* uid of previous owner of blocks */
int fb_ref; /* Children outstanding. */
int fb_cgwait; /* cg writes outstanding. */