aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2002-07-31 12:19:49 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2002-07-31 12:19:49 +0000
commit4eee8de77cb0ff65f6c3b454e5c7523e489bb586 (patch)
tree8895b6491e9be59df954e6ec8571d1cd5b856c84
parent84baf7a20fc203e9a85ebe0d54c0a8be1ab72d6b (diff)
Notes
-rw-r--r--sys/kern/vfs_vnops.c7
-rw-r--r--sys/sys/vnode.h32
2 files changed, 39 insertions, 0 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 218dd723cd3b..c759196196c7 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -209,6 +209,10 @@ restart:
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
*/
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 6f1857c07d3e..524483625c4c 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -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 && \