From b6529a381942b9ad7f4606699d8d55337feffe6b Mon Sep 17 00:00:00 2001 From: Roman Mitz Date: Wed, 25 May 2005 00:14:44 +0000 Subject: [PATCH] STABLE14-discard-rx-streams-20050524 FIXES 18895 they wouldn't compile anyway. remove references also. RCS file: /cvs/openafs/src/rx/Attic/rx_stream.c,v Working file: src/rx/rx_stream.c head: 1.9 branch: locks: strict access list: keyword substitution: kv total revisions: 9; selected revisions: 0 description: RCS file: /cvs/openafs/src/rx/Attic/rx_stream.h,v Working file: src/rx/rx_stream.h head: 1.6 branch: locks: strict access list: keyword substitution: kv total revisions: 6; selected revisions: 0 description: (cherry picked from commit b15721aef16f9b8b689bfc0be01a434f88610919) --- src/rx/rx_prototypes.h | 3 - src/rx/rx_stream.c | 284 ----------------------------------------- src/rx/rx_stream.h | 76 ----------- src/rx/xdr_rx.c | 2 +- 4 files changed, 1 insertion(+), 364 deletions(-) delete mode 100644 src/rx/rx_stream.c delete mode 100644 src/rx/rx_stream.h diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index bc1024efe..7dade4b31 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -535,9 +535,6 @@ extern int rx_WritevProc(struct rx_call *call, struct iovec *iov, int nio, extern void rxi_FlushWrite(register struct rx_call *call); extern void rx_FlushWrite(struct rx_call *call); -/* rx_stream.c */ - - /* rx_trace.c */ diff --git a/src/rx/rx_stream.c b/src/rx/rx_stream.c deleted file mode 100644 index 1cdba1c29..000000000 --- a/src/rx/rx_stream.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - */ - -/* RX stream: the stream I/O layer for RX */ - -This file is now obsolete. -#include -#ifdef KERNEL -#include "afs/param.h" -#else -#include -#endif - - RCSID - ("$Header$"); - -#ifdef KERNEL -#include "h/types.h" -#include "h/uio.h" -#include "rx/rx_stream.h" -#else /* KERNEL */ -#include "rx_stream.h" -#endif /* KERNEL */ - -void -rx_stream_InitRead(sd, call) - struct rx_stream *sd; - struct rx_call *call; -{ - queue_Init(&sd->sd.rd.rq); - queue_Init(&sd->sd.rd.freeTheseQ); - sd->sd.rd.nLeft = 0; - sd->sd.rd.call = call; -} - -/* Normally called from the macro, rx_stream_Read */ -int -rx_stream_ReadProc(sd, buf, nbytes) - struct rx_stream *sd; - char *buf; - int nbytes; -{ - int totalBytes = nbytes; - - if (queue_IsNotEmpty(&sd->sd.rd.freeTheseQ)) - rx_FreePackets(&sd->sd.rd.freeTheseQ); - - while (nbytes) { - struct rx_packet *tp; - if (queue_IsEmpty(&sd->sd.rd.rq)) { - if (rx_ReadData(sd->sd.rd.call, &sd->sd.rd.rq)) - return totalBytes - nbytes; - tp = queue_First(&sd->sd.rd.rq, rx_packet); - sd->sd.rd.nextByte = rx_DataOf(tp); - sd->sd.rd.nLeft = rx_GetDataSize(tp); - } - if (nbytes < sd->sd.rd.nLeft) { - sd->sd.rd.nLeft -= nbytes; - memcpy(buf, sd->sd.rd.nextByte, nbytes); - sd->sd.rd.nextByte += nbytes; - return totalBytes; - } - memcpy(buf, sd->sd.rd.nextByte, sd->sd.rd.nLeft); - buf += sd->sd.rd.nLeft; - nbytes -= sd->sd.rd.nLeft; - tp = queue_First(&sd->sd.rd.rq, rx_packet); - queue_Remove(tp); - rx_FreePacket(tp); - if (queue_IsNotEmpty(&sd->sd.rd.rq)) { - tp = queue_First(&sd->sd.rd.rq, rx_packet); - sd->sd.rd.nextByte = rx_DataOf(tp); - sd->sd.rd.nLeft = rx_GetDataSize(tp); - } - } - return totalBytes; -} - -int -rx_stream_ReadIov(sd, iovlenp, iov, nbytes) - struct rx_stream *sd; - int *iovlenp; - struct iovec *iov; - int nbytes; -{ - int totalBytes = nbytes; - int iovIndex = 0; - int maxiovlen = *iovlenp; - - if (queue_IsNotEmpty(&sd->sd.rd.freeTheseQ)) - rx_FreePackets(&sd->sd.rd.freeTheseQ); - - while (nbytes && iovIndex < maxiovlen) { - struct rx_packet *tp; - if (queue_IsEmpty(&sd->sd.rd.rq)) { - if (rx_ReadData(sd->sd.rd.call, &sd->sd.rd.rq)) - break; - tp = queue_First(&sd->sd.rd.rq, rx_packet); - sd->sd.rd.nextByte = rx_DataOf(tp); - sd->sd.rd.nLeft = rx_GetDataSize(tp); - } - if (nbytes < sd->sd.rd.nLeft) { - sd->sd.rd.nLeft -= nbytes; - iov[iovIndex].iov_base = sd->sd.rd.nextByte; - iov[iovIndex++].iov_len = nbytes; - sd->sd.rd.nextByte += nbytes; - nbytes = 0; - break; - } - iov[iovIndex].iov_base = sd->sd.rd.nextByte; - iov[iovIndex++].iov_len = sd->sd.rd.nLeft; - nbytes -= sd->sd.rd.nLeft; - tp = queue_First(&sd->sd.rd.rq, rx_packet); - queue_MovePrepend(&sd->sd.rd.freeTheseQ, tp); - if (queue_IsNotEmpty(&sd->sd.rd.rq)) { - tp = queue_First(&sd->sd.rd.rq, rx_packet); - sd->sd.rd.nextByte = rx_DataOf(tp); - sd->sd.rd.nLeft = rx_GetDataSize(tp); - } - } - *iovlenp = iovIndex; - return totalBytes - nbytes; -} - -void -rx_stream_FinishRead(sd) - struct rx_stream *sd; -{ - if (queue_IsNotEmpty(&sd->sd.rd.rq)) - rx_FreePackets(&sd->sd.rd.rq); - if (queue_IsNotEmpty(&sd->sd.rd.freeTheseQ)) - rx_FreePackets(&sd->sd.rd.freeTheseQ); -} - -void -rx_stream_InitWrite(sd, call) - struct rx_stream *sd; - struct rx_call *call; -{ - sd->sd.wd.freePtr = 0; - sd->sd.wd.nFree = 0; - sd->sd.wd.call = call; - queue_Init(&sd->sd.wd.wq); - sd->sd.wd.packetSize = rx_MaxDataSize(rx_ConnectionOf(call)); -} - -/* The real write procedure (rx_stream_Write is a macro) */ -int -rx_stream_WriteProc(sd, buf, nbytes) - struct rx_stream *sd; - char *buf; - int nbytes; -{ - int totalBytes = nbytes; - while (nbytes) { - if (queue_IsEmpty(&sd->sd.wd.wq)) { - if (rx_AllocPackets(sd->sd.wd.call, &sd->sd.wd.wq, 1, RX_WAIT)) - break; - sd->sd.wd.nFree = sd->sd.wd.packetSize; - sd->sd.wd.freePtr = - rx_DataOf(queue_First(&sd->sd.wd.wq, rx_packet)); - } - if (nbytes < sd->sd.wd.nFree) { - if (buf) - memcpy(sd->sd.wd.freePtr, buf, nbytes), buf += nbytes; - sd->sd.wd.nFree -= nbytes; - sd->sd.wd.freePtr += nbytes; - nbytes = 0; - break; - } - if (buf) - memcpy(sd->sd.wd.freePtr, buf, sd->sd.wd.nFree), buf += - sd->sd.wd.nFree; - nbytes -= sd->sd.wd.nFree; - sd->sd.wd.nFree = 0; - if (rx_stream_FlushWrite(sd)) - break; - } - return totalBytes - nbytes; -} - -/* Returns nbytes allocated */ -int -rx_stream_AllocIov(sd, iovlenp, iovp, nbytes) - struct rx_stream *sd; - int *iovlenp; - struct iovec *iovp; - int nbytes; -{ - struct rx_packet *p, *nxp; - int maxiovlen = *iovlenp; - int iovIndex; - int totalBytes; - int nFree; - int niovs; - - for (nFree = 0, queue_Scan(&sd->sd.wd.wq, p, nxp, rx_packet)) { - nFree += sd->sd.wd.packetSize; - } - if (sd->sd.wd.nFree) - nFree = nFree - sd->sd.wd.packetSize + sd->sd.wd.nFree; - - /* Allocate the number of bytes requested, or an even portion */ - for (totalBytes = nbytes;; totalBytes >>= 1) { - /* Compute number of additional buffers, beyond current partial buffer, required */ - int nPackets; - nbytes = totalBytes - nFree; - if (nbytes < 0) { - niovs = 1; - break; - } - niovs = nPackets = - (nbytes + sd->sd.wd.packetSize - 1) / sd->sd.wd.packetSize; - if (nFree) - niovs++; - if (niovs <= maxiovlen) { - if (rx_AllocPackets(sd->sd.wd.call, &sd->sd.wd.wq, nPackets, 1)) - break; - if (nFree == 0) { - /* Since there weren't any packets allocated previously, setup new description for first packet */ - sd->sd.wd.nFree = sd->sd.wd.packetSize; - sd->sd.wd.freePtr = - rx_DataOf(queue_First(&sd->sd.wd.wq, rx_packet)); - } - break; - } - } - - /* Create an iovec to describe the set of allocated buffers */ - for (nFree = sd->sd.wd.nFree, nbytes = totalBytes, iovIndex = - 0, queue_Scan(&sd->sd.wd.wq, p, nxp, rx_packet), iovIndex++, nFree = - sd->sd.wd.packetSize) { - if (iovIndex >= niovs) - break; - iovp[iovIndex].iov_base = rx_DataOf(p) + sd->sd.wd.packetSize - nFree; - if (nbytes <= nFree) { - iovp[iovIndex].iov_len = nbytes; - nbytes = 0; - break; - } - nbytes -= nFree; - iovp[iovIndex].iov_len = nFree; - } - *iovlenp = niovs; - return totalBytes - nbytes; -} - -/* Wrong, wrong, wrong */ -rx_stream_FlushWrite(sd) - struct rx_stream *sd; -{ - struct rx_queue q; - queue_Init(&q); - if (queue_IsNotEmpty(&sd->sd.wd.wq) - && sd->sd.wd.nFree < sd->sd.wd.packetSize) { - struct rx_packet *tp = queue_First(&sd->sd.wd.wq, rx_packet); - queue_MoveAppend(&q, tp); - rx_SetDataSize(queue_First(&q, rx_packet), - sd->sd.wd.packetSize - sd->sd.wd.nFree); - if (queue_IsNotEmpty(&sd->sd.wd.wq)) { - sd->sd.wd.nFree = sd->sd.wd.packetSize; - sd->sd.wd.freePtr = - rx_DataOf(queue_First(&sd->sd.wd.wq, rx_packet)); - } else - sd->sd.wd.nFree = 0; - return (rx_SendData(sd->sd.wd.call, &q)); - } - return 0; -} - -void -rx_stream_FinishWrite(sd) - struct rx_stream *sd; -{ - rx_stream_FlushWrite(sd); - if (queue_IsNotEmpty(&sd->sd.wd.wq)) - rx_FreePackets(&sd->sd.wd.wq); - sd->sd.wd.nFree = 0; -} diff --git a/src/rx/rx_stream.h b/src/rx/rx_stream.h deleted file mode 100644 index 42ea4ba94..000000000 --- a/src/rx/rx_stream.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - */ - -/* rx_stream.h: the stream I/O layer for RX */ - -This file is now obsolete. -#ifndef _RX_STREAM_ -#define _RX_STREAM_ -#ifdef KERNEL -#include "rx/rx.h" -#else /* KERNEL */ -#include -#include -#include "rx.h" -#endif /* KERNEL */ -/* Write descriptor */ - struct rx_stream_wd { - char *freePtr; /* Pointer to bytes in first packet */ - int nFree; /* Number of bytes free in first packet */ - struct rx_call *call; /* The call this stream is attached to */ - struct rx_queue wq; /* Currently allocated packets for this stream */ - int packetSize; /* Data size used in each packet */ -}; - -/* Read descriptor */ -struct rx_stream_rd { - struct rx_packet *packet; /* The current packet */ - char *nextByte; /* Pointer to bytes in current packet */ - int nLeft; /* Number of bytes free in current packet */ - struct rx_call *call; /* The call this stream is attached to */ - struct rx_queue rq; /* Currently allocated packets for this stream */ - struct rx_queue freeTheseQ; /* These packets should be freed on the next operation */ -}; - -/* Composite stream descriptor */ -struct rx_stream { - union { - struct rx_stream_rd rd; - struct rx_stream_wd wd; - } sd; -}; - -/* Externals */ -void rx_stream_InitWrite(); -void rx_stream_InitRead(); -void rx_stream_FinishWrite(); -void rx_stream_FinishRead(); -int rx_stream_Read(); -int rx_stream_Write(); -int rx_stream_AllocIov(); - -/* Write nbytes of data to the write stream. Returns the number of bytes written */ -/* If it returns 0, the call status should be checked with rx_Error. */ -#define rx_stream_Write(iod, buf, nbytes) \ - (iod)->sd.wd.nFree > (nbytes) ? \ - (buf) && memcpy((iod)->sd.wd.freePtr, (buf), (nbytes)), \ - (iod)->sd.wd.nFree -= (nbytes), \ - (iod)->sd.wd.freePtr += (nbytes), (nbytes) \ - : rx_stream_WriteProc((iod), (buf), (nbytes)) - - -/* Read nbytes of data from the read stream. Returns the number of bytes read */ -/* If it returns less than requested, the call status should be checked with rx_Error */ -#define rx_stream_Read(iod, buf, nbytes) \ - (iod)->sd.rd.nLeft > (nbytes) ? \ - memcpy((buf), (iod)->sd.rd.nextByte, (nbytes)), \ - (iod)->sd.rd.nLeft -= (nbytes), (iod)->sd.rd.nextByte += (nbytes), (nbytes) \ - : rx_stream_ReadProc((iod), (buf), (nbytes)) - -#endif /* _RX_STREAM_ End of rx_stream.h */ diff --git a/src/rx/xdr_rx.c b/src/rx/xdr_rx.c index a970b4e56..dbeb6f5ef 100644 --- a/src/rx/xdr_rx.c +++ b/src/rx/xdr_rx.c @@ -141,7 +141,7 @@ static struct xdr_ops xdrrx_ops = { /* * Initialize an rx xdr handle, for a given rx call. op must be XDR_ENCODE or XDR_DECODE. - * Call must have been returned by rx_MakeCall or rx_GetCall. Stream should be a pointer to a local rx_stream structure. + * Call must have been returned by rx_MakeCall or rx_GetCall. */ void xdrrx_create(register XDR * xdrs, register struct rx_call *call, -- 2.39.5