Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Aug 2013 10:14:00 +0000 (UTC)
From:      Andre Oppermann <andre@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254769 - head/sys/net
Message-ID:  <201308241014.r7OAE0Qs099791@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andre
Date: Sat Aug 24 10:13:59 2013
New Revision: 254769
URL: http://svnweb.freebsd.org/changeset/base/254769

Log:
  Introduce typedef for pfil hook callback function and replace all
  spelled out occurrences with it.
  
  Reviewed by:	eri

Modified:
  head/sys/net/pfil.c
  head/sys/net/pfil.h

Modified: head/sys/net/pfil.c
==============================================================================
--- head/sys/net/pfil.c	Sat Aug 24 10:06:51 2013	(r254768)
+++ head/sys/net/pfil.c	Sat Aug 24 10:13:59 2013	(r254769)
@@ -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 @@ 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;
 
@@ -334,9 +332,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: head/sys/net/pfil.h
==============================================================================
--- head/sys/net/pfil.h	Sat Aug 24 10:06:51 2013	(r254768)
+++ head/sys/net/pfil.h	Sat Aug 24 10:13:59 2013	(r254769)
@@ -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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308241014.r7OAE0Qs099791>