From owner-svn-src-head@freebsd.org Tue Feb 14 21:36:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DA24CDF6D2; Tue, 14 Feb 2017 21:36:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D938E17C2; Tue, 14 Feb 2017 21:36:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1ELaI7i060203; Tue, 14 Feb 2017 21:36:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1ELaIJT060202; Tue, 14 Feb 2017 21:36:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201702142136.v1ELaIJT060202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 14 Feb 2017 21:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313747 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 21:36:20 -0000 Author: markj Date: Tue Feb 14 21:36:18 2017 New Revision: 313747 URL: https://svnweb.freebsd.org/changeset/base/313747 Log: Unbreak the gcc build of netmap. This fixes several LINT targets. Reviewed by: Vincenzo Maffione Modified: head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Tue Feb 14 21:33:10 2017 (r313746) +++ head/sys/dev/netmap/netmap_generic.c Tue Feb 14 21:36:18 2017 (r313747) @@ -109,10 +109,13 @@ __FBSDID("$FreeBSD$"); * chain into uma_zfree(zone_pack, mf) * (or reinstall the buffer ?) */ -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = (void *)fn; \ - (m)->m_ext.ext_type = EXT_EXTREF; \ -} while (0) +static inline void +set_mbuf_destructor(struct mbuf *m, void *fn) +{ + + m->m_ext.ext_free = fn; + m->m_ext.ext_type = EXT_EXTREF; +} static int void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) @@ -167,9 +170,12 @@ nm_os_get_mbuf(struct ifnet *ifp, int le static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = fn ? (void *)fn : (void *)void_mbuf_dtor; \ -} while (0) +static inline void +set_mbuf_destructor(struct mbuf *m, void *fn) +{ + + m->m_ext.ext_free = (fn != NULL) ? fn : (void *)void_mbuf_dtor; +} static inline struct mbuf * nm_os_get_mbuf(struct ifnet *ifp, int len) @@ -381,7 +387,7 @@ generic_netmap_unregister(struct netmap_ * TX event is consumed. */ mtx_lock_spin(&kring->tx_event_lock); if (kring->tx_event) { - SET_MBUF_DESTRUCTOR(kring->tx_event, NULL); + set_mbuf_destructor(kring->tx_event, NULL); } kring->tx_event = NULL; mtx_unlock_spin(&kring->tx_event_lock); @@ -762,7 +768,7 @@ generic_set_tx_event(struct netmap_kring return; } - SET_MBUF_DESTRUCTOR(m, generic_mbuf_destructor); + set_mbuf_destructor(m, generic_mbuf_destructor); kring->tx_event = m; mtx_unlock_spin(&kring->tx_event_lock);