sysctl.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #include <linux/kernel.h>
  25. #include <linux/mm.h>
  26. #include <linux/sysctl.h>
  27. #include <linux/init.h>
  28. #include <net/9p/9p.h>
  29. static struct ctl_table p9_table[] = {
  30. #ifdef CONFIG_NET_9P_DEBUG
  31. {
  32. .ctl_name = CTL_UNNUMBERED,
  33. .procname = "debug",
  34. .data = &p9_debug_level,
  35. .maxlen = sizeof(int),
  36. .mode = 0644,
  37. .proc_handler = &proc_dointvec
  38. },
  39. #endif
  40. {},
  41. };
  42. static struct ctl_table p9_net_table[] = {
  43. {
  44. .ctl_name = CTL_UNNUMBERED,
  45. .procname = "9p",
  46. .maxlen = 0,
  47. .mode = 0555,
  48. .child = p9_table,
  49. },
  50. {},
  51. };
  52. static struct ctl_table p9_ctl_table[] = {
  53. {
  54. .ctl_name = CTL_NET,
  55. .procname = "net",
  56. .maxlen = 0,
  57. .mode = 0555,
  58. .child = p9_net_table,
  59. },
  60. {},
  61. };
  62. static struct ctl_table_header *p9_table_header;
  63. int __init p9_sysctl_register(void)
  64. {
  65. p9_table_header = register_sysctl_table(p9_ctl_table);
  66. if (!p9_table_header)
  67. return -ENOMEM;
  68. return 0;
  69. }
  70. void __exit p9_sysctl_unregister(void)
  71. {
  72. unregister_sysctl_table(p9_table_header);
  73. }