diff options
Diffstat (limited to 'net/9p/sysctl.c')
| -rw-r--r-- | net/9p/sysctl.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/net/9p/sysctl.c b/net/9p/sysctl.c new file mode 100644 index 000000000000..e7fe706ab95a --- /dev/null +++ b/net/9p/sysctl.c | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | /* | ||
| 2 | * net/9p/sysctl.c | ||
| 3 | * | ||
| 4 | * 9P sysctl interface | ||
| 5 | * | ||
| 6 | * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 | ||
| 10 | * as published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to: | ||
| 19 | * Free Software Foundation | ||
| 20 | * 51 Franklin Street, Fifth Floor | ||
| 21 | * Boston, MA 02111-1301 USA | ||
| 22 | * | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include <linux/kernel.h> | ||
| 26 | #include <linux/mm.h> | ||
| 27 | #include <linux/sysctl.h> | ||
| 28 | #include <linux/init.h> | ||
| 29 | #include <net/9p/9p.h> | ||
| 30 | |||
| 31 | enum { | ||
| 32 | P9_SYSCTL_NET = 487, | ||
| 33 | P9_SYSCTL_DEBUG = 1, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static ctl_table p9_table[] = { | ||
| 37 | #ifdef CONFIG_NET_9P_DEBUG | ||
| 38 | { | ||
| 39 | .ctl_name = P9_SYSCTL_DEBUG, | ||
| 40 | .procname = "debug", | ||
| 41 | .data = &p9_debug_level, | ||
| 42 | .maxlen = sizeof(int), | ||
| 43 | .mode = 0644, | ||
| 44 | .proc_handler = &proc_dointvec | ||
| 45 | }, | ||
| 46 | #endif | ||
| 47 | { .ctl_name = 0 }, | ||
| 48 | }; | ||
| 49 | |||
| 50 | static ctl_table p9_net_table[] = { | ||
| 51 | { | ||
| 52 | .ctl_name = P9_SYSCTL_NET, | ||
| 53 | .procname = "9p", | ||
| 54 | .maxlen = 0, | ||
| 55 | .mode = 0555, | ||
| 56 | .child = p9_table, | ||
| 57 | }, | ||
| 58 | { .ctl_name = 0 }, | ||
| 59 | }; | ||
| 60 | |||
| 61 | static ctl_table p9_ctl_table[] = { | ||
| 62 | { | ||
| 63 | .ctl_name = CTL_NET, | ||
| 64 | .procname = "net", | ||
| 65 | .maxlen = 0, | ||
| 66 | .mode = 0555, | ||
| 67 | .child = p9_net_table, | ||
| 68 | }, | ||
| 69 | { .ctl_name = 0 }, | ||
| 70 | }; | ||
| 71 | |||
| 72 | static struct ctl_table_header *p9_table_header; | ||
| 73 | |||
| 74 | int __init p9_sysctl_register(void) | ||
| 75 | { | ||
| 76 | p9_table_header = register_sysctl_table(p9_ctl_table); | ||
| 77 | if (!p9_table_header) | ||
| 78 | return -ENOMEM; | ||
| 79 | |||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | void __exit p9_sysctl_unregister(void) | ||
| 84 | { | ||
| 85 | unregister_sysctl_table(p9_table_header); | ||
| 86 | } | ||
