diff options
author | Robert Love <rml@novell.com> | 2005-07-13 12:38:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-13 14:09:31 -0400 |
commit | 0399cb08c54708db231d616f106f64d920e0b723 (patch) | |
tree | f0424d43c578f7c5c1e7aa6ea6ca1c906c7ac289 /fs/inotify.c | |
parent | 153f805781d35c91ab2f54aa2b8930cc4cfc7e89 (diff) |
[PATCH] inotify: move sysctl
This moves the inotify sysctl knobs to "/proc/sys/fs/inotify" from
"/proc/sys/fs". Also some related cleanup.
Signed-off-by: Robert Love <rml@novell.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/inotify.c')
-rw-r--r-- | fs/inotify.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/fs/inotify.c b/fs/inotify.c index e423bfe0c86f..fb4803131423 100644 --- a/fs/inotify.c +++ b/fs/inotify.c | |||
@@ -45,8 +45,8 @@ static kmem_cache_t *event_cachep; | |||
45 | 45 | ||
46 | static struct vfsmount *inotify_mnt; | 46 | static struct vfsmount *inotify_mnt; |
47 | 47 | ||
48 | /* These are configurable via /proc/sys/inotify */ | 48 | /* these are configurable via /proc/sys/fs/inotify/ */ |
49 | int inotify_max_user_devices; | 49 | int inotify_max_user_instances; |
50 | int inotify_max_user_watches; | 50 | int inotify_max_user_watches; |
51 | int inotify_max_queued_events; | 51 | int inotify_max_queued_events; |
52 | 52 | ||
@@ -125,6 +125,47 @@ struct inotify_watch { | |||
125 | u32 mask; /* event mask for this watch */ | 125 | u32 mask; /* event mask for this watch */ |
126 | }; | 126 | }; |
127 | 127 | ||
128 | #ifdef CONFIG_SYSCTL | ||
129 | |||
130 | #include <linux/sysctl.h> | ||
131 | |||
132 | static int zero; | ||
133 | |||
134 | ctl_table inotify_table[] = { | ||
135 | { | ||
136 | .ctl_name = INOTIFY_MAX_USER_INSTANCES, | ||
137 | .procname = "max_user_instances", | ||
138 | .data = &inotify_max_user_instances, | ||
139 | .maxlen = sizeof(int), | ||
140 | .mode = 0644, | ||
141 | .proc_handler = &proc_dointvec_minmax, | ||
142 | .strategy = &sysctl_intvec, | ||
143 | .extra1 = &zero, | ||
144 | }, | ||
145 | { | ||
146 | .ctl_name = INOTIFY_MAX_USER_WATCHES, | ||
147 | .procname = "max_user_watches", | ||
148 | .data = &inotify_max_user_watches, | ||
149 | .maxlen = sizeof(int), | ||
150 | .mode = 0644, | ||
151 | .proc_handler = &proc_dointvec_minmax, | ||
152 | .strategy = &sysctl_intvec, | ||
153 | .extra1 = &zero, | ||
154 | }, | ||
155 | { | ||
156 | .ctl_name = INOTIFY_MAX_QUEUED_EVENTS, | ||
157 | .procname = "max_queued_events", | ||
158 | .data = &inotify_max_queued_events, | ||
159 | .maxlen = sizeof(int), | ||
160 | .mode = 0644, | ||
161 | .proc_handler = &proc_dointvec_minmax, | ||
162 | .strategy = &sysctl_intvec, | ||
163 | .extra1 = &zero | ||
164 | }, | ||
165 | { .ctl_name = 0 } | ||
166 | }; | ||
167 | #endif /* CONFIG_SYSCTL */ | ||
168 | |||
128 | static inline void get_inotify_dev(struct inotify_device *dev) | 169 | static inline void get_inotify_dev(struct inotify_device *dev) |
129 | { | 170 | { |
130 | atomic_inc(&dev->count); | 171 | atomic_inc(&dev->count); |
@@ -842,7 +883,7 @@ asmlinkage long sys_inotify_init(void) | |||
842 | 883 | ||
843 | user = get_uid(current->user); | 884 | user = get_uid(current->user); |
844 | 885 | ||
845 | if (unlikely(atomic_read(&user->inotify_devs) >= inotify_max_user_devices)) { | 886 | if (unlikely(atomic_read(&user->inotify_devs) >= inotify_max_user_instances)) { |
846 | ret = -EMFILE; | 887 | ret = -EMFILE; |
847 | goto out_err; | 888 | goto out_err; |
848 | } | 889 | } |
@@ -979,7 +1020,7 @@ static int __init inotify_init(void) | |||
979 | inotify_mnt = kern_mount(&inotify_fs_type); | 1020 | inotify_mnt = kern_mount(&inotify_fs_type); |
980 | 1021 | ||
981 | inotify_max_queued_events = 8192; | 1022 | inotify_max_queued_events = 8192; |
982 | inotify_max_user_devices = 128; | 1023 | inotify_max_user_instances = 8; |
983 | inotify_max_user_watches = 8192; | 1024 | inotify_max_user_watches = 8192; |
984 | 1025 | ||
985 | atomic_set(&inotify_cookie, 0); | 1026 | atomic_set(&inotify_cookie, 0); |