]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - security/apparmor/include/policy_unpack.h
apparmor: allow introspecting the loaded policy pre internal transform
[mirror_ubuntu-artful-kernel.git] / security / apparmor / include / policy_unpack.h
CommitLineData
736ec752
JJ
1/*
2 * AppArmor security module
3 *
4 * This file contains AppArmor policy loading interface function 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 __POLICY_INTERFACE_H
16#define __POLICY_INTERFACE_H
17
dd51c848 18#include <linux/list.h>
5ac8c355 19#include <linux/kref.h>
dd51c848
JJ
20
21struct aa_load_ent {
22 struct list_head list;
23 struct aa_profile *new;
24 struct aa_profile *old;
25 struct aa_profile *rename;
26};
27
28void aa_load_ent_free(struct aa_load_ent *ent);
29struct aa_load_ent *aa_load_ent_alloc(void);
30
03816507
JJ
31#define PACKED_FLAG_HAT 1
32
33#define PACKED_MODE_ENFORCE 0
34#define PACKED_MODE_COMPLAIN 1
35#define PACKED_MODE_KILL 2
36#define PACKED_MODE_UNCONFINED 3
37
5ac8c355
JJ
38/* struct aa_loaddata - buffer of policy load data set */
39struct aa_loaddata {
40 struct kref count;
41 size_t size;
42 int abi;
43 unsigned char *hash;
44 char data[];
45};
46
47int aa_unpack(struct aa_loaddata *udata, struct list_head *lh, const char **ns);
48
49static inline struct aa_loaddata *
50aa_get_loaddata(struct aa_loaddata *data)
51{
52 if (data)
53 kref_get(&(data->count));
54 return data;
55}
56
57void aa_loaddata_kref(struct kref *kref);
58static inline void aa_put_loaddata(struct aa_loaddata *data)
59{
60 if (data)
61 kref_put(&data->count, aa_loaddata_kref);
62}
736ec752
JJ
63
64#endif /* __POLICY_INTERFACE_H */