This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / fs / cachefiles / cf-sysctl.c
1 /* cf-sysctl.c: Control parameters
2  *
3  * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/sysctl.h>
15 #include "internal.h"
16
17 static struct ctl_table_header *cachefiles_sysctl;
18
19 /*
20  * Something that isn't CTL_ANY, CTL_NONE or a value that may clash.
21  * Use the same values as fs/nfs/sysctl.c
22  */
23 #define CTL_UNNUMBERED -2
24
25 static ctl_table cachefiles_sysctl_table[] = {
26         {
27                 .ctl_name       = CTL_UNNUMBERED,
28                 .procname       = "debug",
29                 .data           = &cachefiles_debug,
30                 .maxlen         = sizeof(unsigned long),
31                 .mode           = 0644,
32                 .proc_handler   = &proc_doulongvec_minmax
33         },
34         { .ctl_name = 0 }
35 };
36
37 static ctl_table cachefiles_sysctl_dir[] = {
38         {
39                 .ctl_name       = CTL_UNNUMBERED,
40                 .procname       = "cachefiles",
41                 .maxlen         = 0,
42                 .mode           = 0555,
43                 .child          = cachefiles_sysctl_table
44         },
45         { .ctl_name = 0 }
46 };
47
48 static ctl_table cachefiles_sysctl_root[] = {
49         {
50                 .ctl_name = CTL_FS,
51                 .procname = "fs",
52                 .mode = 0555,
53                 .child = cachefiles_sysctl_dir,
54         },
55         { .ctl_name = 0 }
56 };
57
58 int __init cachefiles_sysctl_init(void)
59 {
60         cachefiles_sysctl = register_sysctl_table(cachefiles_sysctl_root, 0);
61         if (!cachefiles_sysctl)
62                 return -ENOMEM;
63         return 0;
64 }
65
66 void __exit cachefiles_sysctl_cleanup(void)
67 {
68         unregister_sysctl_table(cachefiles_sysctl);
69 }