nfs4sysctl.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 = 0;
  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. }