Lines Matching refs:policy
22 const struct nla_policy *policy;
28 const struct nla_policy *policy,
34 if (!policy || !maxtype)
38 if (state->policies[i].policy == policy &&
42 if (!state->policies[i].policy) {
43 state->policies[i].policy = policy;
58 state->policies[state->n_alloc].policy = policy;
67 * netlink_policy_dump_get_policy_idx - retrieve policy index
68 * @state: the policy dump state
69 * @policy: the policy to find
70 * @maxtype: the policy's maxattr
72 * Returns: the index of the given policy in the dump state
74 * Call this to find a policy index when you've added multiple and e.g.
75 * need to tell userspace which command has which policy (by index).
77 * Note: this will WARN and return 0 if the policy isn't found, which
82 const struct nla_policy *policy,
87 if (WARN_ON(!policy || !maxtype))
91 if (state->policies[i].policy == policy &&
114 * netlink_policy_dump_add_policy - add a policy to the dump
116 * @policy: the new policy to add to the dump
117 * @maxtype: the new policy's max attr type
121 * Call this to allocate a policy dump state, and to add policies to it. This
127 const struct nla_policy *policy,
145 err = add_policy(&state, policy, maxtype);
150 policy_idx < state->n_alloc && state->policies[policy_idx].policy;
152 const struct nla_policy *policy;
155 policy = state->policies[policy_idx].policy;
160 switch (policy[type].type) {
164 policy[type].nested_policy,
165 policy[type].len);
193 !state->policies[state->policy_idx].policy;
198 * @state: the policy dump state
221 /* common, policy idx, policy maxattr */
398 * netlink_policy_dump_write_attr - write a given attribute policy
400 * @pt: the attribute's policy
404 * special, indicating that there's no policy data and
415 * netlink_policy_dump_write - write current policy dump attributes
417 * @state: the policy dump state
425 struct nlattr *policy;
432 pt = &state->policies[state->policy_idx].policy[state->attr_idx];
434 policy = nla_nest_start(skb, state->policy_idx);
435 if (!policy)
440 nla_nest_cancel(skb, policy);
448 nla_nest_end(skb, policy);
466 nla_nest_cancel(skb, policy);
471 * netlink_policy_dump_free - free policy dump state
472 * @state: the policy dump state to free