函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:security\apparmor\include\lib.h Create Date:2022-07-27 21:18:47
首页 Copyright©Brick

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/**
 * __policy_strn_find - find a policy that's name matches @len chars of @str
 * @head: list to search  (NOT NULL)
 * @str: string to search for  (NOT NULL)
 * @len: length of match required
 *
 * Requires: rcu_read_lock be held
 *
 * Returns: unrefcounted policy that match @str or NULL if not found
 *
 * if @len == strlen(@strlen) then this is equiv to __policy_find
 * other wise it allows searching for policy by a partial match of name
 */
static inline struct aa_policy *__policy_strn_find(struct list_head *head,
                        const char *str, int len)
{
    struct aa_policy *policy;
 
    list_for_each_entry_rcu(policy, head, list) {
        if (aa_strneq(policy->name, str, len))
            return policy;
    }
 
    return NULL;
}