krpc_subr.c (171744) | krpc_subr.c (177599) |
---|---|
1/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */ 2 3/*- 4 * Copyright (c) 1995 Gordon Ross, Adam Glass 5 * Copyright (c) 1992 Regents of the University of California. 6 * All rights reserved. 7 * 8 * This software was developed by the Computer Systems Engineering group --- 29 unchanged lines hidden (view full) --- 38 * SUCH DAMAGE. 39 * 40 * partially based on: 41 * libnetboot/rpc.c 42 * @(#) Header: rpc.c,v 1.12 93/09/28 08:31:56 leres Exp (LBL) 43 */ 44 45#include <sys/cdefs.h> | 1/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */ 2 3/*- 4 * Copyright (c) 1995 Gordon Ross, Adam Glass 5 * Copyright (c) 1992 Regents of the University of California. 6 * All rights reserved. 7 * 8 * This software was developed by the Computer Systems Engineering group --- 29 unchanged lines hidden (view full) --- 38 * SUCH DAMAGE. 39 * 40 * partially based on: 41 * libnetboot/rpc.c 42 * @(#) Header: rpc.c,v 1.12 93/09/28 08:31:56 leres Exp (LBL) 43 */ 44 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/sys/nfsclient/krpc_subr.c 171744 2007-08-06 14:26:03Z rwatson $"); | 46__FBSDID("$FreeBSD: head/sys/nfsclient/krpc_subr.c 177599 2008-03-25 09:39:02Z ru $"); |
47 48#include <sys/param.h> 49#include <sys/systm.h> 50#include <sys/malloc.h> 51#include <sys/mbuf.h> 52#include <sys/proc.h> 53#include <sys/socket.h> 54#include <sys/socketvar.h> --- 91 unchanged lines hidden (view full) --- 146 int error; 147 148 /* The portmapper port is fixed. */ 149 if (prog == PMAPPROG) { 150 *portp = htons(PMAPPORT); 151 return 0; 152 } 153 | 47 48#include <sys/param.h> 49#include <sys/systm.h> 50#include <sys/malloc.h> 51#include <sys/mbuf.h> 52#include <sys/proc.h> 53#include <sys/socket.h> 54#include <sys/socketvar.h> --- 91 unchanged lines hidden (view full) --- 146 int error; 147 148 /* The portmapper port is fixed. */ 149 if (prog == PMAPPROG) { 150 *portp = htons(PMAPPORT); 151 return 0; 152 } 153 |
154 m = m_get(M_TRYWAIT, MT_DATA); 155 if (m == NULL) 156 return ENOBUFS; | 154 m = m_get(M_WAIT, MT_DATA); |
157 sdata = mtod(m, struct sdata *); 158 m->m_len = sizeof(*sdata); 159 160 /* Do the RPC to get it. */ 161 sdata->prog = txdr_unsigned(prog); 162 sdata->vers = txdr_unsigned(vers); 163 sdata->proto = txdr_unsigned(IPPROTO_UDP); 164 sdata->port = 0; --- 104 unchanged lines hidden (view full) --- 269 270 /* 271 * Setup socket address for the server. 272 */ 273 274 /* 275 * Prepend RPC message header. 276 */ | 155 sdata = mtod(m, struct sdata *); 156 m->m_len = sizeof(*sdata); 157 158 /* Do the RPC to get it. */ 159 sdata->prog = txdr_unsigned(prog); 160 sdata->vers = txdr_unsigned(vers); 161 sdata->proto = txdr_unsigned(IPPROTO_UDP); 162 sdata->port = 0; --- 104 unchanged lines hidden (view full) --- 267 268 /* 269 * Setup socket address for the server. 270 */ 271 272 /* 273 * Prepend RPC message header. 274 */ |
277 mhead = m_gethdr(M_TRYWAIT, MT_DATA); | 275 mhead = m_gethdr(M_WAIT, MT_DATA); |
278 mhead->m_next = *data; 279 call = mtod(mhead, struct krpc_call *); 280 mhead->m_len = sizeof(*call); 281 bzero((caddr_t)call, sizeof(*call)); 282 /* rpc_call part */ 283 xid++; 284 call->rp_xid = txdr_unsigned(xid); 285 /* call->rp_direction = 0; */ --- 17 unchanged lines hidden (view full) --- 303 /* 304 * Send it, repeatedly, until a reply is received, 305 * but delay each re-send by an increasing amount. 306 * If the delay hits the maximum, start complaining. 307 */ 308 timo = 0; 309 for (;;) { 310 /* Send RPC request (or re-send). */ | 276 mhead->m_next = *data; 277 call = mtod(mhead, struct krpc_call *); 278 mhead->m_len = sizeof(*call); 279 bzero((caddr_t)call, sizeof(*call)); 280 /* rpc_call part */ 281 xid++; 282 call->rp_xid = txdr_unsigned(xid); 283 /* call->rp_direction = 0; */ --- 17 unchanged lines hidden (view full) --- 301 /* 302 * Send it, repeatedly, until a reply is received, 303 * but delay each re-send by an increasing amount. 304 * If the delay hits the maximum, start complaining. 305 */ 306 timo = 0; 307 for (;;) { 308 /* Send RPC request (or re-send). */ |
311 m = m_copym(mhead, 0, M_COPYALL, M_TRYWAIT); 312 if (m == NULL) { 313 error = ENOBUFS; 314 goto out; 315 } | 309 m = m_copym(mhead, 0, M_COPYALL, M_WAIT); |
316 error = sosend(so, (struct sockaddr *)sa, NULL, m, 317 NULL, 0, td); 318 if (error) { 319 printf("krpc_call: sosend: %d\n", error); 320 goto out; 321 } 322 m = NULL; 323 --- 133 unchanged lines hidden (view full) --- 457 int mlen; /* message length */ 458 459 dlen = (len + 3) & ~3; 460 mlen = dlen + 4; 461 462 if (mlen > MCLBYTES) /* If too big, we just can't do it. */ 463 return (NULL); 464 | 310 error = sosend(so, (struct sockaddr *)sa, NULL, m, 311 NULL, 0, td); 312 if (error) { 313 printf("krpc_call: sosend: %d\n", error); 314 goto out; 315 } 316 m = NULL; 317 --- 133 unchanged lines hidden (view full) --- 451 int mlen; /* message length */ 452 453 dlen = (len + 3) & ~3; 454 mlen = dlen + 4; 455 456 if (mlen > MCLBYTES) /* If too big, we just can't do it. */ 457 return (NULL); 458 |
465 m = m_get(M_TRYWAIT, MT_DATA); 466 if (mlen > MLEN) { 467 MCLGET(m, M_TRYWAIT); 468 if ((m->m_flags & M_EXT) == 0) { 469 (void) m_free(m); /* There can be only one. */ 470 return (NULL); 471 } 472 } | 459 m = m_get(M_WAIT, MT_DATA); 460 if (mlen > MLEN) 461 MCLGET(m, M_WAIT); |
473 xs = mtod(m, struct xdr_string *); 474 m->m_len = mlen; 475 xs->len = txdr_unsigned(len); 476 bcopy(str, xs->data, len); 477 return (m); 478} | 462 xs = mtod(m, struct xdr_string *); 463 m->m_len = mlen; 464 xs->len = txdr_unsigned(len); 465 bcopy(str, xs->data, len); 466 return (m); 467} |