diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-06-20 20:46:21 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-06-20 20:46:21 -0400 |
commit | 70ac4385a13f78bc478f26d317511893741b05bd (patch) | |
tree | dafc7f3018295fc4ee00339889e4f35d5b9d7743 /include/linux/inotify.h | |
parent | d59bf96cdde5b874a57bfd1425faa45da915d0b7 (diff) | |
parent | 077e98945db7e54a9865b5f29a1f02f531eca414 (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Conflicts:
include/linux/nfs_fs.h
Fixed up conflict with kernel header updates.
Diffstat (limited to 'include/linux/inotify.h')
-rw-r--r-- | include/linux/inotify.h | 109 |
1 files changed, 106 insertions, 3 deletions
diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 09e00433c78e..d4f48c6402e6 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h | |||
@@ -67,20 +67,66 @@ struct inotify_event { | |||
67 | 67 | ||
68 | #include <linux/dcache.h> | 68 | #include <linux/dcache.h> |
69 | #include <linux/fs.h> | 69 | #include <linux/fs.h> |
70 | #include <linux/config.h> | 70 | |
71 | /* | ||
72 | * struct inotify_watch - represents a watch request on a specific inode | ||
73 | * | ||
74 | * h_list is protected by ih->mutex of the associated inotify_handle. | ||
75 | * i_list, mask are protected by inode->inotify_mutex of the associated inode. | ||
76 | * ih, inode, and wd are never written to once the watch is created. | ||
77 | * | ||
78 | * Callers must use the established inotify interfaces to access inotify_watch | ||
79 | * contents. The content of this structure is private to the inotify | ||
80 | * implementation. | ||
81 | */ | ||
82 | struct inotify_watch { | ||
83 | struct list_head h_list; /* entry in inotify_handle's list */ | ||
84 | struct list_head i_list; /* entry in inode's list */ | ||
85 | atomic_t count; /* reference count */ | ||
86 | struct inotify_handle *ih; /* associated inotify handle */ | ||
87 | struct inode *inode; /* associated inode */ | ||
88 | __s32 wd; /* watch descriptor */ | ||
89 | __u32 mask; /* event mask for this watch */ | ||
90 | }; | ||
91 | |||
92 | struct inotify_operations { | ||
93 | void (*handle_event)(struct inotify_watch *, u32, u32, u32, | ||
94 | const char *, struct inode *); | ||
95 | void (*destroy_watch)(struct inotify_watch *); | ||
96 | }; | ||
71 | 97 | ||
72 | #ifdef CONFIG_INOTIFY | 98 | #ifdef CONFIG_INOTIFY |
73 | 99 | ||
100 | /* Kernel API for producing events */ | ||
101 | |||
74 | extern void inotify_d_instantiate(struct dentry *, struct inode *); | 102 | extern void inotify_d_instantiate(struct dentry *, struct inode *); |
75 | extern void inotify_d_move(struct dentry *); | 103 | extern void inotify_d_move(struct dentry *); |
76 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, | 104 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, |
77 | const char *); | 105 | const char *, struct inode *); |
78 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, | 106 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, |
79 | const char *); | 107 | const char *); |
80 | extern void inotify_unmount_inodes(struct list_head *); | 108 | extern void inotify_unmount_inodes(struct list_head *); |
81 | extern void inotify_inode_is_dead(struct inode *); | 109 | extern void inotify_inode_is_dead(struct inode *); |
82 | extern u32 inotify_get_cookie(void); | 110 | extern u32 inotify_get_cookie(void); |
83 | 111 | ||
112 | /* Kernel Consumer API */ | ||
113 | |||
114 | extern struct inotify_handle *inotify_init(const struct inotify_operations *); | ||
115 | extern void inotify_init_watch(struct inotify_watch *); | ||
116 | extern void inotify_destroy(struct inotify_handle *); | ||
117 | extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *, | ||
118 | struct inotify_watch **); | ||
119 | extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *, | ||
120 | u32); | ||
121 | extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *, | ||
122 | struct inode *, __u32); | ||
123 | extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *); | ||
124 | extern int inotify_rm_wd(struct inotify_handle *, __u32); | ||
125 | extern void inotify_remove_watch_locked(struct inotify_handle *, | ||
126 | struct inotify_watch *); | ||
127 | extern void get_inotify_watch(struct inotify_watch *); | ||
128 | extern void put_inotify_watch(struct inotify_watch *); | ||
129 | |||
84 | #else | 130 | #else |
85 | 131 | ||
86 | static inline void inotify_d_instantiate(struct dentry *dentry, | 132 | static inline void inotify_d_instantiate(struct dentry *dentry, |
@@ -94,7 +140,8 @@ static inline void inotify_d_move(struct dentry *dentry) | |||
94 | 140 | ||
95 | static inline void inotify_inode_queue_event(struct inode *inode, | 141 | static inline void inotify_inode_queue_event(struct inode *inode, |
96 | __u32 mask, __u32 cookie, | 142 | __u32 mask, __u32 cookie, |
97 | const char *filename) | 143 | const char *filename, |
144 | struct inode *n_inode) | ||
98 | { | 145 | { |
99 | } | 146 | } |
100 | 147 | ||
@@ -117,6 +164,62 @@ static inline u32 inotify_get_cookie(void) | |||
117 | return 0; | 164 | return 0; |
118 | } | 165 | } |
119 | 166 | ||
167 | static inline struct inotify_handle *inotify_init(const struct inotify_operations *ops) | ||
168 | { | ||
169 | return ERR_PTR(-EOPNOTSUPP); | ||
170 | } | ||
171 | |||
172 | static inline void inotify_init_watch(struct inotify_watch *watch) | ||
173 | { | ||
174 | } | ||
175 | |||
176 | static inline void inotify_destroy(struct inotify_handle *ih) | ||
177 | { | ||
178 | } | ||
179 | |||
180 | static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode, | ||
181 | struct inotify_watch **watchp) | ||
182 | { | ||
183 | return -EOPNOTSUPP; | ||
184 | } | ||
185 | |||
186 | static inline __s32 inotify_find_update_watch(struct inotify_handle *ih, | ||
187 | struct inode *inode, u32 mask) | ||
188 | { | ||
189 | return -EOPNOTSUPP; | ||
190 | } | ||
191 | |||
192 | static inline __s32 inotify_add_watch(struct inotify_handle *ih, | ||
193 | struct inotify_watch *watch, | ||
194 | struct inode *inode, __u32 mask) | ||
195 | { | ||
196 | return -EOPNOTSUPP; | ||
197 | } | ||
198 | |||
199 | static inline int inotify_rm_watch(struct inotify_handle *ih, | ||
200 | struct inotify_watch *watch) | ||
201 | { | ||
202 | return -EOPNOTSUPP; | ||
203 | } | ||
204 | |||
205 | static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd) | ||
206 | { | ||
207 | return -EOPNOTSUPP; | ||
208 | } | ||
209 | |||
210 | static inline void inotify_remove_watch_locked(struct inotify_handle *ih, | ||
211 | struct inotify_watch *watch) | ||
212 | { | ||
213 | } | ||
214 | |||
215 | static inline void get_inotify_watch(struct inotify_watch *watch) | ||
216 | { | ||
217 | } | ||
218 | |||
219 | static inline void put_inotify_watch(struct inotify_watch *watch) | ||
220 | { | ||
221 | } | ||
222 | |||
120 | #endif /* CONFIG_INOTIFY */ | 223 | #endif /* CONFIG_INOTIFY */ |
121 | 224 | ||
122 | #endif /* __KERNEL __ */ | 225 | #endif /* __KERNEL __ */ |