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. | ||||
*/ | */ | ||||
/* | /* | ||||
* Vnode types. VNON means no type. | * Vnode types. VNON means no type. | ||||
*/ | */ | ||||
enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, | enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, | ||||
VMARKER }; | VMARKER }; | ||||
enum vgetstate { VGET_NONE, VGET_HOLDCNT, VGET_USECOUNT }; | enum vgetstate { VGET_NONE, VGET_HOLDCNT, VGET_USECOUNT }; | ||||
/* | /* | ||||
* Each underlying filesystem allocates its own private area and hangs | * Each underlying filesystem allocates its own private area and hangs | ||||
* it from v_data. If non-null, this area is freed in getnewvnode(). | * it from v_data. If non-null, this area is freed in getnewvnode(). | ||||
*/ | */ | ||||
struct namecache; | struct namecache; | ||||
struct vpollinfo { | struct vpollinfo { | ||||
struct mtx vpi_lock; /* lock to protect below */ | struct mtx vpi_lock; /* lock to protect below */ | ||||
mjg: This is a wart from failed rename experiment, will remove later. | |||||
struct selinfo vpi_selinfo; /* identity of poller(s) */ | struct selinfo vpi_selinfo; /* identity of poller(s) */ | ||||
short vpi_events; /* what they are looking for */ | short vpi_events; /* what they are looking for */ | ||||
short vpi_revents; /* what has happened */ | short vpi_revents; /* what has happened */ | ||||
}; | }; | ||||
/* | /* | ||||
* Reading or writing any of these items requires holding the appropriate lock. | * Reading or writing any of these items requires holding the appropriate lock. | ||||
* | * | ||||
Show All 21 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 All 40 Lines | |||||
struct proc; | struct proc; | ||||
struct stat; | struct stat; | ||||
struct nstat; | struct nstat; | ||||
struct ucred; | struct ucred; | ||||
struct uio; | struct uio; | ||||
struct vattr; | struct vattr; | ||||
struct vfsops; | struct vfsops; | ||||
struct vnode; | struct vnode; | ||||
struct pwd; | |||||
typedef int (*vn_get_ino_t)(struct mount *, void *, int, struct vnode **); | typedef int (*vn_get_ino_t)(struct mount *, void *, int, struct vnode **); | ||||
int bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn, | int bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn, | ||||
daddr_t endn); | daddr_t endn); | ||||
/* cache_* may belong in namei.h. */ | /* cache_* may belong in namei.h. */ | ||||
void cache_changesize(u_long newhashsize); | void cache_changesize(u_long newhashsize); | ||||
#define cache_enter(dvp, vp, cnp) \ | #define cache_enter(dvp, vp, cnp) \ | ||||
cache_enter_time(dvp, vp, cnp, NULL, NULL) | cache_enter_time(dvp, vp, cnp, NULL, NULL) | ||||
void cache_enter_time(struct vnode *dvp, struct vnode *vp, | void cache_enter_time(struct vnode *dvp, struct vnode *vp, | ||||
struct componentname *cnp, struct timespec *tsp, | struct componentname *cnp, struct timespec *tsp, | ||||
struct timespec *dtsp); | struct timespec *dtsp); | ||||
int cache_fplookup(struct nameidata *ndp, bool *handled); | |||||
int cache_lookup(struct vnode *dvp, struct vnode **vpp, | int cache_lookup(struct vnode *dvp, struct vnode **vpp, | ||||
struct componentname *cnp, struct timespec *tsp, int *ticksp); | struct componentname *cnp, struct timespec *tsp, int *ticksp); | ||||
void cache_purge(struct vnode *vp); | void cache_purge(struct vnode *vp); | ||||
void cache_purge_negative(struct vnode *vp); | void cache_purge_negative(struct vnode *vp); | ||||
void cache_purgevfs(struct mount *mp, bool force); | void cache_purgevfs(struct mount *mp, bool force); | ||||
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); | |||||
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(void); | ||||
void getnewvnode_drop_reserve(void); | void getnewvnode_drop_reserve(void); | ||||
Show All 9 Lines | int vn_fullpath(struct thread *td, struct vnode *vn, | ||||
char **retbuf, char **freebuf); | char **retbuf, char **freebuf); | ||||
int vn_fullpath_global(struct thread *td, struct vnode *vn, | int vn_fullpath_global(struct thread *td, struct vnode *vn, | ||||
char **retbuf, char **freebuf); | char **retbuf, char **freebuf); | ||||
struct vnode * | struct vnode * | ||||
vn_dir_dd_ino(struct vnode *vp); | vn_dir_dd_ino(struct vnode *vp); | ||||
int vn_commname(struct vnode *vn, char *buf, u_int buflen); | int vn_commname(struct vnode *vn, char *buf, u_int buflen); | ||||
int vn_path_to_global_path(struct thread *td, struct vnode *vp, | int vn_path_to_global_path(struct thread *td, struct vnode *vp, | ||||
char *path, u_int pathlen); | char *path, u_int pathlen); | ||||
int vaccess_vexec_smr(mode_t file_mode, uid_t file_uid, gid_t file_gid, | |||||
struct ucred *cred); | |||||
int vaccess(enum vtype type, mode_t file_mode, uid_t file_uid, | int vaccess(enum vtype type, mode_t file_mode, uid_t file_uid, | ||||
gid_t file_gid, accmode_t accmode, struct ucred *cred, | gid_t file_gid, accmode_t accmode, struct ucred *cred, | ||||
int *privused); | int *privused); | ||||
int vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid, | int vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid, | ||||
struct acl *aclp, accmode_t accmode, struct ucred *cred, | struct acl *aclp, accmode_t accmode, struct ucred *cred, | ||||
int *privused); | int *privused); | ||||
int vaccess_acl_posix1e(enum vtype type, uid_t file_uid, | int vaccess_acl_posix1e(enum vtype type, uid_t file_uid, | ||||
gid_t file_gid, struct acl *acl, accmode_t accmode, | gid_t file_gid, struct acl *acl, accmode_t accmode, | ||||
struct ucred *cred, int *privused); | struct ucred *cred, int *privused); | ||||
void vattr_null(struct vattr *vap); | void vattr_null(struct vattr *vap); | ||||
int vcount(struct vnode *vp); | int vcount(struct vnode *vp); | ||||
void vlazy(struct vnode *); | void vlazy(struct vnode *); | ||||
void vdrop(struct vnode *); | void vdrop(struct vnode *); | ||||
void vdropl(struct vnode *); | void vdropl(struct vnode *); | ||||
int vflush(struct mount *mp, int rootrefs, int flags, struct thread *td); | int vflush(struct mount *mp, int rootrefs, int flags, struct thread *td); | ||||
int vget(struct vnode *vp, int flags, struct thread *td); | int vget(struct vnode *vp, int flags, struct thread *td); | ||||
enum vgetstate vget_prep_smr(struct vnode *vp); | enum vgetstate vget_prep_smr(struct vnode *vp); | ||||
enum vgetstate vget_prep(struct vnode *vp); | enum vgetstate vget_prep(struct vnode *vp); | ||||
int vget_finish(struct vnode *vp, int flags, enum vgetstate vs); | int vget_finish(struct vnode *vp, int flags, enum vgetstate vs); | ||||
void vget_abort(struct vnode *vp, enum vgetstate vs); | |||||
void vgone(struct vnode *vp); | void vgone(struct vnode *vp); | ||||
void vhold(struct vnode *); | void vhold(struct vnode *); | ||||
void vholdl(struct vnode *); | void vholdl(struct vnode *); | ||||
void vholdnz(struct vnode *); | void vholdnz(struct vnode *); | ||||
bool vhold_smr(struct vnode *); | bool vhold_smr(struct vnode *); | ||||
void vinactive(struct vnode *vp); | void vinactive(struct vnode *vp); | ||||
int vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo); | int vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo); | ||||
int vtruncbuf(struct vnode *vp, off_t length, int blksize); | int vtruncbuf(struct vnode *vp, off_t length, int blksize); | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | |||||
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_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_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_post(void *a, int rc); | void vop_mkdir_post(void *a, int rc); | ||||
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_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_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_post(void *a, int rc); | void vop_symlink_post(void *a, int rc); | ||||
void vop_fplookup_vexec_pre(void *a); | |||||
void vop_fplookup_vexec_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); | ||||
void vop_need_inactive_pre(void *a); | void vop_need_inactive_pre(void *a); | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |
This is a wart from failed rename experiment, will remove later.