rpms/kernel/devel linux-2.6-audit-merged.patch, NONE, 1.1.2.1 kernel-2.6.spec, 1.2212.2.5, 1.2212.2.6 linux-2.6-audit-pending.patch, 1.1.14.2, 1.1.14.3

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed May 31 15:53:25 UTC 2006


Author: sgrubb

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv15875

Modified Files:
      Tag: private-lspp-28-branch
	kernel-2.6.spec linux-2.6-audit-pending.patch 
Added Files:
      Tag: private-lspp-28-branch
	linux-2.6-audit-merged.patch 
Log Message:
lspp.32 updated patches


linux-2.6-audit-merged.patch:
 fs/Kconfig               |   24 -
 fs/Makefile              |    1 
 fs/inotify.c             |  991 +++++++++++++----------------------------------
 fs/inotify_user.c        |  719 ++++++++++++++++++++++++++++++++++
 include/linux/fsnotify.h |   29 -
 include/linux/inotify.h  |  112 +++++
 include/linux/sched.h    |    2 
 kernel/sysctl.c          |    4 
 kernel/user.c            |    2 
 9 files changed, 1152 insertions(+), 732 deletions(-)

--- NEW FILE linux-2.6-audit-merged.patch ---
diff --git a/fs/Kconfig b/fs/Kconfig
index f9b5842..74f11a2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -393,18 +393,30 @@ config INOTIFY
 	bool "Inotify file change notification support"
 	default y
 	---help---
-	  Say Y here to enable inotify support and the associated system
-	  calls.  Inotify is a file change notification system and a
-	  replacement for dnotify.  Inotify fixes numerous shortcomings in
-	  dnotify and introduces several new features.  It allows monitoring
-	  of both files and directories via a single open fd.  Other features
-	  include multiple file events, one-shot support, and unmount
+	  Say Y here to enable inotify support.  Inotify is a file change
+	  notification system and a replacement for dnotify.  Inotify fixes
+	  numerous shortcomings in dnotify and introduces several new features
+	  including multiple file events, one-shot support, and unmount
 	  notification.
 
 	  For more information, see Documentation/filesystems/inotify.txt
 
 	  If unsure, say Y.
 
+config INOTIFY_USER
+	bool "Inotify support for userspace"
+	depends on INOTIFY
+	default y
+	---help---
+	  Say Y here to enable inotify support for userspace, including the
+	  associated system calls.  Inotify allows monitoring of both files and
+	  directories via a single open fd.  Events are read from the file
+	  descriptor, which is also select()- and poll()-able.
+
+	  For more information, see Documentation/filesystems/inotify.txt
+
+	  If unsure, say Y.
+
 config QUOTA
 	bool "Quota support"
 	help
diff --git a/fs/Makefile b/fs/Makefile
index 078d3d1..d0ea6bf 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -13,6 +13,7 @@ obj-y :=	open.o read_write.o file_table.
 		ioprio.o pnode.o drop_caches.o splice.o sync.o
 
 obj-$(CONFIG_INOTIFY)		+= inotify.o
+obj-$(CONFIG_INOTIFY_USER)	+= inotify_user.o
 obj-$(CONFIG_EPOLL)		+= eventpoll.o
 obj-$(CONFIG_COMPAT)		+= compat.o compat_ioctl.o
 
diff --git a/fs/inotify.c b/fs/inotify.c
index 732ec4b..16d65ba 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -5,7 +5,10 @@
  *	John McCutchan	<ttb at tentacle.dhs.org>
  *	Robert Love	<rml at novell.com>
  *
+ * Kernel API added by: Amy Griffis <amy.griffis at hp.com>
+ *
  * Copyright (C) 2005 John McCutchan
+ * Copyright 2006 Hewlett-Packard Development Company, L.P.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -20,35 +23,17 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/idr.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/mount.h>
-#include <linux/namei.h>
-#include <linux/poll.h>
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/writeback.h>
 #include <linux/inotify.h>
-#include <linux/syscalls.h>
-
-#include <asm/ioctls.h>
 
 static atomic_t inotify_cookie;
 
