diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h --- 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 @@ 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 #include diff --git a/sys/fs/fuse/fuse_internal.h b/sys/fs/fuse/fuse_internal.h --- a/sys/fs/fuse/fuse_internal.h +++ b/sys/fs/fuse/fuse_internal.h @@ -90,7 +90,7 @@ 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 @@ /* 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 @@ 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_internal.c b/sys/fs/fuse/fuse_internal.c --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -793,7 +793,7 @@ 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 @@ 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 @@ 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 @@ 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_node.h b/sys/fs/fuse/fuse_node.h --- a/sys/fs/fuse/fuse_node.h +++ b/sys/fs/fuse/fuse_node.h @@ -125,7 +125,7 @@ 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 @@ 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_node.c b/sys/fs/fuse/fuse_node.c --- a/sys/fs/fuse/fuse_node.c +++ b/sys/fs/fuse/fuse_node.c @@ -154,7 +154,7 @@ 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 @@ 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 @@ 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_vfsops.c b/sys/fs/fuse/fuse_vfsops.c --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -543,7 +543,7 @@ 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 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -1393,7 +1393,7 @@ struct fuse_entry_out *feo; struct componentname *cnp; uint64_t nid; - enum vtype vtyp; + __enum_uint8(vtype) vtyp; }; /* Callback for vn_get_ino */ @@ -1441,7 +1441,7 @@ 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 --- a/sys/fs/nfs/nfs_commonacl.c +++ b/sys/fs/nfs/nfs_commonacl.c @@ -35,7 +35,7 @@ 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 @@ */ 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 @@ /* 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 @@ * 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 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -62,8 +62,8 @@ /* 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 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -440,7 +440,7 @@ /* 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_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 @@ 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 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -45,8 +45,8 @@ 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 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -2308,7 +2308,7 @@ */ 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 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -1283,7 +1283,7 @@ struct thread *p) { int error = 0; - enum vtype vtyp; + __enum_uint8(vtype) vtyp; vtyp = nvap->na_type; /* @@ -7035,7 +7035,7 @@ * 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 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -54,7 +54,7 @@ /* 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 @@ 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 @@ 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 --- a/sys/fs/tarfs/tarfs.h +++ b/sys/fs/tarfs/tarfs.h @@ -56,7 +56,7 @@ 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 @@ } 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 --- a/sys/fs/tarfs/tarfs_subr.c +++ b/sys/fs/tarfs/tarfs_subr.c @@ -163,7 +163,7 @@ 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 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -183,7 +183,7 @@ * 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 @@ */ 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 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -535,7 +535,7 @@ * 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 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -308,7 +308,7 @@ 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 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1858,7 +1858,7 @@ 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 --- a/sys/kern/subr_acl_nfs4.c +++ b/sys/kern/subr_acl_nfs4.c @@ -170,7 +170,7 @@ } 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 --- a/sys/kern/subr_acl_posix1e.c +++ b/sys/kern/subr_acl_posix1e.c @@ -56,7 +56,7 @@ * 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 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3654,7 +3654,7 @@ struct pwd *pwd; size_t addend; int error; - enum vtype type; + __enum_uint8(vtype) type; if (*buflen < 2) return (EINVAL); @@ -3676,15 +3676,8 @@ * 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(&type); if (type == VBAD) { error = ENOENT; goto out_bad; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -145,7 +145,7 @@ * 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 }; @@ -5261,7 +5261,7 @@ * 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; @@ -7086,7 +7086,7 @@ #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/types.h b/sys/sys/types.h --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -347,6 +347,18 @@ ((dev_t)(_Minor & 0xff00) << 24) | (_Minor & 0xffff00ff)); } +#if (defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 13)) +#define __enum_uint8_decl(name) enum enum_ ## name ## _uint8 : uint8_t +#define __enum_uint8(name) enum enum_ ## name ## _uint8 +#else +/* + * Note: there is no real size checking here, but the code below can be + * removed once we require GCC 13. + */ +#define __enum_uint8_decl(name) enum __attribute__((packed)) enum_ ## name ## _uint8 +#define __enum_uint8(name) enum __attribute__((packed)) enum_ ## name ## _uint8 +#endif + /* * These declarations belong elsewhere, but are repeated here and in * to give broken programs a better chance of working with diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -56,11 +56,11 @@ /* * Vnode types. VNON means no type. */ -enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, +__enum_uint8_decl(vtype) { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, VMARKER }; #define VLASTTYPE VMARKER -enum vstate { VSTATE_UNINITIALIZED, VSTATE_CONSTRUCTED, VSTATE_DESTROYING, +__enum_uint8_decl(vstate) { VSTATE_UNINITIALIZED, VSTATE_CONSTRUCTED, VSTATE_DESTROYING, VSTATE_DEAD }; #define VLASTSTATE VSTATE_DEAD @@ -110,8 +110,8 @@ * 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 */ @@ -262,7 +262,7 @@ * 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 */ @@ -386,7 +386,7 @@ * 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)]) @@ -701,13 +701,13 @@ 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); @@ -1122,11 +1122,11 @@ 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); @@ -1134,7 +1134,7 @@ 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 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -2644,7 +2644,7 @@ 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 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -62,7 +62,7 @@ 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_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 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -91,7 +91,7 @@ ufs2_daddr_t bno, long size, ino_t inum, - enum vtype vtype, + __enum_uint8(vtype) vtype, struct workhead *wkhd) { return (EINVAL); @@ -1753,7 +1753,7 @@ 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 --- a/sys/ufs/ffs/softdep.h +++ b/sys/ufs/ffs/softdep.h @@ -562,7 +562,7 @@ 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 @@ 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. */