sysctl.c 1.3 KB

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