summaryrefslogtreecommitdiff
path: root/sys/kern/vnode_if.src
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-10-20 03:08:16 +0000
committerthorpej <thorpej@NetBSD.org>2021-10-20 03:08:16 +0000
commit8abbca48b237c9edc3ffb387e9074ddcff8b645d (patch)
tree41861906d64ee2ea60ac288b69c2b14012886108 /sys/kern/vnode_if.src
parent6ddcd84a3618d73c6acd9eb1ba9c92a563467245 (diff)
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example). In support of the above: - Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs. NetBSD 9.99.92.
Diffstat (limited to 'sys/kern/vnode_if.src')
-rw-r--r--sys/kern/vnode_if.src22
1 files changed, 20 insertions, 2 deletions
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index a76d97221f8..fd8ed07cea9 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -1,4 +1,4 @@
-# $NetBSD: vnode_if.src,v 1.82 2021/07/02 16:56:22 dholland Exp $
+# $NetBSD: vnode_if.src,v 1.83 2021/10/20 03:08:18 thorpej Exp $
#
# Copyright (c) 1992, 1993
# The Regents of the University of California. All rights reserved.
@@ -95,6 +95,7 @@ vop_lookup {
#
vop_create {
VERSION 3
+ POST=vop_create_post
IN LOCKED=YES struct vnode *dvp;
OUT WILLMAKE struct vnode **vpp;
IN struct componentname *cnp;
@@ -109,6 +110,7 @@ vop_create {
#
vop_mknod {
VERSION 3
+ POST=vop_mknod_post
IN LOCKED=YES struct vnode *dvp;
OUT WILLMAKE struct vnode **vpp;
IN struct componentname *cnp;
@@ -119,6 +121,7 @@ vop_mknod {
#% open vp L L L
#
vop_open {
+ POST=vop_open_post
IN LOCKED=YES struct vnode *vp;
IN int mode;
IN kauth_cred_t cred;
@@ -128,6 +131,7 @@ vop_open {
#% close vp L L L
#
vop_close {
+ POST=vop_close_post
IN LOCKED=YES struct vnode *vp;
IN int fflag;
IN kauth_cred_t cred;
@@ -164,6 +168,8 @@ vop_getattr {
#% setattr vp L L L
#
vop_setattr {
+ PRE=vop_setattr_pre
+ POST=vop_setattr_post
IN LOCKED=YES struct vnode *vp;
IN struct vattr *vap;
IN kauth_cred_t cred;
@@ -173,6 +179,7 @@ vop_setattr {
#% read vp L L L
#
vop_read {
+ POST=vop_read_post
IN LOCKED=YES struct vnode *vp;
INOUT struct uio *uio;
IN int ioflag;
@@ -183,6 +190,8 @@ vop_read {
#% write vp L L L
#
vop_write {
+ PRE=vop_write_pre
+ POST=vop_write_post
IN LOCKED=YES struct vnode *vp;
INOUT struct uio *uio;
IN int ioflag;
@@ -294,10 +303,13 @@ vop_seek {
#! remove cnp DELETE, LOCKPARENT | LOCKLEAF
#
vop_remove {
- VERSION 2
+ VERSION 3
+ PRE=vop_remove_pre
+ POST=vop_remove_post
IN LOCKED=YES struct vnode *dvp;
IN LOCKED=YES WILLPUT struct vnode *vp;
IN struct componentname *cnp;
+ CONTEXT nlink_t vp_new_nlink;
};
#
@@ -308,6 +320,7 @@ vop_remove {
#
vop_link {
VERSION 2
+ POST=vop_link_post
IN LOCKED=YES struct vnode *dvp;
IN LOCKED=NO struct vnode *vp;
IN struct componentname *cnp;
@@ -339,6 +352,7 @@ vop_rename {
#
vop_mkdir {
VERSION 3
+ POST=vop_mkdir_post
IN LOCKED=YES struct vnode *dvp;
OUT WILLMAKE struct vnode **vpp;
IN struct componentname *cnp;
@@ -353,6 +367,8 @@ vop_mkdir {
#
vop_rmdir {
VERSION 2
+ PRE=vop_rmdir_pre
+ POST=vop_rmdir_post
IN LOCKED=YES struct vnode *dvp;
IN LOCKED=YES WILLPUT struct vnode *vp;
IN struct componentname *cnp;
@@ -366,6 +382,7 @@ vop_rmdir {
#
vop_symlink {
VERSION 3
+ POST=vop_symlink_post
IN LOCKED=YES struct vnode *dvp;
OUT WILLMAKE struct vnode **vpp;
IN struct componentname *cnp;
@@ -549,6 +566,7 @@ vop_getacl {
#% setacl vp L L L
#
vop_setacl {
+ POST=vop_setacl_post
IN struct vnode *vp;
IN acl_type_t type;
IN struct acl *aclp;