-static kmem_cache_t *watch_cachep __read_mostly;
-static kmem_cache_t *event_cachep __read_mostly;
-
-static struct vfsmount *inotify_mnt __read_mostly;
-
-/* these are configurable via /proc/sys/fs/inotify/ */
-int inotify_max_user_instances __read_mostly;
-int inotify_max_user_watches __read_mostly;
-int inotify_max_queued_events __read_mostly;
-
 /*
  * Lock ordering:
  *
@@ -56,327 +41,108 @@ int inotify_max_queued_events __read_mos
  * iprune_mutex (synchronize shrink_icache_memory())
  * 	inode_lock (protects the super_block->s_inodes list)
  * 	inode->inotify_mutex (protects inode->inotify_watches and watches->i_list)
- * 		inotify_dev->mutex (protects inotify_device and watches->d_list)
+ * 		inotify_handle->mutex (protects inotify_handle and watches->h_list)
+ *
+ * The inode->inotify_mutex and inotify_handle->mutex and held during execution
+ * of a caller's event handler.  Thus, the caller must not hold any locks
+ * taken in their event handler while calling any of the published inotify
+ * interfaces.
  */
 
 /*
- * Lifetimes of the three main data structures--inotify_device, inode, and
+ * Lifetimes of the three main data structures--inotify_handle, inode, and
  * inotify_watch--are managed by reference count.
  *
- * inotify_device: Lifetime is from inotify_init() until release.  Additional
- * references can bump the count via get_inotify_dev() and drop the count via
- * put_inotify_dev().
+ * inotify_handle: Lifetime is from inotify_init() to inotify_destroy().
+ * Additional references can bump the count via get_inotify_handle() and drop
+ * the count via put_inotify_handle().
  *
- * inotify_watch: Lifetime is from create_watch() to destory_watch().
- * Additional references can bump the count via get_inotify_watch() and drop
- * the count via put_inotify_watch().
+ * inotify_watch: for inotify's purposes, lifetime is from inotify_add_watch()
+ * to remove_watch_no_event().  Additional references can bump the count via
+ * get_inotify_watch() and drop the count via put_inotify_watch().  The caller
+ * is reponsible for the final put after receiving IN_IGNORED, or when using
+ * IN_ONESHOT after receiving the first event.  Inotify does the final put when
+ * the caller calls inotify_destroy().
  *
  * inode: Pinned so long as the inode is associated with a watch, from
- * create_watch() to put_inotify_watch().
+ * inotify_add_watch() to the final put_inotify_watch().
  */
 
 /*
- * struct inotify_device - represents an inotify instance
+ * struct inotify_handle - represents an inotify instance
  *
  * This structure is protected by the mutex 'mutex'.
  */
