sysctl.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #ifdef CONFIG_SYSCTL
  13. static struct ctl_table_header *fs_table_header;
  14. static struct ctl_table coda_table[] = {
  15. {
  16. .procname = "timeout",
  17. .data = &coda_timeout,
  18. .maxlen = sizeof(int),
  19. .mode = 0644,
  20. .proc_handler = proc_dointvec
  21. },
  22. {
  23. .procname = "hard",
  24. .data = &coda_hard,
  25. .maxlen = sizeof(int),
  26. .mode = 0644,
  27. .proc_handler = proc_dointvec
  28. },
  29. {
  30. .procname = "fake_statfs",
  31. .data = &coda_fake_statfs,
  32. .maxlen = sizeof(int),
  33. .mode = 0600,
  34. .proc_handler = proc_dointvec
  35. },
  36. {}
  37. };
  38. static struct ctl_table fs_table[] = {
  39. {
  40. .procname = "coda",
  41. .mode = 0555,
  42. .child = coda_table
  43. },
  44. {}
  45. };
  46. void coda_sysctl_init(void)
  47. {
  48. if ( !fs_table_header )
  49. fs_table_header = register_sysctl_table(fs_table);
  50. }
  51. void coda_sysctl_clean(void)
  52. {
  53. if ( fs_table_header ) {
  54. unregister_sysctl_table(fs_table_header);
  55. fs_table_header = NULL;
  56. }
  57. }
  58. #else
  59. void coda_sysctl_init(void)
  60. {
  61. }
  62. void coda_sysctl_clean(void)
  63. {
  64. }
  65. #endif