Author: jhb
Date: Fri Dec 23 20:11:37 2011
New Revision: 228849
URL: http://svn.freebsd.org/changeset/base/228849

Log:
  Add post-VOP hooks for VOP_DELETEEXTATTR() and VOP_SETEXTATTR() and use
  these to trigger a NOTE_ATTRIB EVFILT_VNODE kevent when the extended
  attributes of a vnode are changed.
  
  Note that OS X already implements this behavior.
  
  Reviewed by:  rwatson
  MFC after:    2 weeks

Modified:
  head/sys/kern/vfs_subr.c
  head/sys/kern/vnode_if.src
  head/sys/sys/vnode.h

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c    Fri Dec 23 20:03:18 2011        (r228848)
+++ head/sys/kern/vfs_subr.c    Fri Dec 23 20:11:37 2011        (r228849)
@@ -4033,6 +4033,15 @@ vop_create_post(void *ap, int rc)
 }
 
 void
+vop_deleteextattr_post(void *ap, int rc)
+{
+       struct vop_setattr_args *a = ap;
+
+       if (!rc)
+               VFS_KNOTE_LOCKED(a->a_vp, NOTE_ATTRIB);
+}
+
+void
 vop_link_post(void *ap, int rc)
 {
        struct vop_link_args *a = ap;
@@ -4114,6 +4123,15 @@ vop_setattr_post(void *ap, int rc)
 }
 
 void
+vop_setextattr_post(void *ap, int rc)
+{
+       struct vop_setattr_args *a = ap;
+
+       if (!rc)
+               VFS_KNOTE_LOCKED(a->a_vp, NOTE_ATTRIB);
+}
+
+void
 vop_symlink_post(void *ap, int rc)
 {
        struct vop_symlink_args *a = ap;

Modified: head/sys/kern/vnode_if.src
==============================================================================
--- head/sys/kern/vnode_if.src  Fri Dec 23 20:03:18 2011        (r228848)
+++ head/sys/kern/vnode_if.src  Fri Dec 23 20:11:37 2011        (r228849)
@@ -569,6 +569,7 @@ vop_openextattr {
 
 
 %% deleteextattr       vp      E E E
+%! deleteextattr       post    vop_deleteextattr_post
 
 vop_deleteextattr {
        IN struct vnode *vp;
@@ -580,6 +581,7 @@ vop_deleteextattr {
 
 
 %% setextattr  vp      E E E
+%! setextattr  post    vop_setextattr_post
 
 vop_setextattr {
        IN struct vnode *vp;

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h        Fri Dec 23 20:03:18 2011        (r228848)
+++ head/sys/sys/vnode.h        Fri Dec 23 20:11:37 2011        (r228849)
@@ -705,6 +705,7 @@ int vop_panic(struct vop_generic_args *a
 
 /* These are called from within the actual VOPS. */
 void   vop_create_post(void *a, int rc);
+void   vop_deleteextattr_post(void *a, int rc);
 void   vop_link_post(void *a, int rc);
 void   vop_lock_pre(void *a);
 void   vop_lock_post(void *a, int rc);
@@ -717,6 +718,7 @@ void        vop_rename_post(void *a, int rc);
 void   vop_rename_pre(void *a);
 void   vop_rmdir_post(void *a, int rc);
 void   vop_setattr_post(void *a, int rc);
+void   vop_setextattr_post(void *a, int rc);
 void   vop_strategy_pre(void *a);
 void   vop_symlink_post(void *a, int rc);
 void   vop_unlock_post(void *a, int rc);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to