added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.git] / include / linux / dnotify.h
1 /*
2  * Directory notification for Linux
3  *
4  * Copyright (C) 2000,2002 Stephen Rothwell
5  */
6
7 struct dnotify_struct {
8         struct dnotify_struct * dn_next;
9         unsigned long           dn_mask;        /* Events to be notified
10                                                    see linux/fcntl.h */
11         int                     dn_fd;
12         struct file *           dn_filp;
13         fl_owner_t              dn_owner;
14 };
15
16 extern void __inode_dir_notify(struct inode *, unsigned long);
17 extern void dnotify_flush(struct file *filp, fl_owner_t id);
18 extern int fcntl_dirnotify(int, struct file *, unsigned long);
19
20 static inline void inode_dir_notify(struct inode *inode, unsigned long event)
21 {
22         if ((inode)->i_dnotify_mask & (event))
23                 __inode_dir_notify(inode, event);
24 }
25
26 /*
27  * This is hopelessly wrong, but unfixable without API changes.  At
28  * least it doesn't oops the kernel...
29  */
30 static inline void dnotify_parent(struct dentry *dentry, unsigned long event)
31 {
32         struct dentry *parent;
33         spin_lock(&dcache_lock);
34         parent = dentry->d_parent;
35         if (parent->d_inode->i_dnotify_mask & event) {
36                 dget(parent);
37                 spin_unlock(&dcache_lock);
38                 __inode_dir_notify(parent->d_inode, event);
39                 dput(parent);
40         } else
41                 spin_unlock(&dcache_lock);
42 }