Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 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 | |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 31 | static struct ctl_table p9_table[] = { |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 32 | #ifdef CONFIG_NET_9P_DEBUG |
| 33 | { |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 34 | .ctl_name = CTL_UNNUMBERED, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 35 | .procname = "debug", |
| 36 | .data = &p9_debug_level, |
| 37 | .maxlen = sizeof(int), |
| 38 | .mode = 0644, |
| 39 | .proc_handler = &proc_dointvec |
| 40 | }, |
| 41 | #endif |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 42 | {}, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 43 | }; |
| 44 | |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 45 | static struct ctl_table p9_net_table[] = { |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 46 | { |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 47 | .ctl_name = CTL_UNNUMBERED, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 48 | .procname = "9p", |
| 49 | .maxlen = 0, |
| 50 | .mode = 0555, |
| 51 | .child = p9_table, |
| 52 | }, |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 53 | {}, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 54 | }; |
| 55 | |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 56 | static struct ctl_table p9_ctl_table[] = { |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 57 | { |
| 58 | .ctl_name = CTL_NET, |
| 59 | .procname = "net", |
| 60 | .maxlen = 0, |
| 61 | .mode = 0555, |
| 62 | .child = p9_net_table, |
| 63 | }, |
Eric W. Biederman | b053c20 | 2007-07-21 12:53:19 -0600 | [diff] [blame] | 64 | {}, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | static struct ctl_table_header *p9_table_header; |
| 68 | |
| 69 | int __init p9_sysctl_register(void) |
| 70 | { |
| 71 | p9_table_header = register_sysctl_table(p9_ctl_table); |
| 72 | if (!p9_table_header) |
| 73 | return -ENOMEM; |
| 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | void __exit p9_sysctl_unregister(void) |
| 79 | { |
| 80 | unregister_sysctl_table(p9_table_header); |
| 81 | } |