mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 02:37:15 +00:00
vfs: use __enum_uint8 for vtype and vstate
This whacks hackery around only reading v_type once. Bump __FreeBSD_version to 1400093
This commit is contained in:
parent
cebb8646c4
commit
ba8cc6d727
|
@ -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>
|
||||
|
|
|
@ -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__);
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 @@ nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep,
|
|||
*/
|
||||
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 @@ nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
|
|||
|
||||
/* 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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
|
|
|
@ -2308,7 +2308,7 @@ nfsrpc_deallocaterpc(vnode_t vp, off_t offs, off_t len,
|
|||
*/
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 @@ vaccess_vexec_smr(mode_t file_mode, uid_t file_uid, gid_t file_gid, struct ucred
|
|||
* 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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Reference in a new issue