From 5630e57e48c003966005f869d05ab9526a49e940 Mon Sep 17 00:00:00 2001 From: andre Date: Sat, 24 Aug 2013 10:13:59 +0000 Subject: [PATCH] Introduce typedef for pfil hook callback function and replace all spelled out occurrences with it. Reviewed by: eri --- sys/net/pfil.c | 10 +++------- sys/net/pfil.h | 12 ++++++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/sys/net/pfil.c b/sys/net/pfil.c index 9939d72a15aa..e8c7d11d04cc 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -225,8 +225,7 @@ pfil_head_get(int type, u_long val) * PFIL_WAITOK OK to call malloc with M_WAITOK. */ int -pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *), void *arg, int flags, struct pfil_head *ph) +pfil_add_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { struct packet_filter_hook *pfh1 = NULL; struct packet_filter_hook *pfh2 = NULL; @@ -285,8 +284,7 @@ pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, * list. */ int -pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *), void *arg, int flags, struct pfil_head *ph) +pfil_remove_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { int err = 0; @@ -334,9 +332,7 @@ pfil_list_add(pfil_list_t *list, struct packet_filter_hook *pfh1, int flags) * specified list. */ static int -pfil_list_remove(pfil_list_t *list, - int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), - void *arg) +pfil_list_remove(pfil_list_t *list, pfil_func_t func, void *arg) { struct packet_filter_hook *pfh; diff --git a/sys/net/pfil.h b/sys/net/pfil.h index 9cdb4225f43d..b91328f58683 100644 --- a/sys/net/pfil.h +++ b/sys/net/pfil.h @@ -43,14 +43,16 @@ struct mbuf; struct ifnet; struct inpcb; +typedef int (*pfil_func_t)(void *, struct mbuf **, struct ifnet *, int, + struct inpcb *); + /* * The packet filter hooks are designed for anything to call them to * possibly intercept the packet. */ struct packet_filter_hook { TAILQ_ENTRY(packet_filter_hook) pfil_link; - int (*pfil_func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *); + pfil_func_t pfil_func; void *pfil_arg; }; @@ -87,10 +89,8 @@ struct pfil_head { LIST_ENTRY(pfil_head) ph_list; }; -int pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, - int, struct inpcb *), void *, int, struct pfil_head *); -int pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, - int, struct inpcb *), void *, int, struct pfil_head *); +int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *); +int pfil_remove_hook(pfil_func_t, void *, int, struct pfil_head *); int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, int, struct inpcb *inp);