nfs4sysctl.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * linux/fs/nfs/nfs4sysctl.c
  3. *
  4. * Sysctl interface to NFS v4 parameters
  5. *
  6. * Copyright (c) 2006 Trond Myklebust <Trond.Myklebust@netapp.com>
  7. */
  8. #include <linux/sysctl.h>
  9. #include <linux/nfs_idmap.h>
  10. #include <linux/nfs_fs.h>
  11. #include "callback.h"
  12. static const int nfs_set_port_min = 0;
  13. static const int nfs_set_port_max = 65535;
  14. static struct ctl_table_header *nfs4_callback_sysctl_table;
  15. static ctl_table nfs4_cb_sysctls[] = {
  16. {
  17. .procname = "nfs_callback_tcpport",
  18. .data = &nfs_callback_set_tcpport,
  19. .maxlen = sizeof(int),
  20. .mode = 0644,
  21. .proc_handler = proc_dointvec_minmax,
  22. .extra1 = (int *)&nfs_set_port_min,
  23. .extra2 = (int *)&nfs_set_port_max,
  24. },
  25. {
  26. .procname = "idmap_cache_timeout",
  27. .data = &nfs_idmap_cache_timeout,
  28. .maxlen = sizeof(int),
  29. .mode = 0644,
  30. .proc_handler = proc_dointvec_jiffies,
  31. },
  32. { }
  33. };
  34. static ctl_table nfs4_cb_sysctl_dir[] = {
  35. {
  36. .procname = "nfs",
  37. .mode = 0555,
  38. .child = nfs4_cb_sysctls,
  39. },
  40. { }
  41. };
  42. static ctl_table nfs4_cb_sysctl_root[] = {
  43. {
  44. .procname = "fs",
  45. .mode = 0555,
  46. .child = nfs4_cb_sysctl_dir,
  47. },
  48. { }
  49. };
  50. int nfs4_register_sysctl(void)
  51. {
  52. nfs4_callback_sysctl_table = register_sysctl_table(nfs4_cb_sysctl_root);
  53. if (nfs4_callback_sysctl_table == NULL)
  54. return -ENOMEM;
  55. return 0;
  56. }
  57. void nfs4_unregister_sysctl(void)
  58. {
  59. unregister_sysctl_table(nfs4_callback_sysctl_table);
  60. nfs4_callback_sysctl_table = NULL;
  61. }