-struct inotify_device {
-	wait_queue_head_t 	wq;		/* wait queue for i/o */
+struct inotify_handle {
 	struct idr		idr;		/* idr mapping wd -> watch */
 	struct mutex		mutex;		/* protects this bad boy */
-	struct list_head 	events;		/* list of queued events */
 	struct list_head	watches;	/* list of watches */
 	atomic_t		count;		/* reference count */
-	struct user_struct	*user;		/* user who opened this dev */
-	unsigned int		queue_size;	/* size of the queue (bytes) */
-	unsigned int		event_count;	/* number of pending events */
-	unsigned int		max_events;	/* maximum number of events */
 	u32			last_wd;	/* the last wd allocated */
+	const struct inotify_operations *in_ops; /* inotify caller operations */
 };
 
-/*
- * struct inotify_kernel_event - An inotify event, originating from a watch and
- * queued for user-space.  A list of these is attached to each instance of the
- * device.  In read(), this list is walked and all events that can fit in the
- * buffer are returned.
- *
- * Protected by dev->mutex of the device in which we are queued.
- */
-struct inotify_kernel_event {
-	struct inotify_event	event;	/* the user-space event */
-	struct list_head        list;	/* entry in inotify_device's list */
-	char			*name;	/* filename, if any */
-};
-
-/*
- * struct inotify_watch - represents a watch request on a specific inode
- *
- * d_list is protected by dev->mutex of the associated watch->dev.
- * i_list and mask are protected by inode->inotify_mutex of the associated inode.
- * dev, inode, and wd are never written to once the watch is created.
- */
-struct inotify_watch {
-	struct list_head	d_list;	/* entry in inotify_device's list */
-	struct list_head	i_list;	/* entry in inode's list */
-	atomic_t		count;	/* reference count */
-	struct inotify_device	*dev;	/* associated device */
-	struct inode		*inode;	/* associated inode */
-	s32 			wd;	/* watch descriptor */
-	u32			mask;	/* event mask for this watch */
-};
-
-#ifdef CONFIG_SYSCTL
-
[...1947 lines suppressed...]
+++ b/include/linux/inotify.h
@@ -49,7 +49,7 @@ #define IN_MOVE			(IN_MOVED_FROM | IN_MO
 /* special flags */
 #define IN_ONLYDIR		0x01000000	/* only watch the path if it is a directory */
 #define IN_DONT_FOLLOW		0x02000000	/* don't follow a sym link */
-#define IN_MASK_ADD		0x20000000	/* add to the mask of an already existing watch */
+#define IN_MASK_ADD		0x20000000	/* add to the mask of an alreadyexisting watch */
 #define IN_ISDIR		0x40000000	/* event occurred against dir */
 #define IN_ONESHOT		0x80000000	/* only send event once */
 
@@ -69,18 +69,65 @@ #include <linux/dcache.h>
 #include <linux/fs.h>
 #include <linux/config.h>
 
+/*
+ * struct inotify_watch - represents a watch request on a specific inode
+ *
+ * h_list is protected by ih->mutex of the associated inotify_handle.
+ * i_list, mask are protected by inode->inotify_mutex of the associated inode.
+ * ih, inode, and wd are never written to once the watch is created.
+ *
+ * Callers must use the established inotify interfaces to access inotify_watch
+ * contents.  The content of this structure is private to the inotify
+ * implementation.
+ */
+struct inotify_watch {
+	struct list_head	h_list;	/* entry in inotify_handle's list */
+	struct list_head	i_list;	/* entry in inode's list */
+	atomic_t		count;	/* reference count */
+	struct inotify_handle	*ih;	/* associated inotify handle */
+	struct inode		*inode;	/* associated inode */
+	__s32			wd;	/* watch descriptor */
+	__u32			mask;	/* event mask for this watch */
+};
+
+struct inotify_operations {
+	void (*handle_event)(struct inotify_watch *, u32, u32, u32,
+			     const char *, struct inode *);
+	void (*destroy_watch)(struct inotify_watch *);
+};
+
 #ifdef CONFIG_INOTIFY
 
+/* Kernel API for producing events */
+
 extern void inotify_d_instantiate(struct dentry *, struct inode *);
 extern void inotify_d_move(struct dentry *);
 extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
-				      const char *);
+				      const char *, struct inode *);
 extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
 					      const char *);
 extern void inotify_unmount_inodes(struct list_head *);
 extern void inotify_inode_is_dead(struct inode *);
 extern u32 inotify_get_cookie(void);
 
