updated inotify kernels
- From: Robert Love <rml novell com>
- To: dashboard-hackers gnome org
- Subject: updated inotify kernels
- Date: Tue, 28 Sep 2004 12:12:48 -0400
Updated inotify kernels (727.inotify.0) are available.
SMP:
http://primates.ximian.com/~rml/kernel-rml/nld-9-i586/kernel-smp-2.6.5-727.inotify.0.i586.rpm
UP:
http://primates.ximian.com/~rml/kernel-rml/nld-9-i586/kernel-default-2.6.5-727.inotify.0.i586.rpm
These are based on a CVS snapshot from 20040928 SLES9-GA kernel. It
will work on SUSE 9.1, SLES9, and a forthcoming desktop product.
NOTE: WE BROKE THE ABI AND THE API. PLEASE READ BELOW.
There are a lot of changes in this inotify: bug fixes, cleanup,
enhancements, modularization, new flags, queue overflow management, and
so on.
IN_CREATE was removed and replaced by IN_CREATE_SUBDIR and
IN_CREATE_FILE, which do the obvious: Show whether the created object
was a directory or a file.
IN_DELETE was similarly replaced by IN_DELETE_SUBDIR and IN_DELETE_FILE.
IN_DELEITE_SELF was also added, which signifies that the object being
watched itself was deleted.
IN_REPLACE and IN_MOVE were removed. Both were replaced by
IN_MOVED_FROM and IN_MOVED_TO. The filename associated with
IN_MOVED_FROM tells you were the file moved from; the filename
associated with IN_MOVED_TO gives you were the file moved to. Look at
these are more intelligent versions of IN_DELETE and IN_CREATE. We are
looking at ways to link these two together or make them one event.
The signal IN_Q_OVERFLOW was added. It is sent whenever the buffer
queue in the kernel is filled. This lets user-space respond to possible
missed events.
The maximum size of a filename returned inside of inotify_event is
INOTIFY_FILENAME_MAX, which is currently 256. I think we are going to
make this dynamic in the future.
IN_IGNORED should be sent when a file is removed from a watch, e.g. when
you delete it.
The other events (ACCESS, MODIFY, ATTRIB, CLOSE, OPEN, UNMOUNT) are
unchanged, work, and should be self-explanatory.
Please see inotify.h for the exact changes.
Thanks,
Robert Love
/*
* Inode based directory notification for Linux
*
* Copyright (C) 2004 John McCutchan
*/
#ifndef _LINUX_INOTIFY_H
#define _LINUX_INOTIFY_H
#include <linux/limits.h>
/* this size could limit things, since technically we could need PATH_MAX */
#define INOTIFY_FILENAME_MAX 256
/*
* 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, ...
*
* 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;
int cookie;
char filename[INOTIFY_FILENAME_MAX];
};
/* the following are legal, implemented events */
#define IN_ACCESS 0x00000001 /* File was accessed */
#define IN_MODIFY 0x00000002 /* File was modified */
#define IN_ATTRIB 0x00000004 /* File changed attributes */
#define IN_CLOSE 0x00000008 /* File was closed */
#define IN_OPEN 0x00000010 /* File was opened */
#define IN_MOVED_FROM 0x00000020 /* File was moved from X */
#define IN_MOVED_TO 0x00000040 /* File was moved to Y */
#define IN_DELETE_SUBDIR 0x00000080 /* Subdir was deleted */
#define IN_DELETE_FILE 0x00000100 /* Subfile was deleted */
#define IN_CREATE_SUBDIR 0x00000200 /* Subdir was created */
#define IN_CREATE_FILE 0x00000400 /* Subfile was created */
#define IN_DELETE_SELF 0x00000800 /* Self was deleted */
#define IN_UNMOUNT 0x00001000 /* Backing fs was unmounted */
#define IN_Q_OVERFLOW 0x00002000 /* Event queued overflowed */
#define IN_IGNORED 0x00004000 /* File was ignored */
/* special flags */
#define IN_ALL_EVENTS 0xffffffff /* All the events */
/*
* 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 */
};
#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
#ifdef __KERNEL__
#include <linux/dcache.h>
#include <linux/fs.h>
#include <linux/config.h>
#ifdef CONFIG_INOTIFY
extern void inotify_inode_queue_event(struct inode *, unsigned long,
const char *);
extern void inotify_dentry_parent_queue_event(struct dentry *, unsigned long,
const char *);
extern void inotify_super_block_umount(struct super_block *);
extern void inotify_inode_is_dead(struct inode *);
#else
static inline void inotify_inode_queue_event(struct inode *inode,
unsigned long mask,
const char *filename)
{
}
static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
unsigned long mask,
const char *filename)
{
}
static inline void inotify_super_block_umount(struct super_block *sb)
{
}
static inline void inotify_inode_is_dead(struct inode *inode)
{
}
#endif /* CONFIG_INOTIFY */
#endif /* __KERNEL __ */
#endif /* _LINUX_INOTIFY_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]