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()
60 state->policies[old_n_alloc].policy = policy; in add_policy()
68 * netlink_policy_dump_get_policy_idx - retrieve policy index
69 * @state: the policy dump state
70 * @policy: the policy to find
71 * @maxtype: the policy's maxattr
73 * Returns: the index of the given policy in the dump state
75 * Call this to find a policy index when you've added multiple and e.g.
76 * need to tell userspace which command has which policy (by index).
78 * Note: this will WARN and return 0 if the policy isn't found, which
83 const struct nla_policy *policy, in netlink_policy_dump_get_policy_idx() argument
88 if (WARN_ON(!policy || !maxtype)) in netlink_policy_dump_get_policy_idx()
92 if (state->policies[i].policy == policy && in netlink_policy_dump_get_policy_idx()
115 * netlink_policy_dump_add_policy - add a policy to the dump
117 * @policy: the new policy to add to the dump
118 * @maxtype: the new policy's max attr type
122 * Call this to allocate a policy dump state, and to add policies to it. This
128 const struct nla_policy *policy, in netlink_policy_dump_add_policy() argument
146 err = add_policy(&state, policy, maxtype); in netlink_policy_dump_add_policy()
151 policy_idx < state->n_alloc && state->policies[policy_idx].policy; in netlink_policy_dump_add_policy()
153 const struct nla_policy *policy; in netlink_policy_dump_add_policy() local
156 policy = state->policies[policy_idx].policy; in netlink_policy_dump_add_policy()
161 switch (policy[type].type) { in netlink_policy_dump_add_policy()
165 policy[type].nested_policy, in netlink_policy_dump_add_policy()
166 policy[type].len); in netlink_policy_dump_add_policy()
194 !state->policies[state->policy_idx].policy; in netlink_policy_dump_finished()
199 * @state: the policy dump state
222 /* common, policy idx, policy maxattr */ in netlink_policy_dump_attr_size_estimate()
407 * netlink_policy_dump_write_attr - write a given attribute policy
409 * @pt: the attribute's policy
413 * special, indicating that there's no policy data and
424 * netlink_policy_dump_write - write current policy dump attributes
426 * @state: the policy dump state
434 struct nlattr *policy; in netlink_policy_dump_write() local
441 pt = &state->policies[state->policy_idx].policy[state->attr_idx]; in netlink_policy_dump_write()
443 policy = nla_nest_start(skb, state->policy_idx); in netlink_policy_dump_write()
444 if (!policy) in netlink_policy_dump_write()
449 nla_nest_cancel(skb, policy); in netlink_policy_dump_write()
457 nla_nest_end(skb, policy); in netlink_policy_dump_write()
475 nla_nest_cancel(skb, policy); in netlink_policy_dump_write()
480 * netlink_policy_dump_free - free policy dump state
481 * @state: the policy dump state to free