| 1 |
/* |
| 2 |
* Inode based directory notification for Linux |
| 3 |
* |
| 4 |
* Copyright (C) 2005 John McCutchan |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef _LINUX_INOTIFY_H |
| 8 |
#define _LINUX_INOTIFY_H |
| 9 |
|
| 10 |
#include <linux/types.h> |
| 11 |
|
| 12 |
/* |
| 13 |
* struct inotify_event - structure read from the inotify device for each event |
| 14 |
* |
| 15 |
* When you are watching a directory, you will receive the filename for events |
| 16 |
* such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd. |
| 17 |
*/ |
| 18 |
struct inotify_event { |
| 19 |
__s32 wd; /* watch descriptor */ |
| 20 |
__u32 mask; /* watch mask */ |
| 21 |
__u32 cookie; /* cookie to synchronize two events */ |
| 22 |
__u32 len; /* length (including nulls) of name */ |
| 23 |
char name[0]; /* stub for possible name */ |
| 24 |
}; |
| 25 |
|
| 26 |
#include "inotify-masks.h" |
| 27 |
|
| 28 |
#ifdef __KERNEL__ |
| 29 |
|
| 30 |
#include <linux/dcache.h> |
| 31 |
#include <linux/fs.h> |
| 32 |
#include <linux/config.h> |
| 33 |
|
| 34 |
#ifdef CONFIG_INOTIFY |
| 35 |
|
| 36 |
extern void inotify_inode_queue_event(struct inode *, __u32, __u32, |
| 37 |
const char *); |
| 38 |
extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, |
| 39 |
const char *); |
| 40 |
extern void inotify_unmount_inodes(struct list_head *); |
| 41 |
extern void inotify_inode_is_dead(struct inode *); |
| 42 |
extern u32 inotify_get_cookie(void); |
| 43 |
|
| 44 |
#else |
| 45 |
|
| 46 |
static inline void inotify_inode_queue_event(struct inode *inode, |
| 47 |
__u32 mask, __u32 cookie, |
| 48 |
const char *filename) |
| 49 |
{ |
| 50 |
} |
| 51 |
|
| 52 |
static inline void inotify_dentry_parent_queue_event(struct dentry *dentry, |
| 53 |
__u32 mask, __u32 cookie, |
| 54 |
const char *filename) |
| 55 |
{ |
| 56 |
} |
| 57 |
|
| 58 |
static inline void inotify_unmount_inodes(struct list_head *list) |
| 59 |
{ |
| 60 |
} |
| 61 |
|
| 62 |
static inline void inotify_inode_is_dead(struct inode *inode) |
| 63 |
{ |
| 64 |
} |
| 65 |
|
| 66 |
static inline u32 inotify_get_cookie(void) |
| 67 |
{ |
| 68 |
return 0; |
| 69 |
} |
| 70 |
|
| 71 |
#endif /* CONFIG_INOTIFY */ |
| 72 |
|
| 73 |
#endif /* __KERNEL __ */ |
| 74 |
|
| 75 |
#endif /* _LINUX_INOTIFY_H */ |