summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorrvb <rvb>1999-04-28 23:56:33 +0000
committerrvb <rvb>1999-04-28 23:56:33 +0000
commit9abe37c172594192445bca871f0cc752d2f2b3ea (patch)
tree2afc060de45709c429f02eff2101aa8110a74c83 /net
parent661b3bdab3271259b2731c6d802dbc901e594fd4 (diff)
downloadpkgsrc-9abe37c172594192445bca871f0cc752d2f2b3ea.tar.gz
stabilize bandwidth calculation
Diffstat (limited to 'net')
-rw-r--r--net/coda5_client/patches/patch-da22
-rw-r--r--net/coda5_client/patches/patch-db192
-rw-r--r--net/coda5_client/patches/patch-dc16
-rw-r--r--net/coda5_client/patches/patch-dd30
-rw-r--r--net/coda5_client/patches/patch-de75
-rw-r--r--net/coda5_client/patches/patch-df90
-rw-r--r--net/coda5_client/patches/patch-dg21
-rw-r--r--net/coda5_client/patches/patch-dh13
-rw-r--r--net/coda5_client/patches/patch-di37
-rw-r--r--net/coda5_client/patches/patch-dj32
-rw-r--r--net/coda5_client/patches/patch-dk20
-rw-r--r--net/coda5_client/patches/patch-dl19
-rw-r--r--net/coda5_client/patches/patch-dm35
-rw-r--r--net/coda5_client/patches/patch-dn82
-rw-r--r--net/coda5_server/patches/patch-da22
-rw-r--r--net/coda5_server/patches/patch-db192
-rw-r--r--net/coda5_server/patches/patch-dc16
-rw-r--r--net/coda5_server/patches/patch-dd30
-rw-r--r--net/coda5_server/patches/patch-de75
-rw-r--r--net/coda5_server/patches/patch-df90
-rw-r--r--net/coda5_server/patches/patch-dg21
-rw-r--r--net/coda5_server/patches/patch-dh13
-rw-r--r--net/coda5_server/patches/patch-di37
-rw-r--r--net/coda5_server/patches/patch-dj32
-rw-r--r--net/coda5_server/patches/patch-dk20
-rw-r--r--net/coda5_server/patches/patch-dl19
-rw-r--r--net/coda5_server/patches/patch-dm35
-rw-r--r--net/coda5_server/patches/patch-dn82
28 files changed, 1368 insertions, 0 deletions
diff --git a/net/coda5_client/patches/patch-da b/net/coda5_client/patches/patch-da
new file mode 100644
index 00000000000..b729718fd7c
--- /dev/null
+++ b/net/coda5_client/patches/patch-da
@@ -0,0 +1,22 @@
+$NetBSD: patch-da,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/debug.c ./coda-src/rpc2/debug.c
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/debug.c Mon Apr 5 18:00:37 1999
++++ ./coda-src/rpc2/debug.c Mon Apr 26 14:05:08 1999
+@@ -194,11 +194,11 @@
+ hPtr->RTT % ((1 << RPC2_RTT_SHIFT) - 1),
+ hPtr->RTTVar >> RPC2_RTTVAR_SHIFT,
+ hPtr->RTTVar % ((1 << RPC2_RTTVAR_SHIFT) - 1));
+- fprintf(tFile, "\tBW = %ld.%03ld, BWvar = %ld.%03ld\n",
+- hPtr->BW >> RPC2_BW_SHIFT,
+- hPtr->BW % ((1 << RPC2_BW_SHIFT) - 1),
+- hPtr->BWVar >> RPC2_BWVAR_SHIFT,
+- hPtr->BWVar % ((1 << RPC2_BWVAR_SHIFT) - 1));
++ fprintf(tFile, "\tByteRate = %ld.%03ld ns/B, BRvar = %ld.%03ld\n",
++ hPtr->BR >> RPC2_BR_SHIFT,
++ hPtr->BR % ((1 << RPC2_BR_SHIFT) - 1),
++ hPtr->BRVar >> RPC2_BRVAR_SHIFT,
++ hPtr->BRVar % ((1 << RPC2_BRVAR_SHIFT) - 1));
+
+ PrintNetLog("RPC2", hPtr->RPC2_NumEntries, hPtr->RPC2_Log, tFile);
+ PrintNetLog("SE", hPtr->SE_NumEntries, hPtr->SE_Log, tFile);
diff --git a/net/coda5_client/patches/patch-db b/net/coda5_client/patches/patch-db
new file mode 100644
index 00000000000..95228f7cb69
--- /dev/null
+++ b/net/coda5_client/patches/patch-db
@@ -0,0 +1,192 @@
+$NetBSD: patch-db,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/host.c ./coda-src/rpc2/host.c
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/host.c Mon Apr 19 20:02:40 1999
++++ ./coda-src/rpc2/host.c Mon Apr 26 14:05:08 1999
+@@ -148,9 +148,8 @@
+
+ he->RTT = 0;
+ he->RTTVar = 0;
+- he->BW = 1000 << RPC2_BW_SHIFT;
+- he->BWVar = 0 << RPC2_BWVAR_SHIFT;
+- he->LastBytes = 0;
++ he->BR = 1000 << RPC2_BR_SHIFT;
++ he->BRVar = 0;
+
+ /* insert into hash table */
+ bucket = HASHHOST(&he->Host);
+@@ -302,7 +301,8 @@
+ rpc2_UpdateEstimates(host, &tv, Bytes);
+ }
+
+-/* Here we update the RTT and Bandwidth estimates,
++/* Here we update the RTT and Bandwidth (or more precise byterate in ns per
++ * byte) estimates,
+ * ElapsedTime is the observed roundtrip-time in milliseconds
+ * Bytes is the number of bytes transferred */
+ void rpc2_UpdateEstimates(struct HEntry *host, struct timeval *elapsed,
+@@ -310,7 +310,7 @@
+ {
+ unsigned long elapsed_us;
+ long eRTT; /* estimated null roundtrip time */
+- long eBW; /* estimated bandwidth */
++ long eBR; /* estimated byterate (ns/B) */
+ unsigned long eU; /* temporary unsigned variable */
+ long eL; /* temporary signed variable */
+
+@@ -332,41 +332,38 @@
+ /* get the estimated rtt */
+ eRTT = host->RTT >> RPC2_RTT_SHIFT;
+
+- if (elapsed_us > eRTT)
+- {
+- eU = elapsed_us - eRTT;
+-
+- /* eBW = ( eU * 1000 ) / Bytes ; */
+- eBW = ((eU << 7) / Bytes) << 3;
++ if (elapsed_us > eRTT) eU = elapsed_us - eRTT;
++ else eU = 0;
+
+- /* This is a hack to compensate for slow WinNT servers */
+- /* HACK! to avoid small packets with unusually long RTT's to have a
+- * negative effect on the BW estimate, we avoid using measurements
+- * from small packets with a BW smaller than 1/2 the estimated BW */
+- if (eBW > (host->BW >> (RPC2_BW_SHIFT - 1)) && Bytes < 512) eBW = 0;
+- else eBW -= (host->BW >> RPC2_BW_SHIFT);
+- /* HACK! */
++ /* eBR = ( eU * 1000 ) / Bytes ; */
++ eBR = ((eU << 7) / Bytes) << 3;
++ eBR -= (host->BR >> RPC2_BR_SHIFT);
++
++ /* HACK! to avoid small packets with RTT's that are not within the current
++ * window of variance to have a strong effect on the byterate estimate, we
++ * halve the difference of the new measurement, if it falls outside of the
++ * variance window */
++ if (eBR > (host->BRVar >> RPC2_BRVAR_SHIFT)) eBR >>= 1;
++ else if (eBR < -(host->BRVar >> RPC2_BRVAR_SHIFT)) eBR >>= 1;
++ /* HACK! */
++
++ host->BR += eBR;
+
+- host->BW += eBW;
+-
+- if (eBW < 0) eBW = -eBW;
+- }
+- else eBW = 0;
++ if (eBR < 0) eBR = -eBR;
+
+- /* Invariant: eBW contains the absolute difference between the previous
+- * calculated bandwidth and the new measurement */
++ /* Invariant: eBR contains the absolute difference between the previous
++ * calculated byterate and the new measurement */
+
+- eBW -= (host->BWVar >> RPC2_BWVAR_SHIFT);
+- host->BWVar += eBW;
++ eBR -= (host->BRVar >> RPC2_BRVAR_SHIFT);
++ host->BRVar += eBR;
+
+ /* get a new RTT estimate in elapsed_us */
+- /* from here on eBW contains a lower estimate on the effective
+- * bandwidth, eRTT will contain a updated RTT estimate */
+- eBW = (host->BW >> RPC2_BW_SHIFT) +
+- ((host->BWVar >> RPC2_BWVAR_SHIFT) >> 1);
++ /* from here on eBR contains a lower estimate on the effective
++ * byterate, eRTT will contain a updated RTT estimate */
++ eBR = (host->BR >> RPC2_BR_SHIFT) + ((host->BR >> RPC2_BRVAR_SHIFT) >> 1);
+
+- /* eU = ( eBW * Bytes ) / 1000 ; */
+- eU = ((eBW >> 3) * Bytes) >> 7;
++ /* eU = ( eBR * Bytes ) / 1000 ; */
++ eU = ((eBR >> 4) * Bytes) >> 6;
+
+ if (elapsed_us > eU) eL = elapsed_us - eU;
+ else eL = 0;
+@@ -381,13 +378,11 @@
+ eL -= (host->RTTVar >> RPC2_RTTVAR_SHIFT);
+ host->RTTVar += eL;
+
+- host->LastBytes = Bytes;
+-
+ say(0, RPC2_DebugLevel,
+- "Est: %s %4ld.%06lu/%-5lu RTT:%lu/%lu us BW:%lu/%lu B/s\n",
++ "Est: %s %4ld.%06lu/%-5lu RTT:%lu/%lu us BR:%lu/%lu ns/B\n",
+ inet_ntoa(host->Host), elapsed->tv_sec, elapsed->tv_usec, Bytes,
+ host->RTT>>RPC2_RTT_SHIFT, host->RTTVar>>RPC2_RTTVAR_SHIFT,
+- (1<<30)/(host->BW>>RPC2_BW_SHIFT), host->BWVar>>RPC2_BWVAR_SHIFT);
++ (host->BR>>RPC2_BR_SHIFT), host->BRVar>>RPC2_BRVAR_SHIFT);
+
+ return;
+ }
+@@ -396,7 +391,7 @@
+ struct timeval *tv)
+ {
+ unsigned long rto;
+- long effBW;
++ long effBR;
+ int i, shift = 1;
+
+ if (!host || !tv) return;
+@@ -413,11 +408,11 @@
+ * RTT estimate (it is latency estimate), we have to add in the time to
+ * send our packet into the estimated RTO */
+
+- effBW = (host->BW >> RPC2_BW_SHIFT);
+- // - ((host->BWVar >> RPC2_BWVAR_SHIFT) >> 1);
++ effBR = (host->BR >> RPC2_BR_SHIFT);
++ // - ((host->BRVar >> RPC2_BRVAR_SHIFT) >> 1);
+
+- /* rto += ( effBW * Bytes ) / 1000 ; */
+- rto += ((effBW >> 3) * Bytes) >> 7;
++ /* rto += ( effBR * Bytes ) / 1000 ; */
++ rto += ((effBR >> 3) * Bytes) >> 7;
+
+ /* minimum bound for rtt estimates to compensate for scheduling etc. */
+ if (rto < RPC2_MINRTO) rto = RPC2_MINRTO;
+@@ -446,18 +441,40 @@
+ return(RPC2_SUCCESS);
+ }
+
+-int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BW,
+- unsigned long *BWvar)
++int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BWlow,
++ unsigned long *BWavg, unsigned long *BWhigh)
+ {
+ struct CEntry *ce;
++ unsigned long BR, BRVar, tBR;
+
+ ce = rpc2_GetConn(handle);
+- if (ce == NULL)
+- return(RPC2_NOCONNECTION);
++ if (ce == NULL) return(RPC2_NOCONNECTION);
+
+- /* Adding 1 to the BW to avoid divide by zero errors --JH */
+- if (BW) *BW = 1000000000 / ((ce->HostInfo->BW >> RPC2_BW_SHIFT) + 1);
+- if (BWvar) *BWvar = ce->HostInfo->BWVar >> RPC2_BWVAR_SHIFT;
++ BR = ce->HostInfo->BR >> RPC2_BR_SHIFT;
++ BRVar = ce->HostInfo->BRVar >> RPC2_BRVAR_SHIFT;
++
++ if (BWlow) {
++ tBR = BR + BRVar;
++ /* Need at least 1 to avoid divide by zero errors --JH */
++ if (!tBR) tBR = 1;
++
++ *BWlow = 1000000000 / tBR;
++ }
++ if (BWavg) {
++ tBR = BR;
++ /* Need at least 1 to avoid divide by zero errors --JH */
++ if (!tBR) tBR = 1;
++
++ *BWavg = 1000000000 / tBR;
++ }
++ if (BWhigh) {
++ if (BR > BRVar)
++ tBR = BR - BRVar;
++ else
++ tBR = 1;
++
++ *BWhigh = 1000000000 / tBR;
++ }
+
+ return(RPC2_SUCCESS);
+ }
diff --git a/net/coda5_client/patches/patch-dc b/net/coda5_client/patches/patch-dc
new file mode 100644
index 00000000000..aedf62d357e
--- /dev/null
+++ b/net/coda5_client/patches/patch-dc
@@ -0,0 +1,16 @@
+$NetBSD: patch-dc,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.h ./coda-src/rpc2/rpc2.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.h Mon Apr 5 18:00:38 1999
++++ ./coda-src/rpc2/rpc2.h Mon Apr 26 14:05:08 1999
+@@ -704,8 +704,8 @@
+ extern int RPC2_S2RError (int error);
+
+ int RPC2_GetRTT(RPC2_Handle handle, unsigned long *RTT, unsigned long *RTTvar);
+-int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BW,
+- unsigned long *BWvar);
++int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BWlow,
++ unsigned long *BWavg, unsigned long *BWhigh);
+ int RPC2_GetLastObs(RPC2_Handle handle, struct timeval *tv);
+
+ int struct_len(ARG **a_types, PARM **args);
diff --git a/net/coda5_client/patches/patch-dd b/net/coda5_client/patches/patch-dd
new file mode 100644
index 00000000000..459db48688f
--- /dev/null
+++ b/net/coda5_client/patches/patch-dd
@@ -0,0 +1,30 @@
+$NetBSD: patch-dd,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.private.h ./coda-src/rpc2/rpc2.private.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.private.h Mon Apr 19 20:02:41 1999
++++ ./coda-src/rpc2/rpc2.private.h Mon Apr 26 14:05:08 1999
+@@ -103,7 +103,6 @@
+ /* MINRTO/MAXRTO are used to avoid unbounded timeouts */
+ #define RPC2_MINRTO 10000 /* min rto (rtt + variance) is 10 msec */
+ #define RPC2_MAXRTO 30000000 /* max rto (rtt + variance) is 30 seconds */
+-#define UNSET_BW ((unsigned long)-1)
+
+ /* Definitions for Flags field of connections */
+ #define CE_OLDV 0x1 /* old version detected during bind */
+@@ -321,12 +320,10 @@
+ unsigned long RTT; /* RTT (us<<RPC2_RTT_SHIFT) */
+ unsigned long RTTVar; /* RTT variance (us<<RPC2_RTTVAR_SHIFT) */
+
+-#define RPC2_BW_SHIFT 3
+-#define RPC2_BWVAR_SHIFT 2
+- unsigned long BW; /* BW (B/s<<RPC2_BW_SHIFT) */
+- unsigned long BWVar; /* BW variance (B/s<<RPC2_BWVAR_SHIFT) */
+-
+- unsigned long LastBytes; /* last packet size */
++#define RPC2_BR_SHIFT 3
++#define RPC2_BRVAR_SHIFT 2
++ unsigned long BR; /* Byterate (ns/B<<RPC2_BW_SHIFT) */
++ unsigned long BRVar; /* Byterate variance (ns/B<<RPC2_BWVAR_SHIFT) */
+ };
+
+
diff --git a/net/coda5_client/patches/patch-de b/net/coda5_client/patches/patch-de
new file mode 100644
index 00000000000..48a3cd6c217
--- /dev/null
+++ b/net/coda5_client/patches/patch-de
@@ -0,0 +1,75 @@
+$NetBSD: patch-de,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/sftp3.c ./coda-src/rpc2/sftp3.c
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/sftp3.c Mon Apr 5 18:00:41 1999
++++ ./coda-src/rpc2/sftp3.c Mon Apr 26 14:05:08 1999
+@@ -320,21 +320,22 @@
+ return(0);
+ }
+
++#if 0
+ /* Harvest the RTT observation if this is the first packet. (And try to
+ * get an estimate of the amount of bytes transferred on this roundtrip) */
+ if (pBuff->Header.SEFlags & SFTP_FIRST)
+ sftp_UpdateRTT(pBuff, sEntry, pBuff->Prefix.LengthOfPacket + /*data*/
+ sizeof(struct RPC2_PacketHeader));/*ack?*/
++#endif
+
+-#if 0 /* this test is bogus and makes us return bad timestamps when
+- packets are dropped. --JH */
+- /* We are seeing this packet for the first time */
++#if 1
+ if (pBuff->Header.SeqNumber == sEntry->RecvLastContig+1)
+- /* This packet advances the left edge of the window.
+- Save the timestamp to echo in the next ack */
++ /* This packet advances the left edge of the window. Save the
++ * timestamp to echo in the next ack */
+ sEntry->TimeEcho = pBuff->Header.TimeStamp;
+ #else
+- /* We are seeing this packet for the first time */
++ /* Keep track of the highest seen timestamp value, we use this when
++ * replying to the other side */
+ if (sEntry->TimeEcho < pBuff->Header.TimeStamp)
+ sEntry->TimeEcho = pBuff->Header.TimeStamp;
+ #endif
+@@ -358,13 +359,15 @@
+ sEntry->RecvLastContig + i <= sEntry->RecvMostRecent; i++)
+ if (TESTBIT(sEntry->RecvTheseBits, i)) {
+ pb = sEntry->ThesePackets[PBUFF((sEntry->RecvLastContig + i))];
+- if (pb->Header.TimeEcho >= pBuff->Header.TimeEcho &&
+- !(pb->Header.SEFlags & SFTP_COUNTED)) {
++ if (pb->Header.TimeEcho >= pBuff->Header.TimeEcho) {
++ //&& !(pb->Header.SEFlags & SFTP_COUNTED)) {
+ dataThisRound += pb->Prefix.LengthOfPacket;
+ pb->Header.SEFlags |= SFTP_COUNTED;
+ }
+ }
+ if (dataThisRound)
++ /* XXX The dataThisRound value is NOT equal to the data that
++ * was actually sent if we sent duplicate packets! -JH */
+ sftp_UpdateBW(pBuff, dataThisRound, sEntry);
+
+ /* recalculate the retry timeout */
+@@ -582,8 +585,11 @@
+ for (i = sEntry->SendLastContig+1; i <= pBuff->Header.GotEmAll; i++)
+ {
+ pb = sEntry->ThesePackets[PBUFF(i)];
+- if (!(ntohl(pb->Header.SEFlags) & SFTP_COUNTED))
+- dataThisRound += ntohl(pb->Header.BodyLength);
++ /* I had added the following test, but it makes us underestimate
++ * by a large amount the actual transferred data size (as reported
++ * to sftp_UpdateBW) -JH */
++ /* if (!(ntohl(pb->Header.SEFlags) & SFTP_COUNTED)) */
++ dataThisRound += ntohl(pb->Header.BodyLength);
+ }
+
+ for (i = 1; i <= sizeof(int)*BITMASKWIDTH; i++)
+@@ -599,6 +605,8 @@
+ }
+
+ if (dataThisRound)
++ /* XXX This is bogus, the succesfully acked data is NOT equal to
++ * the data we actually transferred over the wire! -JH */
+ sftp_UpdateBW(pBuff, dataThisRound, sEntry);
+ }
+
diff --git a/net/coda5_client/patches/patch-df b/net/coda5_client/patches/patch-df
new file mode 100644
index 00000000000..f796996affe
--- /dev/null
+++ b/net/coda5_client/patches/patch-df
@@ -0,0 +1,90 @@
+$NetBSD: patch-df,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.cc ./coda-src/venus/comm.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.cc Mon Apr 19 20:02:53 1999
++++ ./coda-src/venus/comm.cc Wed Apr 28 13:01:26 1999
+@@ -172,13 +172,6 @@
+ if (gethostname(myHostName, MAXHOSTNAMELEN) < 0)
+ CHOKE("CommInit: gethostname failed");
+
+- /* Hostid is needed for storeid generation. */
+-#ifdef DJGPP
+- myHostId = __djgpp_get_my_host(); /* this needs MYHOST in the cwd */
+-#else
+- myHostId = gethostid();
+-#endif
+-
+ /* Initialize Connections. */
+ connent::conntab = new olist;
+
+@@ -1074,6 +1067,7 @@
+ probeme = 0;
+ EventCounter = 0;
+ userbw = 0;
++ isweak = 0;
+ bw = INIT_BW;
+ bwvar = 0;
+ timerclear(&lastobs);
+@@ -1353,6 +1347,7 @@
+ long srvent::GetBandwidth(unsigned long *Bandwidth) {
+ long rc = 0;
+ unsigned long oldbw = bw;
++ unsigned long bwmin, bwmax;
+
+ LOG(1, ("srvent::GetBandwidth (%s) lastobs %ld.%06ld\n",
+ name, lastobs.tv_sec, lastobs.tv_usec));
+@@ -1371,9 +1366,9 @@
+ }
+
+ /* retrieve the bandwidth information from RPC2 */
+- if ((rc = RPC2_GetBandwidth(connid, &bw, &bwvar)) != RPC2_SUCCESS)
++ if ((rc = RPC2_GetBandwidth(connid, &bwmin, &bw, &bwmax)) != RPC2_SUCCESS)
+ return(rc);
+-
++
+ LOG(1, ("srvent:GetBandWidth: --> new BW %d bytes/sec\n", bw));
+
+ /* update last observation time */
+@@ -1383,20 +1378,22 @@
+ * Signal if we've crossed the weakly-connected threshold. Note
+ * that the connection is considered strong until proven otherwise.
+ */
+- if (oldbw > WCThresh && bw <= WCThresh) {
++ if (!isweak && bwmax < WCThresh) {
++ isweak = 1;
+ MarinerLog("connection::weak %s\n", name);
+ VSGDB->WeakEvent(host);
+ NotifyUsersOfServerWeakEvent(name);
+ }
+- else if (oldbw <= WCThresh && bw > WCThresh) {
++ else if (isweak && bwmin > WCThresh) {
++ isweak = 0;
+ MarinerLog("connection::strong %s\n", name);
+ VSGDB->StrongEvent(host);
+ NotifyUsersOfServerStrongEvent(name);
+ }
+
+ *Bandwidth = bw;
++ MarinerLog("connection::bandwidth %s %d %d %d\n", name,bwmin,bw,bwmax);
+ if (bw != oldbw) {
+- MarinerLog("connection::bandwidth %s %d\n", name, bw);
+ NotifyUsersOfServerBandwidthEvent(name,*Bandwidth);
+ }
+ LOG(1, ("srvent::GetBandwidth (%s) returns %d bytes/sec\n",
+@@ -1430,12 +1427,14 @@
+ */
+ bw = userbw ? b : INIT_BW;
+ bwvar = 0;
+- if (oldbw > WCThresh && bw <= WCThresh) {
++ if (!isweak && bw <= WCThresh) {
++ isweak = 1;
+ MarinerLog("connection::weak %s\n", name);
+ VSGDB->WeakEvent(host);
+ NotifyUsersOfServerWeakEvent(name);
+ }
+- else if (oldbw <= WCThresh && bw > WCThresh) {
++ else if (isweak && bw > WCThresh) {
++ isweak = 0;
+ MarinerLog("connection::strong %s\n", name);
+ VSGDB->StrongEvent(host);
+ NotifyUsersOfServerStrongEvent(name);
diff --git a/net/coda5_client/patches/patch-dg b/net/coda5_client/patches/patch-dg
new file mode 100644
index 00000000000..9a712370723
--- /dev/null
+++ b/net/coda5_client/patches/patch-dg
@@ -0,0 +1,21 @@
+$NetBSD: patch-dg,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.h ./coda-src/venus/comm.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.h Thu Mar 11 23:17:33 1999
++++ ./coda-src/venus/comm.h Wed Apr 28 13:01:26 1999
+@@ -258,6 +258,7 @@
+ unsigned Xbinding : 1; /* 1 --> BINDING, 0 --> NOT_BINDING */
+ unsigned probeme : 1; /* should ProbeD probe this server? */
+ unsigned userbw : 1; /* is current BW set by the user? */
++ unsigned isweak : 1; /* is this server considered weak */
+ unsigned long bw; /* bandwidth estimate, Bytes/sec */
+ unsigned long bwvar; /* variance of the bandwidth estimate */
+ struct timeval lastobs; /* time of most recent estimate */
+@@ -553,7 +554,6 @@
+ extern int COPModes;
+ extern int UseMulticast;
+ extern char myHostName[];
+-extern unsigned long myHostId;
+ extern int rpc2_retries;
+ extern int rpc2_timeout;
+ extern int sftp_windowsize;
diff --git a/net/coda5_client/patches/patch-dh b/net/coda5_client/patches/patch-dh
new file mode 100644
index 00000000000..da3d12b0fe3
--- /dev/null
+++ b/net/coda5_client/patches/patch-dh
@@ -0,0 +1,13 @@
+$NetBSD: patch-dh,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venus.version.h ./coda-src/venus/venus.version.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venus.version.h Thu Mar 11 23:17:41 1999
++++ ./coda-src/venus/venus.version.h Mon Apr 26 13:55:49 1999
+@@ -23,6 +23,6 @@
+ /* ***** Venus Version Numbers ***** */
+ const int VenusMajorVersion = 5;
+ const int VenusMinorVersion = 2;
+-const int VenusReleaseVersion = 0;
++const int VenusReleaseVersion = 3;
+
+ #endif
diff --git a/net/coda5_client/patches/patch-di b/net/coda5_client/patches/patch-di
new file mode 100644
index 00000000000..defec97d1ce
--- /dev/null
+++ b/net/coda5_client/patches/patch-di
@@ -0,0 +1,37 @@
+$NetBSD: patch-di,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.cc ./coda-src/venus/venusrecov.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.cc Mon Apr 19 20:03:05 1999
++++ ./coda-src/venus/venusrecov.cc Wed Apr 28 13:01:27 1999
+@@ -187,6 +192,13 @@
+ fdprint(fd, "Ptrs = [%x %x %x %x %x %x], Heap = [%x] HeapLen = %x\n",
+ recov_FSDB, recov_VDB, recov_VSGDB, recov_HDB, recov_LRDB, recov_VCBDB,
+ recov_HeapAddr, recov_HeapLength);
++
++ fdprint(fd, "UUID = %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
++ ntohl(*(unsigned int *)&recov_UUID[0]),
++ ntohs(*(unsigned short *)&recov_UUID[4]),
++ ntohs(*(unsigned short *)&recov_UUID[6]),
++ recov_UUID[8], recov_UUID[9], recov_UUID[10], recov_UUID[11],
++ recov_UUID[12], recov_UUID[13], recov_UUID[14], recov_UUID[15]);
+ }
+
+
+@@ -201,6 +213,8 @@
+ rvg->recov_MagicNumber = RecovMagicNumber;
+ rvg->recov_VersionNumber = RecovVersionNumber;
+ rvg->recov_LastInit = Vtime();
++ VenusGenID = rpc2_NextRandom(NULL);
++
+ RecovInited = 1;
+ return;
+ }
+@@ -548,6 +562,8 @@
+ rvg->recov_HeapAddr = Recov_RdsAddr;
+ rvg->recov_HeapLength = (unsigned int)Recov_RdsLength;
+
++ VenusGenID = rpc2_NextRandom(NULL);
++
+ /* Initialize the recoverable heap. */
+ int err = 0;
+ rds_init_heap(Recov_RdsAddr, Recov_RdsLength, (unsigned long)RdsChunkSize,
diff --git a/net/coda5_client/patches/patch-dj b/net/coda5_client/patches/patch-dj
new file mode 100644
index 00000000000..084043f5454
--- /dev/null
+++ b/net/coda5_client/patches/patch-dj
@@ -0,0 +1,32 @@
+$NetBSD: patch-dj,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.h ./coda-src/venus/venusrecov.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.h Thu Mar 11 23:17:42 1999
++++ ./coda-src/venus/venusrecov.h Wed Apr 28 13:01:27 1999
+@@ -92,7 +92,7 @@
+ const int UNSET_MAXTS = -1;
+
+ const int RecovMagicNumber = 0x8675309;
+-const int RecovVersionNumber = 28; /* Update this when format changes. */
++const int RecovVersionNumber = 29; /* Update this when format changes. */
+
+
+ /* ***** Types ***** */
+@@ -119,6 +119,17 @@
+ char *recov_HeapAddr; /* Base of recoverable heap */
+ unsigned int recov_HeapLength; /* Length of recoverable heap (in bytes) */
+
++ /* We need to have a identifier that is guaranteed to be identical across
++ * crashes and reboots, but unique with respect to all other venii (that
++ * do stores to the same server/volume), _and_ venus reinitializations. So
++ * we cannot use a timestamp, or the local ip/ether-address. This calls
++ * for a UUID, but using that will require modifications to the RPC2
++ * protocol. So for now a random integer is used. */
++#define VenusGenID (*(unsigned int*)&rvg->recov_UUID)
++
++ /* At some point we should start using a real 128-bit UUID, and this space
++ * is reserved for that purpose */
++ unsigned char recov_UUID[16];
+
+ int validate();
+ void print();
diff --git a/net/coda5_client/patches/patch-dk b/net/coda5_client/patches/patch-dk
new file mode 100644
index 00000000000..2b8a4b0cfa6
--- /dev/null
+++ b/net/coda5_client/patches/patch-dk
@@ -0,0 +1,20 @@
+$NetBSD: patch-dk,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvm.cc ./coda-src/venus/venusvm.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvm.cc Mon Apr 19 20:03:06 1999
++++ ./coda-src/venus/venusvm.cc Wed Apr 28 13:01:27 1999
+@@ -293,7 +293,13 @@
+ struct hostent *h = gethostbyname(VmonHost);
+ if (h) VmonAddr = ntohl(*((unsigned long *)h->h_addr));
+
+- MyVenusId.IPAddress = myHostId;
++#ifdef DJGPP
++ /* this needs MYHOST in the cwd, but vmon is normally not enabled... */
++ MyVenusId.IPAddress = __djgpp_get_my_host();
++#else
++ MyVenusId.IPAddress = gethostid();
++#endif
++
+ MyVenusId.BirthTime = Vtime();
+
+ CEActiveList = new olist;
diff --git a/net/coda5_client/patches/patch-dl b/net/coda5_client/patches/patch-dl
new file mode 100644
index 00000000000..28167ed7190
--- /dev/null
+++ b/net/coda5_client/patches/patch-dl
@@ -0,0 +1,19 @@
+$NetBSD: patch-dl,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvol.cc ./coda-src/venus/venusvol.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvol.cc Mon Apr 19 20:03:06 1999
++++ ./coda-src/venus/venusvol.cc Wed Apr 28 13:01:27 1999
+@@ -2121,7 +2121,12 @@
+ ViceStoreId volent::GenerateStoreId() {
+ ViceStoreId sid;
+
+- sid.Host = (RPC2_Unsigned)myHostId;
++ /* VenusGenID, is randomly chosen whenever rvm is reinitialized, it
++ * should be a 128-bit UUID (re-generated whenever rvm is reinitialized).
++ * But that would require changing in the venus-vice protocol to either
++ * add this UUID to every operation, or send it once per (volume-)
++ * connection setup with ViceNewConnectFS. -JH */
++ sid.Host = (RPC2_Unsigned)VenusGenID;
+
+ RVMLIB_REC_OBJECT(SidUnique);
+ sid.Uniquifier = (RPC2_Unsigned)SidUnique++;
diff --git a/net/coda5_client/patches/patch-dm b/net/coda5_client/patches/patch-dm
new file mode 100644
index 00000000000..710b096a973
--- /dev/null
+++ b/net/coda5_client/patches/patch-dm
@@ -0,0 +1,35 @@
+$NetBSD: patch-dm,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/vice/srvproc.cc ./coda-src/vice/srvproc.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/vice/srvproc.cc Mon Apr 19 20:03:17 1999
++++ ./coda-src/vice/srvproc.cc Wed Apr 28 13:01:28 1999
+@@ -88,7 +88,6 @@
+ #include <repio.h>
+ #include <codadir.h>
+ #include <operations.h>
+-#include <reslog.h>
+ #include <lockqueue.h>
+ #include <resutil.h>
+ #include <ops.h>
+@@ -3653,7 +3657,7 @@
+ {
+ /* When we are continueing a trickle/interrupted fetch, the version
+ * vector must be the same */
+- if (VV && (VV_Cmp(VV, &vptr->disk.versionvector) != VV_EQ))
++ if (Offset && VV && (VV_Cmp(VV, &vptr->disk.versionvector) != VV_EQ))
+ {
+ SLog(1, "FetchBulkTransfer: Attempting resumed fetch on updated object");
+ /* now what errorcode can we use for this case?? */
+@@ -4760,12 +4764,7 @@
+ }
+ if (AllowResolution) {
+ /* clean up spooled log record list */
+- sle *s;
+ rsle *rs;
+- while ((s = (sle *)v->sl.get())) {
+- s->rec_index = -1;
+- delete s;
+- }
+ while ((rs = (rsle *)v->rsl.get()))
+ delete rs;
+ }
diff --git a/net/coda5_client/patches/patch-dn b/net/coda5_client/patches/patch-dn
new file mode 100644
index 00000000000..c507c5ec161
--- /dev/null
+++ b/net/coda5_client/patches/patch-dn
@@ -0,0 +1,82 @@
+$NetBSD: patch-dn,v 1.1 1999/04/28 23:57:04 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/vtools/logbandwidth.in ./coda-src/vtools/logbandwidth.in
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/vtools/logbandwidth.in Thu Mar 11 23:18:26 1999
++++ ./coda-src/vtools/logbandwidth.in Mon Apr 26 13:58:38 1999
+@@ -22,9 +22,11 @@
+ #
+ set strip_value1 0
+ set strip_value2 0
++set strip_value3 0
+ set strip_interval 1000
+ set strip_log1 [ list ]
+ set strip_log2 [ list ]
++set strip_log3 [ list ]
+ set strip_idx 0
+ set strip_label ""
+
+@@ -40,21 +42,38 @@
+ for { set x 0 } { $x < 200 } { incr x } {
+ lappend strip_log1 0
+ lappend strip_log2 0
++ lappend strip_log3 0
+ }
+
+ proc strip_draw {} {
+ global strip_log1 strip_value1
++ global strip_log2 strip_value2
++ global strip_log3 strip_value3
+ global strip_interval strip_idx strip_label
+
+ set strip_log1 [ lreplace $strip_log1 $strip_idx $strip_idx $strip_value1 ]
++ set strip_log2 [ lreplace $strip_log2 $strip_idx $strip_idx $strip_value2 ]
++ set strip_log3 [ lreplace $strip_log3 $strip_idx $strip_idx $strip_value3 ]
+
+ .strip_graph delete data
+
+ set i [ expr 202 - $strip_idx ]
+- foreach v1 $strip_log1 {
++ foreach v1 $strip_log1 v2 $strip_log2 v3 $strip_log3 {
+ if { $v1 < 100 } { set v1 100 }
+- set val1 [ expr 102 - ( ( log10($v1) - 3 ) * 20 ) ]
+- .strip_graph create line $i 103 $i $val1 -tags data -fill LightSlateBlue
++ if { $v2 < 100 } { set v2 100 }
++ if { $v3 < 100 } { set v3 100 }
++ set val1 [ expr ( ( log10($v1) - 3 ) * 20 ) ]
++ set val2 [ expr ( ( log10($v2) - 3 ) * 20 ) ]
++ set val3 [ expr ( ( log10($v3) - 3 ) * 20 ) ]
++ .strip_graph create line $i 103 \
++ $i [ expr 102 - $val1 ] \
++ -tags data -fill LightSlateBlue
++ .strip_graph create line $i [ expr 102 - $val1 ] \
++ $i [ expr 102 - $val3 ] \
++ -tags data -fill SkyBlue
++ .strip_graph create line $i [ expr 102 - $val2 ] \
++ $i [ expr 103 - $val2 ] \
++ -tags data -fill Red
+
+ incr i
+ if { $i >= 202 } { set i 2 }
+@@ -130,7 +149,7 @@
+ # Customized stuff
+ #
+ proc checkline {line} {
+- global who strip_value1 strip_label
++ global who strip_value1 strip_value2 strip_value3 strip_label
+
+ #
+ # match our patterns
+@@ -139,8 +158,12 @@
+ if { $who == "" } { set who [ lindex $line 1 ] }
+ strip_title [ lindex $line 1]
+ set strip_value1 [ lindex $line 2 ]
++ set strip_value2 [ lindex $line 3 ]
++ set strip_value3 [ lindex $line 4 ]
+ if { $strip_value1 < 0 } { set strip_value1 0 }
+- set strip_label "[ expr $strip_value1 * 8 ] bps"
++ if { $strip_value2 < 0 } { set strip_value2 0 }
++ if { $strip_value3 < 0 } { set strip_value3 0 }
++ set strip_label "[ expr $strip_value2 * 8 ] bps"
+ }
+ }
+
diff --git a/net/coda5_server/patches/patch-da b/net/coda5_server/patches/patch-da
new file mode 100644
index 00000000000..d8666e0fdd5
--- /dev/null
+++ b/net/coda5_server/patches/patch-da
@@ -0,0 +1,22 @@
+$NetBSD: patch-da,v 1.1 1999/04/28 23:56:33 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/debug.c ./coda-src/rpc2/debug.c
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/debug.c Mon Apr 5 18:00:37 1999
++++ ./coda-src/rpc2/debug.c Mon Apr 26 14:05:08 1999
+@@ -194,11 +194,11 @@
+ hPtr->RTT % ((1 << RPC2_RTT_SHIFT) - 1),
+ hPtr->RTTVar >> RPC2_RTTVAR_SHIFT,
+ hPtr->RTTVar % ((1 << RPC2_RTTVAR_SHIFT) - 1));
+- fprintf(tFile, "\tBW = %ld.%03ld, BWvar = %ld.%03ld\n",
+- hPtr->BW >> RPC2_BW_SHIFT,
+- hPtr->BW % ((1 << RPC2_BW_SHIFT) - 1),
+- hPtr->BWVar >> RPC2_BWVAR_SHIFT,
+- hPtr->BWVar % ((1 << RPC2_BWVAR_SHIFT) - 1));
++ fprintf(tFile, "\tByteRate = %ld.%03ld ns/B, BRvar = %ld.%03ld\n",
++ hPtr->BR >> RPC2_BR_SHIFT,
++ hPtr->BR % ((1 << RPC2_BR_SHIFT) - 1),
++ hPtr->BRVar >> RPC2_BRVAR_SHIFT,
++ hPtr->BRVar % ((1 << RPC2_BRVAR_SHIFT) - 1));
+
+ PrintNetLog("RPC2", hPtr->RPC2_NumEntries, hPtr->RPC2_Log, tFile);
+ PrintNetLog("SE", hPtr->SE_NumEntries, hPtr->SE_Log, tFile);
diff --git a/net/coda5_server/patches/patch-db b/net/coda5_server/patches/patch-db
new file mode 100644
index 00000000000..dae650e58ea
--- /dev/null
+++ b/net/coda5_server/patches/patch-db
@@ -0,0 +1,192 @@
+$NetBSD: patch-db,v 1.1 1999/04/28 23:56:33 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/host.c ./coda-src/rpc2/host.c
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/host.c Mon Apr 19 20:02:40 1999
++++ ./coda-src/rpc2/host.c Mon Apr 26 14:05:08 1999
+@@ -148,9 +148,8 @@
+
+ he->RTT = 0;
+ he->RTTVar = 0;
+- he->BW = 1000 << RPC2_BW_SHIFT;
+- he->BWVar = 0 << RPC2_BWVAR_SHIFT;
+- he->LastBytes = 0;
++ he->BR = 1000 << RPC2_BR_SHIFT;
++ he->BRVar = 0;
+
+ /* insert into hash table */
+ bucket = HASHHOST(&he->Host);
+@@ -302,7 +301,8 @@
+ rpc2_UpdateEstimates(host, &tv, Bytes);
+ }
+
+-/* Here we update the RTT and Bandwidth estimates,
++/* Here we update the RTT and Bandwidth (or more precise byterate in ns per
++ * byte) estimates,
+ * ElapsedTime is the observed roundtrip-time in milliseconds
+ * Bytes is the number of bytes transferred */
+ void rpc2_UpdateEstimates(struct HEntry *host, struct timeval *elapsed,
+@@ -310,7 +310,7 @@
+ {
+ unsigned long elapsed_us;
+ long eRTT; /* estimated null roundtrip time */
+- long eBW; /* estimated bandwidth */
++ long eBR; /* estimated byterate (ns/B) */
+ unsigned long eU; /* temporary unsigned variable */
+ long eL; /* temporary signed variable */
+
+@@ -332,41 +332,38 @@
+ /* get the estimated rtt */
+ eRTT = host->RTT >> RPC2_RTT_SHIFT;
+
+- if (elapsed_us > eRTT)
+- {
+- eU = elapsed_us - eRTT;
+-
+- /* eBW = ( eU * 1000 ) / Bytes ; */
+- eBW = ((eU << 7) / Bytes) << 3;
++ if (elapsed_us > eRTT) eU = elapsed_us - eRTT;
++ else eU = 0;
+
+- /* This is a hack to compensate for slow WinNT servers */
+- /* HACK! to avoid small packets with unusually long RTT's to have a
+- * negative effect on the BW estimate, we avoid using measurements
+- * from small packets with a BW smaller than 1/2 the estimated BW */
+- if (eBW > (host->BW >> (RPC2_BW_SHIFT - 1)) && Bytes < 512) eBW = 0;
+- else eBW -= (host->BW >> RPC2_BW_SHIFT);
+- /* HACK! */
++ /* eBR = ( eU * 1000 ) / Bytes ; */
++ eBR = ((eU << 7) / Bytes) << 3;
++ eBR -= (host->BR >> RPC2_BR_SHIFT);
++
++ /* HACK! to avoid small packets with RTT's that are not within the current
++ * window of variance to have a strong effect on the byterate estimate, we
++ * halve the difference of the new measurement, if it falls outside of the
++ * variance window */
++ if (eBR > (host->BRVar >> RPC2_BRVAR_SHIFT)) eBR >>= 1;
++ else if (eBR < -(host->BRVar >> RPC2_BRVAR_SHIFT)) eBR >>= 1;
++ /* HACK! */
++
++ host->BR += eBR;
+
+- host->BW += eBW;
+-
+- if (eBW < 0) eBW = -eBW;
+- }
+- else eBW = 0;
++ if (eBR < 0) eBR = -eBR;
+
+- /* Invariant: eBW contains the absolute difference between the previous
+- * calculated bandwidth and the new measurement */
++ /* Invariant: eBR contains the absolute difference between the previous
++ * calculated byterate and the new measurement */
+
+- eBW -= (host->BWVar >> RPC2_BWVAR_SHIFT);
+- host->BWVar += eBW;
++ eBR -= (host->BRVar >> RPC2_BRVAR_SHIFT);
++ host->BRVar += eBR;
+
+ /* get a new RTT estimate in elapsed_us */
+- /* from here on eBW contains a lower estimate on the effective
+- * bandwidth, eRTT will contain a updated RTT estimate */
+- eBW = (host->BW >> RPC2_BW_SHIFT) +
+- ((host->BWVar >> RPC2_BWVAR_SHIFT) >> 1);
++ /* from here on eBR contains a lower estimate on the effective
++ * byterate, eRTT will contain a updated RTT estimate */
++ eBR = (host->BR >> RPC2_BR_SHIFT) + ((host->BR >> RPC2_BRVAR_SHIFT) >> 1);
+
+- /* eU = ( eBW * Bytes ) / 1000 ; */
+- eU = ((eBW >> 3) * Bytes) >> 7;
++ /* eU = ( eBR * Bytes ) / 1000 ; */
++ eU = ((eBR >> 4) * Bytes) >> 6;
+
+ if (elapsed_us > eU) eL = elapsed_us - eU;
+ else eL = 0;
+@@ -381,13 +378,11 @@
+ eL -= (host->RTTVar >> RPC2_RTTVAR_SHIFT);
+ host->RTTVar += eL;
+
+- host->LastBytes = Bytes;
+-
+ say(0, RPC2_DebugLevel,
+- "Est: %s %4ld.%06lu/%-5lu RTT:%lu/%lu us BW:%lu/%lu B/s\n",
++ "Est: %s %4ld.%06lu/%-5lu RTT:%lu/%lu us BR:%lu/%lu ns/B\n",
+ inet_ntoa(host->Host), elapsed->tv_sec, elapsed->tv_usec, Bytes,
+ host->RTT>>RPC2_RTT_SHIFT, host->RTTVar>>RPC2_RTTVAR_SHIFT,
+- (1<<30)/(host->BW>>RPC2_BW_SHIFT), host->BWVar>>RPC2_BWVAR_SHIFT);
++ (host->BR>>RPC2_BR_SHIFT), host->BRVar>>RPC2_BRVAR_SHIFT);
+
+ return;
+ }
+@@ -396,7 +391,7 @@
+ struct timeval *tv)
+ {
+ unsigned long rto;
+- long effBW;
++ long effBR;
+ int i, shift = 1;
+
+ if (!host || !tv) return;
+@@ -413,11 +408,11 @@
+ * RTT estimate (it is latency estimate), we have to add in the time to
+ * send our packet into the estimated RTO */
+
+- effBW = (host->BW >> RPC2_BW_SHIFT);
+- // - ((host->BWVar >> RPC2_BWVAR_SHIFT) >> 1);
++ effBR = (host->BR >> RPC2_BR_SHIFT);
++ // - ((host->BRVar >> RPC2_BRVAR_SHIFT) >> 1);
+
+- /* rto += ( effBW * Bytes ) / 1000 ; */
+- rto += ((effBW >> 3) * Bytes) >> 7;
++ /* rto += ( effBR * Bytes ) / 1000 ; */
++ rto += ((effBR >> 3) * Bytes) >> 7;
+
+ /* minimum bound for rtt estimates to compensate for scheduling etc. */
+ if (rto < RPC2_MINRTO) rto = RPC2_MINRTO;
+@@ -446,18 +441,40 @@
+ return(RPC2_SUCCESS);
+ }
+
+-int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BW,
+- unsigned long *BWvar)
++int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BWlow,
++ unsigned long *BWavg, unsigned long *BWhigh)
+ {
+ struct CEntry *ce;
++ unsigned long BR, BRVar, tBR;
+
+ ce = rpc2_GetConn(handle);
+- if (ce == NULL)
+- return(RPC2_NOCONNECTION);
++ if (ce == NULL) return(RPC2_NOCONNECTION);
+
+- /* Adding 1 to the BW to avoid divide by zero errors --JH */
+- if (BW) *BW = 1000000000 / ((ce->HostInfo->BW >> RPC2_BW_SHIFT) + 1);
+- if (BWvar) *BWvar = ce->HostInfo->BWVar >> RPC2_BWVAR_SHIFT;
++ BR = ce->HostInfo->BR >> RPC2_BR_SHIFT;
++ BRVar = ce->HostInfo->BRVar >> RPC2_BRVAR_SHIFT;
++
++ if (BWlow) {
++ tBR = BR + BRVar;
++ /* Need at least 1 to avoid divide by zero errors --JH */
++ if (!tBR) tBR = 1;
++
++ *BWlow = 1000000000 / tBR;
++ }
++ if (BWavg) {
++ tBR = BR;
++ /* Need at least 1 to avoid divide by zero errors --JH */
++ if (!tBR) tBR = 1;
++
++ *BWavg = 1000000000 / tBR;
++ }
++ if (BWhigh) {
++ if (BR > BRVar)
++ tBR = BR - BRVar;
++ else
++ tBR = 1;
++
++ *BWhigh = 1000000000 / tBR;
++ }
+
+ return(RPC2_SUCCESS);
+ }
diff --git a/net/coda5_server/patches/patch-dc b/net/coda5_server/patches/patch-dc
new file mode 100644
index 00000000000..75fb1b91bd0
--- /dev/null
+++ b/net/coda5_server/patches/patch-dc
@@ -0,0 +1,16 @@
+$NetBSD: patch-dc,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.h ./coda-src/rpc2/rpc2.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.h Mon Apr 5 18:00:38 1999
++++ ./coda-src/rpc2/rpc2.h Mon Apr 26 14:05:08 1999
+@@ -704,8 +704,8 @@
+ extern int RPC2_S2RError (int error);
+
+ int RPC2_GetRTT(RPC2_Handle handle, unsigned long *RTT, unsigned long *RTTvar);
+-int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BW,
+- unsigned long *BWvar);
++int RPC2_GetBandwidth(RPC2_Handle handle, unsigned long *BWlow,
++ unsigned long *BWavg, unsigned long *BWhigh);
+ int RPC2_GetLastObs(RPC2_Handle handle, struct timeval *tv);
+
+ int struct_len(ARG **a_types, PARM **args);
diff --git a/net/coda5_server/patches/patch-dd b/net/coda5_server/patches/patch-dd
new file mode 100644
index 00000000000..41f456b373b
--- /dev/null
+++ b/net/coda5_server/patches/patch-dd
@@ -0,0 +1,30 @@
+$NetBSD: patch-dd,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.private.h ./coda-src/rpc2/rpc2.private.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/rpc2.private.h Mon Apr 19 20:02:41 1999
++++ ./coda-src/rpc2/rpc2.private.h Mon Apr 26 14:05:08 1999
+@@ -103,7 +103,6 @@
+ /* MINRTO/MAXRTO are used to avoid unbounded timeouts */
+ #define RPC2_MINRTO 10000 /* min rto (rtt + variance) is 10 msec */
+ #define RPC2_MAXRTO 30000000 /* max rto (rtt + variance) is 30 seconds */
+-#define UNSET_BW ((unsigned long)-1)
+
+ /* Definitions for Flags field of connections */
+ #define CE_OLDV 0x1 /* old version detected during bind */
+@@ -321,12 +320,10 @@
+ unsigned long RTT; /* RTT (us<<RPC2_RTT_SHIFT) */
+ unsigned long RTTVar; /* RTT variance (us<<RPC2_RTTVAR_SHIFT) */
+
+-#define RPC2_BW_SHIFT 3
+-#define RPC2_BWVAR_SHIFT 2
+- unsigned long BW; /* BW (B/s<<RPC2_BW_SHIFT) */
+- unsigned long BWVar; /* BW variance (B/s<<RPC2_BWVAR_SHIFT) */
+-
+- unsigned long LastBytes; /* last packet size */
++#define RPC2_BR_SHIFT 3
++#define RPC2_BRVAR_SHIFT 2
++ unsigned long BR; /* Byterate (ns/B<<RPC2_BW_SHIFT) */
++ unsigned long BRVar; /* Byterate variance (ns/B<<RPC2_BWVAR_SHIFT) */
+ };
+
+
diff --git a/net/coda5_server/patches/patch-de b/net/coda5_server/patches/patch-de
new file mode 100644
index 00000000000..c889e48c398
--- /dev/null
+++ b/net/coda5_server/patches/patch-de
@@ -0,0 +1,75 @@
+$NetBSD: patch-de,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/sftp3.c ./coda-src/rpc2/sftp3.c
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/rpc2/sftp3.c Mon Apr 5 18:00:41 1999
++++ ./coda-src/rpc2/sftp3.c Mon Apr 26 14:05:08 1999
+@@ -320,21 +320,22 @@
+ return(0);
+ }
+
++#if 0
+ /* Harvest the RTT observation if this is the first packet. (And try to
+ * get an estimate of the amount of bytes transferred on this roundtrip) */
+ if (pBuff->Header.SEFlags & SFTP_FIRST)
+ sftp_UpdateRTT(pBuff, sEntry, pBuff->Prefix.LengthOfPacket + /*data*/
+ sizeof(struct RPC2_PacketHeader));/*ack?*/
++#endif
+
+-#if 0 /* this test is bogus and makes us return bad timestamps when
+- packets are dropped. --JH */
+- /* We are seeing this packet for the first time */
++#if 1
+ if (pBuff->Header.SeqNumber == sEntry->RecvLastContig+1)
+- /* This packet advances the left edge of the window.
+- Save the timestamp to echo in the next ack */
++ /* This packet advances the left edge of the window. Save the
++ * timestamp to echo in the next ack */
+ sEntry->TimeEcho = pBuff->Header.TimeStamp;
+ #else
+- /* We are seeing this packet for the first time */
++ /* Keep track of the highest seen timestamp value, we use this when
++ * replying to the other side */
+ if (sEntry->TimeEcho < pBuff->Header.TimeStamp)
+ sEntry->TimeEcho = pBuff->Header.TimeStamp;
+ #endif
+@@ -358,13 +359,15 @@
+ sEntry->RecvLastContig + i <= sEntry->RecvMostRecent; i++)
+ if (TESTBIT(sEntry->RecvTheseBits, i)) {
+ pb = sEntry->ThesePackets[PBUFF((sEntry->RecvLastContig + i))];
+- if (pb->Header.TimeEcho >= pBuff->Header.TimeEcho &&
+- !(pb->Header.SEFlags & SFTP_COUNTED)) {
++ if (pb->Header.TimeEcho >= pBuff->Header.TimeEcho) {
++ //&& !(pb->Header.SEFlags & SFTP_COUNTED)) {
+ dataThisRound += pb->Prefix.LengthOfPacket;
+ pb->Header.SEFlags |= SFTP_COUNTED;
+ }
+ }
+ if (dataThisRound)
++ /* XXX The dataThisRound value is NOT equal to the data that
++ * was actually sent if we sent duplicate packets! -JH */
+ sftp_UpdateBW(pBuff, dataThisRound, sEntry);
+
+ /* recalculate the retry timeout */
+@@ -582,8 +585,11 @@
+ for (i = sEntry->SendLastContig+1; i <= pBuff->Header.GotEmAll; i++)
+ {
+ pb = sEntry->ThesePackets[PBUFF(i)];
+- if (!(ntohl(pb->Header.SEFlags) & SFTP_COUNTED))
+- dataThisRound += ntohl(pb->Header.BodyLength);
++ /* I had added the following test, but it makes us underestimate
++ * by a large amount the actual transferred data size (as reported
++ * to sftp_UpdateBW) -JH */
++ /* if (!(ntohl(pb->Header.SEFlags) & SFTP_COUNTED)) */
++ dataThisRound += ntohl(pb->Header.BodyLength);
+ }
+
+ for (i = 1; i <= sizeof(int)*BITMASKWIDTH; i++)
+@@ -599,6 +605,8 @@
+ }
+
+ if (dataThisRound)
++ /* XXX This is bogus, the succesfully acked data is NOT equal to
++ * the data we actually transferred over the wire! -JH */
+ sftp_UpdateBW(pBuff, dataThisRound, sEntry);
+ }
+
diff --git a/net/coda5_server/patches/patch-df b/net/coda5_server/patches/patch-df
new file mode 100644
index 00000000000..af264856ffd
--- /dev/null
+++ b/net/coda5_server/patches/patch-df
@@ -0,0 +1,90 @@
+$NetBSD: patch-df,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.cc ./coda-src/venus/comm.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.cc Mon Apr 19 20:02:53 1999
++++ ./coda-src/venus/comm.cc Wed Apr 28 13:01:26 1999
+@@ -172,13 +172,6 @@
+ if (gethostname(myHostName, MAXHOSTNAMELEN) < 0)
+ CHOKE("CommInit: gethostname failed");
+
+- /* Hostid is needed for storeid generation. */
+-#ifdef DJGPP
+- myHostId = __djgpp_get_my_host(); /* this needs MYHOST in the cwd */
+-#else
+- myHostId = gethostid();
+-#endif
+-
+ /* Initialize Connections. */
+ connent::conntab = new olist;
+
+@@ -1074,6 +1067,7 @@
+ probeme = 0;
+ EventCounter = 0;
+ userbw = 0;
++ isweak = 0;
+ bw = INIT_BW;
+ bwvar = 0;
+ timerclear(&lastobs);
+@@ -1353,6 +1347,7 @@
+ long srvent::GetBandwidth(unsigned long *Bandwidth) {
+ long rc = 0;
+ unsigned long oldbw = bw;
++ unsigned long bwmin, bwmax;
+
+ LOG(1, ("srvent::GetBandwidth (%s) lastobs %ld.%06ld\n",
+ name, lastobs.tv_sec, lastobs.tv_usec));
+@@ -1371,9 +1366,9 @@
+ }
+
+ /* retrieve the bandwidth information from RPC2 */
+- if ((rc = RPC2_GetBandwidth(connid, &bw, &bwvar)) != RPC2_SUCCESS)
++ if ((rc = RPC2_GetBandwidth(connid, &bwmin, &bw, &bwmax)) != RPC2_SUCCESS)
+ return(rc);
+-
++
+ LOG(1, ("srvent:GetBandWidth: --> new BW %d bytes/sec\n", bw));
+
+ /* update last observation time */
+@@ -1383,20 +1378,22 @@
+ * Signal if we've crossed the weakly-connected threshold. Note
+ * that the connection is considered strong until proven otherwise.
+ */
+- if (oldbw > WCThresh && bw <= WCThresh) {
++ if (!isweak && bwmax < WCThresh) {
++ isweak = 1;
+ MarinerLog("connection::weak %s\n", name);
+ VSGDB->WeakEvent(host);
+ NotifyUsersOfServerWeakEvent(name);
+ }
+- else if (oldbw <= WCThresh && bw > WCThresh) {
++ else if (isweak && bwmin > WCThresh) {
++ isweak = 0;
+ MarinerLog("connection::strong %s\n", name);
+ VSGDB->StrongEvent(host);
+ NotifyUsersOfServerStrongEvent(name);
+ }
+
+ *Bandwidth = bw;
++ MarinerLog("connection::bandwidth %s %d %d %d\n", name,bwmin,bw,bwmax);
+ if (bw != oldbw) {
+- MarinerLog("connection::bandwidth %s %d\n", name, bw);
+ NotifyUsersOfServerBandwidthEvent(name,*Bandwidth);
+ }
+ LOG(1, ("srvent::GetBandwidth (%s) returns %d bytes/sec\n",
+@@ -1430,12 +1427,14 @@
+ */
+ bw = userbw ? b : INIT_BW;
+ bwvar = 0;
+- if (oldbw > WCThresh && bw <= WCThresh) {
++ if (!isweak && bw <= WCThresh) {
++ isweak = 1;
+ MarinerLog("connection::weak %s\n", name);
+ VSGDB->WeakEvent(host);
+ NotifyUsersOfServerWeakEvent(name);
+ }
+- else if (oldbw <= WCThresh && bw > WCThresh) {
++ else if (isweak && bw > WCThresh) {
++ isweak = 0;
+ MarinerLog("connection::strong %s\n", name);
+ VSGDB->StrongEvent(host);
+ NotifyUsersOfServerStrongEvent(name);
diff --git a/net/coda5_server/patches/patch-dg b/net/coda5_server/patches/patch-dg
new file mode 100644
index 00000000000..cc74d5cdf69
--- /dev/null
+++ b/net/coda5_server/patches/patch-dg
@@ -0,0 +1,21 @@
+$NetBSD: patch-dg,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.h ./coda-src/venus/comm.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/comm.h Thu Mar 11 23:17:33 1999
++++ ./coda-src/venus/comm.h Wed Apr 28 13:01:26 1999
+@@ -258,6 +258,7 @@
+ unsigned Xbinding : 1; /* 1 --> BINDING, 0 --> NOT_BINDING */
+ unsigned probeme : 1; /* should ProbeD probe this server? */
+ unsigned userbw : 1; /* is current BW set by the user? */
++ unsigned isweak : 1; /* is this server considered weak */
+ unsigned long bw; /* bandwidth estimate, Bytes/sec */
+ unsigned long bwvar; /* variance of the bandwidth estimate */
+ struct timeval lastobs; /* time of most recent estimate */
+@@ -553,7 +554,6 @@
+ extern int COPModes;
+ extern int UseMulticast;
+ extern char myHostName[];
+-extern unsigned long myHostId;
+ extern int rpc2_retries;
+ extern int rpc2_timeout;
+ extern int sftp_windowsize;
diff --git a/net/coda5_server/patches/patch-dh b/net/coda5_server/patches/patch-dh
new file mode 100644
index 00000000000..a8266d8afd6
--- /dev/null
+++ b/net/coda5_server/patches/patch-dh
@@ -0,0 +1,13 @@
+$NetBSD: patch-dh,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venus.version.h ./coda-src/venus/venus.version.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venus.version.h Thu Mar 11 23:17:41 1999
++++ ./coda-src/venus/venus.version.h Mon Apr 26 13:55:49 1999
+@@ -23,6 +23,6 @@
+ /* ***** Venus Version Numbers ***** */
+ const int VenusMajorVersion = 5;
+ const int VenusMinorVersion = 2;
+-const int VenusReleaseVersion = 0;
++const int VenusReleaseVersion = 3;
+
+ #endif
diff --git a/net/coda5_server/patches/patch-di b/net/coda5_server/patches/patch-di
new file mode 100644
index 00000000000..2b9f6080a4d
--- /dev/null
+++ b/net/coda5_server/patches/patch-di
@@ -0,0 +1,37 @@
+$NetBSD: patch-di,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.cc ./coda-src/venus/venusrecov.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.cc Mon Apr 19 20:03:05 1999
++++ ./coda-src/venus/venusrecov.cc Wed Apr 28 13:01:27 1999
+@@ -187,6 +192,13 @@
+ fdprint(fd, "Ptrs = [%x %x %x %x %x %x], Heap = [%x] HeapLen = %x\n",
+ recov_FSDB, recov_VDB, recov_VSGDB, recov_HDB, recov_LRDB, recov_VCBDB,
+ recov_HeapAddr, recov_HeapLength);
++
++ fdprint(fd, "UUID = %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
++ ntohl(*(unsigned int *)&recov_UUID[0]),
++ ntohs(*(unsigned short *)&recov_UUID[4]),
++ ntohs(*(unsigned short *)&recov_UUID[6]),
++ recov_UUID[8], recov_UUID[9], recov_UUID[10], recov_UUID[11],
++ recov_UUID[12], recov_UUID[13], recov_UUID[14], recov_UUID[15]);
+ }
+
+
+@@ -201,6 +213,8 @@
+ rvg->recov_MagicNumber = RecovMagicNumber;
+ rvg->recov_VersionNumber = RecovVersionNumber;
+ rvg->recov_LastInit = Vtime();
++ VenusGenID = rpc2_NextRandom(NULL);
++
+ RecovInited = 1;
+ return;
+ }
+@@ -548,6 +562,8 @@
+ rvg->recov_HeapAddr = Recov_RdsAddr;
+ rvg->recov_HeapLength = (unsigned int)Recov_RdsLength;
+
++ VenusGenID = rpc2_NextRandom(NULL);
++
+ /* Initialize the recoverable heap. */
+ int err = 0;
+ rds_init_heap(Recov_RdsAddr, Recov_RdsLength, (unsigned long)RdsChunkSize,
diff --git a/net/coda5_server/patches/patch-dj b/net/coda5_server/patches/patch-dj
new file mode 100644
index 00000000000..c3f397f1700
--- /dev/null
+++ b/net/coda5_server/patches/patch-dj
@@ -0,0 +1,32 @@
+$NetBSD: patch-dj,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.h ./coda-src/venus/venusrecov.h
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusrecov.h Thu Mar 11 23:17:42 1999
++++ ./coda-src/venus/venusrecov.h Wed Apr 28 13:01:27 1999
+@@ -92,7 +92,7 @@
+ const int UNSET_MAXTS = -1;
+
+ const int RecovMagicNumber = 0x8675309;
+-const int RecovVersionNumber = 28; /* Update this when format changes. */
++const int RecovVersionNumber = 29; /* Update this when format changes. */
+
+
+ /* ***** Types ***** */
+@@ -119,6 +119,17 @@
+ char *recov_HeapAddr; /* Base of recoverable heap */
+ unsigned int recov_HeapLength; /* Length of recoverable heap (in bytes) */
+
++ /* We need to have a identifier that is guaranteed to be identical across
++ * crashes and reboots, but unique with respect to all other venii (that
++ * do stores to the same server/volume), _and_ venus reinitializations. So
++ * we cannot use a timestamp, or the local ip/ether-address. This calls
++ * for a UUID, but using that will require modifications to the RPC2
++ * protocol. So for now a random integer is used. */
++#define VenusGenID (*(unsigned int*)&rvg->recov_UUID)
++
++ /* At some point we should start using a real 128-bit UUID, and this space
++ * is reserved for that purpose */
++ unsigned char recov_UUID[16];
+
+ int validate();
+ void print();
diff --git a/net/coda5_server/patches/patch-dk b/net/coda5_server/patches/patch-dk
new file mode 100644
index 00000000000..8727803e01c
--- /dev/null
+++ b/net/coda5_server/patches/patch-dk
@@ -0,0 +1,20 @@
+$NetBSD: patch-dk,v 1.1 1999/04/28 23:56:34 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvm.cc ./coda-src/venus/venusvm.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvm.cc Mon Apr 19 20:03:06 1999
++++ ./coda-src/venus/venusvm.cc Wed Apr 28 13:01:27 1999
+@@ -293,7 +293,13 @@
+ struct hostent *h = gethostbyname(VmonHost);
+ if (h) VmonAddr = ntohl(*((unsigned long *)h->h_addr));
+
+- MyVenusId.IPAddress = myHostId;
++#ifdef DJGPP
++ /* this needs MYHOST in the cwd, but vmon is normally not enabled... */
++ MyVenusId.IPAddress = __djgpp_get_my_host();
++#else
++ MyVenusId.IPAddress = gethostid();
++#endif
++
+ MyVenusId.BirthTime = Vtime();
+
+ CEActiveList = new olist;
diff --git a/net/coda5_server/patches/patch-dl b/net/coda5_server/patches/patch-dl
new file mode 100644
index 00000000000..27e462bfb82
--- /dev/null
+++ b/net/coda5_server/patches/patch-dl
@@ -0,0 +1,19 @@
+$NetBSD: patch-dl,v 1.1 1999/04/28 23:56:35 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvol.cc ./coda-src/venus/venusvol.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/venus/venusvol.cc Mon Apr 19 20:03:06 1999
++++ ./coda-src/venus/venusvol.cc Wed Apr 28 13:01:27 1999
+@@ -2121,7 +2121,12 @@
+ ViceStoreId volent::GenerateStoreId() {
+ ViceStoreId sid;
+
+- sid.Host = (RPC2_Unsigned)myHostId;
++ /* VenusGenID, is randomly chosen whenever rvm is reinitialized, it
++ * should be a 128-bit UUID (re-generated whenever rvm is reinitialized).
++ * But that would require changing in the venus-vice protocol to either
++ * add this UUID to every operation, or send it once per (volume-)
++ * connection setup with ViceNewConnectFS. -JH */
++ sid.Host = (RPC2_Unsigned)VenusGenID;
+
+ RVMLIB_REC_OBJECT(SidUnique);
+ sid.Uniquifier = (RPC2_Unsigned)SidUnique++;
diff --git a/net/coda5_server/patches/patch-dm b/net/coda5_server/patches/patch-dm
new file mode 100644
index 00000000000..cbe25414c7b
--- /dev/null
+++ b/net/coda5_server/patches/patch-dm
@@ -0,0 +1,35 @@
+$NetBSD: patch-dm,v 1.1 1999/04/28 23:56:35 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/vice/srvproc.cc ./coda-src/vice/srvproc.cc
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/vice/srvproc.cc Mon Apr 19 20:03:17 1999
++++ ./coda-src/vice/srvproc.cc Wed Apr 28 13:01:28 1999
+@@ -88,7 +88,6 @@
+ #include <repio.h>
+ #include <codadir.h>
+ #include <operations.h>
+-#include <reslog.h>
+ #include <lockqueue.h>
+ #include <resutil.h>
+ #include <ops.h>
+@@ -3653,7 +3657,7 @@
+ {
+ /* When we are continueing a trickle/interrupted fetch, the version
+ * vector must be the same */
+- if (VV && (VV_Cmp(VV, &vptr->disk.versionvector) != VV_EQ))
++ if (Offset && VV && (VV_Cmp(VV, &vptr->disk.versionvector) != VV_EQ))
+ {
+ SLog(1, "FetchBulkTransfer: Attempting resumed fetch on updated object");
+ /* now what errorcode can we use for this case?? */
+@@ -4760,12 +4764,7 @@
+ }
+ if (AllowResolution) {
+ /* clean up spooled log record list */
+- sle *s;
+ rsle *rs;
+- while ((s = (sle *)v->sl.get())) {
+- s->rec_index = -1;
+- delete s;
+- }
+ while ((rs = (rsle *)v->rsl.get()))
+ delete rs;
+ }
diff --git a/net/coda5_server/patches/patch-dn b/net/coda5_server/patches/patch-dn
new file mode 100644
index 00000000000..cbe9e4b10e2
--- /dev/null
+++ b/net/coda5_server/patches/patch-dn
@@ -0,0 +1,82 @@
+$NetBSD: patch-dn,v 1.1 1999/04/28 23:56:35 rvb Exp $
+
+diff -u /usr/pkgsrc/net/coda-5.2.2/coda-src/vtools/logbandwidth.in ./coda-src/vtools/logbandwidth.in
+--- /usr/pkgsrc/net/coda-5.2.2/coda-src/vtools/logbandwidth.in Thu Mar 11 23:18:26 1999
++++ ./coda-src/vtools/logbandwidth.in Mon Apr 26 13:58:38 1999
+@@ -22,9 +22,11 @@
+ #
+ set strip_value1 0
+ set strip_value2 0
++set strip_value3 0
+ set strip_interval 1000
+ set strip_log1 [ list ]
+ set strip_log2 [ list ]
++set strip_log3 [ list ]
+ set strip_idx 0
+ set strip_label ""
+
+@@ -40,21 +42,38 @@
+ for { set x 0 } { $x < 200 } { incr x } {
+ lappend strip_log1 0
+ lappend strip_log2 0
++ lappend strip_log3 0
+ }
+
+ proc strip_draw {} {
+ global strip_log1 strip_value1
++ global strip_log2 strip_value2
++ global strip_log3 strip_value3
+ global strip_interval strip_idx strip_label
+
+ set strip_log1 [ lreplace $strip_log1 $strip_idx $strip_idx $strip_value1 ]
++ set strip_log2 [ lreplace $strip_log2 $strip_idx $strip_idx $strip_value2 ]
++ set strip_log3 [ lreplace $strip_log3 $strip_idx $strip_idx $strip_value3 ]
+
+ .strip_graph delete data
+
+ set i [ expr 202 - $strip_idx ]
+- foreach v1 $strip_log1 {
++ foreach v1 $strip_log1 v2 $strip_log2 v3 $strip_log3 {
+ if { $v1 < 100 } { set v1 100 }
+- set val1 [ expr 102 - ( ( log10($v1) - 3 ) * 20 ) ]
+- .strip_graph create line $i 103 $i $val1 -tags data -fill LightSlateBlue
++ if { $v2 < 100 } { set v2 100 }
++ if { $v3 < 100 } { set v3 100 }
++ set val1 [ expr ( ( log10($v1) - 3 ) * 20 ) ]
++ set val2 [ expr ( ( log10($v2) - 3 ) * 20 ) ]
++ set val3 [ expr ( ( log10($v3) - 3 ) * 20 ) ]
++ .strip_graph create line $i 103 \
++ $i [ expr 102 - $val1 ] \
++ -tags data -fill LightSlateBlue
++ .strip_graph create line $i [ expr 102 - $val1 ] \
++ $i [ expr 102 - $val3 ] \
++ -tags data -fill SkyBlue
++ .strip_graph create line $i [ expr 102 - $val2 ] \
++ $i [ expr 103 - $val2 ] \
++ -tags data -fill Red
+
+ incr i
+ if { $i >= 202 } { set i 2 }
+@@ -130,7 +149,7 @@
+ # Customized stuff
+ #
+ proc checkline {line} {
+- global who strip_value1 strip_label
++ global who strip_value1 strip_value2 strip_value3 strip_label
+
+ #
+ # match our patterns
+@@ -139,8 +158,12 @@
+ if { $who == "" } { set who [ lindex $line 1 ] }
+ strip_title [ lindex $line 1]
+ set strip_value1 [ lindex $line 2 ]
++ set strip_value2 [ lindex $line 3 ]
++ set strip_value3 [ lindex $line 4 ]
+ if { $strip_value1 < 0 } { set strip_value1 0 }
+- set strip_label "[ expr $strip_value1 * 8 ] bps"
++ if { $strip_value2 < 0 } { set strip_value2 0 }
++ if { $strip_value3 < 0 } { set strip_value3 0 }
++ set strip_label "[ expr $strip_value2 * 8 ] bps"
+ }
+ }
+