apparmorfs.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * AppArmor security module
  3. *
  4. * This file contains AppArmor filesystem definitions.
  5. *
  6. * Copyright (C) 1998-2008 Novell/SUSE
  7. * Copyright 2009-2010 Canonical Ltd.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation, version 2 of the
  12. * License.
  13. */
  14. #ifndef __AA_APPARMORFS_H
  15. #define __AA_APPARMORFS_H
  16. enum aa_fs_type {
  17. AA_FS_TYPE_BOOLEAN,
  18. AA_FS_TYPE_STRING,
  19. AA_FS_TYPE_U64,
  20. AA_FS_TYPE_FOPS,
  21. AA_FS_TYPE_DIR,
  22. };
  23. struct aa_fs_entry;
  24. struct aa_fs_entry {
  25. const char *name;
  26. struct dentry *dentry;
  27. umode_t mode;
  28. enum aa_fs_type v_type;
  29. union {
  30. bool boolean;
  31. char *string;
  32. unsigned long u64;
  33. struct aa_fs_entry *files;
  34. } v;
  35. const struct file_operations *file_ops;
  36. };
  37. extern const struct file_operations aa_fs_seq_file_ops;
  38. #define AA_FS_FILE_BOOLEAN(_name, _value) \
  39. { .name = (_name), .mode = 0444, \
  40. .v_type = AA_FS_TYPE_BOOLEAN, .v.boolean = (_value), \
  41. .file_ops = &aa_fs_seq_file_ops }
  42. #define AA_FS_FILE_STRING(_name, _value) \
  43. { .name = (_name), .mode = 0444, \
  44. .v_type = AA_FS_TYPE_STRING, .v.string = (_value), \
  45. .file_ops = &aa_fs_seq_file_ops }
  46. #define AA_FS_FILE_U64(_name, _value) \
  47. { .name = (_name), .mode = 0444, \
  48. .v_type = AA_FS_TYPE_U64, .v.u64 = (_value), \
  49. .file_ops = &aa_fs_seq_file_ops }
  50. #define AA_FS_FILE_FOPS(_name, _mode, _fops) \
  51. { .name = (_name), .v_type = AA_FS_TYPE_FOPS, \
  52. .mode = (_mode), .file_ops = (_fops) }
  53. #define AA_FS_DIR(_name, _value) \
  54. { .name = (_name), .v_type = AA_FS_TYPE_DIR, .v.files = (_value) }
  55. extern void __init aa_destroy_aafs(void);
  56. #endif /* __AA_APPARMORFS_H */