mirror of https://github.com/torvalds/linux.git
netlink: introduce typedef for filter function
Make the code using filter function a bit nicer by consolidating the filter function arguments using typedef. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
a731132424
commit
403863e985
|
|
@ -59,8 +59,7 @@ static int cn_already_initialized;
|
||||||
* both, or if both are zero then the group is looked up and sent there.
|
* both, or if both are zero then the group is looked up and sent there.
|
||||||
*/
|
*/
|
||||||
int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 __group,
|
int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 __group,
|
||||||
gfp_t gfp_mask,
|
gfp_t gfp_mask, netlink_filter_fn filter,
|
||||||
int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
|
|
||||||
void *filter_data)
|
void *filter_data)
|
||||||
{
|
{
|
||||||
struct cn_callback_entry *__cbq;
|
struct cn_callback_entry *__cbq;
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,7 @@ void cn_del_callback(const struct cb_id *id);
|
||||||
*/
|
*/
|
||||||
int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid,
|
int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid,
|
||||||
u32 group, gfp_t gfp_mask,
|
u32 group, gfp_t gfp_mask,
|
||||||
int (*filter)(struct sock *dsk, struct sk_buff *skb,
|
netlink_filter_fn filter,
|
||||||
void *data),
|
|
||||||
void *filter_data);
|
void *filter_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -228,10 +228,12 @@ bool netlink_strict_get_check(struct sk_buff *skb);
|
||||||
int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
|
int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
|
||||||
int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
|
int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
|
||||||
__u32 group, gfp_t allocation);
|
__u32 group, gfp_t allocation);
|
||||||
|
|
||||||
|
typedef int (*netlink_filter_fn)(struct sock *dsk, struct sk_buff *skb, void *data);
|
||||||
|
|
||||||
int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
|
int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
|
||||||
__u32 portid, __u32 group, gfp_t allocation,
|
__u32 portid, __u32 group, gfp_t allocation,
|
||||||
int (*filter)(struct sock *dsk,
|
netlink_filter_fn filter,
|
||||||
struct sk_buff *skb, void *data),
|
|
||||||
void *filter_data);
|
void *filter_data);
|
||||||
int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code);
|
int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code);
|
||||||
int netlink_register_notifier(struct notifier_block *nb);
|
int netlink_register_notifier(struct notifier_block *nb);
|
||||||
|
|
|
||||||
|
|
@ -1519,8 +1519,7 @@ static void do_one_broadcast(struct sock *sk,
|
||||||
int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
|
int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
|
||||||
u32 portid,
|
u32 portid,
|
||||||
u32 group, gfp_t allocation,
|
u32 group, gfp_t allocation,
|
||||||
int (*filter)(struct sock *dsk,
|
netlink_filter_fn filter,
|
||||||
struct sk_buff *skb, void *data),
|
|
||||||
void *filter_data)
|
void *filter_data)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(ssk);
|
struct net *net = sock_net(ssk);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue