From owner-svn-src-all@FreeBSD.ORG Tue Feb 17 20:52:52 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C203D45F; Tue, 17 Feb 2015 20:52:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 938AE189; Tue, 17 Feb 2015 20:52:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1HKqqdH030925; Tue, 17 Feb 2015 20:52:52 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1HKqqsq030923; Tue, 17 Feb 2015 20:52:52 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201502172052.t1HKqqsq030923@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 17 Feb 2015 20:52:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278920 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Tue, 17 Feb 2015 20:52:52 -0000 Author: glebius Date: Tue Feb 17 20:52:51 2015 New Revision: 278920 URL: https://svnweb.freebsd.org/changeset/base/278920 Log: Use anonymous unions and structs to organize shared space in mbuf(9), instead of preprocessor macros. This will make debugger output of 'print *m' exactly match the names we use in code, making life of a kernel hacker way more pleasant. And this also allows to rename struct_m_ext back to m_ext. Modified: head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Tue Feb 17 20:37:21 2015 (r278919) +++ head/sys/kern/uipc_mbuf.c Tue Feb 17 20:52:51 2015 (r278920) @@ -112,11 +112,11 @@ CTASSERT(offsetof(struct mbuf, m_pktdat) #if defined(__LP64__) CTASSERT(offsetof(struct mbuf, m_dat) == 32); CTASSERT(sizeof(struct pkthdr) == 56); -CTASSERT(sizeof(struct struct_m_ext) == 48); +CTASSERT(sizeof(struct m_ext) == 48); #else CTASSERT(offsetof(struct mbuf, m_dat) == 24); CTASSERT(sizeof(struct pkthdr) == 48); -CTASSERT(sizeof(struct struct_m_ext) == 28); +CTASSERT(sizeof(struct m_ext) == 28); #endif /* Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Tue Feb 17 20:37:21 2015 (r278919) +++ head/sys/sys/mbuf.h Tue Feb 17 20:52:51 2015 (r278920) @@ -65,8 +65,8 @@ * they are sensible. */ struct mbuf; -#define MHSIZE offsetof(struct mbuf, M_dat.M_databuf) -#define MPKTHSIZE offsetof(struct mbuf, M_dat.MH.MH_dat.MH_databuf) +#define MHSIZE offsetof(struct mbuf, m_dat) +#define MPKTHSIZE offsetof(struct mbuf, m_pktdat) #define MLEN ((int)(MSIZE - MHSIZE)) #define MHLEN ((int)(MSIZE - MPKTHSIZE)) #define MINCLSIZE (MHLEN + 1) @@ -160,7 +160,7 @@ struct pkthdr { * Compile-time assertions in uipc_mbuf.c test these values to ensure that * they are correct. */ -struct struct_m_ext { +struct m_ext { volatile u_int *ext_cnt; /* pointer to ref count info */ caddr_t ext_buf; /* start of buffer */ uint32_t ext_size; /* size of buffer, for ext_free */ @@ -211,19 +211,15 @@ struct mbuf { */ union { struct { - struct pkthdr MH_pkthdr; /* M_PKTHDR set */ + struct pkthdr m_pkthdr; /* M_PKTHDR set */ union { - struct struct_m_ext MH_ext; /* M_EXT set */ - char MH_databuf[0]; - } MH_dat; - } MH; - char M_databuf[0]; /* !M_PKTHDR, !M_EXT */ - } M_dat; + struct m_ext m_ext; /* M_EXT set */ + char m_pktdat[0]; + }; + }; + char m_dat[0]; /* !M_PKTHDR, !M_EXT */ + }; }; -#define m_pkthdr M_dat.MH.MH_pkthdr -#define m_ext M_dat.MH.MH_dat.MH_ext -#define m_pktdat M_dat.MH.MH_dat.MH_databuf -#define m_dat M_dat.M_databuf /* * mbuf flags of global significance and layer crossing.