0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __POLICY_INTERFACE_H
0012 #define __POLICY_INTERFACE_H
0013
0014 #include <linux/list.h>
0015 #include <linux/kref.h>
0016 #include <linux/dcache.h>
0017 #include <linux/workqueue.h>
0018
0019 struct aa_load_ent {
0020 struct list_head list;
0021 struct aa_profile *new;
0022 struct aa_profile *old;
0023 struct aa_profile *rename;
0024 const char *ns_name;
0025 };
0026
0027 void aa_load_ent_free(struct aa_load_ent *ent);
0028 struct aa_load_ent *aa_load_ent_alloc(void);
0029
0030 #define PACKED_FLAG_HAT 1
0031 #define PACKED_FLAG_DEBUG1 2
0032 #define PACKED_FLAG_DEBUG2 4
0033
0034 #define PACKED_MODE_ENFORCE 0
0035 #define PACKED_MODE_COMPLAIN 1
0036 #define PACKED_MODE_KILL 2
0037 #define PACKED_MODE_UNCONFINED 3
0038
0039 struct aa_ns;
0040
0041 enum {
0042 AAFS_LOADDATA_ABI = 0,
0043 AAFS_LOADDATA_REVISION,
0044 AAFS_LOADDATA_HASH,
0045 AAFS_LOADDATA_DATA,
0046 AAFS_LOADDATA_COMPRESSED_SIZE,
0047 AAFS_LOADDATA_DIR,
0048 AAFS_LOADDATA_NDENTS
0049 };
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 struct aa_loaddata {
0061 struct kref count;
0062 struct list_head list;
0063 struct work_struct work;
0064 struct dentry *dents[AAFS_LOADDATA_NDENTS];
0065 struct aa_ns *ns;
0066 char *name;
0067 size_t size;
0068 size_t compressed_size;
0069 long revision;
0070 int abi;
0071 unsigned char *hash;
0072
0073
0074
0075
0076
0077 char *data;
0078 };
0079
0080 int aa_unpack(struct aa_loaddata *udata, struct list_head *lh, const char **ns);
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 static inline struct aa_loaddata *
0093 __aa_get_loaddata(struct aa_loaddata *data)
0094 {
0095 if (data && kref_get_unless_zero(&(data->count)))
0096 return data;
0097
0098 return NULL;
0099 }
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109 static inline struct aa_loaddata *
0110 aa_get_loaddata(struct aa_loaddata *data)
0111 {
0112 struct aa_loaddata *tmp = __aa_get_loaddata(data);
0113
0114 AA_BUG(data && !tmp);
0115
0116 return tmp;
0117 }
0118
0119 void __aa_loaddata_update(struct aa_loaddata *data, long revision);
0120 bool aa_rawdata_eq(struct aa_loaddata *l, struct aa_loaddata *r);
0121 void aa_loaddata_kref(struct kref *kref);
0122 struct aa_loaddata *aa_loaddata_alloc(size_t size);
0123 static inline void aa_put_loaddata(struct aa_loaddata *data)
0124 {
0125 if (data)
0126 kref_put(&data->count, aa_loaddata_kref);
0127 }
0128
0129 #endif