sysctl.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/fs/nfs/sysctl.c
  4. *
  5. * Sysctl interface to NFS parameters
  6. */
  7. #include <linux/types.h>
  8. #include <linux/linkage.h>
  9. #include <linux/ctype.h>
  10. #include <linux/fs.h>
  11. #include <linux/sysctl.h>
  12. #include <linux/module.h>
  13. #include <linux/nfs_fs.h>
  14. static struct ctl_table_header *nfs_callback_sysctl_table;
  15. static struct ctl_table nfs_cb_sysctls[] = {
  16. {
  17. .procname = "nfs_mountpoint_timeout",
  18. .data = &nfs_mountpoint_expiry_timeout,
  19. .maxlen = sizeof(nfs_mountpoint_expiry_timeout),
  20. .mode = 0644,
  21. .proc_handler = proc_dointvec_jiffies,
  22. },
  23. {
  24. .procname = "nfs_congestion_kb",
  25. .data = &nfs_congestion_kb,
  26. .maxlen = sizeof(nfs_congestion_kb),
  27. .mode = 0644,
  28. .proc_handler = proc_dointvec,
  29. },
  30. { }
  31. };
  32. static struct ctl_table nfs_cb_sysctl_dir[] = {
  33. {
  34. .procname = "nfs",
  35. .mode = 0555,
  36. .child = nfs_cb_sysctls,
  37. },
  38. { }
  39. };
  40. static struct ctl_table nfs_cb_sysctl_root[] = {
  41. {
  42. .procname = "fs",
  43. .mode = 0555,
  44. .child = nfs_cb_sysctl_dir,
  45. },
  46. { }
  47. };
  48. int nfs_register_sysctl(void)
  49. {
  50. nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
  51. if (nfs_callback_sysctl_table == NULL)
  52. return -ENOMEM;
  53. return 0;
  54. }
  55. void nfs_unregister_sysctl(void)
  56. {
  57. unregister_sysctl_table(nfs_callback_sysctl_table);
  58. nfs_callback_sysctl_table = NULL;
  59. }