Introduce struct xvnode, which will be used instead of struct vnode for
sysctl purposes. Also add two fields to struct vnode, v_cachedfs and v_cachedid, which hold the vnode's device and file id and are filled in by vn_open_cred() and vn_stat(). Sponsored by: DARPA, NAI Labs
This commit is contained in:
parent
84baf7a20f
commit
4eee8de77c
@ -209,6 +209,10 @@ vn_open_cred(ndp, flagp, cmode, cred)
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
if ((error = VOP_GETATTR(vp, vap, cred, td)) == 0) {
|
||||
vp->v_cachedfs = vap->va_fsid;
|
||||
vp->v_cachedid = vap->va_fileid;
|
||||
}
|
||||
if ((error = VOP_OPEN(vp, fmode, cred, td)) != 0)
|
||||
goto bad;
|
||||
/*
|
||||
@ -567,6 +571,9 @@ vn_stat(vp, sb, td)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
vp->v_cachedfs = vap->va_fsid;
|
||||
vp->v_cachedid = vap->va_fileid;
|
||||
|
||||
/*
|
||||
* Zero the spare stat fields
|
||||
*/
|
||||
|
@ -146,6 +146,8 @@ struct vnode {
|
||||
const char *filename; /* Source file doing locking */
|
||||
int line; /* Line number doing locking */
|
||||
#endif
|
||||
udev_t v_cachedfs; /* cached fs id */
|
||||
ino_t v_cachedid; /* cached file id */
|
||||
};
|
||||
#define v_mountedhere v_un.vu_mountedhere
|
||||
#define v_socket v_un.vu_socket
|
||||
@ -153,6 +155,36 @@ struct vnode {
|
||||
#define v_specnext v_un.vu_spec.vu_specnext
|
||||
#define v_fifoinfo v_un.vu_fifoinfo
|
||||
|
||||
/*
|
||||
* Userland version of struct vnode, for sysctl.
|
||||
*/
|
||||
struct xvnode {
|
||||
size_t xv_size; /* sizeof(struct xvnode) */
|
||||
void *xv_vnode; /* address of real vnode */
|
||||
u_long xv_flag; /* vnode flags */
|
||||
int xv_usecount; /* reference count of users */
|
||||
int xv_writecount; /* reference count of writers */
|
||||
int xv_holdcnt; /* page & buffer references */
|
||||
u_long xv_id; /* capability identifier */
|
||||
void *xv_mount; /* address of parent mount */
|
||||
long xv_numoutput; /* num of writes in progress */
|
||||
enum vtype xv_type; /* vnode type */
|
||||
union {
|
||||
void *xvu_socket; /* socket, if VSOCK */
|
||||
void *xvu_fifo; /* fifo, if VFIFO */
|
||||
udev_t xvu_rdev; /* maj/min, if VBLK/VCHR */
|
||||
struct {
|
||||
udev_t xvu_dev; /* device, if VDIR/VREG/VLNK */
|
||||
ino_t xvu_ino; /* id, if VDIR/VREG/VLNK */
|
||||
};
|
||||
} xv_un;
|
||||
};
|
||||
#define xv_socket xv_un.xvu_socket
|
||||
#define xv_fifo xv_un.xvu_fifo
|
||||
#define xv_rdev xv_un.xvu_rdev
|
||||
#define xv_dev xv_un.xvu_dev
|
||||
#define xv_ino xv_un.xvu_ino
|
||||
|
||||
#define VN_POLLEVENT(vp, events) \
|
||||
do { \
|
||||
if ((vp)->v_pollinfo != NULL && \
|
||||
|
Loading…
Reference in New Issue
Block a user