From owner-svn-src-user@FreeBSD.ORG Thu Nov 22 17:26:28 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C3250914; Thu, 22 Nov 2012 17:26:28 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9DBCB8FC0C; Thu, 22 Nov 2012 17:26:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAMHQSLL031355; Thu, 22 Nov 2012 17:26:28 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAMHQSpu031352; Thu, 22 Nov 2012 17:26:28 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211221726.qAMHQSpu031352@svn.freebsd.org> From: Andre Oppermann Date: Thu, 22 Nov 2012 17:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243411 - user/andre/tcp_workqueue/sys/net X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2012 17:26:28 -0000 Author: andre Date: Thu Nov 22 17:26:28 2012 New Revision: 243411 URL: http://svnweb.freebsd.org/changeset/base/243411 Log: Introduce typedef for pfil hook callback function and replace all spelled out occurrences with it. Do some style cleanup of the pfil lock function prototypes. Modified: user/andre/tcp_workqueue/sys/net/pfil.c user/andre/tcp_workqueue/sys/net/pfil.h Modified: user/andre/tcp_workqueue/sys/net/pfil.c ============================================================================== --- user/andre/tcp_workqueue/sys/net/pfil.c Thu Nov 22 17:00:34 2012 (r243410) +++ user/andre/tcp_workqueue/sys/net/pfil.c Thu Nov 22 17:26:28 2012 (r243411) @@ -236,8 +236,7 @@ pfil_head_get(int type, u_long val) * The cookie is simply is a random value that should be unique. */ 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) { return (pfil_add_hook_order(func, arg, "unknown", flags, @@ -245,9 +244,8 @@ pfil_add_hook(int (*func)(void *, struct } int -pfil_add_hook_order(int (*func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *), void *arg, char *name, int flags, uint8_t order, - struct pfil_head *ph) +pfil_add_hook_order(pfil_func_t func, void *arg, char *name, int flags, + uint8_t order, struct pfil_head *ph) { struct packet_filter_hook *pfh1 = NULL; struct packet_filter_hook *pfh2 = NULL; @@ -312,8 +310,7 @@ error: * 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; @@ -333,8 +330,7 @@ pfil_remove_hook(int (*func)(void *, str } int -pfil_get_cookie(int (*func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *), void *arg, int flags, struct pfil_head *ph) +pfil_get_cookie(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { pfil_list_t *list; struct packet_filter_hook *pfh; @@ -402,9 +398,7 @@ pfil_list_add(pfil_list_t *list, struct * 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; Modified: user/andre/tcp_workqueue/sys/net/pfil.h ============================================================================== --- user/andre/tcp_workqueue/sys/net/pfil.h Thu Nov 22 17:00:34 2012 (r243410) +++ user/andre/tcp_workqueue/sys/net/pfil.h Thu Nov 22 17:26:28 2012 (r243411) @@ -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; int pfil_cookie; uint8_t pfil_order; @@ -94,32 +96,29 @@ 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_add_hook_order(int (*func)(void *, struct mbuf **, struct ifnet *, - int, struct inpcb *), void *, char *, int, uint8_t, +int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *); +int pfil_add_hook_order(pfil_func_t, void *, char *, int, uint8_t, struct pfil_head *); -int pfil_get_cookie(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_get_cookie(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); int pfil_run_inject(struct pfil_head *, struct mbuf **, struct ifnet *, int, struct inpcb *inp, int cookie); struct rm_priotracker; /* Do not require including rmlock header */ -int pfil_try_rlock(struct pfil_head *, struct rm_priotracker *); -void pfil_rlock(struct pfil_head *, struct rm_priotracker *); -void pfil_runlock(struct pfil_head *, struct rm_priotracker *); -void pfil_wlock(struct pfil_head *); -void pfil_wunlock(struct pfil_head *); -int pfil_wowned(struct pfil_head *ph); +int pfil_try_rlock(struct pfil_head *, struct rm_priotracker *); +void pfil_rlock(struct pfil_head *, struct rm_priotracker *); +void pfil_runlock(struct pfil_head *, struct rm_priotracker *); +void pfil_wlock(struct pfil_head *); +void pfil_wunlock(struct pfil_head *); +int pfil_wowned(struct pfil_head *ph); int pfil_head_register(struct pfil_head *); int pfil_head_unregister(struct pfil_head *); -struct pfil_head *pfil_head_get(int, u_long); +struct pfil_head *pfil_head_get(int, u_long); #define PFIL_HOOKED(p) ((p)->ph_nhooks > 0) #define PFIL_LOCK_INIT_REAL(l, t) \