From owner-svn-src-all@freebsd.org Fri Apr 10 22:42:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 726C227CF4B; Fri, 10 Apr 2020 22:42:15 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zY132Vbpz3G0v; Fri, 10 Apr 2020 22:42:15 +0000 (UTC) (envelope-from rmacklem@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FFB65D1A; Fri, 10 Apr 2020 22:42:15 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03AMgFIA041541; Fri, 10 Apr 2020 22:42:15 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03AMgFMS041540; Fri, 10 Apr 2020 22:42:15 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202004102242.03AMgFMS041540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 10 Apr 2020 22:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359785 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 359785 X-SVN-Commit-Repository: base 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.29 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: Fri, 10 Apr 2020 22:42:15 -0000 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);