From owner-svn-src-all@FreeBSD.ORG Mon Oct 19 15:19:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F0C9106568B; Mon, 19 Oct 2009 15:19:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DD6A8FC1F; Mon, 19 Oct 2009 15:19:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9JFJEEC005093; Mon, 19 Oct 2009 15:19:14 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9JFJEb8005091; Mon, 19 Oct 2009 15:19:14 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200910191519.n9JFJEb8005091@svn.freebsd.org> From: Robert Watson Date: Mon, 19 Oct 2009 15:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198233 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2009 15:19:14 -0000 Author: rwatson Date: Mon Oct 19 15:19:14 2009 New Revision: 198233 URL: http://svn.freebsd.org/changeset/base/198233 Log: Clean up comments, white space, and style in pfil.c (especially new VNET bits). MFC after: 3 days (not VNET bits) Modified: head/sys/net/pfil.c Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Mon Oct 19 14:36:12 2009 (r198232) +++ head/sys/net/pfil.c Mon Oct 19 15:19:14 2009 (r198233) @@ -86,14 +86,13 @@ pfil_run_hooks(struct pfil_head *ph, str } } PFIL_RUNLOCK(ph, &rmpt); - *mp = m; return (rv); } /* - * pfil_head_register() registers a pfil_head with the packet filter - * hook mechanism. + * pfil_head_register() registers a pfil_head with the packet filter hook + * mechanism. */ int pfil_head_register(struct pfil_head *ph) @@ -105,7 +104,7 @@ pfil_head_register(struct pfil_head *ph) if (ph->ph_type == lph->ph_type && ph->ph_un.phu_val == lph->ph_un.phu_val) { PFIL_LIST_UNLOCK(); - return EEXIST; + return (EEXIST); } } PFIL_LOCK_INIT(ph); @@ -151,7 +150,6 @@ pfil_head_get(int type, u_long val) if (ph->ph_type == type && ph->ph_un.phu_val == val) break; PFIL_LIST_UNLOCK(); - return (ph); } @@ -208,7 +206,7 @@ pfil_add_hook(int (*func)(void *, struct ph->ph_nhooks++; } PFIL_WUNLOCK(ph); - return 0; + return (0); locked_error: PFIL_WUNLOCK(ph); error: @@ -216,12 +214,12 @@ error: free(pfh1, M_IFADDR); if (pfh2 != NULL) free(pfh2, M_IFADDR); - return err; + return (err); } /* - * pfil_remove_hook removes a specific function from the packet filter - * hook list. + * pfil_remove_hook removes a specific function from the packet filter hook + * list. */ int pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, @@ -230,7 +228,6 @@ pfil_remove_hook(int (*func)(void *, str int err = 0; PFIL_WLOCK(ph); - if (flags & PFIL_IN) { err = pfil_list_remove(&ph->ph_in, func, arg); if (err == 0) @@ -242,8 +239,7 @@ pfil_remove_hook(int (*func)(void *, str ph->ph_nhooks--; } PFIL_WUNLOCK(ph); - - return err; + return (err); } static int @@ -257,17 +253,17 @@ pfil_list_add(pfil_list_t *list, struct TAILQ_FOREACH(pfh, list, pfil_link) if (pfh->pfil_func == pfh1->pfil_func && pfh->pfil_arg == pfh1->pfil_arg) - return EEXIST; + return (EEXIST); + /* - * insert the input list in reverse order of the output list - * so that the same path is followed in or out of the kernel. + * Insert the input list in reverse order of the output list so that + * the same path is followed in or out of the kernel. */ if (flags & PFIL_IN) TAILQ_INSERT_HEAD(list, pfh1, pfil_link); else TAILQ_INSERT_TAIL(list, pfh1, pfil_link); - - return 0; + return (0); } /* @@ -285,30 +281,32 @@ pfil_list_remove(pfil_list_t *list, if (pfh->pfil_func == func && pfh->pfil_arg == arg) { TAILQ_REMOVE(list, pfh, pfil_link); free(pfh, M_IFADDR); - return 0; + return (0); } - return ENOENT; + return (ENOENT); } -/**************** - * Stuff that must be initialized for every instance - * (including the first of course). +/* + * Stuff that must be initialized for every instance (including the first of + * course). */ static int vnet_pfil_init(const void *unused) { + LIST_INIT(&V_pfil_head_list); return (0); } -/*********************** +/* * Called for the removal of each instance. */ static int vnet_pfil_uninit(const void *unused) { + /* XXX should panic if list is not empty */ - return 0; + return (0); } /* Define startup order. */ @@ -317,17 +315,17 @@ vnet_pfil_uninit(const void *unused) #define PFIL_VNET_ORDER (PFIL_MODEVENT_ORDER + 2) /* Later still. */ /* - * Starting up. + * Starting up. + * * VNET_SYSINIT is called for each existing vnet and each new vnet. */ VNET_SYSINIT(vnet_pfil_init, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, - vnet_pfil_init, NULL); + vnet_pfil_init, NULL); /* - * Closing up shop. These are done in REVERSE ORDER, - * Not called on reboot. + * Closing up shop. These are done in REVERSE ORDER. Not called on reboot. + * * VNET_SYSUNINIT is called for each exiting vnet as it exits. */ VNET_SYSUNINIT(vnet_pfil_uninit, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, - vnet_pfil_uninit, NULL); - + vnet_pfil_uninit, NULL);