Deleted Added
full compact
nfs_serv.c (47028) nfs_serv.c (47751)
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

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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
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

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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 * $Id: nfs_serv.c,v 1.76 1999/05/06 18:13:04 peter Exp $
37 * $Id: nfs_serv.c,v 1.77 1999/05/11 19:54:45 phk Exp $
38 */
39
40/*
41 * nfs version 2 and 3 server calls to vnode ops
42 * - these routines generally have 3 phases
43 * 1 - break down and validate rpc request in mbuf list
44 * 2 - do the vnode ops for the request
45 * (surprisingly ?? many are very similar to syscalls in vfs_syscalls.c)

--- 569 unchanged lines hidden (view full) ---

615 struct vattr va, *vap = &va;
616 off_t off;
617 u_quad_t frev;
618
619 fhp = &nfh.fh_generic;
620 nfsm_srvmtofh(fhp);
621 if (v3) {
622 nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
38 */
39
40/*
41 * nfs version 2 and 3 server calls to vnode ops
42 * - these routines generally have 3 phases
43 * 1 - break down and validate rpc request in mbuf list
44 * 2 - do the vnode ops for the request
45 * (surprisingly ?? many are very similar to syscalls in vfs_syscalls.c)

--- 569 unchanged lines hidden (view full) ---

615 struct vattr va, *vap = &va;
616 off_t off;
617 u_quad_t frev;
618
619 fhp = &nfh.fh_generic;
620 nfsm_srvmtofh(fhp);
621 if (v3) {
622 nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
623 fxdr_hyper(tl, &off);
623 off = fxdr_hyper(tl);
624 } else {
625 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
626 off = (off_t)fxdr_unsigned(u_int32_t, *tl);
627 }
628 nfsm_srvstrsiz(reqlen, NFS_SRVMAXDATA(nfsd));
629 error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
630 &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
631 if (error) {

--- 19 unchanged lines hidden (view full) ---

651 vput(vp);
652 nfsm_reply(NFSX_POSTOPATTR(v3));
653 nfsm_srvpostop_attr(getret, vap);
654 return (0);
655 }
656 if (off >= vap->va_size)
657 cnt = 0;
658 else if ((off + reqlen) > vap->va_size)
624 } else {
625 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
626 off = (off_t)fxdr_unsigned(u_int32_t, *tl);
627 }
628 nfsm_srvstrsiz(reqlen, NFS_SRVMAXDATA(nfsd));
629 error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
630 &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
631 if (error) {

--- 19 unchanged lines hidden (view full) ---

651 vput(vp);
652 nfsm_reply(NFSX_POSTOPATTR(v3));
653 nfsm_srvpostop_attr(getret, vap);
654 return (0);
655 }
656 if (off >= vap->va_size)
657 cnt = 0;
658 else if ((off + reqlen) > vap->va_size)
659 cnt = nfsm_rndup(vap->va_size - off);
659 cnt = vap->va_size - off;
660 else
661 cnt = reqlen;
662 nfsm_reply(NFSX_POSTOPORFATTR(v3) + 3 * NFSX_UNSIGNED+nfsm_rndup(cnt));
663 if (v3) {
664 nfsm_build(tl, u_int32_t *, NFSX_V3FATTR + 4 * NFSX_UNSIGNED);
665 *tl++ = nfs_true;
666 fp = (struct nfs_fattr *)tl;
667 tl += (NFSX_V3FATTR / sizeof (u_int32_t));
668 } else {
669 nfsm_build(tl, u_int32_t *, NFSX_V2FATTR + NFSX_UNSIGNED);
670 fp = (struct nfs_fattr *)tl;
671 tl += (NFSX_V2FATTR / sizeof (u_int32_t));
672 }
660 else
661 cnt = reqlen;
662 nfsm_reply(NFSX_POSTOPORFATTR(v3) + 3 * NFSX_UNSIGNED+nfsm_rndup(cnt));
663 if (v3) {
664 nfsm_build(tl, u_int32_t *, NFSX_V3FATTR + 4 * NFSX_UNSIGNED);
665 *tl++ = nfs_true;
666 fp = (struct nfs_fattr *)tl;
667 tl += (NFSX_V3FATTR / sizeof (u_int32_t));
668 } else {
669 nfsm_build(tl, u_int32_t *, NFSX_V2FATTR + NFSX_UNSIGNED);
670 fp = (struct nfs_fattr *)tl;
671 tl += (NFSX_V2FATTR / sizeof (u_int32_t));
672 }
673 len = left = cnt;
673 len = left = nfsm_rndup(cnt);
674 if (cnt > 0) {
675 /*
676 * Generate the mbuf list with the uio_iov ref. to it.
677 */
678 i = 0;
679 m = m2 = mb;
680 while (left > 0) {
681 siz = min(M_TRAILINGSPACE(m), left);

--- 8 unchanged lines hidden (view full) ---

690 m2->m_next = m;
691 m2 = m;
692 }
693 }
694 MALLOC(iv, struct iovec *, i * sizeof (struct iovec),
695 M_TEMP, M_WAITOK);
696 uiop->uio_iov = iv2 = iv;
697 m = mb;
674 if (cnt > 0) {
675 /*
676 * Generate the mbuf list with the uio_iov ref. to it.
677 */
678 i = 0;
679 m = m2 = mb;
680 while (left > 0) {
681 siz = min(M_TRAILINGSPACE(m), left);

--- 8 unchanged lines hidden (view full) ---

690 m2->m_next = m;
691 m2 = m;
692 }
693 }
694 MALLOC(iv, struct iovec *, i * sizeof (struct iovec),
695 M_TEMP, M_WAITOK);
696 uiop->uio_iov = iv2 = iv;
697 m = mb;
698 left = cnt;
698 left = len;
699 i = 0;
700 while (left > 0) {
701 if (m == NULL)
702 panic("nfsrv_read iov");
703 siz = min(M_TRAILINGSPACE(m), left);
704 if (siz > 0) {
705 iv->iov_base = mtod(m, caddr_t) + m->m_len;
706 iv->iov_len = siz;
707 m->m_len += siz;
708 left -= siz;
709 iv++;
710 i++;
711 }
712 m = m->m_next;
713 }
714 uiop->uio_iovcnt = i;
715 uiop->uio_offset = off;
699 i = 0;
700 while (left > 0) {
701 if (m == NULL)
702 panic("nfsrv_read iov");
703 siz = min(M_TRAILINGSPACE(m), left);
704 if (siz > 0) {
705 iv->iov_base = mtod(m, caddr_t) + m->m_len;
706 iv->iov_len = siz;
707 m->m_len += siz;
708 left -= siz;
709 iv++;
710 i++;
711 }
712 m = m->m_next;
713 }
714 uiop->uio_iovcnt = i;
715 uiop->uio_offset = off;
716 uiop->uio_resid = cnt;
716 uiop->uio_resid = len;
717 uiop->uio_rw = UIO_READ;
718 uiop->uio_segflg = UIO_SYSSPACE;
719 error = VOP_READ(vp, uiop, IO_NODELOCKED, cred);
720 off = uiop->uio_offset;
721 FREE((caddr_t)iv2, M_TEMP);
722 if (error || (getret = VOP_GETATTR(vp, vap, cred, procp))) {
723 if (!error)
724 error = getret;
725 m_freem(mreq);
726 vput(vp);
727 nfsm_reply(NFSX_POSTOPATTR(v3));
728 nfsm_srvpostop_attr(getret, vap);
729 return (0);
730 }
731 } else
732 uiop->uio_resid = 0;
733 vput(vp);
734 nfsm_srvfillattr(vap, fp);
717 uiop->uio_rw = UIO_READ;
718 uiop->uio_segflg = UIO_SYSSPACE;
719 error = VOP_READ(vp, uiop, IO_NODELOCKED, cred);
720 off = uiop->uio_offset;
721 FREE((caddr_t)iv2, M_TEMP);
722 if (error || (getret = VOP_GETATTR(vp, vap, cred, procp))) {
723 if (!error)
724 error = getret;
725 m_freem(mreq);
726 vput(vp);
727 nfsm_reply(NFSX_POSTOPATTR(v3));
728 nfsm_srvpostop_attr(getret, vap);
729 return (0);
730 }
731 } else
732 uiop->uio_resid = 0;
733 vput(vp);
734 nfsm_srvfillattr(vap, fp);
735 len -= uiop->uio_resid;
736 tlen = nfsm_rndup(len);
737 if (cnt != tlen || tlen != len)
738 nfsm_adj(mb, cnt - tlen, tlen - len);
735 tlen = len - uiop->uio_resid;
736 cnt = cnt < tlen ? cnt : tlen;
737 tlen = nfsm_rndup(cnt);
738 if (len != tlen || tlen != cnt)
739 nfsm_adj(mb, len - tlen, tlen - cnt);
739 if (v3) {
740 if (v3) {
740 *tl++ = txdr_unsigned(len);
741 *tl++ = txdr_unsigned(cnt);
741 if (len < reqlen)
742 *tl++ = nfs_true;
743 else
744 *tl++ = nfs_false;
745 }
742 if (len < reqlen)
743 *tl++ = nfs_true;
744 else
745 *tl++ = nfs_false;
746 }
746 *tl = txdr_unsigned(len);
747 *tl = txdr_unsigned(cnt);
747 nfsm_srvdone;
748}
749
750/*
751 * nfs write service
752 */
753int
754nfsrv_write(nfsd, slp, procp, mrq)

--- 32 unchanged lines hidden (view full) ---

787 if (mrep == NULL) {
788 *mrq = NULL;
789 return (0);
790 }
791 fhp = &nfh.fh_generic;
792 nfsm_srvmtofh(fhp);
793 if (v3) {
794 nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
748 nfsm_srvdone;
749}
750
751/*
752 * nfs write service
753 */
754int
755nfsrv_write(nfsd, slp, procp, mrq)

--- 32 unchanged lines hidden (view full) ---

788 if (mrep == NULL) {
789 *mrq = NULL;
790 return (0);
791 }
792 fhp = &nfh.fh_generic;
793 nfsm_srvmtofh(fhp);
794 if (v3) {
795 nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
795 fxdr_hyper(tl, &off);
796 off = fxdr_hyper(tl);
796 tl += 3;
797 stable = fxdr_unsigned(int, *tl++);
798 } else {
799 nfsm_dissect(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
800 off = (off_t)fxdr_unsigned(u_int32_t, *++tl);
801 tl += 2;
802 if (nfs_async)
803 stable = NFSV3WRITE_UNSTABLE;

--- 188 unchanged lines hidden (view full) ---

992 (v3 ? nfsrvw_procrastinate_v3 : nfsrvw_procrastinate);
993
994 /*
995 * Now, get the write header..
996 */
997 nfsm_srvmtofh(&nfsd->nd_fh);
998 if (v3) {
999 nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
797 tl += 3;
798 stable = fxdr_unsigned(int, *tl++);
799 } else {
800 nfsm_dissect(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
801 off = (off_t)fxdr_unsigned(u_int32_t, *++tl);
802 tl += 2;
803 if (nfs_async)
804 stable = NFSV3WRITE_UNSTABLE;

--- 188 unchanged lines hidden (view full) ---

993 (v3 ? nfsrvw_procrastinate_v3 : nfsrvw_procrastinate);
994
995 /*
996 * Now, get the write header..
997 */
998 nfsm_srvmtofh(&nfsd->nd_fh);
999 if (v3) {
1000 nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
1000 fxdr_hyper(tl, &nfsd->nd_off);
1001 nfsd->nd_off = fxdr_hyper(tl);
1001 tl += 3;
1002 nfsd->nd_stable = fxdr_unsigned(int, *tl++);
1003 } else {
1004 nfsm_dissect(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
1005 nfsd->nd_off = (off_t)fxdr_unsigned(u_int32_t, *++tl);
1006 tl += 2;
1007 if (nfs_async)
1008 nfsd->nd_stable = NFSV3WRITE_UNSTABLE;

--- 1516 unchanged lines hidden (view full) ---

2525 int v3 = (nfsd->nd_flag & ND_NFSV3);
2526 u_quad_t frev, off, toff, verf;
2527 u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */
2528
2529 fhp = &nfh.fh_generic;
2530 nfsm_srvmtofh(fhp);
2531 if (v3) {
2532 nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
1002 tl += 3;
1003 nfsd->nd_stable = fxdr_unsigned(int, *tl++);
1004 } else {
1005 nfsm_dissect(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
1006 nfsd->nd_off = (off_t)fxdr_unsigned(u_int32_t, *++tl);
1007 tl += 2;
1008 if (nfs_async)
1009 nfsd->nd_stable = NFSV3WRITE_UNSTABLE;

--- 1516 unchanged lines hidden (view full) ---

2526 int v3 = (nfsd->nd_flag & ND_NFSV3);
2527 u_quad_t frev, off, toff, verf;
2528 u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */
2529
2530 fhp = &nfh.fh_generic;
2531 nfsm_srvmtofh(fhp);
2532 if (v3) {
2533 nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
2533 fxdr_hyper(tl, &toff);
2534 toff = fxdr_hyper(tl);
2534 tl += 2;
2535 tl += 2;
2535 fxdr_hyper(tl, &verf);
2536 verf = fxdr_hyper(tl);
2536 tl += 2;
2537 } else {
2538 nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2539 toff = fxdr_unsigned(u_quad_t, *tl++);
2537 tl += 2;
2538 } else {
2539 nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2540 toff = fxdr_unsigned(u_quad_t, *tl++);
2541 verf = 0; /* shut up gcc */
2540 }
2541 off = toff;
2542 cnt = fxdr_unsigned(int, *tl);
2543 siz = ((cnt + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
2544 xfer = NFS_SRVMAXDATA(nfsd);
2545 if (siz > xfer)
2546 siz = xfer;
2547 fullsiz = siz;

--- 71 unchanged lines hidden (view full) ---

2619 */
2620 if (siz == 0) {
2621 vrele(vp);
2622 nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_COOKIEVERF(v3) +
2623 2 * NFSX_UNSIGNED);
2624 if (v3) {
2625 nfsm_srvpostop_attr(getret, &at);
2626 nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
2542 }
2543 off = toff;
2544 cnt = fxdr_unsigned(int, *tl);
2545 siz = ((cnt + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
2546 xfer = NFS_SRVMAXDATA(nfsd);
2547 if (siz > xfer)
2548 siz = xfer;
2549 fullsiz = siz;

--- 71 unchanged lines hidden (view full) ---

2621 */
2622 if (siz == 0) {
2623 vrele(vp);
2624 nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_COOKIEVERF(v3) +
2625 2 * NFSX_UNSIGNED);
2626 if (v3) {
2627 nfsm_srvpostop_attr(getret, &at);
2628 nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
2627 txdr_hyper(&at.va_filerev, tl);
2629 txdr_hyper(at.va_filerev, tl);
2628 tl += 2;
2629 } else
2630 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2631 *tl++ = nfs_false;
2632 *tl = nfs_true;
2633 FREE((caddr_t)rbuf, M_TEMP);
2634 FREE((caddr_t)cookies, M_TEMP);
2635 return (0);

--- 29 unchanged lines hidden (view full) ---

2665 goto again;
2666 }
2667
2668 len = 3 * NFSX_UNSIGNED; /* paranoia, probably can be 0 */
2669 nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_COOKIEVERF(v3) + siz);
2670 if (v3) {
2671 nfsm_srvpostop_attr(getret, &at);
2672 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2630 tl += 2;
2631 } else
2632 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2633 *tl++ = nfs_false;
2634 *tl = nfs_true;
2635 FREE((caddr_t)rbuf, M_TEMP);
2636 FREE((caddr_t)cookies, M_TEMP);
2637 return (0);

--- 29 unchanged lines hidden (view full) ---

2667 goto again;
2668 }
2669
2670 len = 3 * NFSX_UNSIGNED; /* paranoia, probably can be 0 */
2671 nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_COOKIEVERF(v3) + siz);
2672 if (v3) {
2673 nfsm_srvpostop_attr(getret, &at);
2674 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2673 txdr_hyper(&at.va_filerev, tl);
2675 txdr_hyper(at.va_filerev, tl);
2674 }
2675 mp = mp2 = mb;
2676 bp = bpos;
2677 be = bp + M_TRAILINGSPACE(mp);
2678
2679 /* Loop through the records and build reply */
2680 while (cpos < cend && ncookies > 0) {
2681 if (dp->d_fileno != 0 && dp->d_type != DT_WHT) {

--- 110 unchanged lines hidden (view full) ---

2792 int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1;
2793 int siz, cnt, fullsiz, eofflag, rdonly, cache, dirlen, ncookies;
2794 u_quad_t frev, off, toff, verf;
2795 u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */
2796
2797 fhp = &nfh.fh_generic;
2798 nfsm_srvmtofh(fhp);
2799 nfsm_dissect(tl, u_int32_t *, 6 * NFSX_UNSIGNED);
2676 }
2677 mp = mp2 = mb;
2678 bp = bpos;
2679 be = bp + M_TRAILINGSPACE(mp);
2680
2681 /* Loop through the records and build reply */
2682 while (cpos < cend && ncookies > 0) {
2683 if (dp->d_fileno != 0 && dp->d_type != DT_WHT) {

--- 110 unchanged lines hidden (view full) ---

2794 int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1;
2795 int siz, cnt, fullsiz, eofflag, rdonly, cache, dirlen, ncookies;
2796 u_quad_t frev, off, toff, verf;
2797 u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */
2798
2799 fhp = &nfh.fh_generic;
2800 nfsm_srvmtofh(fhp);
2801 nfsm_dissect(tl, u_int32_t *, 6 * NFSX_UNSIGNED);
2800 fxdr_hyper(tl, &toff);
2802 toff = fxdr_hyper(tl);
2801 tl += 2;
2803 tl += 2;
2802 fxdr_hyper(tl, &verf);
2804 verf = fxdr_hyper(tl);
2803 tl += 2;
2804 siz = fxdr_unsigned(int, *tl++);
2805 cnt = fxdr_unsigned(int, *tl);
2806 off = toff;
2807 siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
2808 xfer = NFS_SRVMAXDATA(nfsd);
2809 if (siz > xfer)
2810 siz = xfer;

--- 68 unchanged lines hidden (view full) ---

2879 * rpc reply
2880 */
2881 if (siz == 0) {
2882 vrele(vp);
2883 nfsm_reply(NFSX_V3POSTOPATTR + NFSX_V3COOKIEVERF +
2884 2 * NFSX_UNSIGNED);
2885 nfsm_srvpostop_attr(getret, &at);
2886 nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
2805 tl += 2;
2806 siz = fxdr_unsigned(int, *tl++);
2807 cnt = fxdr_unsigned(int, *tl);
2808 off = toff;
2809 siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
2810 xfer = NFS_SRVMAXDATA(nfsd);
2811 if (siz > xfer)
2812 siz = xfer;

--- 68 unchanged lines hidden (view full) ---

2881 * rpc reply
2882 */
2883 if (siz == 0) {
2884 vrele(vp);
2885 nfsm_reply(NFSX_V3POSTOPATTR + NFSX_V3COOKIEVERF +
2886 2 * NFSX_UNSIGNED);
2887 nfsm_srvpostop_attr(getret, &at);
2888 nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
2887 txdr_hyper(&at.va_filerev, tl);
2889 txdr_hyper(at.va_filerev, tl);
2888 tl += 2;
2889 *tl++ = nfs_false;
2890 *tl = nfs_true;
2891 FREE((caddr_t)cookies, M_TEMP);
2892 FREE((caddr_t)rbuf, M_TEMP);
2893 return (0);
2894 }
2895 }

--- 41 unchanged lines hidden (view full) ---

2937 return (0);
2938 }
2939 vput(nvp);
2940
2941 dirlen = len = NFSX_V3POSTOPATTR + NFSX_V3COOKIEVERF + 2 * NFSX_UNSIGNED;
2942 nfsm_reply(cnt);
2943 nfsm_srvpostop_attr(getret, &at);
2944 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2890 tl += 2;
2891 *tl++ = nfs_false;
2892 *tl = nfs_true;
2893 FREE((caddr_t)cookies, M_TEMP);
2894 FREE((caddr_t)rbuf, M_TEMP);
2895 return (0);
2896 }
2897 }

--- 41 unchanged lines hidden (view full) ---

2939 return (0);
2940 }
2941 vput(nvp);
2942
2943 dirlen = len = NFSX_V3POSTOPATTR + NFSX_V3COOKIEVERF + 2 * NFSX_UNSIGNED;
2944 nfsm_reply(cnt);
2945 nfsm_srvpostop_attr(getret, &at);
2946 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2945 txdr_hyper(&at.va_filerev, tl);
2947 txdr_hyper(at.va_filerev, tl);
2946 mp = mp2 = mb;
2947 bp = bpos;
2948 be = bp + M_TRAILINGSPACE(mp);
2949
2950 /* Loop through the records and build reply */
2951 while (cpos < cend && ncookies > 0) {
2952 if (dp->d_fileno != 0 && dp->d_type != DT_WHT) {
2953 nlen = dp->d_namlen;

--- 152 unchanged lines hidden (view full) ---

3106 fhp = &nfh.fh_generic;
3107 nfsm_srvmtofh(fhp);
3108 nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
3109
3110 /*
3111 * XXX At this time VOP_FSYNC() does not accept offset and byte
3112 * count parameters, so these arguments are useless (someday maybe).
3113 */
2948 mp = mp2 = mb;
2949 bp = bpos;
2950 be = bp + M_TRAILINGSPACE(mp);
2951
2952 /* Loop through the records and build reply */
2953 while (cpos < cend && ncookies > 0) {
2954 if (dp->d_fileno != 0 && dp->d_type != DT_WHT) {
2955 nlen = dp->d_namlen;

--- 152 unchanged lines hidden (view full) ---

3108 fhp = &nfh.fh_generic;
3109 nfsm_srvmtofh(fhp);
3110 nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
3111
3112 /*
3113 * XXX At this time VOP_FSYNC() does not accept offset and byte
3114 * count parameters, so these arguments are useless (someday maybe).
3115 */
3114 fxdr_hyper(tl, &off);
3116 off = fxdr_hyper(tl);
3115 tl += 2;
3116 cnt = fxdr_unsigned(int, *tl);
3117 error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
3118 &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
3119 if (error) {
3120 nfsm_reply(2 * NFSX_UNSIGNED);
3121 nfsm_srvwcc_data(for_ret, &bfor, aft_ret, &aft);
3122 return (0);

--- 67 unchanged lines hidden (view full) ---

3190 if (v3)
3191 nfsm_srvpostop_attr(getret, &at);
3192 if (error)
3193 return (0);
3194 nfsm_build(sfp, struct nfs_statfs *, NFSX_STATFS(v3));
3195 if (v3) {
3196 tval = (u_quad_t)sf->f_blocks;
3197 tval *= (u_quad_t)sf->f_bsize;
3117 tl += 2;
3118 cnt = fxdr_unsigned(int, *tl);
3119 error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
3120 &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
3121 if (error) {
3122 nfsm_reply(2 * NFSX_UNSIGNED);
3123 nfsm_srvwcc_data(for_ret, &bfor, aft_ret, &aft);
3124 return (0);

--- 67 unchanged lines hidden (view full) ---

3192 if (v3)
3193 nfsm_srvpostop_attr(getret, &at);
3194 if (error)
3195 return (0);
3196 nfsm_build(sfp, struct nfs_statfs *, NFSX_STATFS(v3));
3197 if (v3) {
3198 tval = (u_quad_t)sf->f_blocks;
3199 tval *= (u_quad_t)sf->f_bsize;
3198 txdr_hyper(&tval, &sfp->sf_tbytes);
3200 txdr_hyper(tval, &sfp->sf_tbytes);
3199 tval = (u_quad_t)sf->f_bfree;
3200 tval *= (u_quad_t)sf->f_bsize;
3201 tval = (u_quad_t)sf->f_bfree;
3202 tval *= (u_quad_t)sf->f_bsize;
3201 txdr_hyper(&tval, &sfp->sf_fbytes);
3203 txdr_hyper(tval, &sfp->sf_fbytes);
3202 tval = (u_quad_t)sf->f_bavail;
3203 tval *= (u_quad_t)sf->f_bsize;
3204 tval = (u_quad_t)sf->f_bavail;
3205 tval *= (u_quad_t)sf->f_bsize;
3204 txdr_hyper(&tval, &sfp->sf_abytes);
3206 txdr_hyper(tval, &sfp->sf_abytes);
3205 sfp->sf_tfiles.nfsuquad[0] = 0;
3206 sfp->sf_tfiles.nfsuquad[1] = txdr_unsigned(sf->f_files);
3207 sfp->sf_ffiles.nfsuquad[0] = 0;
3208 sfp->sf_ffiles.nfsuquad[1] = txdr_unsigned(sf->f_ffree);
3209 sfp->sf_afiles.nfsuquad[0] = 0;
3210 sfp->sf_afiles.nfsuquad[1] = txdr_unsigned(sf->f_ffree);
3211 sfp->sf_invarsec = 0;
3212 } else {

--- 68 unchanged lines hidden (view full) ---

3281 pref = NFS_MAXDATA;
3282 sip->fs_rtmax = txdr_unsigned(NFS_MAXDATA);
3283 sip->fs_rtpref = txdr_unsigned(pref);
3284 sip->fs_rtmult = txdr_unsigned(NFS_FABLKSIZE);
3285 sip->fs_wtmax = txdr_unsigned(NFS_MAXDATA);
3286 sip->fs_wtpref = txdr_unsigned(pref);
3287 sip->fs_wtmult = txdr_unsigned(NFS_FABLKSIZE);
3288 sip->fs_dtpref = txdr_unsigned(pref);
3207 sfp->sf_tfiles.nfsuquad[0] = 0;
3208 sfp->sf_tfiles.nfsuquad[1] = txdr_unsigned(sf->f_files);
3209 sfp->sf_ffiles.nfsuquad[0] = 0;
3210 sfp->sf_ffiles.nfsuquad[1] = txdr_unsigned(sf->f_ffree);
3211 sfp->sf_afiles.nfsuquad[0] = 0;
3212 sfp->sf_afiles.nfsuquad[1] = txdr_unsigned(sf->f_ffree);
3213 sfp->sf_invarsec = 0;
3214 } else {

--- 68 unchanged lines hidden (view full) ---

3283 pref = NFS_MAXDATA;
3284 sip->fs_rtmax = txdr_unsigned(NFS_MAXDATA);
3285 sip->fs_rtpref = txdr_unsigned(pref);
3286 sip->fs_rtmult = txdr_unsigned(NFS_FABLKSIZE);
3287 sip->fs_wtmax = txdr_unsigned(NFS_MAXDATA);
3288 sip->fs_wtpref = txdr_unsigned(pref);
3289 sip->fs_wtmult = txdr_unsigned(NFS_FABLKSIZE);
3290 sip->fs_dtpref = txdr_unsigned(pref);
3289 txdr_hyper(&maxfsize, &sip->fs_maxfilesize);
3291 txdr_hyper(maxfsize, &sip->fs_maxfilesize);
3290 sip->fs_timedelta.nfsv3_sec = 0;
3291 sip->fs_timedelta.nfsv3_nsec = txdr_unsigned(1);
3292 sip->fs_properties = txdr_unsigned(NFSV3FSINFO_LINK |
3293 NFSV3FSINFO_SYMLINK | NFSV3FSINFO_HOMOGENEOUS |
3294 NFSV3FSINFO_CANSETTIME);
3295 nfsm_srvdone;
3296}
3297

--- 185 unchanged lines hidden ---
3292 sip->fs_timedelta.nfsv3_sec = 0;
3293 sip->fs_timedelta.nfsv3_nsec = txdr_unsigned(1);
3294 sip->fs_properties = txdr_unsigned(NFSV3FSINFO_LINK |
3295 NFSV3FSINFO_SYMLINK | NFSV3FSINFO_HOMOGENEOUS |
3296 NFSV3FSINFO_CANSETTIME);
3297 nfsm_srvdone;
3298}
3299

--- 185 unchanged lines hidden ---