nfs4sysctl.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_fs.h>
  10. #include "nfs4_fs.h"
  11. #include "nfs4idmap.h"
  12. #include "callback.h"
  13. static const int nfs_set_port_min;
  14. static const int nfs_set_port_max = 65535;
  15. static struct ctl_table_header *nfs4_callback_sysctl_table;
  16. static struct ctl_table nfs4_cb_sysctls[] = {
  17. {
  18. .procname = "nfs_callback_tcpport",
  19. .data = &nfs_callback_set_tcpport,
  20. .maxlen = sizeof(int),
  21. .mode = 0644,
  22. .proc_handler = proc_dointvec_minmax,
  23. .extra1 = (int *)&nfs_set_port_min,
  24. .extra2 = (int *)&nfs_set_port_max,
  25. },
  26. {
  27. .procname = "idmap_cache_timeout",
  28. .data = &nfs_idmap_cache_timeout,
  29. .maxlen = sizeof(int),
  30. .mode = 0644,
  31. .proc_handler = proc_dointvec,
  32. },
  33. { }
  34. };
  35. static struct ctl_table nfs4_cb_sysctl_dir[] = {
  36. {
  37. .procname = "nfs",
  38. .mode = 0555,
  39. .child = nfs4_cb_sysctls,
  40. },
  41. { }
  42. };
  43. static struct ctl_table nfs4_cb_sysctl_root[] = {
  44. {
  45. .procname = "fs",
  46. .mode = 0555,
  47. .child = nfs4_cb_sysctl_dir,
  48. },
  49. { }
  50. };
  51. int nfs4_register_sysctl(void)
  52. {
  53. nfs4_callback_sysctl_table = register_sysctl_table(nfs4_cb_sysctl_root);
  54. if (nfs4_callback_sysctl_table == NULL)
  55. return -ENOMEM;
  56. return 0;
  57. }
  58. void nfs4_unregister_sysctl(void)
  59. {
  60. unregister_sysctl_table(nfs4_callback_sysctl_table);
  61. nfs4_callback_sysctl_table = NULL;
  62. }