rx-junk-writevinit-20021030
[openafs.git] / src / rx / rx_rdwr.c
index ffadf87..ea2cd60 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <afsconfig.h>
 #ifdef KERNEL
-#include "../afs/param.h"
+#include "afs/param.h"
 #else
 #include <afs/param.h>
 #endif
@@ -19,42 +19,42 @@ RCSID("$Header$");
 #ifdef KERNEL
 #ifndef UKERNEL
 #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
-#include "../afs/sysincludes.h"
+#include "afs/sysincludes.h"
 #else
-#include "../h/types.h"
-#include "../h/time.h"
-#include "../h/stat.h"
+#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
 #endif
-#include "../afs/afs_args.h"
-#include "../afs/afs_osi.h"
+#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 "../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
@@ -87,7 +87,6 @@ RCSID("$Header$");
 # include "rx_queue.h"
 # include "rx.h"
 # include "rx_globals.h"
-# include "rx_internal.h"
 #endif /* KERNEL */
 
 #ifdef RX_LOCKS_DB
@@ -98,10 +97,8 @@ 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;
@@ -287,10 +284,7 @@ MTUXXX  doesn't there need to be an "else" here ???
     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;
@@ -343,9 +337,7 @@ int rx_ReadProc(call, buf, 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;
@@ -407,9 +399,8 @@ int rx_ReadProc32(call, value)
  * 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;
@@ -564,12 +555,8 @@ int rxi_FillReadVec(call, seq, serial, flags)
  *
  * 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 */
@@ -635,12 +622,8 @@ int rxi_ReadvProc(call, iov, nio, maxio, nbytes)
     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;
@@ -659,10 +642,8 @@ int rx_ReadvProc(call, iov, nio, maxio, nbytes)
  *
  * 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;
@@ -824,10 +805,7 @@ int rxi_WriteProc(call, buf, nbytes)
     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;
@@ -880,9 +858,7 @@ int rx_WriteProc(call, buf, 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;
@@ -945,12 +921,8 @@ int rx_WriteProc32(call, value)
  *
  * 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;
@@ -1058,12 +1030,8 @@ int rxi_WritevAlloc(call, iov, nio, maxio, nbytes)
     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;
@@ -1078,49 +1046,14 @@ int rx_WritevAlloc(call, iov, nio, maxio, nbytes)
     return bytes;
 }
 
-int rx_WritevInit(call)
-    struct rx_call *call;
-{
-    int bytes;
-    SPLVAR;
-
-    /*
-     * Free any packets from the last call to ReadvProc/WritevProc.
-     * We do not need the lock because the receiver threads only
-     * touch the iovq when the RX_CALL_IOVEC_WAIT flag is set, and the
-     * RX_CALL_IOVEC_WAIT is always cleared before returning from
-     * ReadvProc/WritevProc.
-     */
-    if (!queue_IsEmpty(&call->iovq)) {
-        register struct rx_packet *rp;
-        register struct rx_packet *nxp;
-        for (queue_Scan(&call->iovq, rp, nxp, rx_packet)) {
-            queue_Remove(rp);
-            rxi_FreePacket(rp);
-        }
-    }
-
-    NETPRI;
-    AFS_RXGLOCK();
-    MUTEX_ENTER(&call->lock);
-    bytes = rxi_WriteProc(call, &bytes, 0);
-    MUTEX_EXIT(&call->lock);
-    AFS_RXGUNLOCK();
-    USERPRI;
-    return bytes;
-}
-
 /* rxi_WritevProc -- internal version.
  *
  * Send buffers allocated in rxi_WritevAlloc.
  *
  * 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_packet *cp = call->currentPacket;
     register struct rx_packet *tp; /* Temporary packet pointer */
@@ -1268,11 +1201,7 @@ int rxi_WritevProc(call, iov, nio, nbytes)
     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;
@@ -1289,8 +1218,7 @@ int rx_WritevProc(call, iov, nio, nbytes)
 
 /* 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 */
@@ -1353,8 +1281,7 @@ void rxi_FlushWrite(call)
 
 /* 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;