sysctl_net_llc.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
  3. *
  4. * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  5. */
  6. #include <linux/mm.h>
  7. #include <linux/init.h>
  8. #include <linux/sysctl.h>
  9. #include <net/net_namespace.h>
  10. #include <net/llc.h>
  11. #ifndef CONFIG_SYSCTL
  12. #error This file should not be compiled without CONFIG_SYSCTL defined
  13. #endif
  14. static struct ctl_table llc2_timeout_table[] = {
  15. {
  16. .procname = "ack",
  17. .data = &sysctl_llc2_ack_timeout,
  18. .maxlen = sizeof(long),
  19. .mode = 0644,
  20. .proc_handler = proc_dointvec_jiffies,
  21. },
  22. {
  23. .procname = "busy",
  24. .data = &sysctl_llc2_busy_timeout,
  25. .maxlen = sizeof(long),
  26. .mode = 0644,
  27. .proc_handler = proc_dointvec_jiffies,
  28. },
  29. {
  30. .procname = "p",
  31. .data = &sysctl_llc2_p_timeout,
  32. .maxlen = sizeof(long),
  33. .mode = 0644,
  34. .proc_handler = proc_dointvec_jiffies,
  35. },
  36. {
  37. .procname = "rej",
  38. .data = &sysctl_llc2_rej_timeout,
  39. .maxlen = sizeof(long),
  40. .mode = 0644,
  41. .proc_handler = proc_dointvec_jiffies,
  42. },
  43. { },
  44. };
  45. static struct ctl_table llc_station_table[] = {
  46. {
  47. .procname = "ack_timeout",
  48. .data = &sysctl_llc_station_ack_timeout,
  49. .maxlen = sizeof(long),
  50. .mode = 0644,
  51. .proc_handler = proc_dointvec_jiffies,
  52. },
  53. { },
  54. };
  55. static struct ctl_table_header *llc2_timeout_header;
  56. static struct ctl_table_header *llc_station_header;
  57. int __init llc_sysctl_init(void)
  58. {
  59. llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
  60. llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
  61. if (!llc2_timeout_header || !llc_station_header) {
  62. llc_sysctl_exit();
  63. return -ENOMEM;
  64. }
  65. return 0;
  66. }
  67. void llc_sysctl_exit(void)
  68. {
  69. if (llc2_timeout_header) {
  70. unregister_net_sysctl_table(llc2_timeout_header);
  71. llc2_timeout_header = NULL;
  72. }
  73. if (llc_station_header) {
  74. unregister_net_sysctl_table(llc_station_header);
  75. llc_station_header = NULL;
  76. }
  77. }