Commit 8de0e8bc authored by Robert Love's avatar Robert Love Committed by Linus Torvalds

[PATCH] make dnotify a configure-time option

make dnotify configurable, via CONFIG_DNOTIFY.  CONFIG_EMBEDDED is required
for disabling dnotify.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 184372a4
...@@ -54,6 +54,12 @@ directory "b". ...@@ -54,6 +54,12 @@ directory "b".
Also, files that are unlinked, will still cause notifications in the Also, files that are unlinked, will still cause notifications in the
last directory that they were linked to. last directory that they were linked to.
Configuration
-------------
Dnotify is controlled via the CONFIG_DNOTIFY configuration option. When
disabled, fcntl(fd, F_NOTIFY, ...) will return -EINVAL.
Example Example
------- -------
......
...@@ -438,6 +438,17 @@ config QUOTACTL ...@@ -438,6 +438,17 @@ config QUOTACTL
depends on XFS_QUOTA || QUOTA depends on XFS_QUOTA || QUOTA
default y default y
config DNOTIFY
bool "Dnotify support" if EMBEDDED
default y
help
Dnotify is a directory-based per-fd file change notification system
that uses signals to communicate events to user-space. There exist
superior alternatives, but some applications may still rely on
dnotify.
Because of this, if unsure, say Y.
config AUTOFS_FS config AUTOFS_FS
tristate "Kernel automounter support" tristate "Kernel automounter support"
help help
......
...@@ -5,12 +5,11 @@ ...@@ -5,12 +5,11 @@
# Rewritten to use lists instead of if-statements. # Rewritten to use lists instead of if-statements.
# #
obj-y := open.o read_write.o file_table.o buffer.o \ obj-y := open.o read_write.o file_table.o buffer.o bio.o super.o \
bio.o super.o block_dev.o char_dev.o stat.o exec.o pipe.o \ block_dev.o char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
namei.o fcntl.o ioctl.o readdir.o select.o fifo.o locks.o \ ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \
dcache.o inode.o attr.o bad_inode.o file.o dnotify.o \ attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
filesystems.o namespace.o seq_file.o xattr.o libfs.o \ seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \
fs-writeback.o mpage.o direct-io.o aio.o
obj-$(CONFIG_EPOLL) += eventpoll.o obj-$(CONFIG_EPOLL) += eventpoll.o
obj-$(CONFIG_COMPAT) += compat.o obj-$(CONFIG_COMPAT) += compat.o
...@@ -37,6 +36,8 @@ obj-$(CONFIG_QFMT_V1) += quota_v1.o ...@@ -37,6 +36,8 @@ obj-$(CONFIG_QFMT_V1) += quota_v1.o
obj-$(CONFIG_QFMT_V2) += quota_v2.o obj-$(CONFIG_QFMT_V2) += quota_v2.o
obj-$(CONFIG_QUOTACTL) += quota.o obj-$(CONFIG_QUOTACTL) += quota.o
obj-$(CONFIG_DNOTIFY) += dnotify.o
obj-$(CONFIG_PROC_FS) += proc/ obj-$(CONFIG_PROC_FS) += proc/
obj-y += partitions/ obj-y += partitions/
obj-$(CONFIG_SYSFS) += sysfs/ obj-$(CONFIG_SYSFS) += sysfs/
......
#ifndef _LINUX_DNOTIFY_H
#define _LINUX_DNOTIFY_H
/* /*
* Directory notification for Linux * Directory notification for Linux
* *
...@@ -8,20 +10,54 @@ ...@@ -8,20 +10,54 @@
struct dnotify_struct { struct dnotify_struct {
struct dnotify_struct * dn_next; struct dnotify_struct * dn_next;
unsigned long dn_mask; /* Events to be notified unsigned long dn_mask;
see linux/fcntl.h */
int dn_fd; int dn_fd;
struct file * dn_filp; struct file * dn_filp;
fl_owner_t dn_owner; fl_owner_t dn_owner;
}; };
#ifdef __KERNEL__
#include <linux/config.h>
#ifdef CONFIG_DNOTIFY
extern void __inode_dir_notify(struct inode *, unsigned long); extern void __inode_dir_notify(struct inode *, unsigned long);
extern void dnotify_flush(struct file *filp, fl_owner_t id); extern void dnotify_flush(struct file *, fl_owner_t);
extern int fcntl_dirnotify(int, struct file *, unsigned long); extern int fcntl_dirnotify(int, struct file *, unsigned long);
void dnotify_parent(struct dentry *dentry, unsigned long event); extern void dnotify_parent(struct dentry *, unsigned long);
static inline void inode_dir_notify(struct inode *inode, unsigned long event) static inline void inode_dir_notify(struct inode *inode, unsigned long event)
{ {
if ((inode)->i_dnotify_mask & (event)) if (inode->i_dnotify_mask & (event))
__inode_dir_notify(inode, event); __inode_dir_notify(inode, event);
} }
#else
static inline void __inode_dir_notify(struct inode *inode, unsigned long event)
{
}
static inline void dnotify_flush(struct file *filp, fl_owner_t id)
{
}
static inline int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
{
return -EINVAL;
}
static inline void dnotify_parent(struct dentry *dentry, unsigned long event)
{
}
static inline void inode_dir_notify(struct inode *inode, unsigned long event)
{
}
#endif /* CONFIG_DNOTIFY */
#endif /* __KERNEL __ */
#endif /* _LINUX_DNOTIFY_H */
...@@ -61,7 +61,11 @@ struct inodes_stat_t { ...@@ -61,7 +61,11 @@ struct inodes_stat_t {
}; };
extern struct inodes_stat_t inodes_stat; extern struct inodes_stat_t inodes_stat;
extern int leases_enable, dir_notify_enable, lease_break_time; extern int leases_enable, lease_break_time;
#ifdef CONFIG_DNOTIFY
extern int dir_notify_enable;
#endif
#define NR_FILE 8192 /* this can well be larger on a larger system */ #define NR_FILE 8192 /* this can well be larger on a larger system */
#define NR_RESERVED_FILES 10 /* reserved for root */ #define NR_RESERVED_FILES 10 /* reserved for root */
...@@ -464,8 +468,10 @@ struct inode { ...@@ -464,8 +468,10 @@ struct inode {
__u32 i_generation; __u32 i_generation;
#ifdef CONFIG_DNOTIFY
unsigned long i_dnotify_mask; /* Directory notify events */ unsigned long i_dnotify_mask; /* Directory notify events */
struct dnotify_struct *i_dnotify; /* for directory notifications */ struct dnotify_struct *i_dnotify; /* for directory notifications */
#endif
unsigned long i_state; unsigned long i_state;
unsigned long dirtied_when; /* jiffies of first dirtying */ unsigned long dirtied_when; /* jiffies of first dirtying */
......
...@@ -894,6 +894,7 @@ static ctl_table fs_table[] = { ...@@ -894,6 +894,7 @@ static ctl_table fs_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
}, },
#ifdef CONFIG_DNOTIFY
{ {
.ctl_name = FS_DIR_NOTIFY, .ctl_name = FS_DIR_NOTIFY,
.procname = "dir-notify-enable", .procname = "dir-notify-enable",
...@@ -902,6 +903,7 @@ static ctl_table fs_table[] = { ...@@ -902,6 +903,7 @@ static ctl_table fs_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
}, },
#endif
{ {
.ctl_name = FS_LEASE_TIME, .ctl_name = FS_LEASE_TIME,
.procname = "lease-break-time", .procname = "lease-break-time",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment