1
2
3
4
5
6
7
8
9
10
11#ifndef __POLICY_INTERFACE_H
12#define __POLICY_INTERFACE_H
13
14#include <linux/list.h>
15#include <linux/kref.h>
16#include <linux/dcache.h>
17#include <linux/workqueue.h>
18
19struct aa_load_ent {
20 struct list_head list;
21 struct aa_profile *new;
22 struct aa_profile *old;
23 struct aa_profile *rename;
24 const char *ns_name;
25};
26
27void aa_load_ent_free(struct aa_load_ent *ent);
28struct aa_load_ent *aa_load_ent_alloc(void);
29
30#define PACKED_FLAG_HAT 1
31
32#define PACKED_MODE_ENFORCE 0
33#define PACKED_MODE_COMPLAIN 1
34#define PACKED_MODE_KILL 2
35#define PACKED_MODE_UNCONFINED 3
36
37struct aa_ns;
38
39enum {
40 AAFS_LOADDATA_ABI = 0,
41 AAFS_LOADDATA_REVISION,
42 AAFS_LOADDATA_HASH,
43 AAFS_LOADDATA_DATA,
44 AAFS_LOADDATA_COMPRESSED_SIZE,
45 AAFS_LOADDATA_DIR,
46 AAFS_LOADDATA_NDENTS
47};
48
49
50
51
52
53
54
55
56
57
58struct aa_loaddata {
59 struct kref count;
60 struct list_head list;
61 struct work_struct work;
62 struct dentry *dents[AAFS_LOADDATA_NDENTS];
63 struct aa_ns *ns;
64 char *name;
65 size_t size;
66 size_t compressed_size;
67 long revision;
68 int abi;
69 unsigned char *hash;
70
71
72
73
74
75 char *data;
76};
77
78int aa_unpack(struct aa_loaddata *udata, struct list_head *lh, const char **ns);
79
80
81
82
83
84
85
86
87
88
89
90static inline struct aa_loaddata *
91__aa_get_loaddata(struct aa_loaddata *data)
92{
93 if (data && kref_get_unless_zero(&(data->count)))
94 return data;
95
96 return NULL;
97}
98
99
100
101
102
103
104
105
106
107static inline struct aa_loaddata *
108aa_get_loaddata(struct aa_loaddata *data)
109{
110 struct aa_loaddata *tmp = __aa_get_loaddata(data);
111
112 AA_BUG(data && !tmp);
113
114 return tmp;
115}
116
117void __aa_loaddata_update(struct aa_loaddata *data, long revision);
118bool aa_rawdata_eq(struct aa_loaddata *l, struct aa_loaddata *r);
119void aa_loaddata_kref(struct kref *kref);
120struct aa_loaddata *aa_loaddata_alloc(size_t size);
121static inline void aa_put_loaddata(struct aa_loaddata *data)
122{
123 if (data)
124 kref_put(&data->count, aa_loaddata_kref);
125}
126
127#endif
128