Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/vnode.h
Show First 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | struct vnode { | ||||
struct mtx v_interlock; /* lock for "i" things */ | struct mtx v_interlock; /* lock for "i" things */ | ||||
struct lock *v_vnlock; /* u pointer to vnode lock */ | struct lock *v_vnlock; /* u pointer to vnode lock */ | ||||
/* | /* | ||||
* The machinery of being a vnode | * The machinery of being a vnode | ||||
*/ | */ | ||||
TAILQ_ENTRY(vnode) v_vnodelist; /* l vnode lists */ | TAILQ_ENTRY(vnode) v_vnodelist; /* l vnode lists */ | ||||
TAILQ_ENTRY(vnode) v_lazylist; /* l vnode lazy list */ | TAILQ_ENTRY(vnode) v_lazylist; /* l vnode lazy list */ | ||||
struct bufobj v_bufobj; /* * Buffer cache object */ | struct vm_object *v_object; /* v page cache container */ | ||||
/* | /* | ||||
* Hooks for various subsystems and features. | * Hooks for various subsystems and features. | ||||
*/ | */ | ||||
struct vpollinfo *v_pollinfo; /* i Poll events, p for *v_pi */ | struct vpollinfo *v_pollinfo; /* i Poll events, p for *v_pi */ | ||||
struct label *v_label; /* MAC label for vnode */ | struct label *v_label; /* MAC label for vnode */ | ||||
struct lockf *v_lockf; /* Byte-level advisory lock list */ | struct lockf *v_lockf; /* Byte-level advisory lock list */ | ||||
struct rangelock v_rl; /* Byte-range lock */ | struct rangelock v_rl; /* Byte-range lock */ | ||||
u_int v_holdcnt; /* I prevents recycling. */ | u_int v_holdcnt; /* I prevents recycling. */ | ||||
u_int v_usecount; /* I ref count of users */ | u_int v_usecount; /* I ref count of users */ | ||||
u_short v_iflag; /* i vnode flags (see below) */ | u_short v_iflag; /* i vnode flags (see below) */ | ||||
u_short v_vflag; /* v vnode flags */ | u_short v_vflag; /* v vnode flags */ | ||||
u_short v_mflag; /* l mnt-specific vnode flags */ | u_short v_mflag; /* l mnt-specific vnode flags */ | ||||
short v_dbatchcpu; /* i LRU requeue deferral batch */ | short v_dbatchcpu; /* i LRU requeue deferral batch */ | ||||
int v_writecount; /* I ref count of writers or | int v_writecount; /* I ref count of writers or | ||||
(negative) text users */ | (negative) text users */ | ||||
int v_seqc_users; /* i modifications pending */ | int v_seqc_users; /* i modifications pending */ | ||||
}; | }; | ||||
#ifndef DEBUG_LOCKS | struct vnode_bo { | ||||
#ifdef _LP64 | struct vnode vb_v; | ||||
/* | struct bufobj vb_bo; | ||||
* Not crossing 448 bytes fits 9 vnodes per page. If you have to add fields | }; | ||||
* to the structure and there is nothing which can be done to prevent growth | |||||
* then so be it. But don't grow it without a good reason. | |||||
*/ | |||||
_Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes"); | |||||
#endif | |||||
#endif | |||||
#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ | #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ | ||||
#define bo2vnode(bo) __containerof((bo), struct vnode, v_bufobj) | |||||
/* XXX: These are temporary to avoid a source sweep at this time */ | |||||
#define v_object v_bufobj.bo_object | |||||
/* | /* | ||||
* Userland version of struct vnode, for sysctl. | * Userland version of struct vnode, for sysctl. | ||||
*/ | */ | ||||
struct xvnode { | struct xvnode { | ||||
size_t xv_size; /* sizeof(struct xvnode) */ | size_t xv_size; /* sizeof(struct xvnode) */ | ||||
void *xv_vnode; /* address of real vnode */ | void *xv_vnode; /* address of real vnode */ | ||||
u_long xv_flag; /* vnode vflags */ | u_long xv_flag; /* vnode vflags */ | ||||
int xv_usecount; /* reference count of users */ | int xv_usecount; /* reference count of users */ | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#define VHOLD_NO_SMR (1<<29) /* Disable vhold_smr */ | #define VHOLD_NO_SMR (1<<29) /* Disable vhold_smr */ | ||||
#define VHOLD_ALL_FLAGS (VHOLD_NO_SMR) | #define VHOLD_ALL_FLAGS (VHOLD_NO_SMR) | ||||
#define VIRF_DOOMED 0x0001 /* This vnode is being recycled */ | #define VIRF_DOOMED 0x0001 /* This vnode is being recycled */ | ||||
#define VIRF_PGREAD 0x0002 /* Direct reads from the page cache are permitted, | #define VIRF_PGREAD 0x0002 /* Direct reads from the page cache are permitted, | ||||
never cleared once set */ | never cleared once set */ | ||||
#define VIRF_MOUNTPOINT 0x0004 /* This vnode is mounted on */ | #define VIRF_MOUNTPOINT 0x0004 /* This vnode is mounted on */ | ||||
#define VIRF_BUFOBJ 0x0008 /* Uses buffers, bufobj is valid */ | |||||
#define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */ | #define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */ | ||||
#define VI_MOUNT 0x0002 /* Mount in progress */ | #define VI_MOUNT 0x0002 /* Mount in progress */ | ||||
#define VI_DOINGINACT 0x0004 /* VOP_INACTIVE is in progress */ | #define VI_DOINGINACT 0x0004 /* VOP_INACTIVE is in progress */ | ||||
#define VI_OWEINACT 0x0008 /* Need to call inactive */ | #define VI_OWEINACT 0x0008 /* Need to call inactive */ | ||||
#define VI_DEFINACT 0x0010 /* deferred inactive */ | #define VI_DEFINACT 0x0010 /* deferred inactive */ | ||||
#define VI_FOPENING 0x0020 /* In open, with opening process having the | #define VI_FOPENING 0x0020 /* In open, with opening process having the | ||||
first right to advlock file */ | first right to advlock file */ | ||||
▲ Show 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | struct vnodeop_desc { | ||||
int *vdesc_vp_offsets; /* list ended by VDESC_NO_OFFSET */ | int *vdesc_vp_offsets; /* list ended by VDESC_NO_OFFSET */ | ||||
int vdesc_vpp_offset; /* return vpp location */ | int vdesc_vpp_offset; /* return vpp location */ | ||||
int vdesc_cred_offset; /* cred location, if any */ | int vdesc_cred_offset; /* cred location, if any */ | ||||
int vdesc_thread_offset; /* thread location, if any */ | int vdesc_thread_offset; /* thread location, if any */ | ||||
int vdesc_componentname_offset; /* if any */ | int vdesc_componentname_offset; /* if any */ | ||||
}; | }; | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#define bo2vnode(bo) &(__containerof((bo), struct vnode_bo, vb_bo)->vb_v) | |||||
static inline struct bufobj * | |||||
vp2bo(struct vnode *vp) | |||||
{ | |||||
struct vnode_bo *vpo; | |||||
KASSERT((vp->v_irflag & VIRF_BUFOBJ) != 0, | |||||
("vp2bo vp %p does not have bufobj", vp)); | |||||
vpo = __containerof(vp, struct vnode_bo, vb_v); | |||||
return (&vpo->vb_bo); | |||||
} | |||||
/* | /* | ||||
* A list of all the operation descs. | * A list of all the operation descs. | ||||
*/ | */ | ||||
extern struct vnodeop_desc *vnodeop_descs[]; | extern struct vnodeop_desc *vnodeop_descs[]; | ||||
#define VOPARG_OFFSETOF(s_type, field) __offsetof(s_type, field) | #define VOPARG_OFFSETOF(s_type, field) __offsetof(s_type, field) | ||||
#define VOPARG_OFFSETTO(s_type, s_offset, struct_p) \ | #define VOPARG_OFFSETTO(s_type, s_offset, struct_p) \ | ||||
((s_type)(((char*)(struct_p)) + (s_offset))) | ((s_type)(((char*)(struct_p)) + (s_offset))) | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
void cache_fast_lookup_enabled_recalc(void); | void cache_fast_lookup_enabled_recalc(void); | ||||
int change_dir(struct vnode *vp, struct thread *td); | int change_dir(struct vnode *vp, struct thread *td); | ||||
void cvtstat(struct stat *st, struct ostat *ost); | void cvtstat(struct stat *st, struct ostat *ost); | ||||
void freebsd11_cvtnstat(struct stat *sb, struct nstat *nsb); | void freebsd11_cvtnstat(struct stat *sb, struct nstat *nsb); | ||||
int freebsd11_cvtstat(struct stat *st, struct freebsd11_stat *ost); | int freebsd11_cvtstat(struct stat *st, struct freebsd11_stat *ost); | ||||
int getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, | int getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, | ||||
struct vnode **vpp); | struct vnode **vpp); | ||||
void getnewvnode_reserve(void); | void getnewvnode_reserve(struct mount *mp); | ||||
void getnewvnode_drop_reserve(void); | void getnewvnode_drop_reserve(void); | ||||
int insmntque1(struct vnode *vp, struct mount *mp, | int insmntque1(struct vnode *vp, struct mount *mp, | ||||
void (*dtr)(struct vnode *, void *), void *dtr_arg); | void (*dtr)(struct vnode *, void *), void *dtr_arg); | ||||
int insmntque(struct vnode *vp, struct mount *mp); | int insmntque(struct vnode *vp, struct mount *mp); | ||||
u_quad_t init_va_filerev(void); | u_quad_t init_va_filerev(void); | ||||
int speedup_syncer(void); | int speedup_syncer(void); | ||||
int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen); | int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen); | ||||
int vn_getcwd(char *buf, char **retbuf, size_t *buflen); | int vn_getcwd(char *buf, char **retbuf, size_t *buflen); | ||||
▲ Show 20 Lines • Show All 439 Lines • Show Last 20 Lines |