+/* Kernel Consumer API */
+
+extern struct inotify_handle *inotify_init(const struct inotify_operations *);
+extern void inotify_init_watch(struct inotify_watch *);
+extern void inotify_destroy(struct inotify_handle *);
+extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *,
+				struct inotify_watch **);
+extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *,
+				       u32);
+extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
+			       struct inode *, __u32);
+extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
+extern int inotify_rm_wd(struct inotify_handle *, __u32);
+extern void inotify_remove_watch_locked(struct inotify_handle *,
+					struct inotify_watch *);
+extern void get_inotify_watch(struct inotify_watch *);
+extern void put_inotify_watch(struct inotify_watch *);
+
 #else
 
 static inline void inotify_d_instantiate(struct dentry *dentry,
@@ -94,7 +141,8 @@ static inline void inotify_d_move(struct
 
 static inline void inotify_inode_queue_event(struct inode *inode,
 					     __u32 mask, __u32 cookie,
-					     const char *filename)
+					     const char *filename,
+					     struct inode *a_inode)
 {
 }
 
@@ -117,6 +165,64 @@ static inline u32 inotify_get_cookie(voi
 	return 0;
 }
 
+static inline struct inotify_handle *
+inotify_init(const struct inotify_operations *ops)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void inotify_init_watch(struct inotify_watch *watch)
+{
+}
+
+static inline void inotify_destroy(struct inotify_handle *ih)
+{
+}
+
+static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode,
+				       struct inotify_watch **watchp)
+{
+	return -EOPNOTSUPP;
+}
+
+
+static inline __s32 inotify_find_update_watch(struct inotify_handle *ih,
+					      struct inode *inode, u32 mask)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline __s32 inotify_add_watch(struct inotify_handle *ih,
+				      struct inotify_watch *watch,
+				      struct inode *inode, __u32 mask)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int inotify_rm_watch(struct inotify_handle *ih,
+				   struct inotify_watch *watch)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
+					       struct inotify_watch *watch)
+{
+}
+
+static inline void get_inotify_watch(struct inotify_watch *watch)
+{
+}
+
+static inline void put_inotify_watch(struct inotify_watch *watch)
+{
+}
+
 #endif	/* CONFIG_INOTIFY */
 
 #endif	/* __KERNEL __ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 29b7d4f..864e5a7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -494,7 +494,7 @@ struct user_struct {
 	atomic_t processes;	/* How many processes does this user have? */
 	atomic_t files;		/* How many open files does this user have? */
 	atomic_t sigpending;	/* How many pending signals does this user have? */
-#ifdef CONFIG_INOTIFY
+#ifdef CONFIG_INOTIFY_USER
 	atomic_t inotify_watches; /* How many inotify watches does this user have? */
 	atomic_t inotify_devs;	/* How many inotify devs does this user have opened? */
 #endif
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e82726f..0d656e6 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -150,7 +150,7 @@ extern ctl_table random_table[];
 #ifdef CONFIG_UNIX98_PTYS
 extern ctl_table pty_table[];
 #endif
-#ifdef CONFIG_INOTIFY
+#ifdef CONFIG_INOTIFY_USER
 extern ctl_table inotify_table[];
 #endif
 
@@ -1028,7 +1028,7 @@ #ifdef CONFIG_MMU
 		.mode		= 0644,
 		.proc_handler	= &proc_doulongvec_minmax,
 	},
