sysctl.c 1.4 KB

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