-/*
+ /*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
*
* directory or online at http://www.openafs.org/dl/license10.html
*/
-#ifdef KERNEL
-#include "../afs/param.h"
+#include <afsconfig.h>
+#ifdef KERNEL
+#include "afs/param.h"
+#else
+#include <afs/param.h>
+#endif
+
+RCSID("$Header$");
+
+#ifdef KERNEL
#ifndef UKERNEL
-#include "../h/types.h"
-#include "../h/time.h"
-#include "../h/stat.h"
+#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#include "afs/sysincludes.h"
+#else
+#include "h/types.h"
+#include "h/time.h"
+#include "h/stat.h"
#ifdef AFS_OSF_ENV
#include <net/net_globals.h>
#endif /* AFS_OSF_ENV */
#ifdef AFS_LINUX20_ENV
-#include "../h/socket.h"
+#include "h/socket.h"
#endif
-#include "../netinet/in.h"
+#include "netinet/in.h"
#if defined(AFS_SGI_ENV)
-#include "../afs/sysincludes.h"
+#include "afs/sysincludes.h"
#endif
-#include "../afs/afs_args.h"
-#include "../afs/afs_osi.h"
+#endif
+#include "afs/afs_args.h"
+#include "afs/afs_osi.h"
#if (defined(AFS_AUX_ENV) || defined(AFS_AIX_ENV))
-#include "../h/systm.h"
+#include "h/systm.h"
#endif
#else /* !UKERNEL */
-#include "../afs/sysincludes.h"
+#include "afs/sysincludes.h"
#endif /* !UKERNEL */
#ifdef RXDEBUG
#undef RXDEBUG /* turn off debugging */
#endif /* RXDEBUG */
-#include "../afsint/afsint.h"
-
-#include "../rx/rx_kmutex.h"
-#include "../rx/rx_kernel.h"
-#include "../rx/rx_clock.h"
-#include "../rx/rx_queue.h"
-#include "../rx/rx.h"
-#include "../rx/rx_globals.h"
-#include "../afs/lock.h"
-#include "../afsint/afsint.h"
+
+#include "rx_kmutex.h"
+#include "rx/rx_kernel.h"
+#include "rx/rx_clock.h"
+#include "rx/rx_queue.h"
+#include "rx/rx.h"
+#include "rx/rx_globals.h"
+#include "afs/lock.h"
+#include "afsint.h"
#ifdef AFS_ALPHA_ENV
#undef kmem_alloc
#undef kmem_free
#undef register
#endif /* AFS_ALPHA_ENV */
#else /* KERNEL */
-# include <afs/param.h>
# include <sys/types.h>
#ifndef AFS_NT40_ENV
# include <sys/socket.h>
# include <sys/stat.h>
# include <sys/time.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
# include "rx_user.h"
# include "rx_clock.h"
# include "rx_queue.h"
# include "rx.h"
# include "rx_globals.h"
-# include "rx_internal.h"
#endif /* KERNEL */
-
#ifdef RX_LOCKS_DB
/* rxdb_fileID is used to identify the lock location, along with line#. */
static int rxdb_fileID = RXDB_FILE_RX_RDWR;
*
* LOCKS USED -- called at netpri with rx global lock and call->lock held.
*/
-int rxi_ReadProc(call, buf, nbytes)
- register struct rx_call *call;
- register char *buf;
- register int nbytes;
+int rxi_ReadProc(register struct rx_call *call, register char *buf,
+ register int nbytes)
{
register struct rx_packet *cp = call->currentPacket;
register struct rx_packet *rp;
* work. It may reduce the length of the packet by up
* to conn->maxTrailerSize, to reflect the length of the
* data + the header. */
- if (error = RXS_CheckPacket(conn->securityObject, call, rp)) {
+ if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) {
/* Used to merely shut down the call, but now we
* shut down the whole connection since this may
* indicate an attempt to hijack it */
while (nbytes && cp) {
t = MIN((int)call->curlen, nbytes);
t = MIN(t, (int)call->nLeft);
- bcopy (call->curpos, buf, t);
+ memcpy(buf, call->curpos, t);
buf += t;
nbytes -= t;
call->curpos += t;
return requestCount;
}
-int rx_ReadProc(call, buf, nbytes)
- struct rx_call *call;
- char *buf;
- int nbytes;
+int rx_ReadProc(struct rx_call *call, char *buf, int nbytes)
{
int bytes;
int tcurlen;
tnLeft = call->nLeft;
if (!call->error && tcurlen > nbytes && tnLeft > nbytes) {
tcurpos = call->curpos;
- bcopy(tcurpos, buf, nbytes);
+ memcpy(buf, tcurpos, nbytes);
call->curpos = tcurpos + nbytes;
call->curlen = tcurlen - nbytes;
call->nLeft = tnLeft - nbytes;
}
/* Optimization for unmarshalling 32 bit integers */
-int rx_ReadProc32(call, value)
- struct rx_call *call;
- afs_int32 *value;
+int rx_ReadProc32(struct rx_call *call, afs_int32 *value)
{
int bytes;
int tcurlen;
if (!((long)tcurpos & (sizeof(afs_int32)-1))) {
*value = *((afs_int32 *)(tcurpos));
} else {
- bcopy(tcurpos, (char *)value, sizeof(afs_int32));
+ memcpy((char *)value, tcurpos, sizeof(afs_int32));
}
call->curpos = tcurpos + sizeof(afs_int32);
call->curlen = tcurlen - sizeof(afs_int32);
* current iovec as possible. Does not block if it runs out
* of packets to complete the iovec. Return true if an ack packet
* was sent, otherwise return false */
-int rxi_FillReadVec(call, seq, serial, flags)
- struct rx_call *call;
- afs_uint32 seq, serial, flags;
+int rxi_FillReadVec(struct rx_call *call, afs_uint32 seq,
+ afs_uint32 serial, afs_uint32 flags)
{
int didConsume = 0;
int didHardAck = 0;
struct rx_packet *rp;
struct rx_packet *curp;
struct iovec *call_iov;
- struct iovec *cur_iov;
+ struct iovec *cur_iov = NULL;
curp = call->currentPacket;
if (curp) {
* work. It may reduce the length of the packet by up
* to conn->maxTrailerSize, to reflect the length of the
* data + the header. */
- if (error = RXS_CheckPacket(conn->securityObject, call, rp)) {
+ if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) {
/* Used to merely shut down the call, but now we
* shut down the whole connection since this may
* indicate an attempt to hijack it */
*
* LOCKS USED -- called at netpri with rx global lock and call->lock held.
*/
-int rxi_ReadvProc(call, iov, nio, maxio, nbytes)
- struct rx_call *call;
- struct iovec *iov;
- int *nio;
- int maxio;
- int nbytes;
+int rxi_ReadvProc(struct rx_call *call, struct iovec *iov, int *nio,
+ int maxio, int nbytes)
{
struct rx_packet *rp;
struct rx_packet *nxp; /* Next packet pointer, for queue_Scan */
return nbytes - call->iovNBytes;
}
-int rx_ReadvProc(call, iov, nio, maxio, nbytes)
- struct rx_call *call;
- struct iovec *iov;
- int *nio;
- int maxio;
- int nbytes;
+int rx_ReadvProc(struct rx_call *call, struct iovec *iov,
+ int *nio, int maxio, int nbytes)
{
int bytes;
SPLVAR;
*
* LOCKS USED -- called at netpri with rx global lock and call->lock held. */
-int rxi_WriteProc(call, buf, nbytes)
- register struct rx_call *call;
- register char *buf;
- register int nbytes;
+int rxi_WriteProc(register struct rx_call *call, register char *buf,
+ register int nbytes)
{
struct rx_connection *conn = call->conn;
register struct rx_packet *cp = call->currentPacket;
}
#endif /* RX_ENABLE_LOCKS */
}
- if (cp = rxi_AllocSendPacket(call, nbytes)) {
+ if ((cp = rxi_AllocSendPacket(call, nbytes))) {
call->currentPacket = cp;
call->nFree = cp->length;
call->curvec = 1; /* 0th vec is always header */
t = MIN((int)call->curlen, nbytes);
t = MIN((int)call->nFree, t);
- bcopy (buf, call->curpos, t);
+ memcpy(call->curpos, buf, t);
buf += t;
nbytes -= t;
call->curpos += t;
return requestCount - nbytes;
}
-int rx_WriteProc(call, buf, nbytes)
- struct rx_call *call;
- char *buf;
- int nbytes;
+int rx_WriteProc(struct rx_call *call, char *buf, int nbytes)
{
int bytes;
int tcurlen;
tnFree = (int)call->nFree;
if (!call->error && tcurlen >= nbytes && tnFree >= nbytes) {
tcurpos = call->curpos;
- bcopy(buf, tcurpos, nbytes);
+ memcpy(tcurpos, buf, nbytes);
call->curpos = tcurpos + nbytes;
call->curlen = tcurlen - nbytes;
call->nFree = tnFree - nbytes;
}
/* Optimization for marshalling 32 bit arguments */
-int rx_WriteProc32(call, value)
- register struct rx_call *call;
- register afs_int32 *value;
+int rx_WriteProc32(register struct rx_call *call, register afs_int32 *value)
{
int bytes;
int tcurlen;
if (!((long)tcurpos & (sizeof(afs_int32)-1))) {
*((afs_int32 *)(tcurpos)) = *value;
} else {
- bcopy((char *)value, tcurpos, sizeof(afs_int32));
+ memcpy(tcurpos, (char *)value, sizeof(afs_int32));
}
call->curpos = tcurpos + sizeof(afs_int32);
call->curlen = tcurlen - sizeof(afs_int32);
*
* LOCKS USED -- called at netpri with rx global lock and call->lock held. */
-int rxi_WritevAlloc(call, iov, nio, maxio, nbytes)
- struct rx_call *call;
- struct iovec *iov;
- int *nio;
- int maxio;
- int nbytes;
+int rxi_WritevAlloc(struct rx_call *call, struct iovec *iov,
+ int *nio, int maxio, int nbytes)
{
struct rx_connection *conn = call->conn;
struct rx_packet *cp = call->currentPacket;
return requestCount - nbytes;
}
-int rx_WritevAlloc(call, iov, nio, maxio, nbytes)
- struct rx_call *call;
- struct iovec *iov;
- int *nio;
- int maxio;
- int nbytes;
+int rx_WritevAlloc(struct rx_call *call, struct iovec *iov, int *nio,
+ int maxio, int nbytes)
{
int bytes;
SPLVAR;
*
* LOCKS USED -- called at netpri with rx global lock and call->lock held. */
-int rxi_WritevProc(call, iov, nio, nbytes)
- struct rx_call *call;
- struct iovec *iov;
- int nio;
- int nbytes;
+int rxi_WritevProc(struct rx_call *call, struct iovec *iov,
+ int nio, int nbytes)
{
- struct rx_connection *conn = call->conn;
struct rx_packet *cp = call->currentPacket;
register struct rx_packet *tp; /* Temporary packet pointer */
register struct rx_packet *nxp; /* Next packet pointer, for queue_Scan */
nextio = 0;
queue_Init(&tmpq);
do {
- unsigned int t;
-
if (call->nFree == 0 && cp) {
clock_NewTime(); /* Bogus: need new time package */
/* The 0, below, specifies that it is not the last packet:
return requestCount - nbytes;
}
-int rx_WritevProc(call, iov, nio, nbytes)
- struct rx_call *call;
- struct iovec *iov;
- int nio;
- int nbytes;
+int rx_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
{
int bytes;
SPLVAR;
/* Flush any buffered data to the stream, switch to read mode
* (clients) or to EOF mode (servers) */
-void rxi_FlushWrite(call)
- register struct rx_call *call;
+void rxi_FlushWrite(register struct rx_call *call)
{
register struct rx_packet *cp = call->currentPacket;
register struct rx_packet *tp; /* Temporary packet pointer */
/* Flush any buffered data to the stream, switch to read mode
* (clients) or to EOF mode (servers) */
-void rx_FlushWrite(call)
- struct rx_call *call;
+void rx_FlushWrite(struct rx_call *call)
{
SPLVAR;
NETPRI;