Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/vnode.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
* 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_uint8_decl(vtype) { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, | ||||
kib: Can you reformat these to have one symbol per-line? | |||||
Done Inline Actionsi can do it if you insist but i don't see much point mjg: i can do it if you insist but i don't see much point | |||||
Not Done Inline ActionsI do think that one line per symbol improves the code layout and makes future diffs smaller. Also, I think you could do ... VMARKER, VLASTTYPE = VMARKER, }; kib: I do think that one line per symbol improves the code layout and makes future diffs smaller. | |||||
VMARKER }; | VMARKER }; | ||||
#define VLASTTYPE VMARKER | #define VLASTTYPE VMARKER | ||||
enum vstate { VSTATE_UNINITIALIZED, VSTATE_CONSTRUCTED, VSTATE_DESTROYING, | __enum_uint8_decl(vstate) { VSTATE_UNINITIALIZED, VSTATE_CONSTRUCTED, VSTATE_DESTROYING, | ||||
VSTATE_DEAD }; | VSTATE_DEAD }; | ||||
#define VLASTSTATE VSTATE_DEAD | #define VLASTSTATE VSTATE_DEAD | ||||
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(). | ||||
*/ | */ | ||||
Show All 33 Lines | |||||
#if defined(_KERNEL) || defined(_KVM_VNODE) | #if defined(_KERNEL) || defined(_KVM_VNODE) | ||||
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_uint8(vtype) v_type; /* u vnode type */ | ||||
enum vstate v_state:8; /* u vnode state */ | __enum_uint8(vstate) v_state; /* u vnode state */ | ||||
Not Done Inline ActionsPlain enum should be fine. arichardson: Plain `enum` should be fine. | |||||
Done Inline Actionsplain enum should fail to compile so that it is apparent everywhere what the size is mjg: plain enum should fail to compile so that it is apparent everywhere what the size is | |||||
Not Done Inline ActionsIf the definition is visible the compiler knows the size so plain enum does the right thing. If you prefer it this way to be explicit that's fine by me although I'd limit the change to just the struct definition, in the function signatures it's unnecessary IMO. arichardson: If the definition is visible the compiler knows the size so plain enum does the right thing. If… | |||||
short v_irflag; /* i frequently read flags */ | short v_irflag; /* i frequently read flags */ | ||||
seqc_t v_seqc; /* i modification count */ | seqc_t v_seqc; /* i modification count */ | ||||
uint32_t v_nchash; /* u namecache hash */ | uint32_t v_nchash; /* u namecache hash */ | ||||
u_int v_hash; | u_int v_hash; | ||||
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 */ | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | |||||
#define VMP_LAZYLIST 0x0001 /* Vnode is on mnt's lazy list */ | #define VMP_LAZYLIST 0x0001 /* Vnode is on mnt's lazy list */ | ||||
/* | /* | ||||
* Vnode attributes. A field value of VNOVAL represents a field whose value | * Vnode attributes. A field value of VNOVAL represents a field whose value | ||||
* is unavailable (getattr) or which is not to be changed (setattr). | * is unavailable (getattr) or which is not to be changed (setattr). | ||||
*/ | */ | ||||
struct vattr { | 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_mode; /* files access mode and type */ | ||||
u_short va_padding0; | u_short va_padding0; | ||||
uid_t va_uid; /* owner user id */ | uid_t va_uid; /* owner user id */ | ||||
gid_t va_gid; /* owner group id */ | gid_t va_gid; /* owner group id */ | ||||
nlink_t va_nlink; /* number of references to file */ | nlink_t va_nlink; /* number of references to file */ | ||||
dev_t va_fsid; /* filesystem id */ | dev_t va_fsid; /* filesystem id */ | ||||
ino_t va_fileid; /* file id */ | ino_t va_fileid; /* file id */ | ||||
u_quad_t va_size; /* file size in bytes */ | u_quad_t va_size; /* file size in bytes */ | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | |||||
extern u_int ncsizefactor; | extern u_int ncsizefactor; | ||||
extern const u_int io_hold_cnt; | extern const u_int io_hold_cnt; | ||||
/* | /* | ||||
* Convert between vnode types and inode formats (since POSIX.1 | * Convert between vnode types and inode formats (since POSIX.1 | ||||
* defines mode word of stat structure in terms of inode formats). | * 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[]; | extern int vttoif_tab[]; | ||||
#define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12]) | #define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12]) | ||||
#define VTTOIF(indx) (vttoif_tab[(int)(indx)]) | #define VTTOIF(indx) (vttoif_tab[(int)(indx)]) | ||||
#define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode)) | #define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode)) | ||||
/* | /* | ||||
* Flags to various vnode functions. | * Flags to various vnode functions. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 298 Lines • ▼ Show 20 Lines | |||||
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 vn_path_to_global_path_hardlink(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, | struct vnode *dvp, char *path, u_int pathlen, const char *leaf_name, | ||||
size_t leaf_length); | 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); | 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, | int vaccess_vexec_smr(mode_t file_mode, uid_t file_uid, gid_t file_gid, | ||||
struct ucred *cred); | 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); | 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, | gid_t file_gid, struct acl *acl, accmode_t accmode, | ||||
struct ucred *cred); | struct ucred *cred); | ||||
void vattr_null(struct vattr *vap); | void vattr_null(struct vattr *vap); | ||||
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); | int vget(struct vnode *vp, int flags); | ||||
▲ Show 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | |||||
int vn_getsize(struct vnode *vp, off_t *size, struct ucred *active_cred); | int vn_getsize(struct vnode *vp, off_t *size, struct ucred *active_cred); | ||||
void vn_fsid(struct vnode *vp, struct vattr *va); | void vn_fsid(struct vnode *vp, struct vattr *va); | ||||
int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); | int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); | ||||
int vn_lktype_write(struct mount *mp, struct vnode *vp); | int vn_lktype_write(struct mount *mp, struct vnode *vp); | ||||
#ifdef INVARIANTS | #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 | #endif | ||||
static inline void | static inline void | ||||
vn_set_state(struct vnode *vp, enum vstate state) | vn_set_state(struct vnode *vp, __enum_uint8(vstate) state) | ||||
{ | { | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
vn_set_state_validate(vp, state); | vn_set_state_validate(vp, state); | ||||
#endif | #endif | ||||
vp->v_state = state; | vp->v_state = state; | ||||
} | } | ||||
static inline enum vstate | static inline __enum_uint8(vstate) | ||||
vn_get_state(struct vnode *vp) | vn_get_state(struct vnode *vp) | ||||
{ | { | ||||
return (vp->v_state); | return (vp->v_state); | ||||
} | } | ||||
#define VOP_UNLOCK_FLAGS(vp, flags) ({ \ | #define VOP_UNLOCK_FLAGS(vp, flags) ({ \ | ||||
struct vnode *_vp = (vp); \ | struct vnode *_vp = (vp); \ | ||||
int _flags = (flags); \ | int _flags = (flags); \ | ||||
Show All 38 Lines |
Can you reformat these to have one symbol per-line?