From owner-svn-src-all@FreeBSD.ORG Sat Mar 6 21:27:26 2010 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 B909B1065670; Sat, 6 Mar 2010 21:27:26 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A92CD8FC14; Sat, 6 Mar 2010 21:27:26 +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 o26LRQl9042060; Sat, 6 Mar 2010 21:27:26 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o26LRQ6J042057; Sat, 6 Mar 2010 21:27:26 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201003062127.o26LRQ6J042057@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 6 Mar 2010 21:27:26 +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: r204808 - 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: Sat, 06 Mar 2010 21:27:26 -0000 Author: bz Date: Sat Mar 6 21:27:26 2010 New Revision: 204808 URL: http://svn.freebsd.org/changeset/base/204808 Log: Introduce a function rn_detachhead() that will free the radix table root nodes. This is only needed (and available) in the virtualization case to free the resources when tearing down a virtual network stack. Sponsored by: ISPsystem Reviewed by: julian, zec MFC after: 5 days Modified: head/sys/net/radix.c head/sys/net/radix.h Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Sat Mar 6 21:24:32 2010 (r204807) +++ head/sys/net/radix.c Sat Mar 6 21:27:26 2010 (r204808) @@ -1161,6 +1161,24 @@ rn_inithead(head, off) return (1); } +#ifdef VIMAGE +int +rn_detachhead(void **head) +{ + struct radix_node_head *rnh; + + KASSERT((head != NULL && *head != NULL), + ("%s: head already freed", __func__)); + rnh = *head; + + /* Free nodes. */ + Free(rnh); + + *head = NULL; + return (1); +} +#endif + void rn_init(int maxk) { Modified: head/sys/net/radix.h ============================================================================== --- head/sys/net/radix.h Sat Mar 6 21:24:32 2010 (r204807) +++ head/sys/net/radix.h Sat Mar 6 21:27:26 2010 (r204808) @@ -162,6 +162,9 @@ struct radix_node_head { void rn_init(int); int rn_inithead(void **, int); +#ifdef VIMAGE +int rn_detachhead(void **); +#endif int rn_refines(void *, void *); struct radix_node *rn_addmask(void *, int, int),