inotify for 2.6.11
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · Robert Love
Quoted 1 line · Christoph Hellwig
The user interface is still bogus.
I presume you are talking about the ioctl. I have tried to engage you and others on what exactly you prefer instead. I have said that moving to a write interface is fine but I don't see how ut is _any_ better than the ioctl. Write is less typed, in fact, since we lose the command versus argument delineation.
Quoted 7 lines
Quoted 2 lines
But if it is a anonymous decision, I'll switch it. Or take patches. ;-) It isn't a big deal.
See the review I sent. Write is exactly the right interface for that kind of thing. For comment vs argument either put the number first so we don't have the problem of finding a delinator that isn't a valid filename, or use '\0' as such.
That's just putrid. You've proposed an interface that combines the worst of ASCII with the worst of binary.
It is now well-established that ASCII interfaces are horribly slow. This one will be no exception... but with the '\0' in there, you have a binary interface. So, it's an evil hybrid.
An ioctl() is a syscall with scope restricting it to a single fd. This is a fine user interface, not a bogus one. (keep 32-on-64 operation in mind to be polite)
If you'd rather have a normal (global) system call though, that'll do too, likely leading to a bit more type checking in the glibc-provided headers.
Adding plain old syscalls is rather nice actually. It's only a pain at first, while waiting for glibc to catch up.
Quoted 8 lines · Albert Cahalan
Quoted 4 lines · Christoph Hellwig
See the review I sent. Write is exactly the right interface for that kind of thing. For comment vs argument either put the number first so we don't have the problem of finding a delinator that isn't a valid filename, or use '\0' as such.
That's just putrid. You've proposed an interface that combines the worst of ASCII with the worst of binary.
I guess it's possible to avoid the need for passing the command at all. The read data already has a format that mixes binary and variable-length ascii data, so write could use a data structure similar (or even identical) to the one used there, e.g.
struct inotify_watch_request {
__u32 mask; /* watch mask */
__u32 len; /* length (including nulls) of name */ char name[0]; /* stub for name */
};
This can replace both INOTIFY_WATCH and INOTIFY_IGNORE, if you simply define a zero mask as a special value for ignore. FIONREAD is a well-established interface, so I don't think it's necessary to replace this.
Quoted 3 lines
Adding plain old syscalls is rather nice actually. It's only a pain at first, while waiting for glibc to catch up.
Yes, that might be a workable interface as well, but don't mix syscalls with a misc device then. Instead, you might build on something like futexfs, with syscalls replacing both ioctl and read:
int inotify_open(int flags);
int inotify_watch(int fd, unsigned mask, char *name);
int inotify_ignore(int fd, int wd);
int inotify_getevents(int fd, int max_events, struct inotify_event *);
Arnd <><