aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-20 18:37:56 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-20 18:37:56 -0400
commitd9eaec9e295a84a80b663996d0489fcff3a1dca9 (patch)
tree85cfc09bb5f0eb42d3be7dfbddaad31353307796 /include/linux
parentcee4cca740d209bcb4b9857baa2253d5ba4e3fbe (diff)
parent41757106b9ca7867dafb2404d618f947b4786fd7 (diff)
Merge branch 'audit.b21' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current
* 'audit.b21' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current: (25 commits) [PATCH] make set_loginuid obey audit_enabled [PATCH] log more info for directory entry change events [PATCH] fix AUDIT_FILTER_PREPEND handling [PATCH] validate rule fields' types [PATCH] audit: path-based rules [PATCH] Audit of POSIX Message Queue Syscalls v.2 [PATCH] fix se_sen audit filter [PATCH] deprecate AUDIT_POSSBILE [PATCH] inline more audit helpers [PATCH] proc_loginuid_write() uses simple_strtoul() on non-terminated array [PATCH] update of IPC audit record cleanup [PATCH] minor audit updates [PATCH] fix audit_krule_to_{rule,data} return values [PATCH] add filtering by ppid [PATCH] log ppid [PATCH] collect sid of those who send signals to auditd [PATCH] execve argument logging [PATCH] fix deadlocks in AUDIT_LIST/AUDIT_LIST_RULES [PATCH] audit_panic() is audit-internal [PATCH] inotify (5/5): update kernel documentation ... Manual fixup of conflict in unclude/linux/inotify.h
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/audit.h99
-rw-r--r--include/linux/fsnotify.h32
-rw-r--r--include/linux/inotify.h108
-rw-r--r--include/linux/sched.h2
4 files changed, 209 insertions, 32 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 14259f6db5bc..e051ff9c5b50 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -82,7 +82,12 @@
82#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */ 82#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */
83#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */ 83#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */
84#define AUDIT_CWD 1307 /* Current working directory */ 84#define AUDIT_CWD 1307 /* Current working directory */
85#define AUDIT_EXECVE 1309 /* execve arguments */
85#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */ 86#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */
87#define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */
88#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */
89#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */
90#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */
86 91
87#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 92#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
88#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 93#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -150,6 +155,7 @@
150#define AUDIT_SE_TYPE 15 /* security label type */ 155#define AUDIT_SE_TYPE 15 /* security label type */
151#define AUDIT_SE_SEN 16 /* security label sensitivity label */ 156#define AUDIT_SE_SEN 16 /* security label sensitivity label */
152#define AUDIT_SE_CLR 17 /* security label clearance label */ 157#define AUDIT_SE_CLR 17 /* security label clearance label */
158#define AUDIT_PPID 18
153 159
154 /* These are ONLY useful when checking 160 /* These are ONLY useful when checking
155 * at syscall exit time (AUDIT_AT_EXIT). */ 161 * at syscall exit time (AUDIT_AT_EXIT). */
@@ -158,6 +164,7 @@
158#define AUDIT_INODE 102 164#define AUDIT_INODE 102
159#define AUDIT_EXIT 103 165#define AUDIT_EXIT 103
160#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ 166#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
167#define AUDIT_WATCH 105
161 168
162#define AUDIT_ARG0 200 169#define AUDIT_ARG0 200
163#define AUDIT_ARG1 (AUDIT_ARG0+1) 170#define AUDIT_ARG1 (AUDIT_ARG0+1)
@@ -277,12 +284,16 @@ struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
277struct audit_sig_info { 284struct audit_sig_info {
278 uid_t uid; 285 uid_t uid;
279 pid_t pid; 286 pid_t pid;
287 char ctx[0];
280}; 288};
281 289
282struct audit_buffer; 290struct audit_buffer;
283struct audit_context; 291struct audit_context;
284struct inode; 292struct inode;
285struct netlink_skb_parms; 293struct netlink_skb_parms;
294struct linux_binprm;
295struct mq_attr;
296struct mqstat;
286 297
287#define AUDITSC_INVALID 0 298#define AUDITSC_INVALID 0
288#define AUDITSC_SUCCESS 1 299#define AUDITSC_SUCCESS 1
@@ -297,15 +308,19 @@ extern void audit_syscall_entry(int arch,
297 int major, unsigned long a0, unsigned long a1, 308 int major, unsigned long a0, unsigned long a1,
298 unsigned long a2, unsigned long a3); 309 unsigned long a2, unsigned long a3);
299extern void audit_syscall_exit(int failed, long return_code); 310extern void audit_syscall_exit(int failed, long return_code);
300extern void audit_getname(const char *name); 311extern void __audit_getname(const char *name);
301extern void audit_putname(const char *name); 312extern void audit_putname(const char *name);
302extern void __audit_inode(const char *name, const struct inode *inode, unsigned flags); 313extern void __audit_inode(const char *name, const struct inode *inode);
303extern void __audit_inode_child(const char *dname, const struct inode *inode, 314extern void __audit_inode_child(const char *dname, const struct inode *inode,
304 unsigned long pino); 315 unsigned long pino);
305static inline void audit_inode(const char *name, const struct inode *inode, 316static inline void audit_getname(const char *name)
306 unsigned flags) { 317{
307 if (unlikely(current->audit_context)) 318 if (unlikely(current->audit_context))
308 __audit_inode(name, inode, flags); 319 __audit_getname(name);
320}
321static inline void audit_inode(const char *name, const struct inode *inode) {
322 if (unlikely(current->audit_context))
323 __audit_inode(name, inode);
309} 324}
310static inline void audit_inode_child(const char *dname, 325static inline void audit_inode_child(const char *dname,
311 const struct inode *inode, 326 const struct inode *inode,
@@ -320,13 +335,61 @@ extern void auditsc_get_stamp(struct audit_context *ctx,
320 struct timespec *t, unsigned int *serial); 335 struct timespec *t, unsigned int *serial);
321extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 336extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
322extern uid_t audit_get_loginuid(struct audit_context *ctx); 337extern uid_t audit_get_loginuid(struct audit_context *ctx);
323extern int audit_ipc_obj(struct kern_ipc_perm *ipcp); 338extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
324extern int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode, struct kern_ipc_perm *ipcp); 339extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
340extern int audit_bprm(struct linux_binprm *bprm);
325extern int audit_socketcall(int nargs, unsigned long *args); 341extern int audit_socketcall(int nargs, unsigned long *args);
326extern int audit_sockaddr(int len, void *addr); 342extern int audit_sockaddr(int len, void *addr);
327extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); 343extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
328extern void audit_signal_info(int sig, struct task_struct *t);
329extern int audit_set_macxattr(const char *name); 344extern int audit_set_macxattr(const char *name);
345extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr);
346extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout);
347extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout);
348extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification);
349extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
350
351static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
352{
353 if (unlikely(current->audit_context))
354 return __audit_ipc_obj(ipcp);
355 return 0;
356}
357static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
358{
359 if (unlikely(current->audit_context))
360 return __audit_ipc_set_perm(qbytes, uid, gid, mode);
361 return 0;
362}
363static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
364{
365 if (unlikely(current->audit_context))
366 return __audit_mq_open(oflag, mode, u_attr);
367 return 0;
368}
369static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
370{
371 if (unlikely(current->audit_context))
372 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
373 return 0;
374}
375static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
376{
377 if (unlikely(current->audit_context))
378 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
379 return 0;
380}
381static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
382{
383 if (unlikely(current->audit_context))
384 return __audit_mq_notify(mqdes, u_notification);
385 return 0;
386}
387static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
388{
389 if (unlikely(current->audit_context))
390 return __audit_mq_getsetattr(mqdes, mqstat);
391 return 0;
392}
330#else 393#else
331#define audit_alloc(t) ({ 0; }) 394#define audit_alloc(t) ({ 0; })
332#define audit_free(t) do { ; } while (0) 395#define audit_free(t) do { ; } while (0)
@@ -334,19 +397,24 @@ extern int audit_set_macxattr(const char *name);
334#define audit_syscall_exit(f,r) do { ; } while (0) 397#define audit_syscall_exit(f,r) do { ; } while (0)
335#define audit_getname(n) do { ; } while (0) 398#define audit_getname(n) do { ; } while (0)
336#define audit_putname(n) do { ; } while (0) 399#define audit_putname(n) do { ; } while (0)
337#define __audit_inode(n,i,f) do { ; } while (0) 400#define __audit_inode(n,i) do { ; } while (0)
338#define __audit_inode_child(d,i,p) do { ; } while (0) 401#define __audit_inode_child(d,i,p) do { ; } while (0)
339#define audit_inode(n,i,f) do { ; } while (0) 402#define audit_inode(n,i) do { ; } while (0)
340#define audit_inode_child(d,i,p) do { ; } while (0) 403#define audit_inode_child(d,i,p) do { ; } while (0)
341#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 404#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
342#define audit_get_loginuid(c) ({ -1; }) 405#define audit_get_loginuid(c) ({ -1; })
343#define audit_ipc_obj(i) ({ 0; }) 406#define audit_ipc_obj(i) ({ 0; })
344#define audit_ipc_set_perm(q,u,g,m,i) ({ 0; }) 407#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
408#define audit_bprm(p) ({ 0; })
345#define audit_socketcall(n,a) ({ 0; }) 409#define audit_socketcall(n,a) ({ 0; })
346#define audit_sockaddr(len, addr) ({ 0; }) 410#define audit_sockaddr(len, addr) ({ 0; })
347#define audit_avc_path(dentry, mnt) ({ 0; }) 411#define audit_avc_path(dentry, mnt) ({ 0; })
348#define audit_signal_info(s,t) do { ; } while (0)
349#define audit_set_macxattr(n) do { ; } while (0) 412#define audit_set_macxattr(n) do { ; } while (0)
413#define audit_mq_open(o,m,a) ({ 0; })
414#define audit_mq_timedsend(d,l,p,t) ({ 0; })
415#define audit_mq_timedreceive(d,l,p,t) ({ 0; })
416#define audit_mq_notify(d,n) ({ 0; })
417#define audit_mq_getsetattr(d,s) ({ 0; })
350#endif 418#endif
351 419
352#ifdef CONFIG_AUDIT 420#ifdef CONFIG_AUDIT
@@ -364,8 +432,11 @@ extern void audit_log_end(struct audit_buffer *ab);
364extern void audit_log_hex(struct audit_buffer *ab, 432extern void audit_log_hex(struct audit_buffer *ab,
365 const unsigned char *buf, 433 const unsigned char *buf,
366 size_t len); 434 size_t len);
367extern void audit_log_untrustedstring(struct audit_buffer *ab, 435extern const char * audit_log_untrustedstring(struct audit_buffer *ab,
368 const char *string); 436 const char *string);
437extern const char * audit_log_n_untrustedstring(struct audit_buffer *ab,
438 size_t n,
439 const char *string);
369extern void audit_log_d_path(struct audit_buffer *ab, 440extern void audit_log_d_path(struct audit_buffer *ab,
370 const char *prefix, 441 const char *prefix,
371 struct dentry *dentry, 442 struct dentry *dentry,
@@ -383,8 +454,8 @@ extern int audit_receive_filter(int type, int pid, int uid, int seq,
383#define audit_log_end(b) do { ; } while (0) 454#define audit_log_end(b) do { ; } while (0)
384#define audit_log_hex(a,b,l) do { ; } while (0) 455#define audit_log_hex(a,b,l) do { ; } while (0)
385#define audit_log_untrustedstring(a,s) do { ; } while (0) 456#define audit_log_untrustedstring(a,s) do { ; } while (0)
457#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0)
386#define audit_log_d_path(b,p,d,v) do { ; } while (0) 458#define audit_log_d_path(b,p,d,v) do { ; } while (0)
387#define audit_panic(m) do { ; } while (0)
388#endif 459#endif
389#endif 460#endif
390#endif 461#endif
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 11438eff4d44..cc5dec70c32c 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -54,19 +54,20 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
54 54
55 if (isdir) 55 if (isdir)
56 isdir = IN_ISDIR; 56 isdir = IN_ISDIR;
57 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name); 57 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name,
58 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name); 58 source);
59 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name,
60 source);
59 61
60 if (target) { 62 if (target) {
61 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL); 63 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL);
62 inotify_inode_is_dead(target); 64 inotify_inode_is_dead(target);
63 } 65 }
64 66
65 if (source) { 67 if (source) {
66 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL); 68 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
67 } 69 }
68 audit_inode_child(old_name, source, old_dir->i_ino); 70 audit_inode_child(new_name, source, new_dir->i_ino);
69 audit_inode_child(new_name, target, new_dir->i_ino);
70} 71}
71 72
72/* 73/*
@@ -85,7 +86,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
85 */ 86 */
86static inline void fsnotify_inoderemove(struct inode *inode) 87static inline void fsnotify_inoderemove(struct inode *inode)
87{ 88{
88 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL); 89 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL);
89 inotify_inode_is_dead(inode); 90 inotify_inode_is_dead(inode);
90} 91}
91 92
@@ -95,7 +96,8 @@ static inline void fsnotify_inoderemove(struct inode *inode)
95static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 96static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
96{ 97{
97 inode_dir_notify(inode, DN_CREATE); 98 inode_dir_notify(inode, DN_CREATE);
98 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name); 99 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
100 dentry->d_inode);
99 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 101 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
100} 102}
101 103
@@ -106,7 +108,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
106{ 108{
107 inode_dir_notify(inode, DN_CREATE); 109 inode_dir_notify(inode, DN_CREATE);
108 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, 110 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0,
109 dentry->d_name.name); 111 dentry->d_name.name, dentry->d_inode);
110 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 112 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
111} 113}
112 114
@@ -123,7 +125,7 @@ static inline void fsnotify_access(struct dentry *dentry)
123 125
124 dnotify_parent(dentry, DN_ACCESS); 126 dnotify_parent(dentry, DN_ACCESS);
125 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 127 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
126 inotify_inode_queue_event(inode, mask, 0, NULL); 128 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
127} 129}
128 130
129/* 131/*
@@ -139,7 +141,7 @@ static inline void fsnotify_modify(struct dentry *dentry)
139 141
140 dnotify_parent(dentry, DN_MODIFY); 142 dnotify_parent(dentry, DN_MODIFY);
141 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 143 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
142 inotify_inode_queue_event(inode, mask, 0, NULL); 144 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
143} 145}
144 146
145/* 147/*
@@ -154,7 +156,7 @@ static inline void fsnotify_open(struct dentry *dentry)
154 mask |= IN_ISDIR; 156 mask |= IN_ISDIR;
155 157
156 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 158 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
157 inotify_inode_queue_event(inode, mask, 0, NULL); 159 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
158} 160}
159 161
160/* 162/*
@@ -172,7 +174,7 @@ static inline void fsnotify_close(struct file *file)
172 mask |= IN_ISDIR; 174 mask |= IN_ISDIR;
173 175
174 inotify_dentry_parent_queue_event(dentry, mask, 0, name); 176 inotify_dentry_parent_queue_event(dentry, mask, 0, name);
175 inotify_inode_queue_event(inode, mask, 0, NULL); 177 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
176} 178}
177 179
178/* 180/*
@@ -187,7 +189,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
187 mask |= IN_ISDIR; 189 mask |= IN_ISDIR;
188 190
189 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 191 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
190 inotify_inode_queue_event(inode, mask, 0, NULL); 192 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
191} 193}
192 194
193/* 195/*
@@ -234,7 +236,7 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
234 if (in_mask) { 236 if (in_mask) {
235 if (S_ISDIR(inode->i_mode)) 237 if (S_ISDIR(inode->i_mode))
236 in_mask |= IN_ISDIR; 238 in_mask |= IN_ISDIR;
237 inotify_inode_queue_event(inode, in_mask, 0, NULL); 239 inotify_inode_queue_event(inode, in_mask, 0, NULL, NULL);
238 inotify_dentry_parent_queue_event(dentry, in_mask, 0, 240 inotify_dentry_parent_queue_event(dentry, in_mask, 0,
239 dentry->d_name.name); 241 dentry->d_name.name);
240 } 242 }
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 71aa1553ef38..d4f48c6402e6 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -68,18 +68,65 @@ struct inotify_event {
68#include <linux/dcache.h> 68#include <linux/dcache.h>
69#include <linux/fs.h> 69#include <linux/fs.h>
70 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 */
82struct 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
92struct 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};
97
71#ifdef CONFIG_INOTIFY 98#ifdef CONFIG_INOTIFY
72 99
100/* Kernel API for producing events */
101
73extern void inotify_d_instantiate(struct dentry *, struct inode *); 102extern void inotify_d_instantiate(struct dentry *, struct inode *);
74extern void inotify_d_move(struct dentry *); 103extern void inotify_d_move(struct dentry *);
75extern void inotify_inode_queue_event(struct inode *, __u32, __u32, 104extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
76 const char *); 105 const char *, struct inode *);
77extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, 106extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
78 const char *); 107 const char *);
79extern void inotify_unmount_inodes(struct list_head *); 108extern void inotify_unmount_inodes(struct list_head *);
80extern void inotify_inode_is_dead(struct inode *); 109extern void inotify_inode_is_dead(struct inode *);
81extern u32 inotify_get_cookie(void); 110extern u32 inotify_get_cookie(void);
82 111
112/* Kernel Consumer API */
113
114extern struct inotify_handle *inotify_init(const struct inotify_operations *);
115extern void inotify_init_watch(struct inotify_watch *);
116extern void inotify_destroy(struct inotify_handle *);
117extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *,
118 struct inotify_watch **);
119extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *,
120 u32);
121extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
122 struct inode *, __u32);
123extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
124extern int inotify_rm_wd(struct inotify_handle *, __u32);
125extern void inotify_remove_watch_locked(struct inotify_handle *,
126 struct inotify_watch *);
127extern void get_inotify_watch(struct inotify_watch *);
128extern void put_inotify_watch(struct inotify_watch *);
129
83#else 130#else
84 131
85static inline void inotify_d_instantiate(struct dentry *dentry, 132static inline void inotify_d_instantiate(struct dentry *dentry,
@@ -93,7 +140,8 @@ static inline void inotify_d_move(struct dentry *dentry)
93 140
94static inline void inotify_inode_queue_event(struct inode *inode, 141static inline void inotify_inode_queue_event(struct inode *inode,
95 __u32 mask, __u32 cookie, 142 __u32 mask, __u32 cookie,
96 const char *filename) 143 const char *filename,
144 struct inode *n_inode)
97{ 145{
98} 146}
99 147
@@ -116,6 +164,62 @@ static inline u32 inotify_get_cookie(void)
116 return 0; 164 return 0;
117} 165}
118 166
167static inline struct inotify_handle *inotify_init(const struct inotify_operations *ops)
168{
169 return ERR_PTR(-EOPNOTSUPP);
170}
171
172static inline void inotify_init_watch(struct inotify_watch *watch)
173{
174}
175
176static inline void inotify_destroy(struct inotify_handle *ih)
177{
178}
179
180static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode,
181 struct inotify_watch **watchp)
182{
183 return -EOPNOTSUPP;
184}
185
186static inline __s32 inotify_find_update_watch(struct inotify_handle *ih,
187 struct inode *inode, u32 mask)
188{
189 return -EOPNOTSUPP;
190}
191
192static 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
199static inline int inotify_rm_watch(struct inotify_handle *ih,
200 struct inotify_watch *watch)
201{
202 return -EOPNOTSUPP;
203}
204
205static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
206{
207 return -EOPNOTSUPP;
208}
209
210static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
211 struct inotify_watch *watch)
212{
213}
214
215static inline void get_inotify_watch(struct inotify_watch *watch)
216{
217}
218
219static inline void put_inotify_watch(struct inotify_watch *watch)
220{
221}
222
119#endif /* CONFIG_INOTIFY */ 223#endif /* CONFIG_INOTIFY */
120 224
121#endif /* __KERNEL __ */ 225#endif /* __KERNEL __ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 701b8cbceb05..267f15257040 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -494,7 +494,7 @@ struct user_struct {
494 atomic_t processes; /* How many processes does this user have? */ 494 atomic_t processes; /* How many processes does this user have? */
495 atomic_t files; /* How many open files does this user have? */ 495 atomic_t files; /* How many open files does this user have? */
496 atomic_t sigpending; /* How many pending signals does this user have? */ 496 atomic_t sigpending; /* How many pending signals does this user have? */
497#ifdef CONFIG_INOTIFY 497#ifdef CONFIG_INOTIFY_USER
498 atomic_t inotify_watches; /* How many inotify watches does this user have? */ 498 atomic_t inotify_watches; /* How many inotify watches does this user have? */
499 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ 499 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */
500#endif 500#endif