Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/vnode.h
Show All 39 Lines | |||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/lockmgr.h> | #include <sys/lockmgr.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/rangelock.h> | #include <sys/rangelock.h> | ||||
#include <sys/selinfo.h> | #include <sys/selinfo.h> | ||||
#include <sys/uio.h> | #include <sys/uio.h> | ||||
#include <sys/acl.h> | #include <sys/acl.h> | ||||
#include <sys/ktr.h> | #include <sys/ktr.h> | ||||
#include <sys/_seqc.h> | |||||
/* | /* | ||||
* The vnode is the focus of all file activity in UNIX. There is a | * The vnode is the focus of all file activity in UNIX. There is a | ||||
* unique vnode allocated for each active file, each current directory, | * unique vnode allocated for each active file, each current directory, | ||||
* each mounted-on file, text file, and the root. | * each mounted-on file, text file, and the root. | ||||
*/ | */ | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
struct vnode { | struct vnode { | ||||
/* | /* | ||||
* Fields which define the identity of the vnode. These fields are | * Fields which define the identity of the vnode. These fields are | ||||
* owned by the filesystem (XXX: and vgone() ?) | * owned by the filesystem (XXX: and vgone() ?) | ||||
*/ | */ | ||||
enum vtype v_type:8; /* u vnode type */ | enum vtype v_type:8; /* u vnode type */ | ||||
short v_irflag; /* i frequently read flags */ | short v_irflag; /* i frequently read flags */ | ||||
seqc_t v_seqc; /* i modification count */ | |||||
struct vop_vector *v_op; /* u vnode operations vector */ | struct vop_vector *v_op; /* u vnode operations vector */ | ||||
void *v_data; /* u private data for fs */ | void *v_data; /* u private data for fs */ | ||||
/* | /* | ||||
* Filesystem instance stuff | * Filesystem instance stuff | ||||
*/ | */ | ||||
struct mount *v_mount; /* u ptr to vfs we are in */ | struct mount *v_mount; /* u ptr to vfs we are in */ | ||||
TAILQ_ENTRY(vnode) v_nmntvnodes; /* m vnodes for mount point */ | TAILQ_ENTRY(vnode) v_nmntvnodes; /* m vnodes for mount point */ | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | struct vnode { | ||||
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_int v_iflag; /* i vnode flags (see below) */ | u_int v_iflag; /* i vnode flags (see below) */ | ||||
u_int v_vflag; /* v vnode flags */ | u_int 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 */ | |||||
u_int v_hash; | u_int v_hash; | ||||
}; | }; | ||||
#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ | #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ | ||||
#define bo2vnode(bo) __containerof((bo), struct vnode, v_bufobj) | #define bo2vnode(bo) __containerof((bo), struct vnode, v_bufobj) | ||||
/* XXX: These are temporary to avoid a source sweep at this time */ | /* XXX: These are temporary to avoid a source sweep at this time */ | ||||
▲ Show 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | |||||
void assert_vop_unlocked(struct vnode *vp, const char *str); | void assert_vop_unlocked(struct vnode *vp, const char *str); | ||||
#define ASSERT_VI_LOCKED(vp, str) assert_vi_locked((vp), (str)) | #define ASSERT_VI_LOCKED(vp, str) assert_vi_locked((vp), (str)) | ||||
#define ASSERT_VI_UNLOCKED(vp, str) assert_vi_unlocked((vp), (str)) | #define ASSERT_VI_UNLOCKED(vp, str) assert_vi_unlocked((vp), (str)) | ||||
#define ASSERT_VOP_ELOCKED(vp, str) assert_vop_elocked((vp), (str)) | #define ASSERT_VOP_ELOCKED(vp, str) assert_vop_elocked((vp), (str)) | ||||
#define ASSERT_VOP_LOCKED(vp, str) assert_vop_locked((vp), (str)) | #define ASSERT_VOP_LOCKED(vp, str) assert_vop_locked((vp), (str)) | ||||
#define ASSERT_VOP_UNLOCKED(vp, str) assert_vop_unlocked((vp), (str)) | #define ASSERT_VOP_UNLOCKED(vp, str) assert_vop_unlocked((vp), (str)) | ||||
#define ASSERT_VOP_IN_SEQC(vp) do { \ | |||||
struct vnode *_vp = (vp); \ | |||||
\ | |||||
VNPASS(seqc_in_modify(_vp->v_seqc), _vp); \ | |||||
} while (0) | |||||
#define ASSERT_VOP_NOT_IN_SEQC(vp) do { \ | |||||
struct vnode *_vp = (vp); \ | |||||
\ | |||||
VNPASS(!seqc_in_modify(_vp->v_seqc), _vp); \ | |||||
} while (0) | |||||
#else /* !DEBUG_VFS_LOCKS */ | #else /* !DEBUG_VFS_LOCKS */ | ||||
#define ASSERT_VI_LOCKED(vp, str) ((void)0) | #define ASSERT_VI_LOCKED(vp, str) ((void)0) | ||||
#define ASSERT_VI_UNLOCKED(vp, str) ((void)0) | #define ASSERT_VI_UNLOCKED(vp, str) ((void)0) | ||||
#define ASSERT_VOP_ELOCKED(vp, str) ((void)0) | #define ASSERT_VOP_ELOCKED(vp, str) ((void)0) | ||||
#define ASSERT_VOP_LOCKED(vp, str) ((void)0) | #define ASSERT_VOP_LOCKED(vp, str) ((void)0) | ||||
#define ASSERT_VOP_UNLOCKED(vp, str) ((void)0) | #define ASSERT_VOP_UNLOCKED(vp, str) ((void)0) | ||||
#define ASSERT_VOP_IN_SEQC(vp) ((void)0) | |||||
#define ASSERT_VOP_NOT_IN_SEQC(vp) ((void)0) | |||||
#endif /* DEBUG_VFS_LOCKS */ | #endif /* DEBUG_VFS_LOCKS */ | ||||
/* | /* | ||||
* This call works for vnodes in the kernel. | * This call works for vnodes in the kernel. | ||||
*/ | */ | ||||
#define VCALL(c) ((c)->a_desc->vdesc_call(c)) | #define VCALL(c) ((c)->a_desc->vdesc_call(c)) | ||||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | int vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, | ||||
void *alloc_arg, int lkflags, struct vnode **rvp); | void *alloc_arg, int lkflags, struct vnode **rvp); | ||||
int vn_utimes_perm(struct vnode *vp, struct vattr *vap, | int vn_utimes_perm(struct vnode *vp, struct vattr *vap, | ||||
struct ucred *cred, struct thread *td); | struct ucred *cred, struct thread *td); | ||||
int vn_io_fault_uiomove(char *data, int xfersize, struct uio *uio); | int vn_io_fault_uiomove(char *data, int xfersize, struct uio *uio); | ||||
int vn_io_fault_pgmove(vm_page_t ma[], vm_offset_t offset, int xfersize, | int vn_io_fault_pgmove(vm_page_t ma[], vm_offset_t offset, int xfersize, | ||||
struct uio *uio); | struct uio *uio); | ||||
void vn_seqc_write_begin_locked(struct vnode *vp); | |||||
void vn_seqc_write_begin(struct vnode *vp); | |||||
void vn_seqc_write_end_locked(struct vnode *vp); | |||||
void vn_seqc_write_end(struct vnode *vp); | |||||
#define vn_seqc_read_any(vp) seqc_read_any(&(vp)->v_seqc) | |||||
#define vn_seqc_consistent(vp, seq) seqc_consistent(&(vp)->v_seqc, seq) | |||||
#define vn_rangelock_unlock(vp, cookie) \ | #define vn_rangelock_unlock(vp, cookie) \ | ||||
rangelock_unlock(&(vp)->v_rl, (cookie), VI_MTX(vp)) | rangelock_unlock(&(vp)->v_rl, (cookie), VI_MTX(vp)) | ||||
#define vn_rangelock_unlock_range(vp, cookie, start, end) \ | #define vn_rangelock_unlock_range(vp, cookie, start, end) \ | ||||
rangelock_unlock_range(&(vp)->v_rl, (cookie), (start), (end), \ | rangelock_unlock_range(&(vp)->v_rl, (cookie), (start), (end), \ | ||||
VI_MTX(vp)) | VI_MTX(vp)) | ||||
#define vn_rangelock_rlock(vp, start, end) \ | #define vn_rangelock_rlock(vp, start, end) \ | ||||
rangelock_rlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) | rangelock_rlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) | ||||
#define vn_rangelock_tryrlock(vp, start, end) \ | #define vn_rangelock_tryrlock(vp, start, end) \ | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
int vop_null(struct vop_generic_args *ap); | int vop_null(struct vop_generic_args *ap); | ||||
int vop_panic(struct vop_generic_args *ap); | int vop_panic(struct vop_generic_args *ap); | ||||
int dead_poll(struct vop_poll_args *ap); | int dead_poll(struct vop_poll_args *ap); | ||||
int dead_read(struct vop_read_args *ap); | int dead_read(struct vop_read_args *ap); | ||||
int dead_write(struct vop_write_args *ap); | int dead_write(struct vop_write_args *ap); | ||||
/* These are called from within the actual VOPS. */ | /* These are called from within the actual VOPS. */ | ||||
void vop_close_post(void *a, int rc); | void vop_close_post(void *a, int rc); | ||||
void vop_create_pre(void *a); | |||||
void vop_create_post(void *a, int rc); | void vop_create_post(void *a, int rc); | ||||
void vop_deleteextattr_pre(void *a); | |||||
void vop_deleteextattr_post(void *a, int rc); | void vop_deleteextattr_post(void *a, int rc); | ||||
void vop_link_pre(void *a); | |||||
void vop_link_post(void *a, int rc); | void vop_link_post(void *a, int rc); | ||||
void vop_lookup_post(void *a, int rc); | void vop_lookup_post(void *a, int rc); | ||||
void vop_lookup_pre(void *a); | void vop_lookup_pre(void *a); | ||||
void vop_mkdir_pre(void *a); | |||||
void vop_mkdir_post(void *a, int rc); | void vop_mkdir_post(void *a, int rc); | ||||
void vop_mknod_pre(void *a); | |||||
void vop_mknod_post(void *a, int rc); | void vop_mknod_post(void *a, int rc); | ||||
void vop_open_post(void *a, int rc); | void vop_open_post(void *a, int rc); | ||||
void vop_read_post(void *a, int rc); | void vop_read_post(void *a, int rc); | ||||
void vop_readdir_post(void *a, int rc); | void vop_readdir_post(void *a, int rc); | ||||
void vop_reclaim_post(void *a, int rc); | void vop_reclaim_post(void *a, int rc); | ||||
void vop_remove_pre(void *a); | |||||
void vop_remove_post(void *a, int rc); | void vop_remove_post(void *a, int rc); | ||||
void vop_rename_post(void *a, int rc); | void vop_rename_post(void *a, int rc); | ||||
void vop_rename_pre(void *a); | void vop_rename_pre(void *a); | ||||
void vop_rmdir_pre(void *a); | |||||
void vop_rmdir_post(void *a, int rc); | void vop_rmdir_post(void *a, int rc); | ||||
void vop_setattr_pre(void *a); | |||||
void vop_setattr_post(void *a, int rc); | void vop_setattr_post(void *a, int rc); | ||||
void vop_setacl_pre(void *a); | |||||
void vop_setacl_post(void *a, int rc); | |||||
void vop_setextattr_pre(void *a); | |||||
void vop_setextattr_post(void *a, int rc); | void vop_setextattr_post(void *a, int rc); | ||||
void vop_symlink_pre(void *a); | |||||
void vop_symlink_post(void *a, int rc); | void vop_symlink_post(void *a, int rc); | ||||
int vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a); | int vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a); | ||||
#ifdef DEBUG_VFS_LOCKS | #ifdef DEBUG_VFS_LOCKS | ||||
void vop_strategy_pre(void *a); | void vop_strategy_pre(void *a); | ||||
void vop_lock_pre(void *a); | void vop_lock_pre(void *a); | ||||
void vop_lock_post(void *a, int rc); | void vop_lock_post(void *a, int rc); | ||||
void vop_unlock_pre(void *a); | void vop_unlock_pre(void *a); | ||||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |