svn commit: r359785 - head/sys/fs/nfsclient

Rick Macklem rmacklem at FreeBSD.org
Fri Apr 10 22:42:15 UTC 2020


Author: rmacklem
Date: Fri Apr 10 22:42:14 2020
New Revision: 359785
URL: https://svnweb.freebsd.org/changeset/base/359785

Log:
  Replace mbuf macros with the code they would generate in the NFS code.
  
  When the code was ported to Mac OS/X, mbuf handling functions were
  converted to using the Mac OS/X accessor functions. For FreeBSD, they
  are a simple set of macros in sys/fs/nfs/nfskpiport.h.
  Since porting to Mac OS/X is no longer a consideration, replacement of
  these macros with the code generated by them makes the code more
  readable.
  When support for external page mbufs is added as needed by the KERN_TLS,
  the patch becomes simpler if done without the macros.
  
  This patch should not result in any semantic change.
  This conversion will be committed one file at a time.

Modified:
  head/sys/fs/nfsclient/nfs_clcomsubs.c

Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clcomsubs.c	Fri Apr 10 22:27:45 2020	(r359784)
+++ head/sys/fs/nfsclient/nfs_clcomsubs.c	Fri Apr 10 22:42:14 2020	(r359785)
@@ -87,8 +87,8 @@ nfsm_uiombuf(struct nfsrv_descript *nd, struct uio *ui
 					NFSMCLGET(mp, M_WAITOK);
 				else
 					NFSMGET(mp);
-				mbuf_setlen(mp, 0);
-				mbuf_setnext(mp2, mp);
+				mp->m_len = 0;
+				mp2->m_next = mp;
 				mp2 = mp;
 				mlen = M_TRAILINGSPACE(mp);
 			}
@@ -97,17 +97,17 @@ nfsm_uiombuf(struct nfsrv_descript *nd, struct uio *ui
 			/* Not Yet.. */
 			if (uiop->uio_iov->iov_op != NULL)
 				(*(uiop->uio_iov->iov_op))
-				(uiocp, NFSMTOD(mp, caddr_t) + mbuf_len(mp),
+				(uiocp, mtod(mp, caddr_t) + mp->m_len,
 				    xfer);
 			else
 #endif
 			if (uiop->uio_segflg == UIO_SYSSPACE)
-			    NFSBCOPY(uiocp, NFSMTOD(mp, caddr_t) + mbuf_len(mp),
+			    NFSBCOPY(uiocp, mtod(mp, caddr_t) + mp->m_len,
 				xfer);
 			else
-			    copyin(CAST_USER_ADDR_T(uiocp), NFSMTOD(mp, caddr_t)
-				+ mbuf_len(mp), xfer);
-			mbuf_setlen(mp, mbuf_len(mp) + xfer);
+			    copyin(CAST_USER_ADDR_T(uiocp), mtod(mp, caddr_t)
+				+ mp->m_len, xfer);
+			mp->m_len += xfer;
 			left -= xfer;
 			uiocp += xfer;
 			uiop->uio_offset += xfer;
@@ -122,16 +122,16 @@ nfsm_uiombuf(struct nfsrv_descript *nd, struct uio *ui
 	if (rem > 0) {
 		if (rem > M_TRAILINGSPACE(mp)) {
 			NFSMGET(mp);
-			mbuf_setlen(mp, 0);
-			mbuf_setnext(mp2, mp);
+			mp->m_len = 0;
+			mp2->m_next = mp;
 		}
-		cp = NFSMTOD(mp, caddr_t) + mbuf_len(mp);
+		cp = mtod(mp, caddr_t) + mp->m_len;
 		for (left = 0; left < rem; left++)
 			*cp++ = '\0';
-		mbuf_setlen(mp, mbuf_len(mp) + rem);
+		mp->m_len += rem;
 		nd->nd_bpos = cp;
 	} else
-		nd->nd_bpos = NFSMTOD(mp, caddr_t) + mbuf_len(mp);
+		nd->nd_bpos = mtod(mp, caddr_t) + mp->m_len;
 	nd->nd_mb = mp;
 }
 
@@ -159,7 +159,7 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu
 		NFSMCLGET(mp, M_WAITOK);
 	else
 		NFSMGET(mp);
-	mbuf_setlen(mp, 0);
+	mp->m_len = 0;
 	firstmp = mp2 = mp;
 	while (siz > 0) {
 		left = uiop->uio_iov->iov_len;
@@ -174,19 +174,19 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu
 					NFSMCLGET(mp, M_WAITOK);
 				else
 					NFSMGET(mp);
-				mbuf_setlen(mp, 0);
-				mbuf_setnext(mp2, mp);
+				mp->m_len = 0;
+				mp2->m_next = mp;
 				mp2 = mp;
 				mlen = M_TRAILINGSPACE(mp);
 			}
 			xfer = (left > mlen) ? mlen : left;
 			if (uiop->uio_segflg == UIO_SYSSPACE)
-				NFSBCOPY(uiocp, NFSMTOD(mp, caddr_t) +
-				    mbuf_len(mp), xfer);
+				NFSBCOPY(uiocp, mtod(mp, caddr_t) +
+				    mp->m_len, xfer);
 			else
-				copyin(uiocp, NFSMTOD(mp, caddr_t) +
-				    mbuf_len(mp), xfer);
-			mbuf_setlen(mp, mbuf_len(mp) + xfer);
+				copyin(uiocp, mtod(mp, caddr_t) +
+				    mp->m_len, xfer);
+			mp->m_len += xfer;
 			left -= xfer;
 			uiocp += xfer;
 			uiop->uio_offset += xfer;
@@ -199,7 +199,7 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu
 		siz -= uiosiz;
 	}
 	if (cpp != NULL)
-		*cpp = NFSMTOD(mp, caddr_t) + mbuf_len(mp);
+		*cpp = mtod(mp, caddr_t) + mp->m_len;
 	if (mbp != NULL)
 		*mbp = mp;
 	return (firstmp);


More information about the svn-src-head mailing list