public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@novell.com>
To: John McCutchan <ttb@tentacle.dhs.org>
Cc: linux-kernel@vger.kernel.org, viro@parcelfarce.linux.theplanet.co.uk
Subject: Re: [RFC][PATCH] inotify 0.9.2
Date: Tue, 21 Sep 2004 01:21:31 -0400	[thread overview]
Message-ID: <1095744091.2454.56.camel@localhost> (raw)
In-Reply-To: <1095652572.23128.2.camel@vertex>

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

On Sun, 2004-09-19 at 23:56 -0400, John McCutchan wrote:

> I would appreciate design review, code review and testing.

Hey, John!

Attached patch, against inotify 0.9.2, cleans up the inotify.h header
file a bit.  The patch is a little noisy because I reformat some lines
for readability or coding style concerns, but there are a few important
changes:

	- Use PATH_MAX, the actual maximum path length, not 256, for the
	  size of "filename" in "struct inotify_event"

	- Separate with __KERNEL__ the kernel from the user API

	- Instead of forward declaring the inode, superblock, and
	  dentry structures, include the appropriate header file

Thanks!

	Robert Love


[-- Attachment #2: inotify-cleanup-header-rml-1.patch --]
[-- Type: text/x-patch, Size: 4390 bytes --]

Clean up the inotify header

Signed-Off-By: Robert Love <rml@novell.com>

 include/linux/inotify.h |   79 +++++++++++++++++++++++++++++-------------------
 1 files changed, 48 insertions(+), 31 deletions(-)

--- linux-inotify/include/linux/inotify.h	2004-09-21 00:58:03.920388608 -0400
+++ linux/include/linux/inotify.h	2004-09-21 01:15:05.831034576 -0400
@@ -9,66 +9,83 @@
 #ifndef _LINUX_INOTIFY_H
 #define _LINUX_INOTIFY_H
 
-struct inode;
-struct dentry;
-struct super_block;
+#include <linux/limits.h>
 
+/*
+ * struct inotify_event - structure read from the inotify device for each event
+ *
+ * When you are watching a directory, you will receive the filename for events
+ * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, and so on ...
+ *
+ * Note: When reading from the device you must provide a buffer that is a
+ * multiple of sizeof(struct inotify_event)
+ */
 struct inotify_event {
 	int wd;
 	int mask;
-	char filename[256];
-	/* When you are watching a directory you will get the filenames
-	 * for events like IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, etc.. 
-	 */
+	char filename[PATH_MAX];
 };
-/* When reading from the device you must provide a buffer 
- * that is a multiple of the sizeof(inotify_event)
- */
 
+/* the following are legal, implemented events */
 #define IN_ACCESS	0x00000001	/* File was accessed */
 #define IN_MODIFY	0x00000002	/* File was modified */
 #define IN_CREATE	0x00000004	/* File was created */
 #define IN_DELETE	0x00000008	/* File was deleted */
 #define IN_RENAME	0x00000010	/* File was renamed */
-#define IN_ATTRIB	0x00000020	/* File changed attributes */
-#define IN_MOVE		0x00000040	/* File was moved */
-#define IN_UNMOUNT	0x00000080	/* Device file was on, was unmounted */
+#define IN_UNMOUNT	0x00000080	/* Backing filesystem was unmounted */
 #define IN_CLOSE	0x00000100	/* File was closed */
 #define IN_OPEN		0x00000200	/* File was opened */
+
+/* the following are legal, but not yet implemented, events */
+#define IN_ATTRIB	0x00000020	/* File changed attributes */
+#define IN_MOVE		0x00000040	/* File was moved */
+
+/* special flags */
 #define IN_IGNORED	0x00000400	/* File was ignored */
 #define IN_ALL_EVENTS	0xffffffff	/* All the events */
 
-/* ioctl */
-
-/* Fill this and pass it to INOTIFY_WATCH ioctl */
+/*
+ * struct inotify_watch_request - represents a watch request
+ *
+ * Pass to the inotify device via the INOTIFY_WATCH ioctl
+ */
 struct inotify_watch_request {
-	char *dirname; // directory name
-	unsigned long mask; // event mask
+	char *dirname;		/* directory name */
+	unsigned long mask;	/* event mask */
 };
 
-#define INOTIFY_IOCTL_MAGIC 'Q'
-#define INOTIFY_IOCTL_MAXNR 4
+#define INOTIFY_IOCTL_MAGIC	'Q'
+#define INOTIFY_IOCTL_MAXNR	4
 
 #define INOTIFY_WATCH  		_IOR(INOTIFY_IOCTL_MAGIC, 1, struct inotify_watch_request)
 #define INOTIFY_IGNORE 		_IOR(INOTIFY_IOCTL_MAGIC, 2, int)
 #define INOTIFY_STATS		_IOR(INOTIFY_IOCTL_MAGIC, 3, int)
 #define INOTIFY_SETDEBUG	_IOR(INOTIFY_IOCTL_MAGIC, 4, int)
 
-#define INOTIFY_DEBUG_NONE   0x00000000
-#define INOTIFY_DEBUG_ALLOC  0x00000001
-#define INOTIFY_DEBUG_EVENTS 0x00000002
-#define INOTIFY_DEBUG_INODE  0x00000004
-#define INOTIFY_DEBUG_ERRORS 0x00000008
-#define INOTIFY_DEBUG_FILEN  0x00000010
-#define INOTIFY_DEBUG_ALL    0xffffffff
+#define INOTIFY_DEBUG_NONE	0x00000000
+#define INOTIFY_DEBUG_ALLOC	0x00000001
+#define INOTIFY_DEBUG_EVENTS	0x00000002
+#define INOTIFY_DEBUG_INODE	0x00000004
+#define INOTIFY_DEBUG_ERRORS	0x00000008
+#define INOTIFY_DEBUG_FILEN	0x00000010
+#define INOTIFY_DEBUG_ALL	0xffffffff
+
+#ifdef __KERNEL__
+
+#include <linux/dcache.h>
+#include <linux/fs.h>
 
-/* Kernel API */
 /* Adds events to all watchers on inode that are interested in mask */
-void inotify_inode_queue_event (struct inode *inode, unsigned long mask, const char *filename);
+void inotify_inode_queue_event (struct inode *inode, unsigned long mask,
+		const char *filename);
+
 /* Same as above but uses dentry's inode */
-void inotify_dentry_parent_queue_event (struct dentry *dentry, unsigned long mask, const char *filename);
+void inotify_dentry_parent_queue_event (struct dentry *dentry,
+		unsigned long mask, const char *filename);
+
 /* This will remove all watchers from all inodes on the superblock */
 void inotify_super_block_umount (struct super_block *sb);
 
-#endif
+#endif	/* __KERNEL __ */
 
+#endif	/* _LINUX_INOTIFY_H */

  parent reply	other threads:[~2004-09-21  5:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-20  3:56 [RFC][PATCH] inotify 0.9.2 John McCutchan
2004-09-20 21:52 ` Robert Love
2004-09-21  5:21 ` Robert Love [this message]
2004-09-21 15:34   ` Edgar Toernig
2004-09-21 15:43     ` Chris Friesen
2004-09-22  2:27       ` John McCutchan
2004-09-23  1:46         ` Ray Lee
2004-09-23  3:42           ` John McCutchan
2004-09-23  4:52             ` Ray Lee
2004-09-23  5:10               ` Robert Love
2004-09-23  5:29                 ` Ray Lee
2004-09-21 15:46     ` Robert Love
2004-09-21  5:26 ` Robert Love
2004-09-21  5:44 ` Robert Love
2004-09-21 16:04 ` Robert Love
2004-09-21 18:56   ` Robert Love
2004-09-21 20:55     ` Robert Love
2004-09-22  2:32     ` John McCutchan
2004-09-22  3:49       ` Robert Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1095744091.2454.56.camel@localhost \
    --to=rml@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ttb@tentacle.dhs.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox