Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Pirko and committed by
Paolo Abeni
403863e9 a7311324

+8 -9
+2 -3
drivers/connector/connector.c
··· 59 59 * both, or if both are zero then the group is looked up and sent there. 60 60 */ 61 61 int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 __group, 62 - gfp_t gfp_mask, 63 - int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), 64 - void *filter_data) 62 + gfp_t gfp_mask, netlink_filter_fn filter, 63 + void *filter_data) 65 64 { 66 65 struct cn_callback_entry *__cbq; 67 66 unsigned int size;
+1 -2
include/linux/connector.h
··· 100 100 */ 101 101 int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, 102 102 u32 group, gfp_t gfp_mask, 103 - int (*filter)(struct sock *dsk, struct sk_buff *skb, 104 - void *data), 103 + netlink_filter_fn filter, 105 104 void *filter_data); 106 105 107 106 /**
+4 -2
include/linux/netlink.h
··· 228 228 int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); 229 229 int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, 230 230 __u32 group, gfp_t allocation); 231 + 232 + typedef int (*netlink_filter_fn)(struct sock *dsk, struct sk_buff *skb, void *data); 233 + 231 234 int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, 232 235 __u32 portid, __u32 group, gfp_t allocation, 233 - int (*filter)(struct sock *dsk, 234 - struct sk_buff *skb, void *data), 236 + netlink_filter_fn filter, 235 237 void *filter_data); 236 238 int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code); 237 239 int netlink_register_notifier(struct notifier_block *nb);
+1 -2
net/netlink/af_netlink.c
··· 1519 1519 int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, 1520 1520 u32 portid, 1521 1521 u32 group, gfp_t allocation, 1522 - int (*filter)(struct sock *dsk, 1523 - struct sk_buff *skb, void *data), 1522 + netlink_filter_fn filter, 1524 1523 void *filter_data) 1525 1524 { 1526 1525 struct net *net = sock_net(ssk);