nfs_serv.c (108533) | nfs_serv.c (109623) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 37 */ 38 39#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 37 */ 38 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/sys/nfsserver/nfs_serv.c 108533 2003-01-01 18:49:04Z schweikh $"); | 40__FBSDID("$FreeBSD: head/sys/nfsserver/nfs_serv.c 109623 2003-01-21 08:56:16Z alfred $"); |
41 42/* 43 * nfs version 2 and 3 server calls to vnode ops 44 * - these routines generally have 3 phases 45 * 1 - break down and validate rpc request in mbuf list 46 * 2 - do the vnode ops for the request 47 * (surprisingly ?? many are very similar to syscalls in vfs_syscalls.c) 48 * 3 - build the rpc reply in an mbuf list --- 602 unchanged lines hidden (view full) --- 651 mp = NULL; 652#endif 653 mp3 = NULL; 654 fhp = &nfh.fh_generic; 655 nfsm_srvmtofh(fhp); 656 len = 0; 657 i = 0; 658 while (len < NFS_MAXPATHLEN) { | 41 42/* 43 * nfs version 2 and 3 server calls to vnode ops 44 * - these routines generally have 3 phases 45 * 1 - break down and validate rpc request in mbuf list 46 * 2 - do the vnode ops for the request 47 * (surprisingly ?? many are very similar to syscalls in vfs_syscalls.c) 48 * 3 - build the rpc reply in an mbuf list --- 602 unchanged lines hidden (view full) --- 651 mp = NULL; 652#endif 653 mp3 = NULL; 654 fhp = &nfh.fh_generic; 655 nfsm_srvmtofh(fhp); 656 len = 0; 657 i = 0; 658 while (len < NFS_MAXPATHLEN) { |
659 MGET(nmp, M_TRYWAIT, MT_DATA); 660 MCLGET(nmp, M_TRYWAIT); | 659 MGET(nmp, 0, MT_DATA); 660 MCLGET(nmp, 0); |
661 nmp->m_len = NFSMSIZ(nmp); 662 if (len == 0) 663 mp3 = mp = nmp; 664 else { 665 mp->m_next = nmp; 666 mp = nmp; 667 } 668 if ((len + mp->m_len) > NFS_MAXPATHLEN) { --- 225 unchanged lines hidden (view full) --- 894 m = m2 = mb; 895 while (left > 0) { 896 siz = min(M_TRAILINGSPACE(m), left); 897 if (siz > 0) { 898 left -= siz; 899 i++; 900 } 901 if (left > 0) { | 661 nmp->m_len = NFSMSIZ(nmp); 662 if (len == 0) 663 mp3 = mp = nmp; 664 else { 665 mp->m_next = nmp; 666 mp = nmp; 667 } 668 if ((len + mp->m_len) > NFS_MAXPATHLEN) { --- 225 unchanged lines hidden (view full) --- 894 m = m2 = mb; 895 while (left > 0) { 896 siz = min(M_TRAILINGSPACE(m), left); 897 if (siz > 0) { 898 left -= siz; 899 i++; 900 } 901 if (left > 0) { |
902 MGET(m, M_TRYWAIT, MT_DATA); 903 MCLGET(m, M_TRYWAIT); | 902 MGET(m, 0, MT_DATA); 903 MCLGET(m, 0); |
904 m->m_len = 0; 905 m2->m_next = m; 906 m2 = m; 907 } 908 } 909 MALLOC(iv, struct iovec *, i * sizeof (struct iovec), | 904 m->m_len = 0; 905 m2->m_next = m; 906 m2 = m; 907 } 908 } 909 MALLOC(iv, struct iovec *, i * sizeof (struct iovec), |
910 M_TEMP, M_WAITOK); | 910 M_TEMP, 0); |
911 uiop->uio_iov = iv2 = iv; 912 m = mb; 913 left = len; 914 i = 0; 915 while (left > 0) { 916 if (m == NULL) 917 panic("nfsrv_read iov"); 918 siz = min(M_TRAILINGSPACE(m), left); --- 183 unchanged lines hidden (view full) --- 1102 if (v3) 1103 nfsm_srvwcc_data(forat_ret, &forat, aftat_ret, vap); 1104 error = 0; 1105 goto nfsmout; 1106 } 1107 1108 if (len > 0) { 1109 MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, | 911 uiop->uio_iov = iv2 = iv; 912 m = mb; 913 left = len; 914 i = 0; 915 while (left > 0) { 916 if (m == NULL) 917 panic("nfsrv_read iov"); 918 siz = min(M_TRAILINGSPACE(m), left); --- 183 unchanged lines hidden (view full) --- 1102 if (v3) 1103 nfsm_srvwcc_data(forat_ret, &forat, aftat_ret, vap); 1104 error = 0; 1105 goto nfsmout; 1106 } 1107 1108 if (len > 0) { 1109 MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, |
1110 M_WAITOK); | 1110 0); |
1111 uiop->uio_iov = iv = ivp; 1112 uiop->uio_iovcnt = cnt; 1113 mp = mrep; 1114 while (mp) { 1115 if (mp->m_len > 0) { 1116 ivp->iov_base = mtod(mp, caddr_t); 1117 ivp->iov_len = mp->m_len; 1118 ivp++; --- 280 unchanged lines hidden (view full) --- 1399 i = 0; 1400 while (mp) { 1401 if (mp->m_len > 0) 1402 i++; 1403 mp = mp->m_next; 1404 } 1405 uiop->uio_iovcnt = i; 1406 MALLOC(iov, struct iovec *, i * sizeof (struct iovec), | 1111 uiop->uio_iov = iv = ivp; 1112 uiop->uio_iovcnt = cnt; 1113 mp = mrep; 1114 while (mp) { 1115 if (mp->m_len > 0) { 1116 ivp->iov_base = mtod(mp, caddr_t); 1117 ivp->iov_len = mp->m_len; 1118 ivp++; --- 280 unchanged lines hidden (view full) --- 1399 i = 0; 1400 while (mp) { 1401 if (mp->m_len > 0) 1402 i++; 1403 mp = mp->m_next; 1404 } 1405 uiop->uio_iovcnt = i; 1406 MALLOC(iov, struct iovec *, i * sizeof (struct iovec), |
1407 M_TEMP, M_WAITOK); | 1407 M_TEMP, 0); |
1408 uiop->uio_iov = ivp = iov; 1409 mp = mrep; 1410 while (mp) { 1411 if (mp->m_len > 0) { 1412 ivp->iov_base = mtod(mp, caddr_t); 1413 ivp->iov_len = mp->m_len; 1414 ivp++; 1415 } --- 1130 unchanged lines hidden (view full) --- 2546 } 2547 if (error) 2548 goto out; 2549 2550 VATTR_NULL(vap); 2551 if (v3) 2552 nfsm_srvsattr(vap); 2553 nfsm_srvpathsiz(len2); | 1408 uiop->uio_iov = ivp = iov; 1409 mp = mrep; 1410 while (mp) { 1411 if (mp->m_len > 0) { 1412 ivp->iov_base = mtod(mp, caddr_t); 1413 ivp->iov_len = mp->m_len; 1414 ivp++; 1415 } --- 1130 unchanged lines hidden (view full) --- 2546 } 2547 if (error) 2548 goto out; 2549 2550 VATTR_NULL(vap); 2551 if (v3) 2552 nfsm_srvsattr(vap); 2553 nfsm_srvpathsiz(len2); |
2554 MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, M_WAITOK); | 2554 MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, 0); |
2555 iv.iov_base = pathcp; 2556 iv.iov_len = len2; 2557 io.uio_resid = len2; 2558 io.uio_offset = 0; 2559 io.uio_iov = &iv; 2560 io.uio_iovcnt = 1; 2561 io.uio_segflg = UIO_SYSSPACE; 2562 io.uio_rw = UIO_READ; --- 491 unchanged lines hidden (view full) --- 3054 error = 0; 3055 goto nfsmout; 3056 } 3057 VOP_UNLOCK(vp, 0, td); 3058 3059 /* 3060 * end section. Allocate rbuf and continue 3061 */ | 2555 iv.iov_base = pathcp; 2556 iv.iov_len = len2; 2557 io.uio_resid = len2; 2558 io.uio_offset = 0; 2559 io.uio_iov = &iv; 2560 io.uio_iovcnt = 1; 2561 io.uio_segflg = UIO_SYSSPACE; 2562 io.uio_rw = UIO_READ; --- 491 unchanged lines hidden (view full) --- 3054 error = 0; 3055 goto nfsmout; 3056 } 3057 VOP_UNLOCK(vp, 0, td); 3058 3059 /* 3060 * end section. Allocate rbuf and continue 3061 */ |
3062 MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); | 3062 MALLOC(rbuf, caddr_t, siz, M_TEMP, 0); |
3063again: 3064 iv.iov_base = rbuf; 3065 iv.iov_len = fullsiz; 3066 io.uio_iov = &iv; 3067 io.uio_iovcnt = 1; 3068 io.uio_offset = (off_t)off; 3069 io.uio_resid = fullsiz; 3070 io.uio_segflg = UIO_SYSSPACE; --- 261 unchanged lines hidden (view full) --- 3332 vput(vp); 3333 vp = NULL; 3334 nfsm_reply(NFSX_V3POSTOPATTR); 3335 nfsm_srvpostop_attr(getret, &at); 3336 error = 0; 3337 goto nfsmout; 3338 } 3339 VOP_UNLOCK(vp, 0, td); | 3063again: 3064 iv.iov_base = rbuf; 3065 iv.iov_len = fullsiz; 3066 io.uio_iov = &iv; 3067 io.uio_iovcnt = 1; 3068 io.uio_offset = (off_t)off; 3069 io.uio_resid = fullsiz; 3070 io.uio_segflg = UIO_SYSSPACE; --- 261 unchanged lines hidden (view full) --- 3332 vput(vp); 3333 vp = NULL; 3334 nfsm_reply(NFSX_V3POSTOPATTR); 3335 nfsm_srvpostop_attr(getret, &at); 3336 error = 0; 3337 goto nfsmout; 3338 } 3339 VOP_UNLOCK(vp, 0, td); |
3340 MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); | 3340 MALLOC(rbuf, caddr_t, siz, M_TEMP, 0); |
3341again: 3342 iv.iov_base = rbuf; 3343 iv.iov_len = fullsiz; 3344 io.uio_iov = &iv; 3345 io.uio_iovcnt = 1; 3346 io.uio_offset = (off_t)off; 3347 io.uio_resid = fullsiz; 3348 io.uio_segflg = UIO_SYSSPACE; --- 720 unchanged lines hidden --- | 3341again: 3342 iv.iov_base = rbuf; 3343 iv.iov_len = fullsiz; 3344 io.uio_iov = &iv; 3345 io.uio_iovcnt = 1; 3346 io.uio_offset = (off_t)off; 3347 io.uio_resid = fullsiz; 3348 io.uio_segflg = UIO_SYSSPACE; --- 720 unchanged lines hidden --- |