apparmorfs.h (5d5182cae40115c03933989473288e54afb39c7c) apparmorfs.h (c97204baf840bf850e14ef4f5f43251239ca43b6)
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
15#ifndef __AA_APPARMORFS_H
16#define __AA_APPARMORFS_H
17
18extern struct path aa_null;
19
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
15#ifndef __AA_APPARMORFS_H
16#define __AA_APPARMORFS_H
17
18extern struct path aa_null;
19
20enum aa_fs_type {
21 AA_FS_TYPE_BOOLEAN,
22 AA_FS_TYPE_STRING,
23 AA_FS_TYPE_U64,
24 AA_FS_TYPE_FOPS,
25 AA_FS_TYPE_DIR,
20enum aa_sfs_type {
21 AA_SFS_TYPE_BOOLEAN,
22 AA_SFS_TYPE_STRING,
23 AA_SFS_TYPE_U64,
24 AA_SFS_TYPE_FOPS,
25 AA_SFS_TYPE_DIR,
26};
27
26};
27
28struct aa_fs_entry;
28struct aa_sfs_entry;
29
29
30struct aa_fs_entry {
30struct aa_sfs_entry {
31 const char *name;
32 struct dentry *dentry;
33 umode_t mode;
31 const char *name;
32 struct dentry *dentry;
33 umode_t mode;
34 enum aa_fs_type v_type;
34 enum aa_sfs_type v_type;
35 union {
36 bool boolean;
37 char *string;
38 unsigned long u64;
35 union {
36 bool boolean;
37 char *string;
38 unsigned long u64;
39 struct aa_fs_entry *files;
39 struct aa_sfs_entry *files;
40 } v;
41 const struct file_operations *file_ops;
42};
43
40 } v;
41 const struct file_operations *file_ops;
42};
43
44extern const struct file_operations aa_fs_seq_file_ops;
44extern const struct file_operations aa_sfs_seq_file_ops;
45
45
46#define AA_FS_FILE_BOOLEAN(_name, _value) \
46#define AA_SFS_FILE_BOOLEAN(_name, _value) \
47 { .name = (_name), .mode = 0444, \
47 { .name = (_name), .mode = 0444, \
48 .v_type = AA_FS_TYPE_BOOLEAN, .v.boolean = (_value), \
49 .file_ops = &aa_fs_seq_file_ops }
50#define AA_FS_FILE_STRING(_name, _value) \
48 .v_type = AA_SFS_TYPE_BOOLEAN, .v.boolean = (_value), \
49 .file_ops = &aa_sfs_seq_file_ops }
50#define AA_SFS_FILE_STRING(_name, _value) \
51 { .name = (_name), .mode = 0444, \
51 { .name = (_name), .mode = 0444, \
52 .v_type = AA_FS_TYPE_STRING, .v.string = (_value), \
53 .file_ops = &aa_fs_seq_file_ops }
54#define AA_FS_FILE_U64(_name, _value) \
52 .v_type = AA_SFS_TYPE_STRING, .v.string = (_value), \
53 .file_ops = &aa_sfs_seq_file_ops }
54#define AA_SFS_FILE_U64(_name, _value) \
55 { .name = (_name), .mode = 0444, \
55 { .name = (_name), .mode = 0444, \
56 .v_type = AA_FS_TYPE_U64, .v.u64 = (_value), \
57 .file_ops = &aa_fs_seq_file_ops }
58#define AA_FS_FILE_FOPS(_name, _mode, _fops) \
59 { .name = (_name), .v_type = AA_FS_TYPE_FOPS, \
56 .v_type = AA_SFS_TYPE_U64, .v.u64 = (_value), \
57 .file_ops = &aa_sfs_seq_file_ops }
58#define AA_SFS_FILE_FOPS(_name, _mode, _fops) \
59 { .name = (_name), .v_type = AA_SFS_TYPE_FOPS, \
60 .mode = (_mode), .file_ops = (_fops) }
60 .mode = (_mode), .file_ops = (_fops) }
61#define AA_FS_DIR(_name, _value) \
62 { .name = (_name), .v_type = AA_FS_TYPE_DIR, .v.files = (_value) }
61#define AA_SFS_DIR(_name, _value) \
62 { .name = (_name), .v_type = AA_SFS_TYPE_DIR, .v.files = (_value) }
63
64extern void __init aa_destroy_aafs(void);
65
66struct aa_profile;
67struct aa_ns;
68
69enum aafs_ns_type {
70 AAFS_NS_DIR,

--- 31 unchanged lines hidden (view full) ---

102#define ns_subload(X) ((X)->dents[AAFS_NS_LOAD])
103#define ns_subreplace(X) ((X)->dents[AAFS_NS_REPLACE])
104#define ns_subremove(X) ((X)->dents[AAFS_NS_REMOVE])
105
106#define prof_dir(X) ((X)->dents[AAFS_PROF_DIR])
107#define prof_child_dir(X) ((X)->dents[AAFS_PROF_PROFS])
108
109void __aa_bump_ns_revision(struct aa_ns *ns);
63
64extern void __init aa_destroy_aafs(void);
65
66struct aa_profile;
67struct aa_ns;
68
69enum aafs_ns_type {
70 AAFS_NS_DIR,

--- 31 unchanged lines hidden (view full) ---

102#define ns_subload(X) ((X)->dents[AAFS_NS_LOAD])
103#define ns_subreplace(X) ((X)->dents[AAFS_NS_REPLACE])
104#define ns_subremove(X) ((X)->dents[AAFS_NS_REMOVE])
105
106#define prof_dir(X) ((X)->dents[AAFS_PROF_DIR])
107#define prof_child_dir(X) ((X)->dents[AAFS_PROF_PROFS])
108
109void __aa_bump_ns_revision(struct aa_ns *ns);
110void __aa_fs_profile_rmdir(struct aa_profile *profile);
111void __aa_fs_profile_migrate_dents(struct aa_profile *old,
110void __aafs_profile_rmdir(struct aa_profile *profile);
111void __aafs_profile_migrate_dents(struct aa_profile *old,
112 struct aa_profile *new);
112 struct aa_profile *new);
113int __aa_fs_profile_mkdir(struct aa_profile *profile, struct dentry *parent);
114void __aa_fs_ns_rmdir(struct aa_ns *ns);
115int __aa_fs_ns_mkdir(struct aa_ns *ns, struct dentry *parent,
113int __aafs_profile_mkdir(struct aa_profile *profile, struct dentry *parent);
114void __aafs_ns_rmdir(struct aa_ns *ns);
115int __aafs_ns_mkdir(struct aa_ns *ns, struct dentry *parent,
116 const char *name);
117
118struct aa_loaddata;
119void __aa_fs_remove_rawdata(struct aa_loaddata *rawdata);
120int __aa_fs_create_rawdata(struct aa_ns *ns, struct aa_loaddata *rawdata);
121
122#endif /* __AA_APPARMORFS_H */
116 const char *name);
117
118struct aa_loaddata;
119void __aa_fs_remove_rawdata(struct aa_loaddata *rawdata);
120int __aa_fs_create_rawdata(struct aa_ns *ns, struct aa_loaddata *rawdata);
121
122#endif /* __AA_APPARMORFS_H */