From: Chris Wedgwood <cw@f00f.org>
To: John McCutchan <ttb@tentacle.dhs.org>
Cc: linux-kernel@vger.kernel.org, nautilus-list@gnome.org
Subject: Re: [RFC/PATCH] inotify -- a dnotify replacement
Date: Sun, 9 May 2004 19:11:42 -0700 [thread overview]
Message-ID: <20040510021141.GA10760@taniwha.stupidest.org> (raw)
In-Reply-To: <1084152941.22837.21.camel@vertex>
On Sun, May 09, 2004 at 09:35:41PM -0400, John McCutchan wrote:
> The two biggest complaints people have about dnotify are
>
> 1) dnotify delivers events using signals.
is that really a problem?
>
> 2) dnotify needs a file to be kept open on the device, causing
> problems during unmount.
i never thought of that... what about
3) dnotify cannot easily watch changes for a directory hierarchy
> @@ -127,6 +128,7 @@
> return dn_mask;
> }
>
> +
> int notify_change(struct dentry * dentry, struct iattr * attr)
> {
> struct inode *inode = dentry->d_inode;
plz don't add unnecessary whitespace
> diff -ru clean/linux-2.6.5/fs/inode.c linux-2.6.5/fs/inode.c
> +++ linux-2.6.5/fs/inode.c 2004-05-09 21:10:12.000000000 -0400
> @@ -151,6 +151,10 @@
> mapping->backing_dev_info = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
> memset(&inode->u, 0, sizeof(inode->u));
> inode->i_mapping = mapping;
> +
> + INIT_LIST_HEAD(&inode->watchers);
> + atomic_set (&inode->watcher_count, 0);
^
whitespace after if/for/while but not functions:
if (..)
func(...)
> +#define INOTIFY_MINOR 99
there is a registry for these, i think you can use -1 (to get one
dynamically allocated) if you've not been assigned one
> #define MAX_WATCHER_COUNT 8 /* We only support 8 watchers */
seems like this could be a problem for gui stuff
> #define MAX_WATCH_COUNT 128 /* A watcher can only be watching 128 inodes */
likewise
> static int watcher_count = 0;
global variables don't need explicitly initialized to zero and in fact
this will make the kernel larger when using older gcc versions
> /* A list of these structures is attached to each inode that is being watched.
> * * each item in the list represents a unique watcher.
> * * it tell us what events we are looking at and who is watching the inode.
> * */
heh, odd comment style
> struct inotify_event {
> struct list_head list;
> unsigned long i_no;
> unsigned long i_dev;
> unsigned long mask;
> };
i'm not so sure using unsigned long is a good idea here, it's size
varies depending on arch (also consider 32-bit code on 64-bit
platforms)
we might also have a 64-bit ino_t on i386 some day? (what a revolting
idea but we have PAE, etc. so it's possible)
> if (watcher->private_data == dev)
> {
> return watcher;
> }
minor nit:
if (...)
return ...;
> if (NULL != watcher) {
i really hate that, what is wrong with
if (watcher)
> list_for_each_entry (watch, dev->watch, list)
list_for_each_entry (...) {
> static char inotify_dev_has_events (struct inotify_device *dev)
> {
> return dev->events && !list_empty(dev->events);
> }
why does this need to be a separate function?
> static int __init inotify_init (void)
> {
> int ret;
>
> ret = misc_register (&inotify_device);
>
> if (ret) {
> goto out;
> }
>
> ret = 0;
if we got here, ret must be 0
--cw
next prev parent reply other threads:[~2004-05-10 2:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-10 1:35 [RFC/PATCH] inotify -- a dnotify replacement John McCutchan
2004-05-10 2:11 ` Chris Wedgwood [this message]
2004-05-10 22:17 ` John McCutchan
2004-05-10 22:31 ` Davide Libenzi
2004-05-10 22:41 ` John McCutchan
2004-05-10 22:52 ` Davide Libenzi
2004-05-10 23:10 ` Valdis.Kletnieks
2004-05-10 23:42 ` Davide Libenzi
2004-05-11 4:11 ` Chris Wedgwood
2004-05-11 2:00 ` Ian Kent
2004-05-11 2:47 ` Chris Wedgwood
2004-05-11 11:52 ` nf
2004-05-11 12:17 ` Stephen Rothwell
2004-05-11 12:24 ` John McCutchan
[not found] ` <1084278605.3839.47.camel@carados.180sw.com>
[not found] ` <1084885604.4062.48.camel@lilota.lamp.priv>
[not found] ` <1085127066.20393.440.camel@localhost.localdomain>
2004-05-21 12:04 ` nf
2004-05-11 12:20 ` John McCutchan
2004-05-11 12:46 ` viro
2004-05-11 19:02 ` John McCutchan
2004-05-11 20:28 ` carbonated beverage
2004-05-11 21:28 ` John McCutchan
2004-05-11 15:02 ` Alexander Larsson
2004-05-11 21:41 ` Chris Wedgwood
2004-05-12 12:38 ` Jörn Engel
2004-05-13 15:36 ` raven
2004-05-13 19:04 ` Chris Wedgwood
2004-05-14 7:04 ` Ian Kent
2004-05-13 21:24 ` John McCutchan
2004-05-14 2:02 ` Ian Kent
2004-05-15 4:52 ` raven
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=20040510021141.GA10760@taniwha.stupidest.org \
--to=cw@f00f.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nautilus-list@gnome.org \
--cc=ttb@tentacle.dhs.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.