Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2015 11:16:22 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276818 - head/sys/kern
Message-ID:  <201501081116.t08BGMeC013275@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Thu Jan  8 11:16:21 2015
New Revision: 276818
URL: https://svnweb.freebsd.org/changeset/base/276818

Log:
  Replace hand-crafted versions of M_SIZE() and M_START() in uipc_mbuf.c
  with calls to the centralised macros, reducing direct use of MLEN and
  MHLEN.
  
  Differential Revision:	https://reviews.freebsd.org/D1444
  Reviewed by:	bz
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/kern/uipc_mbuf.c

Modified: head/sys/kern/uipc_mbuf.c
==============================================================================
--- head/sys/kern/uipc_mbuf.c	Thu Jan  8 10:53:20 2015	(r276817)
+++ head/sys/kern/uipc_mbuf.c	Thu Jan  8 11:16:21 2015	(r276818)
@@ -196,8 +196,7 @@ m_getm2(struct mbuf *m, int len, int how
 		}
 
 		/* Book keeping. */
-		len -= (mb->m_flags & M_EXT) ? mb->m_ext.ext_size :
-			((mb->m_flags & M_PKTHDR) ? MHLEN : MLEN);
+		len -= M_SIZE(mb);
 		if (mtail != NULL)
 			mtail->m_next = mb;
 		else
@@ -430,11 +429,8 @@ m_sanity(struct mbuf *m0, int sanitize)
 		 * unrelated kernel memory before or after us is trashed.
 		 * No way to recover from that.
 		 */
-		a = ((m->m_flags & M_EXT) ? m->m_ext.ext_buf :
-			((m->m_flags & M_PKTHDR) ? (caddr_t)(&m->m_pktdat) :
-			 (caddr_t)(&m->m_dat)) );
-		b = (caddr_t)(a + (m->m_flags & M_EXT ? m->m_ext.ext_size :
-			((m->m_flags & M_PKTHDR) ? MHLEN : MLEN)));
+		a = M_START(m);
+		b = a + M_SIZE(m);
 		if ((caddr_t)m->m_data < a)
 			M_SANITY_ACTION("m_data outside mbuf data range left");
 		if ((caddr_t)m->m_data > b)



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