diff options
author | praks <none@none> | 2007-08-14 17:10:25 -0700 |
---|---|---|
committer | praks <none@none> | 2007-08-14 17:10:25 -0700 |
commit | df2381bfa5cf7dd654bcf30b2f5af53f34f3043a (patch) | |
tree | 64f247ef81041ed83c44dc2d9aadf46ed66b5ab3 /usr/src/uts/common/fs/vnode.c | |
parent | 2038334ab26baaa43c9083f35def041511c3cc1f (diff) | |
download | illumos-gate-df2381bfa5cf7dd654bcf30b2f5af53f34f3043a.tar.gz |
PSARC/2007/027 File Events Notification API
6367770 RFE: add userland interface to fem (file event monitoring)
--HG--
rename : deleted_files/usr/src/uts/common/fs/portfs/port_fop.c => usr/src/uts/common/fs/portfs/port_fop.c
Diffstat (limited to 'usr/src/uts/common/fs/vnode.c')
-rw-r--r-- | usr/src/uts/common/fs/vnode.c | 72 |
1 files changed, 60 insertions, 12 deletions
diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c index 7129cfead9..55813947ec 100644 --- a/usr/src/uts/common/fs/vnode.c +++ b/usr/src/uts/common/fs/vnode.c @@ -89,6 +89,9 @@ static vopstats_t *vs_templatep; /* Kmem cache handle for vsk_anchor_t allocations */ kmem_cache_t *vsk_anchor_cache; +/* file events cleanup routine */ +extern void free_fopdata(vnode_t *); + /* * Root of AVL tree for the kstats associated with vopstats. Lock protects * updates to vsktat_tree. @@ -1988,10 +1991,10 @@ vn_cache_constructor(void *buf, void *cdrarg, int kmflags) cv_init(&vp->v_cv, NULL, CV_DEFAULT, NULL); rw_init(&vp->v_nbllock, NULL, RW_DEFAULT, NULL); rw_init(&vp->v_mslock, NULL, RW_DEFAULT, NULL); - vp->v_femhead = NULL; /* Must be done before vn_reinit() */ vp->v_path = NULL; vp->v_mpssdata = NULL; + vp->v_fopdata = NULL; return (0); } @@ -2058,6 +2061,10 @@ vn_recycle(vnode_t *vp) kmem_free(vp->v_path, strlen(vp->v_path) + 1); vp->v_path = NULL; } + + if (vp->v_fopdata != NULL) { + free_fopdata(vp); + } vp->v_mpssdata = NULL; } @@ -2110,6 +2117,7 @@ vn_alloc(int kmflag) if (vp != NULL) { vp->v_femhead = NULL; /* Must be done before vn_reinit() */ + vp->v_fopdata = NULL; vn_reinit(vp); } @@ -2138,6 +2146,10 @@ vn_free(vnode_t *vp) kmem_free(vp->v_femhead, sizeof (*(vp->v_femhead))); vp->v_femhead = NULL; } + + if (vp->v_fopdata != NULL) { + free_fopdata(vp); + } vp->v_mpssdata = NULL; kmem_cache_free(vn_cache, vp); } @@ -2200,43 +2212,79 @@ vnevent_support(vnode_t *vp) if (vp == NULL) return (EINVAL); - return (VOP_VNEVENT(vp, VE_SUPPORT)); + return (VOP_VNEVENT(vp, VE_SUPPORT, NULL, NULL)); +} + +void +vnevent_rename_src(vnode_t *vp, vnode_t *dvp, char *name) +{ + if (vp == NULL || vp->v_femhead == NULL) { + return; + } + (void) VOP_VNEVENT(vp, VE_RENAME_SRC, dvp, name); +} + +void +vnevent_rename_dest(vnode_t *vp, vnode_t *dvp, char *name) +{ + if (vp == NULL || vp->v_femhead == NULL) { + return; + } + (void) VOP_VNEVENT(vp, VE_RENAME_DEST, dvp, name); +} + +void +vnevent_rename_dest_dir(vnode_t *vp) +{ + if (vp == NULL || vp->v_femhead == NULL) { + return; + } + (void) VOP_VNEVENT(vp, VE_RENAME_DEST_DIR, NULL, NULL); +} + +void +vnevent_remove(vnode_t *vp, vnode_t *dvp, char *name) +{ + if (vp == NULL || vp->v_femhead == NULL) { + return; + } + (void) VOP_VNEVENT(vp, VE_REMOVE, dvp, name); } void -vnevent_rename_src(vnode_t *vp) +vnevent_rmdir(vnode_t *vp, vnode_t *dvp, char *name) { if (vp == NULL || vp->v_femhead == NULL) { return; } - (void) VOP_VNEVENT(vp, VE_RENAME_SRC); + (void) VOP_VNEVENT(vp, VE_RMDIR, dvp, name); } void -vnevent_rename_dest(vnode_t *vp) +vnevent_create(vnode_t *vp) { if (vp == NULL || vp->v_femhead == NULL) { return; } - (void) VOP_VNEVENT(vp, VE_RENAME_DEST); + (void) VOP_VNEVENT(vp, VE_CREATE, NULL, NULL); } void -vnevent_remove(vnode_t *vp) +vnevent_link(vnode_t *vp) { if (vp == NULL || vp->v_femhead == NULL) { return; } - (void) VOP_VNEVENT(vp, VE_REMOVE); + (void) VOP_VNEVENT(vp, VE_LINK, NULL, NULL); } void -vnevent_rmdir(vnode_t *vp) +vnevent_mountedover(vnode_t *vp) { if (vp == NULL || vp->v_femhead == NULL) { return; } - (void) VOP_VNEVENT(vp, VE_RMDIR); + (void) VOP_VNEVENT(vp, VE_MOUNTEDOVER, NULL, NULL); } /* @@ -3558,11 +3606,11 @@ fop_shrlock( } int -fop_vnevent(vnode_t *vp, vnevent_t vnevent) +fop_vnevent(vnode_t *vp, vnevent_t vnevent, vnode_t *dvp, char *fnm) { int err; - err = (*(vp)->v_op->vop_vnevent)(vp, vnevent); + err = (*(vp)->v_op->vop_vnevent)(vp, vnevent, dvp, fnm); VOPSTATS_UPDATE(vp, vnevent); return (err); } |