Re: [patch] inotify for 2.6.12-rc3.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2005-04-21 at 01:13 -0400, Robert Love wrote:

> Live from linux.conf.au, below is inotify against 2.6.12-rc3.

G'day mates!  By popular request!

Cheers,

	Robert Love


Send an event on xattr change.  Just use the existing metadata change event,
IN_ATTRIB, instead of adding a new event.  While here, do not wrap
dnotify_flush(), no need.

Signed-off-by: Robert Love <[email protected]>

 fs/open.c                |    2 +-
 fs/xattr.c               |    5 ++++-
 include/linux/fsnotify.h |   18 ++++++++++--------
 3 files changed, 15 insertions(+), 10 deletions(-)

diff -urN linux-2.6.12-rc3-inotify-0.22-2/fs/open.c linux/fs/open.c
--- linux-2.6.12-rc3-inotify-0.22-2/fs/open.c	2005-04-21 01:13:17.000000000 -0400
+++ linux/fs/open.c	2005-04-21 01:17:27.000000000 -0400
@@ -1000,7 +1000,7 @@
 			retval = err;
 	}
 
-	fsnotify_flush(filp, id);
+	dnotify_flush(filp, id);
 	locks_remove_posix(filp, id);
 	fput(filp);
 	return retval;
diff -urN linux-2.6.12-rc3-inotify-0.22-2/fs/xattr.c linux/fs/xattr.c
--- linux-2.6.12-rc3-inotify-0.22-2/fs/xattr.c	2005-04-21 01:13:17.000000000 -0400
+++ linux/fs/xattr.c	2005-04-21 01:24:24.000000000 -0400
@@ -16,6 +16,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/module.h>
+#include <linux/fsnotify.h>
 #include <asm/uaccess.h>
 
 /*
@@ -57,8 +58,10 @@
 		if (error)
 			goto out;
 		error = d->d_inode->i_op->setxattr(d, kname, kvalue, size, flags);
-		if (!error)
+		if (!error) {
+			fsnotify_xattr(d);
 			security_inode_post_setxattr(d, kname, kvalue, size, flags);
+		}
 out:
 		up(&d->d_inode->i_sem);
 	}
diff -urN linux-2.6.12-rc3-inotify-0.22-2/include/linux/fsnotify.h linux/include/linux/fsnotify.h
--- linux-2.6.12-rc3-inotify-0.22-2/include/linux/fsnotify.h	2005-04-21 01:13:20.000000000 -0400
+++ linux/include/linux/fsnotify.h	2005-04-21 01:23:06.000000000 -0400
@@ -131,6 +131,16 @@
 }
 
 /*
+ * fsnotify_xattr - extended attributes were changed
+ */
+static inline void fsnotify_xattr(struct dentry *dentry)
+{
+	inotify_dentry_parent_queue_event(dentry, IN_ATTRIB, 0,
+					  dentry->d_name.name);
+	inotify_inode_queue_event(dentry->d_inode, IN_ATTRIB, 0, NULL);
+}
+
+/*
  * fsnotify_change - notify_change event.  file was modified and/or metadata
  * was changed.
  */
@@ -177,14 +187,6 @@
 	}
 }
 
-/*
- * fsnotify_flush - flush time!
- */
-static inline void fsnotify_flush(struct file *filp, fl_owner_t id)
-{
-	dnotify_flush(filp, id);
-}
-
 #ifdef CONFIG_INOTIFY	/* inotify helpers */
 
 /*


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux