nfs_subs.c (104908) | nfs_subs.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_subs.c 8.8 (Berkeley) 5/22/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_subs.c 8.8 (Berkeley) 5/22/95 37 */ 38 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_subs.c 104908 2002-10-11 14:58:34Z mike $"); | 40__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_subs.c 109623 2003-01-21 08:56:16Z alfred $"); |
41 42/* 43 * These functions support the macros and help fiddle mbuf chains for 44 * the nfs op functions. They do things like create the rpc header and 45 * copy data between mbuf chains and uio lists. 46 */ 47 48#include <sys/param.h> --- 88 unchanged lines hidden (view full) --- 137 * The hsiz is the size of the rest of the nfs request header. 138 * (just used to decide if a cluster is a good idea) 139 */ 140struct mbuf * 141nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz) 142{ 143 struct mbuf *mb; 144 | 41 42/* 43 * These functions support the macros and help fiddle mbuf chains for 44 * the nfs op functions. They do things like create the rpc header and 45 * copy data between mbuf chains and uio lists. 46 */ 47 48#include <sys/param.h> --- 88 unchanged lines hidden (view full) --- 137 * The hsiz is the size of the rest of the nfs request header. 138 * (just used to decide if a cluster is a good idea) 139 */ 140struct mbuf * 141nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz) 142{ 143 struct mbuf *mb; 144 |
145 MGET(mb, M_TRYWAIT, MT_DATA); | 145 MGET(mb, 0, MT_DATA); |
146 if (hsiz >= MINCLSIZE) | 146 if (hsiz >= MINCLSIZE) |
147 MCLGET(mb, M_TRYWAIT); | 147 MCLGET(mb, 0); |
148 mb->m_len = 0; 149 return (mb); 150} 151 152/* 153 * Build the RPC header and fill in the authorization info. 154 * The authorization string argument is only used when the credentials 155 * come from outside of the kernel. --- 7 unchanged lines hidden (view full) --- 163 struct mbuf *mb; 164 u_int32_t *tl; 165 caddr_t bpos; 166 int i; 167 struct mbuf *mreq; 168 int grpsiz, authsiz; 169 170 authsiz = nfsm_rndup(auth_len); | 148 mb->m_len = 0; 149 return (mb); 150} 151 152/* 153 * Build the RPC header and fill in the authorization info. 154 * The authorization string argument is only used when the credentials 155 * come from outside of the kernel. --- 7 unchanged lines hidden (view full) --- 163 struct mbuf *mb; 164 u_int32_t *tl; 165 caddr_t bpos; 166 int i; 167 struct mbuf *mreq; 168 int grpsiz, authsiz; 169 170 authsiz = nfsm_rndup(auth_len); |
171 MGETHDR(mb, M_TRYWAIT, MT_DATA); | 171 MGETHDR(mb, 0, MT_DATA); |
172 if ((authsiz + 10 * NFSX_UNSIGNED) >= MINCLSIZE) { | 172 if ((authsiz + 10 * NFSX_UNSIGNED) >= MINCLSIZE) { |
173 MCLGET(mb, M_TRYWAIT); | 173 MCLGET(mb, 0); |
174 } else if ((authsiz + 10 * NFSX_UNSIGNED) < MHLEN) { 175 MH_ALIGN(mb, authsiz + 10 * NFSX_UNSIGNED); 176 } else { 177 MH_ALIGN(mb, 8 * NFSX_UNSIGNED); 178 } 179 mb->m_len = 0; 180 mreq = mb; 181 bpos = mtod(mb, caddr_t); --- 84 unchanged lines hidden (view full) --- 266 left = uiop->uio_iov->iov_len; 267 uiocp = uiop->uio_iov->iov_base; 268 if (left > siz) 269 left = siz; 270 uiosiz = left; 271 while (left > 0) { 272 mlen = M_TRAILINGSPACE(mp); 273 if (mlen == 0) { | 174 } else if ((authsiz + 10 * NFSX_UNSIGNED) < MHLEN) { 175 MH_ALIGN(mb, authsiz + 10 * NFSX_UNSIGNED); 176 } else { 177 MH_ALIGN(mb, 8 * NFSX_UNSIGNED); 178 } 179 mb->m_len = 0; 180 mreq = mb; 181 bpos = mtod(mb, caddr_t); --- 84 unchanged lines hidden (view full) --- 266 left = uiop->uio_iov->iov_len; 267 uiocp = uiop->uio_iov->iov_base; 268 if (left > siz) 269 left = siz; 270 uiosiz = left; 271 while (left > 0) { 272 mlen = M_TRAILINGSPACE(mp); 273 if (mlen == 0) { |
274 MGET(mp, M_TRYWAIT, MT_DATA); | 274 MGET(mp, 0, MT_DATA); |
275 if (clflg) | 275 if (clflg) |
276 MCLGET(mp, M_TRYWAIT); | 276 MCLGET(mp, 0); |
277 mp->m_len = 0; 278 mp2->m_next = mp; 279 mp2 = mp; 280 mlen = M_TRAILINGSPACE(mp); 281 } 282 xfer = (left > mlen) ? mlen : left; 283#ifdef notdef 284 /* Not Yet.. */ --- 14 unchanged lines hidden (view full) --- 299 } 300 uiop->uio_iov->iov_base = 301 (char *)uiop->uio_iov->iov_base + uiosiz; 302 uiop->uio_iov->iov_len -= uiosiz; 303 siz -= uiosiz; 304 } 305 if (rem > 0) { 306 if (rem > M_TRAILINGSPACE(mp)) { | 277 mp->m_len = 0; 278 mp2->m_next = mp; 279 mp2 = mp; 280 mlen = M_TRAILINGSPACE(mp); 281 } 282 xfer = (left > mlen) ? mlen : left; 283#ifdef notdef 284 /* Not Yet.. */ --- 14 unchanged lines hidden (view full) --- 299 } 300 uiop->uio_iov->iov_base = 301 (char *)uiop->uio_iov->iov_base + uiosiz; 302 uiop->uio_iov->iov_len -= uiosiz; 303 siz -= uiosiz; 304 } 305 if (rem > 0) { 306 if (rem > M_TRAILINGSPACE(mp)) { |
307 MGET(mp, M_TRYWAIT, MT_DATA); | 307 MGET(mp, 0, MT_DATA); |
308 mp->m_len = 0; 309 mp2->m_next = mp; 310 } 311 cp = mtod(mp, caddr_t)+mp->m_len; 312 for (left = 0; left < rem; left++) 313 *cp++ = '\0'; 314 mp->m_len += rem; 315 *bpos = cp; --- 28 unchanged lines hidden (view full) --- 344 siz -= left; 345 cp += left; 346 m2->m_len += left; 347 left = 0; 348 } 349 } 350 /* Loop around adding mbufs */ 351 while (siz > 0) { | 308 mp->m_len = 0; 309 mp2->m_next = mp; 310 } 311 cp = mtod(mp, caddr_t)+mp->m_len; 312 for (left = 0; left < rem; left++) 313 *cp++ = '\0'; 314 mp->m_len += rem; 315 *bpos = cp; --- 28 unchanged lines hidden (view full) --- 344 siz -= left; 345 cp += left; 346 m2->m_len += left; 347 left = 0; 348 } 349 } 350 /* Loop around adding mbufs */ 351 while (siz > 0) { |
352 MGET(m1, M_TRYWAIT, MT_DATA); | 352 MGET(m1, 0, MT_DATA); |
353 if (siz > MLEN) | 353 if (siz > MLEN) |
354 MCLGET(m1, M_TRYWAIT); | 354 MCLGET(m1, 0); |
355 m1->m_len = NFSMSIZ(m1); 356 m2->m_next = m1; 357 m2 = m1; 358 tl = mtod(m1, u_int32_t *); 359 tlen = 0; 360 if (putsize) { 361 *tl++ = txdr_unsigned(siz); 362 m1->m_len -= NFSX_UNSIGNED; --- 348 unchanged lines hidden (view full) --- 711#endif 712 return (&nfs_nullcookie); 713 } 714 pos--; 715 dp = LIST_FIRST(&np->n_cookies); 716 if (!dp) { 717 if (add) { 718 MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), | 355 m1->m_len = NFSMSIZ(m1); 356 m2->m_next = m1; 357 m2 = m1; 358 tl = mtod(m1, u_int32_t *); 359 tlen = 0; 360 if (putsize) { 361 *tl++ = txdr_unsigned(siz); 362 m1->m_len -= NFSX_UNSIGNED; --- 348 unchanged lines hidden (view full) --- 711#endif 712 return (&nfs_nullcookie); 713 } 714 pos--; 715 dp = LIST_FIRST(&np->n_cookies); 716 if (!dp) { 717 if (add) { 718 MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), |
719 M_NFSDIROFF, M_WAITOK); | 719 M_NFSDIROFF, 0); |
720 dp->ndm_eocookie = 0; 721 LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); 722 } else 723 return (NULL); 724 } 725 while (pos >= NFSNUMCOOKIES) { 726 pos -= NFSNUMCOOKIES; 727 if (LIST_NEXT(dp, ndm_list)) { 728 if (!add && dp->ndm_eocookie < NFSNUMCOOKIES && 729 pos >= dp->ndm_eocookie) 730 return (NULL); 731 dp = LIST_NEXT(dp, ndm_list); 732 } else if (add) { 733 MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), | 720 dp->ndm_eocookie = 0; 721 LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); 722 } else 723 return (NULL); 724 } 725 while (pos >= NFSNUMCOOKIES) { 726 pos -= NFSNUMCOOKIES; 727 if (LIST_NEXT(dp, ndm_list)) { 728 if (!add && dp->ndm_eocookie < NFSNUMCOOKIES && 729 pos >= dp->ndm_eocookie) 730 return (NULL); 731 dp = LIST_NEXT(dp, ndm_list); 732 } else if (add) { 733 MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), |
734 M_NFSDIROFF, M_WAITOK); | 734 M_NFSDIROFF, 0); |
735 dp2->ndm_eocookie = 0; 736 LIST_INSERT_AFTER(dp, dp2, ndm_list); 737 dp = dp2; 738 } else 739 return (NULL); 740 } 741 if (pos >= dp->ndm_eocookie) { 742 if (add) --- 323 unchanged lines hidden --- | 735 dp2->ndm_eocookie = 0; 736 LIST_INSERT_AFTER(dp, dp2, ndm_list); 737 dp = dp2; 738 } else 739 return (NULL); 740 } 741 if (pos >= dp->ndm_eocookie) { 742 if (add) --- 323 unchanged lines hidden --- |