nfs4sysctl.c 1.4 KB

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