From 3bc01464c33bc4146846edc453a79c7e15035762 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sun, 14 Sep 2008 05:22:44 +0000 Subject: [PATCH] typedef pfil_func_t --- sys/net/pfil.c | 23 +++++++---------------- sys/net/pfil.h | 16 ++++++++-------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/sys/net/pfil.c b/sys/net/pfil.c index d09bef36cd..c87505fd3b 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -1,5 +1,5 @@ /* $NetBSD: pfil.c,v 1.20 2001/11/12 23:49:46 lukem Exp $ */ -/* $DragonFly: src/sys/net/pfil.c,v 1.8 2008/09/14 04:34:26 sephe Exp $ */ +/* $DragonFly: src/sys/net/pfil.c,v 1.9 2008/09/14 05:22:44 sephe Exp $ */ /* * Copyright (c) 1996 Matthew R. Green @@ -41,11 +41,8 @@ #include #include -static int pfil_list_add(struct pfil_head *, - int (*)(void *, struct mbuf **, struct ifnet *, int), void *, int); - -static int pfil_list_remove(struct pfil_head *, - int (*)(void *, struct mbuf **, struct ifnet *, int), void *, int); +static int pfil_list_add(struct pfil_head *, pfil_func_t, void *, int); +static int pfil_list_remove(struct pfil_head *, pfil_func_t, void *, int); LIST_HEAD(, pfil_head) pfil_head_list = LIST_HEAD_INITIALIZER(&pfil_head_list); @@ -140,8 +137,7 @@ pfil_head_get(int type, u_long val) * PFIL_WAITOK OK to call kmalloc with M_WAITOK. */ int -pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int), - void *arg, int flags, struct pfil_head *ph) +pfil_add_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { int err = 0; @@ -162,9 +158,7 @@ pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int), } static int -pfil_list_add(struct pfil_head *ph, - int (*func)(void *, struct mbuf **, struct ifnet *, int), void *arg, - int flags) +pfil_list_add(struct pfil_head *ph, pfil_func_t func, void *arg, int flags) { struct packet_filter_hook *pfh; pfil_list_t *list; @@ -204,8 +198,7 @@ pfil_list_add(struct pfil_head *ph, * hook list. */ int -pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int), - 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; @@ -221,9 +214,7 @@ pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int), * specified list. Clear ph_hashooks if no functions remain on any list. */ static int -pfil_list_remove(struct pfil_head *ph, - int (*func)(void *, struct mbuf **, struct ifnet *, int), void *arg, - int flags) +pfil_list_remove(struct pfil_head *ph, pfil_func_t func, void *arg, int flags) { struct packet_filter_hook *pfh; pfil_list_t *list; diff --git a/sys/net/pfil.h b/sys/net/pfil.h index c28553ce8a..80b4f7f23e 100644 --- a/sys/net/pfil.h +++ b/sys/net/pfil.h @@ -1,5 +1,5 @@ /* $NetBSD: pfil.h,v 1.22 2003/06/23 12:57:08 martin Exp $ */ -/* $DragonFly: src/sys/net/pfil.h,v 1.6 2008/09/14 02:05:07 sephe Exp $ */ +/* $DragonFly: src/sys/net/pfil.h,v 1.7 2008/09/14 05:22:44 sephe Exp $ */ /* * Copyright (c) 1996 Matthew R. Green @@ -45,15 +45,17 @@ struct mbuf; struct ifnet; +typedef int (*pfil_func_t)(void *, struct mbuf **, struct ifnet *, int); + /* * 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); - void *pfil_arg; - int pfil_flags; + pfil_func_t pfil_func; + void *pfil_arg; + int pfil_flags; }; #define PFIL_IN 0x00000001 @@ -83,10 +85,8 @@ typedef struct pfil_head pfil_head_t; int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, int); -int pfil_add_hook(int (*func)(void *, struct mbuf **, - struct ifnet *, int), void *, int, struct pfil_head *); -int pfil_remove_hook(int (*func)(void *, struct mbuf **, - struct ifnet *, int), 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_head_register(struct pfil_head *); int pfil_head_unregister(struct pfil_head *); -- 2.41.0