sysctl_net_llc.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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(sysctl_llc2_ack_timeout),
  19. .mode = 0644,
  20. .proc_handler = proc_dointvec_jiffies,
  21. },
  22. {
  23. .procname = "busy",
  24. .data = &sysctl_llc2_busy_timeout,
  25. .maxlen = sizeof(sysctl_llc2_busy_timeout),
  26. .mode = 0644,
  27. .proc_handler = proc_dointvec_jiffies,
  28. },
  29. {
  30. .procname = "p",
  31. .data = &sysctl_llc2_p_timeout,
  32. .maxlen = sizeof(sysctl_llc2_p_timeout),
  33. .mode = 0644,
  34. .proc_handler = proc_dointvec_jiffies,
  35. },
  36. {
  37. .procname = "rej",
  38. .data = &sysctl_llc2_rej_timeout,
  39. .maxlen = sizeof(sysctl_llc2_rej_timeout),
  40. .mode = 0644,
  41. .proc_handler = proc_dointvec_jiffies,
  42. },
  43. { },
  44. };
  45. static struct ctl_table llc_station_table[] = {
  46. { },
  47. };
  48. static struct ctl_table_header *llc2_timeout_header;
  49. static struct ctl_table_header *llc_station_header;
  50. int __init llc_sysctl_init(void)
  51. {
  52. llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
  53. llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
  54. if (!llc2_timeout_header || !llc_station_header) {
  55. llc_sysctl_exit();
  56. return -ENOMEM;
  57. }
  58. return 0;
  59. }
  60. void llc_sysctl_exit(void)
  61. {
  62. if (llc2_timeout_header) {
  63. unregister_net_sysctl_table(llc2_timeout_header);
  64. llc2_timeout_header = NULL;
  65. }
  66. if (llc_station_header) {
  67. unregister_net_sysctl_table(llc_station_header);
  68. llc_station_header = NULL;
  69. }
  70. }