Date: Mon, 27 Jul 2020 01:51:33 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r363593 - in projects/nfs-over-tls/sys/fs: nfs nfsserver Message-ID: <202007270151.06R1pX0j010674@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Mon Jul 27 01:51:33 2020 New Revision: 363593 URL: https://svnweb.freebsd.org/changeset/base/363593 Log: Move nfsm_trimtrailing() into nfs_nfsdport.c, since that is the only place it is used. Modified: projects/nfs-over-tls/sys/fs/nfs/nfs_var.h projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: projects/nfs-over-tls/sys/fs/nfs/nfs_var.h ============================================================================== --- projects/nfs-over-tls/sys/fs/nfs/nfs_var.h Mon Jul 27 01:38:14 2020 (r363592) +++ projects/nfs-over-tls/sys/fs/nfs/nfs_var.h Mon Jul 27 01:51:33 2020 (r363593) @@ -410,8 +410,6 @@ void nfsd_init(void); int nfsd_checkrootexp(struct nfsrv_descript *); void nfsd_getminorvers(struct nfsrv_descript *, u_char *, u_char **, int *, u_int32_t *); -void nfsm_trimtrailing(struct nfsrv_descript *, struct mbuf *, - caddr_t, int, int); /* nfs_clvfsops.c */ void nfscl_retopts(struct nfsmount *, char *, size_t); Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c Mon Jul 27 01:38:14 2020 (r363592) +++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c Mon Jul 27 01:51:33 2020 (r363593) @@ -147,6 +147,8 @@ static int nfsrv_dsremove(struct vnode *, char *, stru static int nfsrv_dssetacl(struct vnode *, struct acl *, struct ucred *, NFSPROC_T *); static int nfsrv_pnfsstatfs(struct statfs *, struct mount *); +static void nfsm_trimtrailing(struct nfsrv_descript *, struct mbuf *, + char *, int, int); int nfs_pnfsio(task_fn_t *, void *); @@ -6550,6 +6552,44 @@ out: } NFSEXITCODE(error); return (error); +} + +/* + * Trim trailing data off the mbuf list being built. + */ +static void +nfsm_trimtrailing(struct nfsrv_descript *nd, struct mbuf *mb, char *bpos, + int bextpg, int bextpgsiz) +{ + vm_page_t pg; + int fullpgsiz, i; + + if (mb->m_next != NULL) { + m_freem(mb->m_next); + mb->m_next = NULL; + } + if ((mb->m_flags & M_EXTPG) != 0) { + /* First, get rid of any pages after this position. */ + for (i = mb->m_epg_npgs - 1; i > bextpg; i--) { + pg = PHYS_TO_VM_PAGE(mb->m_epg_pa[i]); + vm_page_unwire_noq(pg); + vm_page_free(pg); + } + mb->m_epg_npgs = bextpg + 1; + if (bextpg == 0) + fullpgsiz = PAGE_SIZE - mb->m_epg_1st_off; + else + fullpgsiz = PAGE_SIZE; + mb->m_epg_last_len = fullpgsiz - bextpgsiz; + mb->m_len = m_epg_pagelen(mb, 0, mb->m_epg_1st_off); + for (i = 1; i < mb->m_epg_npgs; i++) + mb->m_len += m_epg_pagelen(mb, i, 0); + nd->nd_bextpgsiz = bextpgsiz; + nd->nd_bextpg = bextpg; + } else + mb->m_len = bpos - mtod(mb, char *); + nd->nd_mb = mb; + nd->nd_bpos = bpos; } extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdsubs.c Mon Jul 27 01:38:14 2020 (r363592) +++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdsubs.c Mon Jul 27 01:51:33 2020 (r363593) @@ -2181,41 +2181,3 @@ nfsmout: *taglenp = taglen; } -/* - * Trim trailing data off the mbuf list being built. - */ -void -nfsm_trimtrailing(struct nfsrv_descript *nd, struct mbuf *mb, char *bpos, - int bextpg, int bextpgsiz) -{ - vm_page_t pg; - int fullpgsiz, i; - - if (mb->m_next != NULL) { - m_freem(mb->m_next); - mb->m_next = NULL; - } - if ((mb->m_flags & M_EXTPG) != 0) { - /* First, get rid of any pages after this position. */ - for (i = mb->m_epg_npgs - 1; i > bextpg; i--) { - pg = PHYS_TO_VM_PAGE(mb->m_epg_pa[i]); - vm_page_unwire_noq(pg); - vm_page_free(pg); - } - mb->m_epg_npgs = bextpg + 1; - if (bextpg == 0) - fullpgsiz = PAGE_SIZE - mb->m_epg_1st_off; - else - fullpgsiz = PAGE_SIZE; - mb->m_epg_last_len = fullpgsiz - bextpgsiz; - mb->m_len = m_epg_pagelen(mb, 0, mb->m_epg_1st_off); - for (i = 1; i < mb->m_epg_npgs; i++) - mb->m_len += m_epg_pagelen(mb, i, 0); - nd->nd_bextpgsiz = bextpgsiz; - nd->nd_bextpg = bextpg; - } else - mb->m_len = bpos - mtod(mb, char *); - nd->nd_mb = mb; - nd->nd_bpos = bpos; -} -
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007270151.06R1pX0j010674>