-#ifdef CONFIG_INOTIFY
+#ifdef CONFIG_INOTIFY_USER
 	{
 		.ctl_name	= FS_INOTIFY,
 		.procname	= "inotify",
diff --git a/kernel/user.c b/kernel/user.c
index 2116642..4b1eb74 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -140,7 +140,7 @@ struct user_struct * alloc_uid(uid_t uid
 		atomic_set(&new->processes, 0);
 		atomic_set(&new->files, 0);
 		atomic_set(&new->sigpending, 0);
-#ifdef CONFIG_INOTIFY
+#ifdef CONFIG_INOTIFY_USER
 		atomic_set(&new->inotify_watches, 0);
 		atomic_set(&new->inotify_devs, 0);
 #endif


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2212.2.5
retrieving revision 1.2212.2.6
diff -u -r1.2212.2.5 -r1.2212.2.6
--- kernel-2.6.spec	31 May 2006 13:33:30 -0000	1.2212.2.5
+++ kernel-2.6.spec	31 May 2006 15:53:23 -0000	1.2212.2.6
@@ -405,8 +405,8 @@
 
 # Audit & lspp patches
 Patch20100: linux-2.6-audit-git.patch
-Patch20101: linux-2.6-audit-pending.patch
-Patch20102: null-dereference-in-fs-audit.patch
+Patch20101: linux-2.6-audit-merged.patch
+Patch20102: linux-2.6-audit-pending.patch
 Patch20103: linux-2.6-net-label.patch
 
 

linux-2.6-audit-pending.patch:
 Documentation/filesystems/inotify.txt |  130 +++++
 include/linux/audit.h                 |   47 ++
 init/Kconfig                          |    3 
 ipc/mqueue.c                          |   22 
 kernel/audit.c                        |   39 +
 kernel/audit.h                        |   33 +
 kernel/auditfilter.c                  |  765 ++++++++++++++++++++++++++++++++--
 kernel/auditsc.c                      |  391 +++++++++++++++--
 8 files changed, 1335 insertions(+), 95 deletions(-)

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.1.14.2 -r 1.1.14.3 linux-2.6-audit-pending.patch
Index: linux-2.6-audit-pending.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/Attic/linux-2.6-audit-pending.patch,v
retrieving revision 1.1.14.2
retrieving revision 1.1.14.3
diff -u -r1.1.14.2 -r1.1.14.3
--- linux-2.6-audit-pending.patch	25 May 2006 22:00:23 -0000	1.1.14.2
+++ linux-2.6-audit-pending.patch	31 May 2006 15:53:23 -0000	1.1.14.3
@@ -152,2040 +152,6 @@
     interfaces.  The only real difference was whether we wanted to use open(2)
     and ioctl(2) or a couple of new system calls.  System calls beat ioctls.
  
-diff --git a/fs/Kconfig b/fs/Kconfig
-index f9b5842..74f11a2 100644
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -393,18 +393,30 @@ config INOTIFY
- 	bool "Inotify file change notification support"
- 	default y
- 	---help---
--	  Say Y here to enable inotify support and the associated system
--	  calls.  Inotify is a file change notification system and a
--	  replacement for dnotify.  Inotify fixes numerous shortcomings in
--	  dnotify and introduces several new features.  It allows monitoring
--	  of both files and directories via a single open fd.  Other features
--	  include multiple file events, one-shot support, and unmount
-+	  Say Y here to enable inotify support.  Inotify is a file change
-+	  notification system and a replacement for dnotify.  Inotify fixes
-+	  numerous shortcomings in dnotify and introduces several new features
-+	  including multiple file events, one-shot support, and unmount
- 	  notification.
- 
- 	  For more information, see Documentation/filesystems/inotify.txt
- 
- 	  If unsure, say Y.
- 
-+config INOTIFY_USER
-+	bool "Inotify support for userspace"
-+	depends on INOTIFY
-+	default y
-+	---help---
-+	  Say Y here to enable inotify support for userspace, including the
-+	  associated system calls.  Inotify allows monitoring of both files and
-+	  directories via a single open fd.  Events are read from the file
-+	  descriptor, which is also select()- and poll()-able.
-+
-+	  For more information, see Documentation/filesystems/inotify.txt
-+
-+	  If unsure, say Y.
-+
- config QUOTA
- 	bool "Quota support"
- 	help
-diff --git a/fs/Makefile b/fs/Makefile
-index 078d3d1..d0ea6bf 100644
---- a/fs/Makefile
-+++ b/fs/Makefile
-@@ -13,6 +13,7 @@ obj-y :=	open.o read_write.o file_table.
- 		ioprio.o pnode.o drop_caches.o splice.o sync.o
- 
- obj-$(CONFIG_INOTIFY)		+= inotify.o
-+obj-$(CONFIG_INOTIFY_USER)	+= inotify_user.o
- obj-$(CONFIG_EPOLL)		+= eventpoll.o
- obj-$(CONFIG_COMPAT)		+= compat.o compat_ioctl.o
- 
-diff --git a/fs/inotify.c b/fs/inotify.c
-index 732ec4b..16d65ba 100644
---- a/fs/inotify.c
-+++ b/fs/inotify.c
-@@ -5,7 +5,10 @@
-  *	John McCutchan	<ttb at tentacle.dhs.org>
-  *	Robert Love	<rml at novell.com>
-  *
-+ * Kernel API added by: Amy Griffis <amy.griffis at hp.com>
-+ *
-  * Copyright (C) 2005 John McCutchan
-+ * Copyright 2006 Hewlett-Packard Development Company, L.P.
-  *
-  * This program is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU General Public License as published by the
-@@ -20,35 +23,17 @@
- 
- #include <linux/module.h>
- #include <linux/kernel.h>
--#include <linux/sched.h>
- #include <linux/spinlock.h>
- #include <linux/idr.h>
- #include <linux/slab.h>
- #include <linux/fs.h>
--#include <linux/file.h>
--#include <linux/mount.h>
--#include <linux/namei.h>
--#include <linux/poll.h>
- #include <linux/init.h>
- #include <linux/list.h>
- #include <linux/writeback.h>
- #include <linux/inotify.h>
--#include <linux/syscalls.h>
--
--#include <asm/ioctls.h>
- 
- static atomic_t inotify_cookie;
- 
--static kmem_cache_t *watch_cachep __read_mostly;
--static kmem_cache_t *event_cachep __read_mostly;
--
--static struct vfsmount *inotify_mnt __read_mostly;
--
--/* these are configurable via /proc/sys/fs/inotify/ */
--int inotify_max_user_instances __read_mostly;
--int inotify_max_user_watches __read_mostly;
--int inotify_max_queued_events __read_mostly;
--
- /*
-  * Lock ordering:
-  *
-@@ -56,327 +41,108 @@ int inotify_max_queued_events __read_mos
-  * iprune_mutex (synchronize shrink_icache_memory())
-  * 	inode_lock (protects the super_block->s_inodes list)
-  * 	inode->inotify_mutex (protects inode->inotify_watches and watches->i_list)
-- * 		inotify_dev->mutex (protects inotify_device and watches->d_list)
-+ * 		inotify_handle->mutex (protects inotify_handle and watches->h_list)
-+ *
-+ * The inode->inotify_mutex and inotify_handle->mutex and held during execution
-+ * of a caller's event handler.  Thus, the caller must not hold any locks
-+ * taken in their event handler while calling any of the published inotify
-+ * interfaces.
-  */
- 
- /*
-- * Lifetimes of the three main data structures--inotify_device, inode, and
-+ * Lifetimes of the three main data structures--inotify_handle, inode, and
-  * inotify_watch--are managed by reference count.
-  *
-- * inotify_device: Lifetime is from inotify_init() until release.  Additional
-- * references can bump the count via get_inotify_dev() and drop the count via
-- * put_inotify_dev().
-+ * inotify_handle: Lifetime is from inotify_init() to inotify_destroy().
-+ * Additional references can bump the count via get_inotify_handle() and drop
-+ * the count via put_inotify_handle().
-  *
-- * inotify_watch: Lifetime is from create_watch() to destory_watch().
-- * Additional references can bump the count via get_inotify_watch() and drop
-- * the count via put_inotify_watch().
-+ * inotify_watch: for inotify's purposes, lifetime is from inotify_add_watch()
-+ * to remove_watch_no_event().  Additional references can bump the count via
-+ * get_inotify_watch() and drop the count via put_inotify_watch().  The caller
-+ * is reponsible for the final put after receiving IN_IGNORED, or when using
-+ * IN_ONESHOT after receiving the first event.  Inotify does the final put when
-+ * the caller calls inotify_destroy().
-  *
-  * inode: Pinned so long as the inode is associated with a watch, from
-- * create_watch() to put_inotify_watch().
-+ * inotify_add_watch() to the final put_inotify_watch().
-  */
- 
- /*
-- * struct inotify_device - represents an inotify instance
-+ * struct inotify_handle - represents an inotify instance
-  *
-  * This structure is protected by the mutex 'mutex'.
-  */
--struct inotify_device {
--	wait_queue_head_t 	wq;		/* wait queue for i/o */
-+struct inotify_handle {
- 	struct idr		idr;		/* idr mapping wd -> watch */
- 	struct mutex		mutex;		/* protects this bad boy */
--	struct list_head 	events;		/* list of queued events */
- 	struct list_head	watches;	/* list of watches */
- 	atomic_t		count;		/* reference count */
--	struct user_struct	*user;		/* user who opened this dev */
--	unsigned int		queue_size;	/* size of the queue (bytes) */
--	unsigned int		event_count;	/* number of pending events */
--	unsigned int		max_events;	/* maximum number of events */
- 	u32			last_wd;	/* the last wd allocated */
-+	const struct inotify_operations *in_ops; /* inotify caller operations */
- };
- 
--/*
-- * struct inotify_kernel_event - An inotify event, originating from a watch and
-- * queued for user-space.  A list of these is attached to each instance of the
-- * device.  In read(), this list is walked and all events that can fit in the
-- * buffer are returned.
-- *
-- * Protected by dev->mutex of the device in which we are queued.
-- */
--struct inotify_kernel_event {
--	struct inotify_event	event;	/* the user-space event */
--	struct list_head        list;	/* entry in inotify_device's list */
--	char			*name;	/* filename, if any */
--};
--
--/*
-- * struct inotify_watch - represents a watch request on a specific inode
-- *
-- * d_list is protected by dev->mutex of the associated watch->dev.
-- * i_list and mask are protected by inode->inotify_mutex of the associated inode.
-- * dev, inode, and wd are never written to once the watch is created.
-- */
--struct inotify_watch {
[...1971 lines suppressed...]
-+#define IN_MASK_ADD		0x20000000	/* add to the mask of an alreadyexisting watch */
- #define IN_ISDIR		0x40000000	/* event occurred against dir */
- #define IN_ONESHOT		0x80000000	/* only send event once */
- 
-@@ -69,18 +69,65 @@ #include <linux/dcache.h>
- #include <linux/fs.h>
- #include <linux/config.h>
- 
-+/*
-+ * struct inotify_watch - represents a watch request on a specific inode
-+ *
-+ * h_list is protected by ih->mutex of the associated inotify_handle.
-+ * i_list, mask are protected by inode->inotify_mutex of the associated inode.
-+ * ih, inode, and wd are never written to once the watch is created.
-+ *
-+ * Callers must use the established inotify interfaces to access inotify_watch
-+ * contents.  The content of this structure is private to the inotify
-+ * implementation.
-+ */
-+struct inotify_watch {
-+	struct list_head	h_list;	/* entry in inotify_handle's list */
-+	struct list_head	i_list;	/* entry in inode's list */
-+	atomic_t		count;	/* reference count */
-+	struct inotify_handle	*ih;	/* associated inotify handle */
-+	struct inode		*inode;	/* associated inode */
-+	__s32			wd;	/* watch descriptor */
-+	__u32			mask;	/* event mask for this watch */
-+};
-+
-+struct inotify_operations {
-+	void (*handle_event)(struct inotify_watch *, u32, u32, u32,
-+			     const char *, struct inode *);
-+	void (*destroy_watch)(struct inotify_watch *);
-+};
-+
- #ifdef CONFIG_INOTIFY
- 
-+/* Kernel API for producing events */
-+
- extern void inotify_d_instantiate(struct dentry *, struct inode *);
- extern void inotify_d_move(struct dentry *);
- extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
--				      const char *);
-+				      const char *, struct inode *);
- extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
- 					      const char *);
- extern void inotify_unmount_inodes(struct list_head *);
- extern void inotify_inode_is_dead(struct inode *);
- extern u32 inotify_get_cookie(void);
- 
-+/* Kernel Consumer API */
-+
-+extern struct inotify_handle *inotify_init(const struct inotify_operations *);
-+extern void inotify_init_watch(struct inotify_watch *);
-+extern void inotify_destroy(struct inotify_handle *);
-+extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *,
-+				struct inotify_watch **);
-+extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *,
-+				       u32);
-+extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
-+			       struct inode *, __u32);
-+extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
-+extern int inotify_rm_wd(struct inotify_handle *, __u32);
-+extern void inotify_remove_watch_locked(struct inotify_handle *,
-+					struct inotify_watch *);
-+extern void get_inotify_watch(struct inotify_watch *);
-+extern void put_inotify_watch(struct inotify_watch *);
-+
- #else
- 
- static inline void inotify_d_instantiate(struct dentry *dentry,
-@@ -94,7 +141,8 @@ static inline void inotify_d_move(struct
- 
- static inline void inotify_inode_queue_event(struct inode *inode,
- 					     __u32 mask, __u32 cookie,
--					     const char *filename)
-+					     const char *filename,
-+					     struct inode *a_inode)
- {
- }
- 
-@@ -117,6 +165,63 @@ static inline u32 inotify_get_cookie(voi
- 	return 0;
- }
- 
-+static inline struct inotify_handle *inotify_init(const struct inotify_operations *)
-+{
-+	return ERR_PTR(-EOPNOTSUPP);
-+}
-+
-+static inline void inotify_init_watch(struct inotify_watch *watch)
-+{
-+}
-+
-+static inline void inotify_destroy(struct inotify_handle *ih)
-+{
-+}
-+
-+static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode,
-+				       struct inotify_watch **watchp)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+
-+static inline __s32 inotify_find_update_watch(struct inotify_handle *ih,
-+					      struct inode *inode, u32 mask)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+static inline __s32 inotify_add_watch(struct inotify_handle *ih,
-+				      struct inotify_watch *watch,
-+				      struct inode *inode, __u32 mask)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+static inline int inotify_rm_watch(struct inotify_handle *ih,
-+				   struct inotify_watch *watch)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
-+					       struct inotify_watch *watch)
-+{
-+}
-+
-+static inline void get_inotify_watch(struct inotify_watch *watch)
-+{
-+}
-+
-+static inline void put_inotify_watch(struct inotify_watch *watch)
-+{
-+}
-+
- #endif	/* CONFIG_INOTIFY */
- 
- #endif	/* __KERNEL __ */
-diff --git a/include/linux/sched.h b/include/linux/sched.h
-index 29b7d4f..864e5a7 100644
---- a/include/linux/sched.h
-+++ b/include/linux/sched.h
-@@ -494,7 +494,7 @@ struct user_struct {
- 	atomic_t processes;	/* How many processes does this user have? */
- 	atomic_t files;		/* How many open files does this user have? */
- 	atomic_t sigpending;	/* How many pending signals does this user have? */
--#ifdef CONFIG_INOTIFY
-+#ifdef CONFIG_INOTIFY_USER
- 	atomic_t inotify_watches; /* How many inotify watches does this user have? */
- 	atomic_t inotify_devs;	/* How many inotify devs does this user have opened? */
- #endif
 diff --git a/init/Kconfig b/init/Kconfig
 index 3b36a1d..c4d0fa6 100644
 --- a/init/Kconfig
@@ -4326,38 +2016,3 @@
   * audit_ipc_obj - record audit data for ipc object
   * @ipcp: ipc permissions
   *
-diff --git a/kernel/sysctl.c b/kernel/sysctl.c
-index e82726f..0d656e6 100644
---- a/kernel/sysctl.c
-+++ b/kernel/sysctl.c
-@@ -150,7 +150,7 @@ extern ctl_table random_table[];
- #ifdef CONFIG_UNIX98_PTYS
- extern ctl_table pty_table[];
- #endif
--#ifdef CONFIG_INOTIFY
-+#ifdef CONFIG_INOTIFY_USER
- extern ctl_table inotify_table[];
- #endif
- 
-@@ -1028,7 +1028,7 @@ #ifdef CONFIG_MMU
- 		.mode		= 0644,
- 		.proc_handler	= &proc_doulongvec_minmax,
- 	},
--#ifdef CONFIG_INOTIFY
-+#ifdef CONFIG_INOTIFY_USER
- 	{
- 		.ctl_name	= FS_INOTIFY,
- 		.procname	= "inotify",
-diff --git a/kernel/user.c b/kernel/user.c
-index 2116642..4b1eb74 100644
---- a/kernel/user.c
-+++ b/kernel/user.c
-@@ -140,7 +140,7 @@ struct user_struct * alloc_uid(uid_t uid
- 		atomic_set(&new->processes, 0);
- 		atomic_set(&new->files, 0);
- 		atomic_set(&new->sigpending, 0);
--#ifdef CONFIG_INOTIFY
-+#ifdef CONFIG_INOTIFY_USER
- 		atomic_set(&new->inotify_watches, 0);
- 		atomic_set(&new->inotify_devs, 0);
- #endif




More information about the fedora-cvs-commits mailing list