sysctl.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Key management controls
  2. *
  3. * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <linux/key.h>
  12. #include <linux/sysctl.h>
  13. #include "internal.h"
  14. static const int zero, one = 1, max = INT_MAX;
  15. struct ctl_table key_sysctls[] = {
  16. {
  17. .procname = "maxkeys",
  18. .data = &key_quota_maxkeys,
  19. .maxlen = sizeof(unsigned),
  20. .mode = 0644,
  21. .proc_handler = proc_dointvec_minmax,
  22. .extra1 = (void *) &one,
  23. .extra2 = (void *) &max,
  24. },
  25. {
  26. .procname = "maxbytes",
  27. .data = &key_quota_maxbytes,
  28. .maxlen = sizeof(unsigned),
  29. .mode = 0644,
  30. .proc_handler = proc_dointvec_minmax,
  31. .extra1 = (void *) &one,
  32. .extra2 = (void *) &max,
  33. },
  34. {
  35. .procname = "root_maxkeys",
  36. .data = &key_quota_root_maxkeys,
  37. .maxlen = sizeof(unsigned),
  38. .mode = 0644,
  39. .proc_handler = proc_dointvec_minmax,
  40. .extra1 = (void *) &one,
  41. .extra2 = (void *) &max,
  42. },
  43. {
  44. .procname = "root_maxbytes",
  45. .data = &key_quota_root_maxbytes,
  46. .maxlen = sizeof(unsigned),
  47. .mode = 0644,
  48. .proc_handler = proc_dointvec_minmax,
  49. .extra1 = (void *) &one,
  50. .extra2 = (void *) &max,
  51. },
  52. {
  53. .procname = "gc_delay",
  54. .data = &key_gc_delay,
  55. .maxlen = sizeof(unsigned),
  56. .mode = 0644,
  57. .proc_handler = proc_dointvec_minmax,
  58. .extra1 = (void *) &zero,
  59. .extra2 = (void *) &max,
  60. },
  61. #ifdef CONFIG_PERSISTENT_KEYRINGS
  62. {
  63. .procname = "persistent_keyring_expiry",
  64. .data = &persistent_keyring_expiry,
  65. .maxlen = sizeof(unsigned),
  66. .mode = 0644,
  67. .proc_handler = proc_dointvec_minmax,
  68. .extra1 = (void *) &zero,
  69. .extra2 = (void *) &max,
  70. },
  71. #endif
  72. { }
  73. };