lib.h (b91deb9db12851c18ccb55719f1cd55c2400aca1) lib.h (a1bd627b46d169268a0ee5960899fb5be960a317)
1/*
2 * AppArmor security module
3 *
4 * This file contains AppArmor lib definitions
5 *
6 * 2017 Canonical Ltd.
7 *
8 * This program is free software; you can redistribute it and/or

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

95 return aa_dfa_next(dfa, start, 0);
96}
97
98static inline bool path_mediated_fs(struct dentry *dentry)
99{
100 return !(dentry->d_sb->s_flags & MS_NOUSER);
101}
102
1/*
2 * AppArmor security module
3 *
4 * This file contains AppArmor lib definitions
5 *
6 * 2017 Canonical Ltd.
7 *
8 * This program is free software; you can redistribute it and/or

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

95 return aa_dfa_next(dfa, start, 0);
96}
97
98static inline bool path_mediated_fs(struct dentry *dentry)
99{
100 return !(dentry->d_sb->s_flags & MS_NOUSER);
101}
102
103
104struct counted_str {
105 struct kref count;
106 char name[];
107};
108
109#define str_to_counted(str) \
110 ((struct counted_str *)(str - offsetof(struct counted_str, name)))
111
112#define __counted /* atm just a notation */
113
114void aa_str_kref(struct kref *kref);
115char *aa_str_alloc(int size, gfp_t gfp);
116
117
118static inline __counted char *aa_get_str(__counted char *str)
119{
120 if (str)
121 kref_get(&(str_to_counted(str)->count));
122
123 return str;
124}
125
126static inline void aa_put_str(__counted char *str)
127{
128 if (str)
129 kref_put(&str_to_counted(str)->count, aa_str_kref);
130}
131
132
103/* struct aa_policy - common part of both namespaces and profiles
104 * @name: name of the object
105 * @hname - The hierarchical name
106 * @list: list policy object is on
107 * @profiles: head of the profiles list contained in the object
108 */
109struct aa_policy {
110 const char *name;
133/* struct aa_policy - common part of both namespaces and profiles
134 * @name: name of the object
135 * @hname - The hierarchical name
136 * @list: list policy object is on
137 * @profiles: head of the profiles list contained in the object
138 */
139struct aa_policy {
140 const char *name;
111 const char *hname;
141 __counted char *hname;
112 struct list_head list;
113 struct list_head profiles;
114};
115
116/**
117 * basename - find the last component of an hname
118 * @name: hname to find the base profile name component of (NOT NULL)
119 *

--- 65 unchanged lines hidden ---
142 struct list_head list;
143 struct list_head profiles;
144};
145
146/**
147 * basename - find the last component of an hname
148 * @name: hname to find the base profile name component of (NOT NULL)
149 *

--- 65 unchanged lines hidden ---