sysctl.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Sysctl operations for Coda filesystem
  4. * Original version: (C) 1996 P. Braam and M. Callahan
  5. * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
  6. *
  7. * Carnegie Mellon encourages users to contribute improvements to
  8. * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
  9. */
  10. #include <linux/sysctl.h>
  11. #include "coda_int.h"
  12. static struct ctl_table_header *fs_table_header;
  13. static struct ctl_table coda_table[] = {
  14. {
  15. .procname = "timeout",
  16. .data = &coda_timeout,
  17. .maxlen = sizeof(int),
  18. .mode = 0644,
  19. .proc_handler = proc_dointvec
  20. },
  21. {
  22. .procname = "hard",
  23. .data = &coda_hard,
  24. .maxlen = sizeof(int),
  25. .mode = 0644,
  26. .proc_handler = proc_dointvec
  27. },
  28. {
  29. .procname = "fake_statfs",
  30. .data = &coda_fake_statfs,
  31. .maxlen = sizeof(int),
  32. .mode = 0600,
  33. .proc_handler = proc_dointvec
  34. },
  35. {}
  36. };
  37. static struct ctl_table fs_table[] = {
  38. {
  39. .procname = "coda",
  40. .mode = 0555,
  41. .child = coda_table
  42. },
  43. {}
  44. };
  45. void coda_sysctl_init(void)
  46. {
  47. if ( !fs_table_header )
  48. fs_table_header = register_sysctl_table(fs_table);
  49. }
  50. void coda_sysctl_clean(void)
  51. {
  52. if ( fs_table_header ) {
  53. unregister_sysctl_table(fs_table_header);
  54. fs_table_header = NULL;
  55. }
  56. }