blob: 7ea4769fab3f7785c056dc0cd60e6a8f1b606c98 [file] [log] [blame]
John Johansen63e2b422010-07-29 14:48:03 -07001/*
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
15#ifndef __AA_APPARMORFS_H
16#define __AA_APPARMORFS_H
17
Kees Cook9acd4942012-01-26 16:29:20 -080018enum aa_fs_type {
Kees Cooke74abcf2012-01-26 16:29:21 -080019 AA_FS_TYPE_BOOLEAN,
Kees Cooka9bf8e92012-01-26 16:29:22 -080020 AA_FS_TYPE_STRING,
Kees Cooke74abcf2012-01-26 16:29:21 -080021 AA_FS_TYPE_U64,
Kees Cook9acd4942012-01-26 16:29:20 -080022 AA_FS_TYPE_FOPS,
23 AA_FS_TYPE_DIR,
24};
25
26struct aa_fs_entry;
27
28struct aa_fs_entry {
29 const char *name;
30 struct dentry *dentry;
31 umode_t mode;
32 enum aa_fs_type v_type;
33 union {
Kees Cooke74abcf2012-01-26 16:29:21 -080034 bool boolean;
Kees Cooka9bf8e92012-01-26 16:29:22 -080035 char *string;
Kees Cooke74abcf2012-01-26 16:29:21 -080036 unsigned long u64;
Kees Cook9acd4942012-01-26 16:29:20 -080037 struct aa_fs_entry *files;
38 } v;
39 const struct file_operations *file_ops;
40};
41
Kees Cooke74abcf2012-01-26 16:29:21 -080042extern const struct file_operations aa_fs_seq_file_ops;
43
44#define AA_FS_FILE_BOOLEAN(_name, _value) \
45 { .name = (_name), .mode = 0444, \
46 .v_type = AA_FS_TYPE_BOOLEAN, .v.boolean = (_value), \
47 .file_ops = &aa_fs_seq_file_ops }
Kees Cooka9bf8e92012-01-26 16:29:22 -080048#define AA_FS_FILE_STRING(_name, _value) \
49 { .name = (_name), .mode = 0444, \
50 .v_type = AA_FS_TYPE_STRING, .v.string = (_value), \
51 .file_ops = &aa_fs_seq_file_ops }
Kees Cooke74abcf2012-01-26 16:29:21 -080052#define AA_FS_FILE_U64(_name, _value) \
53 { .name = (_name), .mode = 0444, \
54 .v_type = AA_FS_TYPE_U64, .v.u64 = (_value), \
55 .file_ops = &aa_fs_seq_file_ops }
Kees Cook9acd4942012-01-26 16:29:20 -080056#define AA_FS_FILE_FOPS(_name, _mode, _fops) \
57 { .name = (_name), .v_type = AA_FS_TYPE_FOPS, \
58 .mode = (_mode), .file_ops = (_fops) }
59#define AA_FS_DIR(_name, _value) \
60 { .name = (_name), .v_type = AA_FS_TYPE_DIR, .v.files = (_value) }
61
John Johansen63e2b422010-07-29 14:48:03 -070062extern void __init aa_destroy_aafs(void);
63
64#endif /* __AA_APPARMORFS_H */