Lines Matching full:policy
3 * NETLINK Policy advertisement to userspace
22 const struct nla_policy *policy; member
28 const struct nla_policy *policy, in add_policy() argument
34 if (!policy || !maxtype) in add_policy()
38 if (state->policies[i].policy == policy && in add_policy()
42 if (!state->policies[i].policy) { in add_policy()
43 state->policies[i].policy = policy; in add_policy()
58 state->policies[state->n_alloc].policy = policy; in add_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, in netlink_policy_dump_get_policy_idx() argument
87 if (WARN_ON(!policy || !maxtype)) in netlink_policy_dump_get_policy_idx()
91 if (state->policies[i].policy == policy && in netlink_policy_dump_get_policy_idx()
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, in netlink_policy_dump_add_policy() argument
145 err = add_policy(&state, policy, maxtype); in netlink_policy_dump_add_policy()
150 policy_idx < state->n_alloc && state->policies[policy_idx].policy; in netlink_policy_dump_add_policy()
152 const struct nla_policy *policy; in netlink_policy_dump_add_policy() local
155 policy = state->policies[policy_idx].policy; in netlink_policy_dump_add_policy()
160 switch (policy[type].type) { in netlink_policy_dump_add_policy()
164 policy[type].nested_policy, in netlink_policy_dump_add_policy()
165 policy[type].len); in netlink_policy_dump_add_policy()
193 !state->policies[state->policy_idx].policy; in netlink_policy_dump_finished()
198 * @state: the policy dump state
221 /* common, policy idx, policy maxattr */ in netlink_policy_dump_attr_size_estimate()
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; in netlink_policy_dump_write() local
432 pt = &state->policies[state->policy_idx].policy[state->attr_idx]; in netlink_policy_dump_write()
434 policy = nla_nest_start(skb, state->policy_idx); in netlink_policy_dump_write()
435 if (!policy) in netlink_policy_dump_write()
440 nla_nest_cancel(skb, policy); in netlink_policy_dump_write()
448 nla_nest_end(skb, policy); in netlink_policy_dump_write()
466 nla_nest_cancel(skb, policy); in netlink_policy_dump_write()
471 * netlink_policy_dump_free - free policy dump state
472 * @state: the policy dump state to free