Commit 293a4886 authored by John Johansen's avatar John Johansen

apparmor: add get_dfa() fn

The dfa is currently setup to be shared (has the basis of refcounting)
but currently can't be because the count can't be increased.
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent 474d6b75
...@@ -127,6 +127,21 @@ unsigned int aa_dfa_next(struct aa_dfa *dfa, unsigned int state, ...@@ -127,6 +127,21 @@ unsigned int aa_dfa_next(struct aa_dfa *dfa, unsigned int state,
void aa_dfa_free_kref(struct kref *kref); void aa_dfa_free_kref(struct kref *kref);
/**
* aa_get_dfa - increment refcount on dfa @p
* @dfa: dfa (MAYBE NULL)
*
* Returns: pointer to @dfa if @dfa is NULL will return NULL
* Requires: @dfa must be held with valid refcount when called
*/
static inline struct aa_dfa *aa_get_dfa(struct aa_dfa *dfa)
{
if (dfa)
kref_get(&(dfa->count));
return dfa;
}
/** /**
* aa_put_dfa - put a dfa refcount * aa_put_dfa - put a dfa refcount
* @dfa: dfa to put refcount (MAYBE NULL) * @dfa: dfa to put refcount (MAYBE NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment