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