2000-11-04 02:13:13 +00:00
|
|
|
/*
|
2000-11-04 10:01:08 +00:00
|
|
|
* 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
|
|
|
|
*/
|
2000-11-04 02:13:13 +00:00
|
|
|
|
|
|
|
/* rx_stream.h: the stream I/O layer for RX */
|
|
|
|
|
|
|
|
This file is now obsolete.
|
|
|
|
#ifndef _RX_STREAM_
|
|
|
|
#define _RX_STREAM_
|
|
|
|
#ifdef KERNEL
|
2002-10-16 04:58:13 +00:00
|
|
|
#include "rx/rx.h"
|
2003-07-16 00:28:24 +00:00
|
|
|
#else /* KERNEL */
|
2000-11-04 02:13:13 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include "rx.h"
|
2003-07-16 00:28:24 +00:00
|
|
|
#endif /* KERNEL */
|
2000-11-04 02:13:13 +00:00
|
|
|
/* Write descriptor */
|
2003-07-16 00:28:24 +00:00
|
|
|
struct rx_stream_wd {
|
2000-11-04 02:13:13 +00:00
|
|
|
char *freePtr; /* Pointer to bytes in first packet */
|
2003-07-16 00:28:24 +00:00
|
|
|
int nFree; /* Number of bytes free in first packet */
|
2000-11-04 02:13:13 +00:00
|
|
|
struct rx_call *call; /* The call this stream is attached to */
|
|
|
|
struct rx_queue wq; /* Currently allocated packets for this stream */
|
2003-07-16 00:28:24 +00:00
|
|
|
int packetSize; /* Data size used in each packet */
|
2000-11-04 02:13:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Read descriptor */
|
|
|
|
struct rx_stream_rd {
|
|
|
|
struct rx_packet *packet; /* The current packet */
|
|
|
|
char *nextByte; /* Pointer to bytes in current packet */
|
2003-07-16 00:28:24 +00:00
|
|
|
int nLeft; /* Number of bytes free in current packet */
|
2000-11-04 02:13:13 +00:00
|
|
|
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) ? \
|
convert-from-bsd-to-posix-string-and-memory-functions-20010807
bcopy, bcmp, bzero, index, rindex, you're all cut.
memcpy, memcmp, memset, strchr, strrchr, show us how it's done
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
fix reference to memset the right thing
====================
make change to arguments globally and not just for e.g. linux/darwin/fbsd
====================
fix a minor flub in how this was done
====================
correct another bad memcpy coversion
====================
fix up more inadvertant turds
====================
fix two errors found by chas williams
2001-08-08 03:05:55 +00:00
|
|
|
(buf) && memcpy((iod)->sd.wd.freePtr, (buf), (nbytes)), \
|
2000-11-04 02:13:13 +00:00
|
|
|
(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) ? \
|
convert-from-bsd-to-posix-string-and-memory-functions-20010807
bcopy, bcmp, bzero, index, rindex, you're all cut.
memcpy, memcmp, memset, strchr, strrchr, show us how it's done
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
fix reference to memset the right thing
====================
make change to arguments globally and not just for e.g. linux/darwin/fbsd
====================
fix a minor flub in how this was done
====================
correct another bad memcpy coversion
====================
fix up more inadvertant turds
====================
fix two errors found by chas williams
2001-08-08 03:05:55 +00:00
|
|
|
memcpy((buf), (iod)->sd.rd.nextByte, (nbytes)), \
|
2000-11-04 02:13:13 +00:00
|
|
|
(iod)->sd.rd.nLeft -= (nbytes), (iod)->sd.rd.nextByte += (nbytes), (nbytes) \
|
|
|
|
: rx_stream_ReadProc((iod), (buf), (nbytes))
|
|
|
|
|
2003-07-16 00:28:24 +00:00
|
|
|
#endif /* _RX_STREAM_ End of rx_stream.h */
|