From 9f57c28605f948fa0e0a924cf2ccd6d382a177c7 Mon Sep 17 00:00:00 2001 From: Hartmut Reuter Date: Mon, 12 Feb 2001 19:33:40 +0000 Subject: [PATCH] rx-writevinit-for-mrafs-20010212 --- src/rx/rx_rdwr.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 2184f0649..b1bbadd13 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -1059,6 +1059,38 @@ 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. -- 2.39.5