krpc_subr.c (91406) | krpc_subr.c (109623) |
---|---|
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 91406 2002-02-27 18:32:23Z jhb $"); | 46__FBSDID("$FreeBSD: head/sys/nfsclient/krpc_subr.c 109623 2003-01-21 08:56:16Z alfred $"); |
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> --- 89 unchanged lines hidden (view full) --- 144 int error; 145 146 /* The portmapper port is fixed. */ 147 if (prog == PMAPPROG) { 148 *portp = htons(PMAPPORT); 149 return 0; 150 } 151 | 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> --- 89 unchanged lines hidden (view full) --- 144 int error; 145 146 /* The portmapper port is fixed. */ 147 if (prog == PMAPPROG) { 148 *portp = htons(PMAPPORT); 149 return 0; 150 } 151 |
152 m = m_get(M_TRYWAIT, MT_DATA); | 152 m = m_get(0, MT_DATA); |
153 if (m == NULL) 154 return ENOBUFS; 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); --- 105 unchanged lines hidden (view full) --- 266 267 /* 268 * Setup socket address for the server. 269 */ 270 271 /* 272 * Prepend RPC message header. 273 */ | 153 if (m == NULL) 154 return ENOBUFS; 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); --- 105 unchanged lines hidden (view full) --- 266 267 /* 268 * Setup socket address for the server. 269 */ 270 271 /* 272 * Prepend RPC message header. 273 */ |
274 mhead = m_gethdr(M_TRYWAIT, MT_DATA); | 274 mhead = m_gethdr(0, MT_DATA); |
275 mhead->m_next = *data; 276 call = mtod(mhead, struct rpc_call *); 277 mhead->m_len = sizeof(*call); 278 bzero((caddr_t)call, sizeof(*call)); 279 /* rpc_call part */ 280 xid++; 281 call->rp_xid = txdr_unsigned(xid); 282 /* call->rp_direction = 0; */ --- 23 unchanged lines hidden (view full) --- 306 /* 307 * Send it, repeatedly, until a reply is received, 308 * but delay each re-send by an increasing amount. 309 * If the delay hits the maximum, start complaining. 310 */ 311 timo = 0; 312 for (;;) { 313 /* Send RPC request (or re-send). */ | 275 mhead->m_next = *data; 276 call = mtod(mhead, struct rpc_call *); 277 mhead->m_len = sizeof(*call); 278 bzero((caddr_t)call, sizeof(*call)); 279 /* rpc_call part */ 280 xid++; 281 call->rp_xid = txdr_unsigned(xid); 282 /* call->rp_direction = 0; */ --- 23 unchanged lines hidden (view full) --- 306 /* 307 * Send it, repeatedly, until a reply is received, 308 * but delay each re-send by an increasing amount. 309 * If the delay hits the maximum, start complaining. 310 */ 311 timo = 0; 312 for (;;) { 313 /* Send RPC request (or re-send). */ |
314 m = m_copym(mhead, 0, M_COPYALL, M_TRYWAIT); | 314 m = m_copym(mhead, 0, M_COPYALL, 0); |
315 if (m == NULL) { 316 error = ENOBUFS; 317 goto out; 318 } 319 error = sosend(so, (struct sockaddr *)sa, NULL, m, 320 NULL, 0, td); 321 if (error) { 322 printf("krpc_call: sosend: %d\n", error); --- 137 unchanged lines hidden (view full) --- 460 int mlen; /* message length */ 461 462 dlen = (len + 3) & ~3; 463 mlen = dlen + 4; 464 465 if (mlen > MCLBYTES) /* If too big, we just can't do it. */ 466 return (NULL); 467 | 315 if (m == NULL) { 316 error = ENOBUFS; 317 goto out; 318 } 319 error = sosend(so, (struct sockaddr *)sa, NULL, m, 320 NULL, 0, td); 321 if (error) { 322 printf("krpc_call: sosend: %d\n", error); --- 137 unchanged lines hidden (view full) --- 460 int mlen; /* message length */ 461 462 dlen = (len + 3) & ~3; 463 mlen = dlen + 4; 464 465 if (mlen > MCLBYTES) /* If too big, we just can't do it. */ 466 return (NULL); 467 |
468 m = m_get(M_TRYWAIT, MT_DATA); | 468 m = m_get(0, MT_DATA); |
469 if (mlen > MLEN) { | 469 if (mlen > MLEN) { |
470 MCLGET(m, M_TRYWAIT); | 470 MCLGET(m, 0); |
471 if ((m->m_flags & M_EXT) == 0) { 472 (void) m_free(m); /* There can be only one. */ 473 return (NULL); 474 } 475 } 476 xs = mtod(m, struct xdr_string *); 477 m->m_len = mlen; 478 xs->len = txdr_unsigned(len); 479 bcopy(str, xs->data, len); 480 return (m); 481} | 471 if ((m->m_flags & M_EXT) == 0) { 472 (void) m_free(m); /* There can be only one. */ 473 return (NULL); 474 } 475 } 476 xs = mtod(m, struct xdr_string *); 477 m->m_len = mlen; 478 xs->len = txdr_unsigned(len); 479 bcopy(str, xs->data, len); 480 return (m); 481} |