Index: openafs/src/JAVA/libjafs/File.c
diff -c openafs/src/JAVA/libjafs/File.c:1.4.4.1 openafs/src/JAVA/libjafs/File.c:1.4.4.2
*** openafs/src/JAVA/libjafs/File.c:1.4.4.1	Tue Apr 10 14:39:44 2007
--- openafs/src/JAVA/libjafs/File.c	Sun Nov 30 15:24:36 2008
***************
*** 20,25 ****
--- 20,26 ----
   */
  
  #include <afs/param.h>
+ #include <afs/com_err.h>
  #include <errno.h>
  
  #include "Internal.h"
Index: openafs/src/WINNT/afsd/afsd_service.c
diff -c openafs/src/WINNT/afsd/afsd_service.c:1.52.4.31 openafs/src/WINNT/afsd/afsd_service.c:1.52.4.32
*** openafs/src/WINNT/afsd/afsd_service.c:1.52.4.31	Thu Nov  6 14:18:51 2008
--- openafs/src/WINNT/afsd/afsd_service.c	Mon Dec 29 17:38:25 2008
***************
*** 91,96 ****
--- 91,98 ----
      cm_DumpSCache(afsi_file, "a", 0);
      cm_DumpBufHashTable(afsi_file, "a", 0);
      smb_DumpVCP(afsi_file, "a", 0);			
+     rx_DumpPackets(afsi_file, "a");
+     rx_DumpCalls(afsi_file, "a");
      afsi_log("--- end   dump ---");
      
  #ifdef DEBUG
Index: openafs/src/WINNT/afsd/cm_btree.c
diff -c openafs/src/WINNT/afsd/cm_btree.c:1.1.2.22 openafs/src/WINNT/afsd/cm_btree.c:1.1.2.24
*** openafs/src/WINNT/afsd/cm_btree.c:1.1.2.22	Sun Oct 19 19:19:33 2008
--- openafs/src/WINNT/afsd/cm_btree.c	Fri Dec 26 18:40:23 2008
***************
*** 1582,1588 ****
      normchar_t * entry = NULL;
  
      if (op->scp->dirBplus == NULL || 
!         op->dataVersion != op->scp->dirDataVersion) {
          rc = EINVAL;
          goto done;
      }
--- 1582,1588 ----
      normchar_t * entry = NULL;
  
      if (op->scp->dirBplus == NULL || 
!         op->dataVersion > op->scp->dirDataVersion) {
          rc = EINVAL;
          goto done;
      }
***************
*** 1678,1684 ****
      LARGE_INTEGER start, end;
  
      if (op->scp->dirBplus == NULL || 
!         op->dataVersion != op->scp->dirDataVersion) {
          rc = EINVAL;
          goto done;
      }
--- 1678,1684 ----
      LARGE_INTEGER start, end;
  
      if (op->scp->dirBplus == NULL || 
!         op->dataVersion > op->scp->dirDataVersion) {
          rc = EINVAL;
          goto done;
      }
***************
*** 2176,2182 ****
      afs_uint32 count = 0, slot, numentries;
      Nptr leafNode = NONODE, nextLeafNode;
      Nptr firstDataNode, dataNode, nextDataNode;
!     cm_direnum_t * enump;
      long rc = 0;
      char buffer[512];
  
--- 2176,2182 ----
      afs_uint32 count = 0, slot, numentries;
      Nptr leafNode = NONODE, nextLeafNode;
      Nptr firstDataNode, dataNode, nextDataNode;
!     cm_direnum_t * enump = NULL;
      long rc = 0;
      char buffer[512];
  
***************
*** 2188,2193 ****
--- 2188,2194 ----
  
      if (scp->dirBplus == NULL) {
  	osi_Log0(afsd_logp, "cm_BPlusDirEnumerate No BPlus Tree");
+         rc = CM_ERROR_WOULDBLOCK;
  	goto done;
      }
  
Index: openafs/src/WINNT/afsd/cm_buf.c
diff -c openafs/src/WINNT/afsd/cm_buf.c:1.31.2.46 openafs/src/WINNT/afsd/cm_buf.c:1.31.2.48
*** openafs/src/WINNT/afsd/cm_buf.c:1.31.2.46	Fri Aug 29 22:15:07 2008
--- openafs/src/WINNT/afsd/cm_buf.c	Fri Nov 21 11:53:00 2008
***************
*** 217,223 ****
  buf_Sync(int quitOnShutdown) 
  {
      cm_buf_t **bpp, *bp, *prevbp;
!     long wasDirty = 0;
      cm_req_t req;
  
      /* go through all of the dirty buffers */
--- 217,223 ----
  buf_Sync(int quitOnShutdown) 
  {
      cm_buf_t **bpp, *bp, *prevbp;
!     afs_uint32 wasDirty = 0;
      cm_req_t req;
  
      /* go through all of the dirty buffers */
***************
*** 232,245 ****
          */
          lock_ObtainMutex(&bp->mx);
  
!         if (bp->flags & CM_BUF_DIRTY) {
              /* start cleaning the buffer; don't touch log pages since
              * the log code counts on knowing exactly who is writing
              * a log page at any given instant.
              */
              cm_InitReq(&req);
              req.flags |= CM_REQ_NORETRY;
!             wasDirty |= buf_CleanAsyncLocked(bp, &req);
          }
  
          /* the buffer may or may not have been dirty
--- 232,248 ----
          */
          lock_ObtainMutex(&bp->mx);
  
!         if (bp->flags & CM_BUF_DIRTY && !(bp->flags & CM_BUF_REDIR)) {
              /* start cleaning the buffer; don't touch log pages since
              * the log code counts on knowing exactly who is writing
              * a log page at any given instant.
              */
+             afs_uint32 dirty;
+ 
              cm_InitReq(&req);
              req.flags |= CM_REQ_NORETRY;
!             buf_CleanAsyncLocked(bp, &req, &dirty);
!             wasDirty |= dirty;
          }
  
          /* the buffer may or may not have been dirty
***************
*** 688,697 ****
   *
   * Returns non-zero if the buffer was dirty.
   */
! long buf_CleanAsyncLocked(cm_buf_t *bp, cm_req_t *reqp)
  {
!     long code = 0;
!     long isdirty = 0;
      cm_scache_t * scp = NULL;
      osi_hyper_t offset;
  
--- 691,700 ----
   *
   * Returns non-zero if the buffer was dirty.
   */
! afs_uint32 buf_CleanAsyncLocked(cm_buf_t *bp, cm_req_t *reqp, afs_uint32 *pisdirty)
  {
!     afs_uint32 code = 0;
!     afs_uint32 isdirty = 0;
      cm_scache_t * scp = NULL;
      osi_hyper_t offset;
  
***************
*** 758,770 ****
  	    break;
      };
  
-     if (!(bp->flags & CM_BUF_DIRTY)) {
- 	/* remove buffer from dirty buffer queue */
- 
-     }
- 
-     /* do logging after call to GetLastError, or else */
-         
      /* if someone was waiting for the I/O that just completed or failed,
       * wake them up.
       */
--- 761,766 ----
***************
*** 773,779 ****
          osi_Log1(buf_logp, "buf_WaitIO Waking bp 0x%p", bp);
          osi_Wakeup((LONG_PTR) bp);
      }
!     return isdirty;
  }
  
  /* Called with a zero-ref count buffer and with the buf_globalLock write locked.
--- 769,779 ----
          osi_Log1(buf_logp, "buf_WaitIO Waking bp 0x%p", bp);
          osi_Wakeup((LONG_PTR) bp);
      }
! 
!     if (pisdirty)
!         *pisdirty = isdirty;
! 
!     return code;
  }
  
  /* Called with a zero-ref count buffer and with the buf_globalLock write locked.
***************
*** 960,966 ****
                   * have the WRITING flag set, so we won't get
                   * back here.
                   */
!                 buf_CleanAsync(bp, &req);
  
                  /* now put it back and go around again */
                  buf_Release(bp);
--- 960,966 ----
                   * have the WRITING flag set, so we won't get
                   * back here.
                   */
!                 buf_CleanAsync(bp, &req, NULL);
  
                  /* now put it back and go around again */
                  buf_Release(bp);
***************
*** 1272,1284 ****
  }
  
  /* clean a buffer synchronously */
! long buf_CleanAsync(cm_buf_t *bp, cm_req_t *reqp)
  {
      long code;
      osi_assertx(bp->magic == CM_BUF_MAGIC, "invalid cm_buf_t magic");
  
      lock_ObtainMutex(&bp->mx);
!     code = buf_CleanAsyncLocked(bp, reqp);
      lock_ReleaseMutex(&bp->mx);
  
      return code;
--- 1272,1284 ----
  }
  
  /* clean a buffer synchronously */
! long buf_CleanAsync(cm_buf_t *bp, cm_req_t *reqp, afs_uint32 *pisdirty)
  {
      long code;
      osi_assertx(bp->magic == CM_BUF_MAGIC, "invalid cm_buf_t magic");
  
      lock_ObtainMutex(&bp->mx);
!     code = buf_CleanAsyncLocked(bp, reqp, pisdirty);
      lock_ReleaseMutex(&bp->mx);
  
      return code;
***************
*** 1409,1415 ****
                  cm_InitReq(&req);
  		req.flags |= CM_REQ_NORETRY;
  
! 		buf_CleanAsync(bp, &req);
  		buf_CleanWait(NULL, bp, FALSE);
  
                  /* relock and release buffer */
--- 1409,1415 ----
                  cm_InitReq(&req);
  		req.flags |= CM_REQ_NORETRY;
  
! 		buf_CleanAsync(bp, &req, NULL);
  		buf_CleanWait(NULL, bp, FALSE);
  
                  /* relock and release buffer */
***************
*** 1623,1629 ****
              lock_ObtainMutex(&bp->mx);
  
              /* start cleaning the buffer, and wait for it to finish */
!             buf_CleanAsyncLocked(bp, reqp);
              buf_WaitIO(scp, bp);
              lock_ReleaseMutex(&bp->mx);
  
--- 1623,1629 ----
              lock_ObtainMutex(&bp->mx);
  
              /* start cleaning the buffer, and wait for it to finish */
!             buf_CleanAsyncLocked(bp, reqp, NULL);
              buf_WaitIO(scp, bp);
              lock_ReleaseMutex(&bp->mx);
  
***************
*** 1741,1747 ****
          if (cm_FidCmp(&bp->fid, &scp->fid) == 0) {
              lock_ObtainMutex(&bp->mx);
              if (bp->flags & CM_BUF_DIRTY) {
!                 if (userp) {
                      cm_HoldUser(userp);
                      if (bp->userp) 
                          cm_ReleaseUser(bp->userp);
--- 1741,1747 ----
          if (cm_FidCmp(&bp->fid, &scp->fid) == 0) {
              lock_ObtainMutex(&bp->mx);
              if (bp->flags & CM_BUF_DIRTY) {
!                 if (userp && userp != bp->userp) {
                      cm_HoldUser(userp);
                      if (bp->userp) 
                          cm_ReleaseUser(bp->userp);
***************
*** 1771,1777 ****
                      bp->dirtyCounter++;
                      break;
                  default:
!                     wasDirty = buf_CleanAsyncLocked(bp, reqp);
                      if (bp->flags & CM_BUF_ERROR) {
                          code = bp->error;
                          if (code == 0)
--- 1771,1777 ----
                      bp->dirtyCounter++;
                      break;
                  default:
!                     code = buf_CleanAsyncLocked(bp, reqp, &wasDirty);
                      if (bp->flags & CM_BUF_ERROR) {
                          code = bp->error;
                          if (code == 0)
***************
*** 1862,1872 ****
  	    StringCbPrintfA(output, sizeof(output), 
  			    "%s bp=0x%08X, hash=%d, fid (cell=%d, volume=%d, "
  			    "vnode=%d, unique=%d), offset=%x:%08x, dv=%I64d, "
! 			    "flags=0x%x, cmFlags=0x%x, refCount=%d\r\n",
  			     cookie, (void *)bp, i, bp->fid.cell, bp->fid.volume, 
  			     bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
  			     bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			     bp->cmFlags, bp->refCount);
  	    WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
      }
--- 1862,1872 ----
  	    StringCbPrintfA(output, sizeof(output), 
  			    "%s bp=0x%08X, hash=%d, fid (cell=%d, volume=%d, "
  			    "vnode=%d, unique=%d), offset=%x:%08x, dv=%I64d, "
! 			    "flags=0x%x, cmFlags=0x%x, error=0x%x, refCount=%d\r\n",
  			     cookie, (void *)bp, i, bp->fid.cell, bp->fid.volume, 
  			     bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
  			     bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			     bp->cmFlags, bp->error, bp->refCount);
  	    WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
      }
***************
*** 1880,1890 ****
  	StringCbPrintfA(output, sizeof(output), 
  			 "%s bp=0x%08X, fid (cell=%d, volume=%d, "
  			 "vnode=%d, unique=%d), offset=%x:%08x, dv=%I64d, "
! 			 "flags=0x%x, cmFlags=0x%x, refCount=%d\r\n",
  			 cookie, (void *)bp, bp->fid.cell, bp->fid.volume, 
  			 bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
  			 bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			 bp->cmFlags, bp->refCount);
  	WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
      StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_FreeListEndp.\r\n", cookie);
--- 1880,1890 ----
  	StringCbPrintfA(output, sizeof(output), 
  			 "%s bp=0x%08X, fid (cell=%d, volume=%d, "
  			 "vnode=%d, unique=%d), offset=%x:%08x, dv=%I64d, "
! 			 "flags=0x%x, cmFlags=0x%x, error=0x%x, refCount=%d\r\n",
  			 cookie, (void *)bp, bp->fid.cell, bp->fid.volume, 
  			 bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
  			 bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			 bp->cmFlags, bp->error, bp->refCount);
  	WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
      StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_FreeListEndp.\r\n", cookie);
***************
*** 1896,1906 ****
  	StringCbPrintfA(output, sizeof(output), 
  			 "%s bp=0x%08X, fid (cell=%d, volume=%d, "
  			 "vnode=%d, unique=%d), offset=%x:%08x, dv=%I64d, "
! 			 "flags=0x%x, cmFlags=0x%x, refCount=%d\r\n",
  			 cookie, (void *)bp, bp->fid.cell, bp->fid.volume, 
  			 bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
  			 bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			 bp->cmFlags, bp->refCount);
  	WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
      StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_dirtyListp.\r\n", cookie);
--- 1896,1906 ----
  	StringCbPrintfA(output, sizeof(output), 
  			 "%s bp=0x%08X, fid (cell=%d, volume=%d, "
  			 "vnode=%d, unique=%d), offset=%x:%08x, dv=%I64d, "
! 			 "flags=0x%x, cmFlags=0x%x, error=0x%x, refCount=%d\r\n",
  			 cookie, (void *)bp, bp->fid.cell, bp->fid.volume, 
  			 bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
  			 bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			 bp->cmFlags, bp->error, bp->refCount);
  	WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
      StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_dirtyListp.\r\n", cookie);
Index: openafs/src/WINNT/afsd/cm_buf.h
diff -c openafs/src/WINNT/afsd/cm_buf.h:1.12.4.17 openafs/src/WINNT/afsd/cm_buf.h:1.12.4.18
*** openafs/src/WINNT/afsd/cm_buf.h:1.12.4.17	Thu Jul 24 15:33:53 2008
--- openafs/src/WINNT/afsd/cm_buf.h	Sat Nov 15 12:10:27 2008
***************
*** 160,168 ****
  
  extern long buf_GetNew(struct cm_scache *, osi_hyper_t *, cm_buf_t **);
  
! extern long buf_CleanAsyncLocked(cm_buf_t *, cm_req_t *);
  
! extern long buf_CleanAsync(cm_buf_t *, cm_req_t *);
  
  extern void buf_CleanWait(cm_scache_t *, cm_buf_t *, afs_uint32 locked);
  
--- 160,168 ----
  
  extern long buf_GetNew(struct cm_scache *, osi_hyper_t *, cm_buf_t **);
  
! extern afs_uint32 buf_CleanAsyncLocked(cm_buf_t *, cm_req_t *, afs_uint32 *);
  
! extern afs_uint32 buf_CleanAsync(cm_buf_t *, cm_req_t *, afs_uint32 *);
  
  extern void buf_CleanWait(cm_scache_t *, cm_buf_t *, afs_uint32 locked);
  
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.41.4.51 openafs/src/WINNT/afsd/cm_callback.c:1.41.4.52
*** openafs/src/WINNT/afsd/cm_callback.c:1.41.4.51	Sat Sep 13 00:20:48 2008
--- openafs/src/WINNT/afsd/cm_callback.c	Tue Dec 23 15:42:56 2008
***************
*** 357,364 ****
          port = rx_PortOf(peerp);
  
          tsp = cm_FindServerByIP(host, CM_SERVER_FILE);
!         if (tsp)
              cellp = tsp->cellp;
  
          if (!cellp)
              osi_Log2(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d",
--- 357,366 ----
          port = rx_PortOf(peerp);
  
          tsp = cm_FindServerByIP(host, CM_SERVER_FILE);
!         if (tsp) {
              cellp = tsp->cellp;
+             cm_PutServer(tsp);
+         }
  
          if (!cellp)
              osi_Log2(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d",
Index: openafs/src/WINNT/afsd/cm_daemon.h
diff -c openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.3 openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.4
*** openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.3	Mon Dec 24 00:24:14 2007
--- openafs/src/WINNT/afsd/cm_daemon.h	Fri Dec 26 18:29:32 2008
***************
*** 41,46 ****
  extern void cm_QueueBKGRequest(cm_scache_t *scp, cm_bkgProc_t *procp, afs_uint32 p1,
  	afs_uint32 p2, afs_uint32 p3, afs_uint32 p4, cm_user_t *userp);
  
! #define CM_MAX_DAEMONS 8
  
  #endif /*  __CM_DAEMON_H_ENV_ */
--- 41,46 ----
  extern void cm_QueueBKGRequest(cm_scache_t *scp, cm_bkgProc_t *procp, afs_uint32 p1,
  	afs_uint32 p2, afs_uint32 p3, afs_uint32 p4, cm_user_t *userp);
  
! #define CM_MAX_DAEMONS 64
  
  #endif /*  __CM_DAEMON_H_ENV_ */
Index: openafs/src/WINNT/afsd/cm_dir.c
diff -c openafs/src/WINNT/afsd/cm_dir.c:1.4.4.21 openafs/src/WINNT/afsd/cm_dir.c:1.4.4.22
*** openafs/src/WINNT/afsd/cm_dir.c:1.4.4.21	Sun Oct 19 19:19:33 2008
--- openafs/src/WINNT/afsd/cm_dir.c	Fri Dec 26 18:34:37 2008
***************
*** 600,605 ****
--- 600,607 ----
      LARGE_INTEGER       start;
      LARGE_INTEGER       end;
  
+     lock_AssertNone(&op->scp->rw);
+ 
      QueryPerformanceCounter(&start);
  
      osi_Log2(afsd_logp, "cm_DirLookup for op 0x%p, entry[%s]",
***************
*** 1498,1510 ****
         contents just to make sure that we don't end up with buffers
         that was locally modified. */
  
!     if (op->scp->flags & CM_SCACHEFLAG_LOCAL) {
!         lock_ReleaseWrite(&op->scp->rw);
!         code = cm_FlushFile(op->scp, op->userp, &op->req);
!         if (code != 0)
!             return code;
!         lock_ObtainWrite(&op->scp->rw);
!     }
  
      offset = ConvertLongToLargeInteger(0);
      while (LargeIntegerLessThan(offset, op->scp->length)) {
--- 1500,1507 ----
         contents just to make sure that we don't end up with buffers
         that was locally modified. */
  
!     if (op->scp->flags & CM_SCACHEFLAG_LOCAL)
!         op->scp->bufDataVersionLow = op->scp->dataVersion;
  
      offset = ConvertLongToLargeInteger(0);
      while (LargeIntegerLessThan(offset, op->scp->length)) {
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.66 openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.67
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.66	Mon Nov  3 14:56:07 2008
--- openafs/src/WINNT/afsd/cm_ioctl.c	Mon Dec 29 17:38:25 2008
***************
*** 3018,3023 ****
--- 3018,3025 ----
      cm_DumpSCache(hLogFile, cookie, 1);
      cm_DumpBufHashTable(hLogFile, cookie, 1);
      smb_DumpVCP(hLogFile, cookie, 1);
+     rx_DumpCalls(hLogFile, cookie);
+     rx_DumpPackets(hLogFile, cookie);
  
      CloseHandle(hLogFile);                          
    
Index: openafs/src/WINNT/afsd/cm_server.c
diff -c openafs/src/WINNT/afsd/cm_server.c:1.25.2.37 openafs/src/WINNT/afsd/cm_server.c:1.25.2.38
*** openafs/src/WINNT/afsd/cm_server.c:1.25.2.37	Sat Sep 13 00:20:48 2008
--- openafs/src/WINNT/afsd/cm_server.c	Tue Dec 23 15:42:56 2008
***************
*** 926,931 ****
--- 926,936 ----
              tsp->addr.sin_addr.S_un.S_addr == ipaddr)
              break;
      }
+ 
+     /* bump ref count if we found the server */
+     if (tsp) 
+         cm_GetServerNoLock(tsp);
+ 
      lock_ReleaseRead(&cm_serverLock);
  
      return tsp;
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.93 openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.94
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.93	Tue Oct 21 21:25:38 2008
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Fri Dec 26 18:26:18 2008
***************
*** 3307,3318 ****
--- 3307,3353 ----
      cm_dirOp_t newDirOp;
      fschar_t * newNamep = NULL;
      int free_oldNamep = FALSE;
+     cm_scache_t *oldScp = NULL, *newScp = NULL;
  
      if (cOldNamep == NULL || cNewNamep == NULL ||
          cm_ClientStrLen(cOldNamep) == 0 ||
          cm_ClientStrLen(cNewNamep) == 0)
          return CM_ERROR_INVAL;
  
+     /* 
+      * Before we permit the operation, make sure that we do not already have
+      * an object in the destination directory that has a case-insensitive match
+      * for this name UNLESS the matching object is the object we are renaming.
+      */
+     code = cm_Lookup(oldDscp, cOldNamep, 0, userp, reqp, &oldScp);
+     if (code) {
+         osi_Log2(afsd_logp, "cm_Rename oldDscp 0x%p cOldName %S old name lookup failed", 
+                  oldDscp, osi_LogSaveStringW(afsd_logp, cOldNamep));
+         goto done;
+     }
+ 
+     code = cm_Lookup(newDscp, cNewNamep, CM_FLAG_CASEFOLD, userp, reqp, &newScp);
+     if (code == 0) {
+         /* found a matching object with the new name */
+         if (cm_FidCmp(&oldScp->fid, &newScp->fid)) {
+             /* and they don't match so return an error */
+             osi_Log2(afsd_logp, "cm_Rename newDscp 0x%p cNewName %S new name already exists", 
+                       newDscp, osi_LogSaveStringW(afsd_logp, cNewNamep));
+             code = CM_ERROR_EXISTS;
+         }
+         cm_ReleaseSCache(newScp);
+         newScp = NULL;
+     } else if (code == CM_ERROR_AMBIGUOUS_FILENAME) {
+         code = CM_ERROR_EXISTS;
+     } else {
+         code = 0;
+     }
+     cm_ReleaseSCache(oldScp);
+     oldScp = NULL;
+ 
+     if (code) 
+         goto done;
+ 
      if (oldNamep == NULL) {
          code = -1;
  #ifdef USE_BPLUS
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.32.4.26 openafs/src/WINNT/afsd/fs.c:1.32.4.27
*** openafs/src/WINNT/afsd/fs.c:1.32.4.26	Mon Nov  3 14:56:07 2008
--- openafs/src/WINNT/afsd/fs.c	Sun Nov 30 15:24:38 2008
***************
*** 9,14 ****
--- 9,15 ----
  
  #include <afs/param.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  
  #include <windows.h>
  #include <stdlib.h>
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.118.2.105 openafs/src/WINNT/afsd/smb.c:1.118.2.111
*** openafs/src/WINNT/afsd/smb.c:1.118.2.105	Tue Oct 21 21:25:38 2008
--- openafs/src/WINNT/afsd/smb.c	Wed Dec 17 11:19:42 2008
***************
*** 914,920 ****
      return vcp;
  }
  
! int smb_IsStarMask(clientchar_t *maskp)
  {
      int i;
      clientchar_t tc;
--- 914,920 ----
      return vcp;
  }
  
! static int smb_Is8Dot3StarMask(clientchar_t *maskp)
  {
      int i;
      clientchar_t tc;
***************
*** 927,932 ****
--- 927,945 ----
      return 0;
  }
  
+ static int smb_IsStarMask(clientchar_t *maskp)
+ {
+     int i;
+     clientchar_t tc;
+         
+     while (*maskp) {
+         tc = *maskp++;
+         if (tc == _C('?') || tc == _C('*') || tc == _C('>'))
+ 	    return 1;
+     }
+     return 0;
+ }
+ 
  #ifdef DEBUG_SMB_REFCOUNT
  void smb_ReleaseVCInternalDbg(smb_vc_t *vcp, char * file, long line)
  #define smb_ReleaseVCInternal(a) smb_ReleaseVCInternalDbg(a, file, line)
***************
*** 2989,2995 ****
  
      /* map CM_ERROR_* errors to NT 32-bit status codes */
      /* NT Status codes are listed in ntstatus.h not winerror.h */
!     if (code == CM_ERROR_NOSUCHCELL) {
          NTStatus = 0xC000000FL;	/* No such file */
      }
      else if (code == CM_ERROR_NOSUCHVOLUME) {
--- 3002,3011 ----
  
      /* map CM_ERROR_* errors to NT 32-bit status codes */
      /* NT Status codes are listed in ntstatus.h not winerror.h */
!     if (code == 0) {
!         NTStatus = 0;
!     } 
!     else if (code == CM_ERROR_NOSUCHCELL) {
          NTStatus = 0xC000000FL;	/* No such file */
      }
      else if (code == CM_ERROR_NOSUCHVOLUME) {
***************
*** 3085,3091 ****
          NTStatus = 0xC0000033L;	/* Object name invalid */
      }
      else if (code == CM_ERROR_WOULDBLOCK) {
!         NTStatus = 0xC0000055L;	/* Lock not granted */
      }
      else if (code == CM_ERROR_SHARING_VIOLATION) {
          NTStatus = 0xC0000043L; /* Sharing violation */
--- 3101,3107 ----
          NTStatus = 0xC0000033L;	/* Object name invalid */
      }
      else if (code == CM_ERROR_WOULDBLOCK) {
!         NTStatus = 0xC00000D8L;	/* Can't wait */
      }
      else if (code == CM_ERROR_SHARING_VIOLATION) {
          NTStatus = 0xC0000043L; /* Sharing violation */
***************
*** 3141,3146 ****
--- 3157,3164 ----
      }
      else if (code == CM_ERROR_LOCK_NOT_GRANTED) {
          NTStatus = 0xC0000055L; /* Lock Not Granted */
+     } else if (code == ENOMEM) {
+         NTStatus = 0xC0000017L; /* Out of Memory */
      } else {
          NTStatus = 0xC0982001L;	/* SMB non-specific error */
      }
***************
*** 4070,4079 ****
  
      tidp = smb_FindTID(vcp, newTid, SMB_FLAG_CREATE);
      uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
      userp = smb_GetUserFromUID(uidp);
      shareFound = smb_FindShare(vcp, uidp, shareName, &sharePath);
!     if (uidp)
!         smb_ReleaseUID(uidp);
      if (!shareFound) {
          smb_ReleaseTID(tidp, FALSE);
          return CM_ERROR_BADSHARENAME;
--- 4088,4098 ----
  
      tidp = smb_FindTID(vcp, newTid, SMB_FLAG_CREATE);
      uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
+     if (!uidp)
+         return CM_ERROR_BADSMB;
      userp = smb_GetUserFromUID(uidp);
      shareFound = smb_FindShare(vcp, uidp, shareName, &sharePath);
!     smb_ReleaseUID(uidp);
      if (!shareFound) {
          smb_ReleaseTID(tidp, FALSE);
          return CM_ERROR_BADSHARENAME;
***************
*** 4562,4568 ****
          memcpy(dsp->mask, mask, 12);
  
          /* track if this is likely to match a lot of entries */
!         if (smb_IsStarMask(mask)) 
              starPattern = 1;
          else 
              starPattern = 0;
--- 4581,4587 ----
          memcpy(dsp->mask, mask, 12);
  
          /* track if this is likely to match a lot of entries */
!         if (smb_Is8Dot3StarMask(mask)) 
              starPattern = 1;
          else 
              starPattern = 0;
***************
*** 5935,5944 ****
              osi_Log0(smb_logp, "Can't rename.  Target already exists");
              code = CM_ERROR_EXISTS;
          }
- 
-         if (tmpscp != NULL)
-             cm_ReleaseSCache(tmpscp);
- 
          goto done;
      }
  
--- 5954,5959 ----
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.95.2.83 openafs/src/WINNT/afsd/smb3.c:1.95.2.85
*** openafs/src/WINNT/afsd/smb3.c:1.95.2.83	Sun Oct 19 19:19:33 2008
--- openafs/src/WINNT/afsd/smb3.c	Sat Dec 27 23:41:48 2008
***************
*** 2746,2751 ****
--- 2746,2752 ----
          /* attributes, defined in WINNT.H:
           *	FILE_CASE_SENSITIVE_SEARCH	0x1
           *	FILE_CASE_PRESERVED_NAMES	0x2
+          *      FILE_UNICODE_ON_DISK            0x4
  	 *      FILE_VOLUME_QUOTAS              0x10
           *	<no name defined>		0x4000
           *	   If bit 0x4000 is not set, Windows 95 thinks
***************
*** 2755,2768 ****
          qi.u.FSattributeInfo.attributes = 0x4003;
          /* The maxCompLength is supposed to be in bytes */
  #ifdef SMB_UNICODE
!         if ((vcp->flags & SMB_VCFLAG_USEUNICODE) == SMB_VCFLAG_USEUNICODE)
!             qi.u.FSattributeInfo.maxCompLength = MAX_PATH * sizeof(wchar_t);
!         else {
! #endif
!         qi.u.FSattributeInfo.maxCompLength = MAX_PATH;
! #ifdef SMB_UNICODE
!         }
  #endif
          smb_UnparseString(op, qi.u.FSattributeInfo.FSname, _C("AFS"), &sz, SMB_STRF_IGNORENUL);
          qi.u.FSattributeInfo.FSnameLength = sz;
  
--- 2756,2764 ----
          qi.u.FSattributeInfo.attributes = 0x4003;
          /* The maxCompLength is supposed to be in bytes */
  #ifdef SMB_UNICODE
!         qi.u.FSattributeInfo.attributes |= 0x04;
  #endif
+         qi.u.FSattributeInfo.maxCompLength = 255;
          smb_UnparseString(op, qi.u.FSattributeInfo.FSname, _C("AFS"), &sz, SMB_STRF_IGNORENUL);
          qi.u.FSattributeInfo.FSnameLength = sz;
  
Index: openafs/src/WINNT/afsd/smb_ioctl.c
diff -c openafs/src/WINNT/afsd/smb_ioctl.c:1.25.2.17 openafs/src/WINNT/afsd/smb_ioctl.c:1.25.2.18
*** openafs/src/WINNT/afsd/smb_ioctl.c:1.25.2.17	Tue Sep  2 17:21:35 2008
--- openafs/src/WINNT/afsd/smb_ioctl.c	Mon Nov 17 14:08:39 2008
***************
*** 349,354 ****
--- 349,356 ----
      count = smb_GetSMBParm(inp, 5);
  	
      uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
+     if (!uidp)
+         return CM_ERROR_BADSMB;
      userp = smb_GetUserFromUID(uidp);
      osi_assertx(userp != NULL, "null cm_user_t");
      iop->uidp = uidp;
Index: openafs/src/WINNT/afsd/symlink.c
diff -c openafs/src/WINNT/afsd/symlink.c:1.8.4.7 openafs/src/WINNT/afsd/symlink.c:1.8.4.8
*** openafs/src/WINNT/afsd/symlink.c:1.8.4.7	Thu Jun 26 08:45:12 2008
--- openafs/src/WINNT/afsd/symlink.c	Sun Nov 30 15:24:38 2008
***************
*** 9,14 ****
--- 9,15 ----
  
  #include <afs/param.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  
  #include <windows.h>
  #include <stdlib.h>
Index: openafs/src/WINNT/client_config/NTMakefile
diff -c openafs/src/WINNT/client_config/NTMakefile:1.11.4.6 openafs/src/WINNT/client_config/NTMakefile:1.11.4.7
*** openafs/src/WINNT/client_config/NTMakefile:1.11.4.6	Wed Jul  2 08:48:46 2008
--- openafs/src/WINNT/client_config/NTMakefile	Fri Dec 26 21:27:56 2008
***************
*** 110,116 ****
  $(EXEFILE) : $(EXEOBJS) $(EXEOBJSc) $(EXERES) $(AFSDOBJS) $(EXELIBS)
  	$(EXEGUILINK) $(VCLIBS)
  !IF ("$(AFSVER_CL)" == "1400")
!         if exist $@.manifest mt.exe -manifest afs_config.exe.manifest $(MANIFEST) -out:$(MANIFEST)
  !ELSE
          $(COPY) afs_config.exe.manifest $(MANIFEST)
  !ENDIF
--- 110,116 ----
  $(EXEFILE) : $(EXEOBJS) $(EXEOBJSc) $(EXERES) $(AFSDOBJS) $(EXELIBS)
  	$(EXEGUILINK) $(VCLIBS)
  !IF ("$(AFSVER_CL)" == "1400")
!         if exist $@.manifest mt.exe -manifest afs_config.exe.manifest -out:$(MANIFEST)
  !ELSE
          $(COPY) afs_config.exe.manifest $(MANIFEST)
  !ENDIF
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.40 openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.41
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.40	Fri Nov  7 19:06:39 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm	Mon Dec 29 17:51:32 2008
***************
*** 57,63 ****
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.55</h2>
  
  <p class=MsoNormal>&nbsp; </p>
  
--- 57,63 ----
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.56</h2>
  
  <p class=MsoNormal>&nbsp; </p>
  
***************
*** 78,84 ****
  <span
  style='font-family:Symbol'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span></span><a
! href="ReleaseNotes/relnotes-frames.htm">OpenAFS for Windows 1.5.55
  Release Notes</a></p>
  
  <p style='margin-left:36.0pt;text-indent:-18.0pt;'>
--- 78,84 ----
  <span
  style='font-family:Symbol'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span></span><a
! href="ReleaseNotes/relnotes-frames.htm">OpenAFS for Windows 1.5.56
  Release Notes</a></p>
  
  <p style='margin-left:36.0pt;text-indent:-18.0pt;'>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.38 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.39
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.38	Fri Nov  7 19:06:51 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm	Mon Dec 29 17:51:37 2008
***************
*** 18,24 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.55 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
--- 18,24 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.56 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.40 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.41
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.40	Fri Nov  7 19:06:51 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm	Mon Dec 29 17:51:37 2008
***************
*** 10,16 ****
  <meta name=Originator content="Microsoft Word 12">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
  <link rel=Preview href="relnotes-frames_files/preview.wmf">
! <title>OpenAFS for Windows 1.5.55 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:LastAuthor>Jeffrey Eric Altman</o:LastAuthor>
--- 10,16 ----
  <meta name=Originator content="Microsoft Word 12">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
  <link rel=Preview href="relnotes-frames_files/preview.wmf">
! <title>OpenAFS for Windows 1.5.56 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:LastAuthor>Jeffrey Eric Altman</o:LastAuthor>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.46 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.47
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.46	Fri Nov  7 19:06:51 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm	Mon Dec 29 17:51:37 2008
***************
*** 22,28 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.55 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
--- 22,28 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.56 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
***************
*** 1226,1232 ****
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.55 (with Unicode Support)<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
--- 1226,1232 ----
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.56 (with Unicode Support)<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.39 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.40
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.39	Fri Nov  7 19:06:52 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm	Mon Dec 29 17:51:37 2008
***************
*** 12,18 ****
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
  <link rel=Preview href="toc_files/preview.wmf">
! <title>OpenAFS for Windows 1.5.55 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
--- 12,18 ----
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
  <link rel=Preview href="toc_files/preview.wmf">
! <title>OpenAFS for Windows 1.5.56 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
Index: openafs/src/WINNT/install/NSIS/NTMakefile
diff -c openafs/src/WINNT/install/NSIS/NTMakefile:1.18.4.8 openafs/src/WINNT/install/NSIS/NTMakefile:1.18.4.9
*** openafs/src/WINNT/install/NSIS/NTMakefile:1.18.4.8	Fri Jul 25 15:45:32 2008
--- openafs/src/WINNT/install/NSIS/NTMakefile	Fri Dec 26 21:54:14 2008
***************
*** 3,9 ****
--- 3,11 ----
  !INCLUDE ..\..\..\config\NTMakefile.version
  
  EXEDIR = $(DESTDIR)\WinInstall\Config
+ !IFNDEF NSISDIR
  NSISDIR = C:\Program Files\NSIS
+ !ENDIF
  
  # Revise the rule for compiling sources to use static libraries
  C2OBJ   = $(cc) /Fo$@ /Fd$*.pdb $(cflags) $(cdebug) $(cvars) $(afscflags) $(afscdefs) /c
Index: openafs/src/WINNT/netidmgr_plugin/afsfuncs.c
diff -c openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.21 openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.22
*** openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.21	Fri Nov  7 13:19:51 2008
--- openafs/src/WINNT/netidmgr_plugin/afsfuncs.c	Mon Nov 10 22:33:51 2008
***************
*** 22,28 ****
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.c,v 1.1.2.21 2008/11/07 18:19:51 jaltman Exp $ */
  
  /* Disable the 'macro redefinition' warning which is getting
     triggerred by a redefinition of the ENCRYPT and DECRYPT macros. */
--- 22,28 ----
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.c,v 1.1.2.22 2008/11/11 03:33:51 jaltman Exp $ */
  
  /* Disable the 'macro redefinition' warning which is getting
     triggerred by a redefinition of the ENCRYPT and DECRYPT macros. */
***************
*** 1614,1621 ****
      realm = afs_realm_of_cell(&cellconfig, FALSE);
      if (cellconfig.linkedCell)
          free(cellconfig.linkedCell);
!     if (realm == NULL)
!         return FALSE;
  
      AnsiStrToUnicode(wrealm, sizeof(wrealm), realm);
  
--- 1614,1621 ----
      realm = afs_realm_of_cell(&cellconfig, FALSE);
      if (cellconfig.linkedCell)
          free(cellconfig.linkedCell);
!     if (!realm[0])      /* referral; assume it matches */
!         return TRUE;
  
      AnsiStrToUnicode(wrealm, sizeof(wrealm), realm);
  
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.86.4.21 openafs/src/afs/afs_call.c:1.86.4.22
*** openafs/src/afs/afs_call.c:1.86.4.21	Wed Apr 30 15:08:04 2008
--- openafs/src/afs/afs_call.c	Sat Nov 29 13:20:24 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.86.4.21 2008/04/30 19:08:04 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.86.4.22 2008/11/29 18:20:24 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 86,92 ****
  static int
  afs_InitSetup(int preallocs)
  {
-     extern void afs_InitStats();
      int code;
  
      if (afs_InitSetup_done)
--- 86,91 ----
***************
*** 477,487 ****
  #endif
  }
  
- /* leaving as is, probably will barf if we add prototypes here since it's likely being called
- with partial list */
  int
! afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6)
!      long parm, parm2, parm3, parm4, parm5, parm6;
  {
      afs_int32 code = 0;
  #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
--- 476,483 ----
  #endif
  }
  
  int
! afs_syscall_call(long parm, long parm2, long parm3, long parm4, long parm5, long parm6)
  {
      afs_int32 code = 0;
  #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
Index: openafs/src/afs/afs_cell.c
diff -c openafs/src/afs/afs_cell.c:1.34.4.9 openafs/src/afs/afs_cell.c:1.34.4.10
*** openafs/src/afs/afs_cell.c:1.34.4.9	Sat Nov  8 11:34:42 2008
--- openafs/src/afs/afs_cell.c	Sat Nov 29 13:20:24 2008
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.34.4.9 2008/11/08 16:34:42 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.34.4.10 2008/11/29 18:20:24 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 54,60 ****
   * Terminate the AFSDB handler, used on shutdown.
   */
  void
! afs_StopAFSDB()
  {
      if (afsdb_handler_running) {
  	afs_osi_Wakeup(&afsdb_req);
--- 54,60 ----
   * Terminate the AFSDB handler, used on shutdown.
   */
  void
! afs_StopAFSDB(void)
  {
      if (afsdb_handler_running) {
  	afs_osi_Wakeup(&afsdb_req);
***************
*** 1066,1072 ****
   * Perform whatever initialization is necessary.
   */
  void
! afs_CellInit()
  {
      RWLOCK_INIT(&afs_xcell, "afs_xcell");
  #ifdef AFS_AFSDB_ENV
--- 1066,1072 ----
   * Perform whatever initialization is necessary.
   */
  void
! afs_CellInit(void)
  {
      RWLOCK_INIT(&afs_xcell, "afs_xcell");
  #ifdef AFS_AFSDB_ENV
***************
*** 1083,1089 ****
   * Called on shutdown, should deallocate memory, etc.
   */
  void
! shutdown_cell()
  {
      struct afs_q *cq, *tq;
      struct cell *tc;
--- 1083,1089 ----
   * Called on shutdown, should deallocate memory, etc.
   */
  void
! shutdown_cell(void)
  {
      struct afs_q *cq, *tq;
      struct cell *tc;
Index: openafs/src/afs/afs_dcache.c
diff -c openafs/src/afs/afs_dcache.c:1.64.4.13 openafs/src/afs/afs_dcache.c:1.64.4.16
*** openafs/src/afs/afs_dcache.c:1.64.4.13	Sat Nov  8 11:34:42 2008
--- openafs/src/afs/afs_dcache.c	Sun Nov 30 15:17:24 2008
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.64.4.13 2008/11/08 16:34:42 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.64.4.16 2008/11/30 20:17:24 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 106,112 ****
  
  int dcacheDisabled = 0;
  
! static int afs_UFSCacheFetchProc(), afs_UFSCacheStoreProc();
  struct afs_cacheOps afs_UfsCacheOps = {
  #if defined(LINUX_USE_FH)
      osi_UFSOpen_fh,
--- 106,121 ----
  
  int dcacheDisabled = 0;
  
! static int afs_UFSCacheFetchProc(struct rx_call *, struct osi_file *,
! 		                 afs_size_t, struct dcache *,
! 				 struct vcache *, afs_size_t *,
! 				 afs_size_t *, afs_int32);
! 
! static int afs_UFSCacheStoreProc(struct rx_call *, struct osi_file *,
! 				 afs_int32, struct vcache *,
! 				 int *, afs_size_t *,
! 				 afs_size_t *);
! 
  struct afs_cacheOps afs_UfsCacheOps = {
  #if defined(LINUX_USE_FH)
      osi_UFSOpen_fh,
***************
*** 3369,3374 ****
--- 3378,3384 ----
          tdc->f.fh_type = osi_get_fh(filevp, &tdc->f.fh, &max_len);
  #else
          tdc->f.inode = VTOI(filevp->d_inode)->i_number;
+ 	dput(filevp);
  #endif
  #else
  	tdc->f.inode = afs_vnodeToInumber(filevp);
***************
*** 3383,3389 ****
  #if defined(LINUX_USE_FH)
      tfile = osi_UFSOpen_fh(&tdc->f.fh, tdc->f.fh_type);
  #else
!     tfile = osi_UFSOpen(ainode);
  #endif
      code = afs_osi_Stat(tfile, &tstat);
      if (code)
--- 3393,3399 ----
  #if defined(LINUX_USE_FH)
      tfile = osi_UFSOpen_fh(&tdc->f.fh, tdc->f.fh_type);
  #else
!     tfile = osi_UFSOpen(tdc->f.inode);
  #endif
      code = afs_osi_Stat(tfile, &tstat);
      if (code)
***************
*** 3823,3829 ****
      if (!ret_code) {
      	if (!avc->ddirty_flags) {
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 763);
! 	    AFS_DISCON_ADD_DIRTY(avc);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  	avc->shVnode = shadow_fid.Fid.Vnode;
--- 3833,3839 ----
      if (!ret_code) {
      	if (!avc->ddirty_flags) {
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 763);
! 	    AFS_DISCON_ADD_DIRTY(avc, 1);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  	avc->shVnode = shadow_fid.Fid.Vnode;
Index: openafs/src/afs/afs_disconnected.c
diff -c openafs/src/afs/afs_disconnected.c:1.2.2.3 openafs/src/afs/afs_disconnected.c:1.2.2.5
*** openafs/src/afs/afs_disconnected.c:1.2.2.3	Mon Sep 22 15:29:54 2008
--- openafs/src/afs/afs_disconnected.c	Sun Nov 30 15:11:17 2008
***************
*** 7,13 ****
  #include <afsconfig.h>
  #include "afs/param.h"
   
! RCSID("$Header: /cvs/openafs/src/afs/afs_disconnected.c,v 1.2.2.3 2008/09/22 19:29:54 shadow Exp $");
   
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 7,13 ----
  #include <afsconfig.h>
  #include "afs/param.h"
   
! RCSID("$Header: /cvs/openafs/src/afs/afs_disconnected.c,v 1.2.2.5 2008/11/30 20:11:17 shadow Exp $");
   
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 322,329 ****
      /* Count unfinished dirty children. VDisconShadowed can still be set,
       * because we need it to remove the shadow dir.
       */
!     if (tvc && tvc->ddirty_flags) {
! 	v->count++;
  	afs_PutVCache(tvc);
      }
  
--- 322,331 ----
      /* Count unfinished dirty children. VDisconShadowed can still be set,
       * because we need it to remove the shadow dir.
       */
!     if (tvc) {
! 	if (tvc->ddirty_flags)
! 	    v->count++;
! 
  	afs_PutVCache(tvc);
      }
  
***************
*** 1283,1293 ****
  	    	    /* We can discard the shadow dir now. */
  	    	    afs_DeleteShadowDir(tmp);
  
! 		if (tmp->ddirty_flags & VDisconRemove)
! 		    /* Drop the refcount on the deleted vnodes,
! 		     * because we don't need them anymore.
! 		     */
! 		    afs_PutVCache(tmp);
  
  	    	/* Only if sync was successfull,
  		 * clear flags and dirty references.
--- 1285,1294 ----
  	    	    /* We can discard the shadow dir now. */
  	    	    afs_DeleteShadowDir(tmp);
  
! 		/* Drop the refcount on this vnode because it's not in the
! 		 * list anymore.
! 		 */
! 		 afs_PutVCache(tmp);
  
  	    	/* Only if sync was successfull,
  		 * clear flags and dirty references.
Index: openafs/src/afs/afs_dynroot.c
diff -c openafs/src/afs/afs_dynroot.c:1.12.6.4 openafs/src/afs/afs_dynroot.c:1.12.6.5
*** openafs/src/afs/afs_dynroot.c:1.12.6.4	Wed Dec 20 15:08:32 2006
--- openafs/src/afs/afs_dynroot.c	Sat Nov 29 13:20:24 2008
***************
*** 84,90 ****
   * Set up a cell for dynroot if it's not there yet.
   */
  static int
! afs_dynrootCellInit()
  {
      if (!afs_dynrootCell) {
  	afs_int32 cellHosts[MAXCELLHOSTS];
--- 84,90 ----
   * Set up a cell for dynroot if it's not there yet.
   */
  static int
! afs_dynrootCellInit(void)
  {
      if (!afs_dynrootCell) {
  	afs_int32 cellHosts[MAXCELLHOSTS];
Index: openafs/src/afs/afs_lock.c
diff -c openafs/src/afs/afs_lock.c:1.9 openafs/src/afs/afs_lock.c:1.9.14.1
*** openafs/src/afs/afs_lock.c:1.9	Tue Jul 15 19:14:12 2003
--- openafs/src/afs/afs_lock.c	Sat Nov 29 13:20:24 2008
***************
*** 26,32 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_lock.c,v 1.9 2003/07/15 23:14:12 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 26,32 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_lock.c,v 1.9.14.1 2008/11/29 18:20:24 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 35,43 ****
  /* probably needed if lock_trace is enabled - should ifdef */
  int afs_trclock = 0;
  
! void Lock_Obtain();
! void Lock_ReleaseR();
! void Lock_ReleaseW();
  
  void
  Lock_Init(register struct afs_lock *lock)
--- 35,42 ----
  /* probably needed if lock_trace is enabled - should ifdef */
  int afs_trclock = 0;
  
! void Lock_ReleaseR(struct afs_lock *lock);
! void Lock_ReleaseW(struct afs_lock *lock);
  
  void
  Lock_Init(register struct afs_lock *lock)
Index: openafs/src/afs/afs_nfsclnt.c
diff -c openafs/src/afs/afs_nfsclnt.c:1.13.6.7 openafs/src/afs/afs_nfsclnt.c:1.13.6.8
*** openafs/src/afs/afs_nfsclnt.c:1.13.6.7	Tue Oct 16 17:56:45 2007
--- openafs/src/afs/afs_nfsclnt.c	Sat Nov 29 13:20:24 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_nfsclnt.c,v 1.13.6.7 2007/10/16 21:56:45 shadow Exp $");
  
  #if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV)
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_nfsclnt.c,v 1.13.6.8 2008/11/29 18:20:24 shadow Exp $");
  
  #if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV)
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 46,55 ****
  afs_lock_t afs_xnfspag /*, afs_xnfsreq */ ;
  extern struct afs_exporter *afs_nfsexporter;
  
! /* Creates an nfsclientpag structure for the (uid, host) pair if one doesn't exist. RefCount is incremented and it's time stamped. */
  static struct nfsclientpag *
! afs_GetNfsClientPag(uid, host)
!      register afs_int32 uid, host;
  {
      register struct nfsclientpag *np;
      register afs_int32 i, now;
--- 46,55 ----
  afs_lock_t afs_xnfspag /*, afs_xnfsreq */ ;
  extern struct afs_exporter *afs_nfsexporter;
  
! /* Creates an nfsclientpag structure for the (uid, host) pair if one doesn't 
!  * exist. RefCount is incremented and it's time stamped. */
  static struct nfsclientpag *
! afs_GetNfsClientPag(register afs_int32 uid, register afs_int32 host)
  {
      register struct nfsclientpag *np;
      register afs_int32 i, now;
***************
*** 107,116 ****
  }
  
  
! /* Return the nfsclientpag structure associated with the (uid, host) or {pag, host} pair, if pag is nonzero. RefCount is incremented and it's time stamped. */
  static struct nfsclientpag *
! afs_FindNfsClientPag(uid, host, pag)
!      register afs_int32 uid, host, pag;
  {
      register struct nfsclientpag *np;
      register afs_int32 i;
--- 107,117 ----
  }
  
  
! /* Return the nfsclientpag structure associated with the (uid, host) or 
!  * {pag, host} pair, if pag is nonzero. RefCount is incremented and it's 
!  * time stamped. */
  static struct nfsclientpag *
! afs_FindNfsClientPag(afs_int32 uid, afs_int32 host, afs_int32 pag)
  {
      register struct nfsclientpag *np;
      register afs_int32 i;
***************
*** 191,197 ****
  
      afs_nfsexporter->exp_stats.calls++;
      if (!(afs_nfsexporter->exp_states & EXP_EXPORTED)) {
! 	/* No afs requests accepted as long as EXPORTED flag is turned 'off'. Set/Reset via a pioctl call (fs exportafs). Note that this is on top of the /etc/exports nfs requirement (i.e. /afs must be exported to all or whomever there too!)
  	 */
  	afs_nfsexporter->exp_stats.rejectedcalls++;
  	return EINVAL;
--- 192,201 ----
  
      afs_nfsexporter->exp_stats.calls++;
      if (!(afs_nfsexporter->exp_states & EXP_EXPORTED)) {
! 	/* No afs requests accepted as long as EXPORTED flag is turned 'off'. 
! 	 * Set/Reset via a pioctl call (fs exportafs). Note that this is on 
! 	 * top of the /etc/exports nfs requirement (i.e. /afs must be 
! 	 * exported to all or whomever there too!)
  	 */
  	afs_nfsexporter->exp_stats.rejectedcalls++;
  	return EINVAL;
***************
*** 239,245 ****
      if ((afs_nfsexporter->exp_states & EXP_CLIPAGS))
         	pag = NOPAG;
      if (!np) {
! 	/* Even if there is a "good" pag coming in we don't accept it if no nfsclientpag struct exists for the user since that would mean that the translator rebooted and therefore we ignore all older pag values */
  #ifdef	AFS_OSF_ENV
  	if (code = setpag(u.u_procp, cred, -1, &pag, 0)) {	/* XXX u.u_procp is a no-op XXX */
  #else
--- 243,253 ----
      if ((afs_nfsexporter->exp_states & EXP_CLIPAGS))
         	pag = NOPAG;
      if (!np) {
! 	/* Even if there is a "good" pag coming in we don't accept it if no 
! 	 * nfsclientpag struct exists for the user since that would mean 
! 	 * that the translator rebooted and therefore we ignore all older 
! 	 * pag values 
! 	 */
  #ifdef	AFS_OSF_ENV
  	if (code = setpag(u.u_procp, cred, -1, &pag, 0)) {	/* XXX u.u_procp is a no-op XXX */
  #else
***************
*** 548,557 ****
  
  
  int
! afs_nfsclient_stats(export)
!      register struct afs_exporter *export;
  {
!     /* Nothing much to do here yet since most important stats are collected directly in the afs_exporter structure itself */
      AFS_STATCNT(afs_nfsclient_stats);
      return 0;
  }
--- 556,565 ----
  
  
  int
! afs_nfsclient_stats(register struct afs_exporter *export)
  {
!     /* Nothing much to do here yet since most important stats are collected 
!      * directly in the afs_exporter structure itself */
      AFS_STATCNT(afs_nfsclient_stats);
      return 0;
  }
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.58.2.7 openafs/src/afs/afs_osi.c:1.58.2.8
*** openafs/src/afs/afs_osi.c:1.58.2.7	Tue Aug 26 10:01:31 2008
--- openafs/src/afs/afs_osi.c	Sat Nov 29 13:20:24 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.58.2.7 2008/08/26 14:01:31 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.58.2.8 2008/11/29 18:20:24 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 171,177 ****
  }
  
  void 
! afs_osi_UnmaskUserLoop()
  {
  #ifdef AFS_DARWIN_ENV
      afs_osi_fullSigRestore();
--- 171,177 ----
  }
  
  void 
! afs_osi_UnmaskUserLoop(void)
  {
  #ifdef AFS_DARWIN_ENV
      afs_osi_fullSigRestore();
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.110.2.21 openafs/src/afs/afs_pioctl.c:1.110.2.24
*** openafs/src/afs/afs_pioctl.c:1.110.2.21	Fri Oct 10 19:27:02 2008
--- openafs/src/afs/afs_pioctl.c	Mon Dec 22 12:31:09 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.110.2.21 2008/10/10 23:27:02 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.110.2.24 2008/12/22 17:31:09 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
***************
*** 147,154 ****
  static int Prefetch(char *apath, struct afs_ioctl *adata, int afollow,
  		    struct AFS_UCRED *acred);
  
  
! static int (*(VpioctlSw[])) () = {
      PBogus,			/* 0 */
  	PSetAcl,		/* 1 */
  	PGetAcl,		/* 2 */
--- 147,157 ----
  static int Prefetch(char *apath, struct afs_ioctl *adata, int afollow,
  		    struct AFS_UCRED *acred);
  
+ typedef int (*pioctlFunction) (struct vcache *, int, struct vrequest *,
+ 			       char *, char *, afs_int32, afs_int32 *,
+ 			       struct AFS_UCRED **);
  
! static pioctlFunction VpioctlSw[] = {
      PBogus,			/* 0 */
  	PSetAcl,		/* 1 */
  	PGetAcl,		/* 2 */
***************
*** 221,227 ****
  	PGetVnodeXStatus2,	/* 69 - get caller access and some vcache status */
  };
  
! static int (*(CpioctlSw[])) () = {
      PBogus,			/* 0 */
  	PNewAlias,		/* 1 -- create new cell alias */
  	PListAliases,		/* 2 -- list cell aliases */
--- 224,230 ----
  	PGetVnodeXStatus2,	/* 69 - get caller access and some vcache status */
  };
  
! static pioctlFunction CpioctlSw[] = {
      PBogus,			/* 0 */
  	PNewAlias,		/* 1 -- create new cell alias */
  	PListAliases,		/* 2 -- list cell aliases */
***************
*** 383,398 ****
  #ifdef	AFS_AIX32_ENV
  #ifdef AFS_AIX51_ENV
  #ifdef __64BIT__
! kioctl(fdes, com, arg, ext, arg2, arg3)
  #else /* __64BIT__ */
! kioctl32(fdes, com, arg, ext, arg2, arg3)
  #endif /* __64BIT__ */
-      caddr_t arg2, arg3;
  #else
! kioctl(fdes, com, arg, ext)
  #endif
-      int fdes, com;
-      caddr_t arg, ext;
  {
      struct a {
  	int fd, com;
--- 386,403 ----
  #ifdef	AFS_AIX32_ENV
  #ifdef AFS_AIX51_ENV
  #ifdef __64BIT__
! int
! kioctl(int fdes, int com, caddr_t arg, caddr_t ext, caddr_t arg2, 
! 	   caddr_t arg3)
  #else /* __64BIT__ */
! int
! kioctl32(int fdes, int com, caddr_t arg, caddr_t ext, caddr_t arg2, 
! 	     caddr_t arg3)
  #endif /* __64BIT__ */
  #else
! int
! kioctl(int fdes, int com, caddr_t arg, caddr_t ext)
  #endif
  {
      struct a {
  	int fd, com;
***************
*** 410,424 ****
      int arg;
  };
  
! afs_xioctl(uap, rvp)
!      struct afs_ioctl_sys *uap;
!      rval_t *rvp;
  {
  #elif defined(AFS_OSF_ENV)
! afs_xioctl(p, args, retval)
!      struct proc *p;
!      void *args;
!      long *retval;
  {
      struct a {
  	long fd;
--- 415,426 ----
      int arg;
  };
  
! int 
! afs_xioctl(struct afs_ioctl_sys *uap, rval_t *rvp)
  {
  #elif defined(AFS_OSF_ENV)
! int 
! afs_xioctl(struct proc *p, void *args, long *retval)
  {
      struct a {
  	long fd;
***************
*** 428,437 ****
  #elif defined(AFS_FBSD50_ENV)
  #define arg data
  int
! afs_xioctl(td, uap, retval)
!      struct thread *td;
!      register struct ioctl_args *uap;
!      register_t *retval;
  {
      struct proc *p = td->td_proc;
  #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
--- 430,437 ----
  #elif defined(AFS_FBSD50_ENV)
  #define arg data
  int
! afs_xioctl(struct thread *td, register struct ioctl_args *uap, 
! 	   register_t *retval)
  {
      struct proc *p = td->td_proc;
  #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
***************
*** 442,451 ****
  };
  
  int
! afs_xioctl(p, uap, retval)
!      struct proc *p;
!      register struct ioctl_args *uap;
!      register_t *retval;
  {
  #elif defined(AFS_LINUX22_ENV)
  struct afs_ioctl_sys {
--- 442,448 ----
  };
  
  int
! afs_xioctl(struct proc *p, register struct ioctl_args *uap, register_t *retval)
  {
  #elif defined(AFS_LINUX22_ENV)
  struct afs_ioctl_sys {
***************
*** 715,724 ****
  }
  
  #elif defined(AFS_OSF_ENV)
! afs_pioctl(p, args, retval)
!      struct proc *p;
!      void *args;
!      int *retval;
  {
      struct a {
  	char *path;
--- 712,718 ----
  }
  
  #elif defined(AFS_OSF_ENV)
! afs_pioctl(struct proc *p, void *args, int *retval)
  {
      struct a {
  	char *path;
***************
*** 733,742 ****
  
  #elif defined(AFS_FBSD50_ENV)
  int
! afs_pioctl(td, args, retval)
!      struct thread *td;
!      void *args;
!      int *retval;
  {
      struct a {
  	char *path;
--- 727,733 ----
  
  #elif defined(AFS_FBSD50_ENV)
  int
! afs_pioctl(struct thread *td, void *args, int *retval)
  {
      struct a {
  	char *path;
***************
*** 752,761 ****
  
  #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  int
! afs_pioctl(p, args, retval)
!      struct proc *p;
!      void *args;
!      int *retval;
  {
      struct a {
  	char *path;
--- 743,749 ----
  
  #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  int
! afs_pioctl(struct proc *p, void *args, int *retval)
  {
      struct a {
  	char *path;
***************
*** 787,807 ****
  
  int
  #ifdef	AFS_SUN5_ENV
! afs_syscall_pioctl(path, com, cmarg, follow, rvp, credp)
!      rval_t *rvp;
!      struct AFS_UCRED *credp;
  #else
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! afs_syscall_pioctl(path, com, cmarg, follow, credp)
!      struct AFS_UCRED *credp;
  #else
! afs_syscall_pioctl(path, com, cmarg, follow)
  #endif
  #endif
-      char *path;
-      unsigned int com;
-      caddr_t cmarg;
-      int follow;
  {
      struct afs_ioctl data;
  #ifdef AFS_NEED_CLIENTCONTEXT
--- 775,790 ----
  
  int
  #ifdef	AFS_SUN5_ENV
! afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow, 
! 		   rval_t *vvp, struct AFS_UCRED *credp)
  #else
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow, 
! 		   struct AFS_UCRED *credp)
  #else
! afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow)
  #endif
  #endif
  {
      struct afs_ioctl data;
  #ifdef AFS_NEED_CLIENTCONTEXT
***************
*** 1032,1038 ****
      register afs_int32 function, device;
      afs_int32 inSize, outSize, outSizeMax;
      char *inData, *outData;
!     int (*(*pioctlSw)) ();
      int pioctlSwSize;
      struct afs_fakestat_state fakestate;
  
--- 1015,1021 ----
      register afs_int32 function, device;
      afs_int32 inSize, outSize, outSizeMax;
      char *inData, *outData;
!     pioctlFunction *pioctlSw;
      int pioctlSwSize;
      struct afs_fakestat_state fakestate;
  
***************
*** 1143,1154 ****
  }
  
  /*!
!  * VIOCETFID (22) - Get file ID quickly
   *
   * \ingroup pioctl
   *
   * \param[in] ain	not in use
!  * \param[out] aout	not in use
   *
   * \retval EINVAL	Error if some of the initial arguments aren't set
   *
--- 1126,1137 ----
  }
  
  /*!
!  * VIOCGETFID (22) - Get file ID quickly
   *
   * \ingroup pioctl
   *
   * \param[in] ain	not in use
!  * \param[out] aout	fid of requested file
   *
   * \retval EINVAL	Error if some of the initial arguments aren't set
   *
***************
*** 3439,3448 ****
  
  static int debugsetsp = 0;
  static int
! afs_setsprefs(sp, num, vlonly)
!      struct spref *sp;
!      unsigned int num;
!      unsigned int vlonly;
  {
      struct srvAddr *sa;
      int i, j, k, matches, touchedSize;
--- 3422,3428 ----
  
  static int debugsetsp = 0;
  static int
! afs_setsprefs(struct spref *sp, unsigned int num, unsigned int vlonly)
  {
      struct srvAddr *sa;
      int i, j, k, matches, touchedSize;
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.74.2.19 openafs/src/afs/afs_prototypes.h:1.74.2.22
*** openafs/src/afs/afs_prototypes.h:1.74.2.19	Sat Nov  8 11:34:42 2008
--- openafs/src/afs/afs_prototypes.h	Tue Dec 16 16:49:04 2008
***************
*** 549,555 ****
  extern void shutdown_osinet(void);
  
  /* afs_osi_pag.c */
! extern int afs_setpag();
  extern afs_uint32 genpag(void);
  extern afs_uint32 getpag(void);
  #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
--- 549,562 ----
  extern void shutdown_osinet(void);
  
  /* afs_osi_pag.c */
! #if defined(AFS_SUN5_ENV)
! extern int afs_setpag(struct AFS_UCRED **credpp);
! #elif  defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! extern int afs_setpag(struct proc *p, void *args, int *retval);
! #else
! extern int afs_setpag(void);
! #endif
! 	
  extern afs_uint32 genpag(void);
  extern afs_uint32 getpag(void);
  #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
***************
*** 626,635 ****
  
  
  /* ARCH/osi_inode.c */
! extern int afs_syscall_icreate();
! extern int afs_syscall_iopen();
! extern int afs_syscall_iincdec();
! 
  
  /* ARCH/osi_file.c */
  extern int afs_osicred_initialized;
--- 633,657 ----
  
  
  /* ARCH/osi_inode.c */
! #ifdef AFS_SUN5_ENV
! extern int afs_syscall_icreate(dev_t, long, long, long, long, long, 
! 		               rval_t *, struct AFS_UCRED *);
! extern int afs_syscall_iopen(dev_t, int, int, rval_t *, struct AFS_UCRED *);
! extern int afs_syscall_iincdec(dev_t, int, int, int, rval_t *, 
! 			       struct AFS_UCRED *);
! #elif defined(AFS_SGI65_ENV)
! extern int afs_syscall_icreate(afs_uint32, afs_uint32, afs_uint32, afs_uint32, afs_uint32, afs_uint32, rval_t *);
! extern int afs_syscall_iopen(int, ino_t, int, rval_t *);
! extern int afs_syscall_iincdec(int, int, int, int);
! #elif defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! extern int afs_syscall_icreate(long, long, long, long, long, long, long*);
! extern int afs_syscall_iopen(int dev, int inode, int usrmod, long *retval);
! extern int afs_syscall_iincdec(int dev, int inode, int inode_p1, int amount);
! #else
! extern int afs_syscall_icreate(long, long, long, long, long, long);
! extern int afs_syscall_iopen(int, int, int);
! extern int afs_syscall_iincdec(int, int, int, int);
! #endif
  
  /* ARCH/osi_file.c */
  extern int afs_osicred_initialized;
***************
*** 696,701 ****
--- 718,724 ----
  extern struct vfs_ubcops afs_ubcops;
  #endif
  #endif
+ extern int afs_inactive(struct vcache *avc, struct AFS_UCRED *acred);
  
  /* afs_osifile.c */
  
***************
*** 736,742 ****
  extern short afs_waitForeverCount;
  extern afs_int32 afs_showflags;
  extern int afs_defaultAsynchrony;
! extern int afs_syscall_pioctl();
  
  /* afs_segments.c */
  extern int afs_StoreMini(register struct vcache *avc, struct vrequest *areq);
--- 759,777 ----
  extern short afs_waitForeverCount;
  extern afs_int32 afs_showflags;
  extern int afs_defaultAsynchrony;
! #ifdef AFS_SUN5_ENV
! extern int afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, 
! 			      int follow, rval_t *rvp, struct AFS_UCRED *credp);
! #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! extern int afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, 
! 			      int follow, struct AFS_UCRED *credp);
! #else
! extern int afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg,
! 			      int follow);
! #endif
! extern int HandleIoctl(register struct vcache *avc, register afs_int32 acom,
! 		       struct afs_ioctl *adata);
! 
  
  /* afs_segments.c */
  extern int afs_StoreMini(register struct vcache *avc, struct vrequest *areq);
***************
*** 1012,1025 ****
--- 1047,1102 ----
  			 register struct dcache *adc,
  			 register AFSFetchStatus * astat, register int aincr);
  
+ /* VNOPS/afs_vnop_dirops.c */
+ 
+ extern int afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, 
+ 		     register struct vcache **avcp, struct AFS_UCRED *acred);
+ #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
+ extern int afs_rmdir(OSI_VC_DECL(adp), char *aname, struct vnode *cdirp, 
+ 		     struct AFS_UCRED *acred);
+ #else
+ extern int afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred);
+ #endif
+ 
+ struct fid;
+ /* VNOPS/afs_vnop_fid.c */
+ #if !defined(AFS_ATHENA_ENV)
+ #ifdef AFS_AIX41_ENV
+ int afs_fid(OSI_VC_DECL(avc), struct fid *fidpp, struct ucred *credp);
+ #elif defined(AFS_OSF_ENV) || defined(AFS_SUN54_ENV)
+ int afs_fid(OSI_VC_DECL(avc), struct fid *fidpp);
+ #else
+ int afs_fid(OSI_VC_DECL(avc), struct fid **fidpp);
+ #endif                          /* AFS_AIX41_ENV */
+ #endif
  
  /* VNOPS/afs_vnop_flock.c */
+ extern afs_int32 lastWarnTime;
+ 
  extern void lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp,
  		      int clid);
  extern int HandleFlock(register struct vcache *avc, int acom,
  		       struct vrequest *areq, pid_t clid, int onlymine);
  
+ #ifdef AFS_OSF_ENV
+ extern int afs_lockctl(struct vcache * avc, struct eflock * af, int flag,
+ 		       struct AFS_UCRED * acred, pid_t clid, off_t offset);
+ #elif defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+ extern int afs_lockctl(struct vcache * avc, struct AFS_FLOCK * af, int acmd,
+ 		       struct AFS_UCRED * acred, pid_t clid);
+ #else
+ extern int afs_lockctl(struct vcache * avc, struct AFS_FLOCK * af, int acmd,
+ 		       struct AFS_UCRED * acred);
+ #endif
  
+ /* VNOPS/afs_vnop_link.c */
+ #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
+ extern int afs_link(OSI_VC_DECL(adp), struct vcache *avc, char *aname, 
+ 		    struct AFS_UCRED *acred);
+ #else
+ extern int afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, 
+ 		    struct AFS_UCRED *acred);
+ #endif
  
  /* VNOPS/afs_vnop_lookup.c */
  extern int EvalMountPoint(register struct vcache *avc, struct vcache *advc,
***************
*** 1040,1048 ****
  		      struct sysname_info *state);
  extern int afs_DoBulkStat(struct vcache *adp, long dirCookie,
  			  struct vrequest *areqp);
! extern int afs_lookup();
! 
! 
  /* VNOPS/afs_vnop_open.c */
  #ifdef AFS_SGI64_ENV
  extern int afs_open(bhv_desc_t * bhv, struct vcache **avcp, afs_int32 aflags,
--- 1117,1137 ----
  		      struct sysname_info *state);
  extern int afs_DoBulkStat(struct vcache *adp, long dirCookie,
  			  struct vrequest *areqp);
! #ifdef AFS_OSF_ENV
! extern int afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, 
! 		      struct AFS_UCRED *acred, int opflag, int wantparent);
! #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
! extern int afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, 
! 		      struct pathname *pnp, int flags, struct vnode *rdir, 
! 		      struct AFS_UCRED *acred);
! #elif defined(UKERNEL)
! extern int afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, 
! 		      struct AFS_UCRED *acred, int flags);
! #else
! extern int afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, 
! 		      struct AFS_UCRED *acred);
! #endif
! 	
  /* VNOPS/afs_vnop_open.c */
  #ifdef AFS_SGI64_ENV
  extern int afs_open(bhv_desc_t * bhv, struct vcache **avcp, afs_int32 aflags,
***************
*** 1069,1097 ****
  
  /* VNOPS/afs_vnop_readdir.c */
  extern int afs_rd_stash_i;
! 
  
  /* VNOPS/afs_vnop_remove.c */
  extern int afsremove(register struct vcache *adp, register struct dcache *tdc,
  		     register struct vcache *tvc, char *aname,
  		     struct AFS_UCRED *acred, struct vrequest *treqp);
  extern int afs_remunlink(register struct vcache *avc, register int doit);
! 
  
  /* VNOPS/afs_vnop_rename.c */
  extern int afsrename(struct vcache *aodp, char *aname1, struct vcache *andp,
  		     char *aname2, struct AFS_UCRED *acred,
  		     struct vrequest *areq);
! 
  
  /* VNOPS/afs_vnop_symlink.c */
  extern int afs_MemHandleLink(register struct vcache *avc,
  			     struct vrequest *areq);
  extern int afs_UFSHandleLink(register struct vcache *avc,
  			     struct vrequest *areq);
! 
! /* VNOPS/afs_vnop_flock.c */
! extern afs_int32 lastWarnTime;
  
  /* VNOPS/afs_vnop_write.c */
  extern int afs_MemWrite(register struct vcache *avc, struct uio *auio,
--- 1158,1212 ----
  
  /* VNOPS/afs_vnop_readdir.c */
  extern int afs_rd_stash_i;
! #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! extern int afs_readdir(OSI_VC_DECL(avc), struct uio *auio, 
! 		       struct AFS_UCRED *acred, int *eofp);
! #elif defined(AFS_HPUX100_ENV)
! extern int afs_readdir2(OIS_VC_DECL(avc), struct uio *auio, 
! 		        struct AFS_UCRED *acred);
! #else
! extern int afs_readdir(OSI_VC_DECL(avc), struct uio *auio, 
! 		       struct AFS_UCRED *acred);
! #endif
  
  /* VNOPS/afs_vnop_remove.c */
  extern int afsremove(register struct vcache *adp, register struct dcache *tdc,
  		     register struct vcache *tvc, char *aname,
  		     struct AFS_UCRED *acred, struct vrequest *treqp);
  extern int afs_remunlink(register struct vcache *avc, register int doit);
! extern int afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred);
! extern char *afs_newname(void);
  
  /* VNOPS/afs_vnop_rename.c */
  extern int afsrename(struct vcache *aodp, char *aname1, struct vcache *andp,
  		     char *aname2, struct AFS_UCRED *acred,
  		     struct vrequest *areq);
! #ifdef AFS_SGI_ENV
! extern int afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, 
! 		      char *aname2, struct pathname *npnp, 
! 		      struct AFS_UCRED *acred);
! #else
! extern int afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, 
! 		      char *aname2, struct AFS_UCRED *acred);
! #endif
! 	
! /* VNOPS/afs_vnop_strategy.c */
! #if defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! extern int afs_ustrategy(register struct buf *adp, struct AFS_UCRED *credp);
! #else
! extern int afs_ustrategy(register struct buf *adp);
! #endif
  
  /* VNOPS/afs_vnop_symlink.c */
  extern int afs_MemHandleLink(register struct vcache *avc,
  			     struct vrequest *areq);
  extern int afs_UFSHandleLink(register struct vcache *avc,
  			     struct vrequest *areq);
! extern int afs_symlink(OSI_VC_DECL(adp), char *aname, 
! 		       struct vattr *attrs, char *atargetName, 
! 		       struct AFS_UCRED *acred);
! extern int afs_readlink(OSI_VC_DECL(avc), struct uio *auio,
! 			struct AFS_UCRED *acred);
  
  /* VNOPS/afs_vnop_write.c */
  extern int afs_MemWrite(register struct vcache *avc, struct uio *auio,
***************
*** 1104,1124 ****
  			      struct vrequest *areq);
  extern int afs_closex(register struct file *afd);
  
! /* other VNOPS (please fix these) */
! extern int afs_close();
! extern int HandleIoctl();
! extern int afs_fsync();
! extern int afs_remove();
! extern int afs_link();
! extern int afs_rename();
! extern int afs_mkdir();
! extern int afs_rmdir();
! extern int afs_symlink();
! extern int afs_readdir();
! extern int afs_readlink();
! extern int afs_ustrategy();
! extern int afs_lockctl();
! 
  
  /* afs_volume.c */
  extern afs_int32 afs_FVIndex;
--- 1219,1255 ----
  			      struct vrequest *areq);
  extern int afs_closex(register struct file *afd);
  
! #ifdef AFS_SGI65_ENV
! extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags, 
! 		     lastclose_t lastclose, struct AFS_UCRED *acred);
! #elif defined(AFS_SGI64_ENV)
! extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags, 
! 		     lastclose_t lastclose, off_t offset, 
! 		     struct AFS_UCRED *acred, struct flid *flp);
! #elif defined(AFS_SGI_ENV)
! extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags, 
! 		     lastclose_t lastclose, off_t offset,
! 		     struct AFS_UCRED *acred);
! #elif defined(AFS_SUN5_ENV)
! extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags, int count, 
! 		     offset_t offset, struct AFS_UCRED *acred);
! #else
! extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags,  
! 		     struct AFS_UCRED *acred);
! #endif
! 
! #ifdef AFS_OSF_ENV
! extern int afs_fsync(OSI_VC_DECL(avc), int fflags, struct AFS_UCRED *acred, 
! 		     int waitfor);
! #elif defined(AFS_SGI65_ENV)
! extern int afs_fsync(OSI_VC_DECL(avc), int flags, struct AFS_UCRED *acred, 
! 		     off_t start, off_t stop);
! #elif defined(AFS_SGI_ENV) || defined(AFS_SUN53_ENV)
! extern int afs_fsync(OSI_VC_DECL(avc), int flag, struct AFS_UCRED *acred);
! #else
! extern int afs_fsync(OSI_VC_DECL(avc), struct AFS_UCRED *acred);
! #endif
! 		
  
  /* afs_volume.c */
  extern afs_int32 afs_FVIndex;
Index: openafs/src/afs/afs_syscall.c
diff -c openafs/src/afs/afs_syscall.c:1.1.2.6 openafs/src/afs/afs_syscall.c:1.1.2.7
*** openafs/src/afs/afs_syscall.c:1.1.2.6	Mon Apr 21 14:59:34 2008
--- openafs/src/afs/afs_syscall.c	Mon Dec 15 14:12:19 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_syscall.c,v 1.1.2.6 2008/04/21 18:59:34 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_syscall.c,v 1.1.2.7 2008/12/15 19:12:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 630,637 ****
  			       p->p_cred->pc_ucred);
  #else
  	code =
! 	    afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3,
! 			       uap->parm4);
  #endif
  	AFS_GUNLOCK();
      } else if (uap->syscall == AFSCALL_ICREATE) {
--- 630,637 ----
  			       p->p_cred->pc_ucred);
  #else
  	code =
! 	    afs_syscall_pioctl((char *)uap->parm1, (unsigned int)uap->parm2, (caddr_t)uap->parm3,
! 			       (int) uap->parm4);
  #endif
  	AFS_GUNLOCK();
      } else if (uap->syscall == AFSCALL_ICREATE) {
Index: openafs/src/afs/afs_vcache.c
diff -c openafs/src/afs/afs_vcache.c:1.114.2.14 openafs/src/afs/afs_vcache.c:1.114.2.15
*** openafs/src/afs/afs_vcache.c:1.114.2.14	Sun Oct 12 14:07:01 2008
--- openafs/src/afs/afs_vcache.c	Sun Nov 30 15:06:51 2008
***************
*** 41,47 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.114.2.14 2008/10/12 18:07:01 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 41,47 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.114.2.15 2008/11/30 20:06:51 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 1624,1630 ****
  	if (!avc->ddirty_flags ||
  		(avc->ddirty_flags == VDisconShadowed)) {
  		/* Not in dirty list. */
! 		AFS_DISCON_ADD_DIRTY(avc);
  	}
  
  	avc->ddirty_flags |= flags;
--- 1624,1630 ----
  	if (!avc->ddirty_flags ||
  		(avc->ddirty_flags == VDisconShadowed)) {
  		/* Not in dirty list. */
! 		AFS_DISCON_ADD_DIRTY(avc, 1);
  	}
  
  	avc->ddirty_flags |= flags;
Index: openafs/src/afs/discon.h
diff -c openafs/src/afs/discon.h:1.2.2.3 openafs/src/afs/discon.h:1.2.2.4
*** openafs/src/afs/discon.h:1.2.2.3	Mon Sep 22 15:29:54 2008
--- openafs/src/afs/discon.h	Sun Nov 30 15:06:51 2008
***************
*** 9,15 ****
  #define AFS_DISCON_LOCK()
  #define AFS_DISCON_UNLOCK()
  
! #define AFS_DISCON_ADD_DIRTY(avc)
  
  #else
  
--- 9,15 ----
  #define AFS_DISCON_LOCK()
  #define AFS_DISCON_UNLOCK()
  
! #define AFS_DISCON_ADD_DIRTY(avc, lock)
  
  #else
  
***************
*** 66,79 ****
  #define AFS_DISCON_LOCK() ObtainReadLock(&afs_discon_lock)
  #define AFS_DISCON_UNLOCK() ReleaseReadLock(&afs_discon_lock)
  
! #define AFS_DISCON_ADD_DIRTY(avc)				\
  do {								\
      if (!afs_DDirtyVCListStart) {				\
      	afs_DDirtyVCListStart = afs_DDirtyVCList = avc;		\
      } else {							\
      	afs_DDirtyVCList->ddirty_next = avc;			\
  	afs_DDirtyVCList = avc;					\
      }								\
  } while(0);
  
  #endif /* AFS_DISCON_ENV */
--- 66,86 ----
  #define AFS_DISCON_LOCK() ObtainReadLock(&afs_discon_lock)
  #define AFS_DISCON_UNLOCK() ReleaseReadLock(&afs_discon_lock)
  
! /* Call with avc and afs_DDirtyVCListLock w locks held. */
! #define AFS_DISCON_ADD_DIRTY(avc, lock)				\
  do {								\
+     int retry = 0;						\
      if (!afs_DDirtyVCListStart) {				\
      	afs_DDirtyVCListStart = afs_DDirtyVCList = avc;		\
      } else {							\
      	afs_DDirtyVCList->ddirty_next = avc;			\
  	afs_DDirtyVCList = avc;					\
      }								\
+     if (lock)							\
+ 	ObtainWriteLock(&afs_xvcache, 763);			\
+     osi_vnhold(avc, 0);						\
+     if (lock)							\
+ 	ReleaseWriteLock(&afs_xvcache);				\
  } while(0);
  
  #endif /* AFS_DISCON_ENV */
Index: openafs/src/afs/exporter.h
diff -c openafs/src/afs/exporter.h:1.8.14.4 openafs/src/afs/exporter.h:1.8.14.5
*** openafs/src/afs/exporter.h:1.8.14.4	Sat Oct 25 20:45:55 2008
--- openafs/src/afs/exporter.h	Sat Nov 29 13:20:24 2008
***************
*** 50,64 ****
  #endif
  #endif
  
  struct exporterops {
!     int (*export_reqhandler) ();
!     void (*export_hold) ();
!     void (*export_rele) ();
!     int (*export_sysname) ();
!     void (*export_garbagecollect) ();
!     int (*export_statistics) ();
!     int (*export_checkhost) ();
!     afs_int32 (*export_gethost) ();
  };
  
  struct exporterstats {
--- 50,75 ----
  #endif
  #endif
  
+ struct afs_exporter;
+ 
  struct exporterops {
!     int (*export_reqhandler) (struct afs_exporter *exp,
! 		    	      struct AFS_UCRED **cred,
! 			      afs_uint32 host,
! 			      afs_int32 pag,
! 			      struct afs_exporter **expp);
!     void (*export_hold) (struct afs_exporter *exp);
!     void (*export_rele) (struct afs_exporter *exp);
!     int (*export_sysname) (struct afs_exporter *exp,
! 		           char *inname,
! 			   char **outname,
! 			   int *num,
! 			   int allpags);
!     void (*export_garbagecollect) (struct afs_exporter *exp,
! 		    		   afs_int32 param);
!     int (*export_statistics) (struct afs_exporter *exp);
!     int (*export_checkhost) (struct afs_exporter *exp, afs_int32 host);
!     afs_int32 (*export_gethost) (struct afs_exporter *exp);
  };
  
  struct exporterstats {
Index: openafs/src/afs/lock.h
diff -c openafs/src/afs/lock.h:1.17.4.7 openafs/src/afs/lock.h:1.17.4.8
*** openafs/src/afs/lock.h:1.17.4.7	Mon Sep 22 15:29:54 2008
--- openafs/src/afs/lock.h	Sun Nov 30 15:06:51 2008
***************
*** 31,37 ****
  /* This is the max lock number in use. Please update it if you add any new
   * lock numbers.
   */
! #define MAX_LOCK_NUMBER 760
  #endif
  
  struct afs_bozoLock {
--- 31,37 ----
  /* This is the max lock number in use. Please update it if you add any new
   * lock numbers.
   */
! #define MAX_LOCK_NUMBER 780
  #endif
  
  struct afs_bozoLock {
Index: openafs/src/afs/AIX/osi_inode.c
diff -c openafs/src/afs/AIX/osi_inode.c:1.10.4.1 openafs/src/afs/AIX/osi_inode.c:1.10.4.2
*** openafs/src/afs/AIX/osi_inode.c:1.10.4.1	Wed Aug 15 23:52:33 2007
--- openafs/src/afs/AIX/osi_inode.c	Mon Dec 15 14:12:20 2008
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/AIX/osi_inode.c,v 1.10.4.1 2007/08/16 03:52:33 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/AIX/osi_inode.c,v 1.10.4.2 2008/12/15 19:12:20 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 72,79 ****
  #define IWRITE_UNLOCK(ip)       simple_unlock(&((ip)->afs_inode_lock))
  
  #define	SYSENT(name, arglist, decls)			\
! name arglist						\
! decls {							\
  	lock_t lockt;					\
  	int rval1 = 0;					\
  	label_t jmpbuf;					\
--- 72,79 ----
  #define IWRITE_UNLOCK(ip)       simple_unlock(&((ip)->afs_inode_lock))
  
  #define	SYSENT(name, arglist, decls)			\
! name decls 						\
! {							\
  	lock_t lockt;					\
  	int rval1 = 0;					\
  	label_t jmpbuf;					\
***************
*** 95,102 ****
  							\
  	return(getuerror() ? -1 : rval1);		\
  }							\
! afs_syscall_ ## name arglist				\
! decls							\
  
  
  /*
--- 95,101 ----
  							\
  	return(getuerror() ? -1 : rval1);		\
  }							\
! afs_syscall_ ## name decls				\
  
  
  /*
***************
*** 257,263 ****
  #define INODESPECIAL	0xffffffff	/* ... from ../vol/viceonode.h  */
  #endif
  
! SYSENT(icreate, (dev, near_inode, param1, param2, param3, param4),)
  {
      struct inode *ip, *newip, *pip;
      register int err, rval1, rc = 0;
--- 256,262 ----
  #define INODESPECIAL	0xffffffff	/* ... from ../vol/viceonode.h  */
  #endif
  
! SYSENT(icreate, (dev, near_inode, param1, param2, param3, param4), (long dev, long near_inode, long param1, long param2, long param3, long param4))
  {
      struct inode *ip, *newip, *pip;
      register int err, rval1, rc = 0;
***************
*** 320,326 ****
      return getuerror()? -1 : rval1;
  }
  
! SYSENT(iopen, (dev, inode, usrmod),)
  {
      struct file *fp;
      register struct inode *ip;
--- 319,325 ----
      return getuerror()? -1 : rval1;
  }
  
! SYSENT(iopen, (dev, inode, usrmod),(int dev, int inode, int usrmod))
  {
      struct file *fp;
      register struct inode *ip;
***************
*** 388,394 ****
  }
  
  
! SYSENT(iincdec, (dev, inode, inode_p1, amount),)
  {
      register struct inode *ip;
      char error;
--- 387,393 ----
  }
  
  
! SYSENT(iincdec, (dev, inode, inode_p1, amount),(int dev, int inode, int inode_p1, int amount))
  {
      register struct inode *ip;
      char error;
Index: openafs/src/afs/DARWIN/osi_inode.c
diff -c openafs/src/afs/DARWIN/osi_inode.c:1.8 openafs/src/afs/DARWIN/osi_inode.c:1.8.4.1
*** openafs/src/afs/DARWIN/osi_inode.c:1.8	Thu Oct 13 11:12:07 2005
--- openafs/src/afs/DARWIN/osi_inode.c	Sat Nov 29 13:20:26 2008
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_inode.c,v 1.8 2005/10/13 15:12:07 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_inode.c,v 1.8.4.1 2008/11/29 18:20:26 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 233,254 ****
  }
  #endif
  
! afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
!      long *retval;
!      long dev, near_inode, param1, param2, param3, param4;
  {
      return EOPNOTSUPP;
  }
  
! afs_syscall_iopen(dev, inode, usrmod, retval)
!      long *retval;
!      int dev, inode, usrmod;
  {
      return EOPNOTSUPP;
  }
  
! afs_syscall_iincdec(dev, inode, inode_p1, amount)
!      int dev, inode, inode_p1, amount;
  {
      return EOPNOTSUPP;
  }
--- 233,253 ----
  }
  #endif
  
! int
! afs_syscall_icreate(long dev, long near_inode, long param1, long param2, 
! 		    long param3, long param4, long *retval)
  {
      return EOPNOTSUPP;
  }
  
! int
! afs_syscall_iopen(int dev, int inode, int usrmod, long *retval)
  {
      return EOPNOTSUPP;
  }
  
! int
! afs_syscall_iincdec(int dev, int inode, int inode_p1, int amount)
  {
      return EOPNOTSUPP;
  }
Index: openafs/src/afs/DARWIN/osi_vnodeops.c
diff -c openafs/src/afs/DARWIN/osi_vnodeops.c:1.41.2.11 openafs/src/afs/DARWIN/osi_vnodeops.c:1.41.2.12
*** openafs/src/afs/DARWIN/osi_vnodeops.c:1.41.2.11	Sun Feb 10 23:00:48 2008
--- openafs/src/afs/DARWIN/osi_vnodeops.c	Sat Nov 29 13:20:26 2008
***************
*** 5,11 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.41.2.11 2008/02/11 04:00:48 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
--- 5,11 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.41.2.12 2008/11/29 18:20:26 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
***************
*** 538,546 ****
      struct vcache *avc = VTOAFS(vp);
      AFS_GLOCK();
      if (vop_cred)
! 	code = afs_close(avc, ap->a_fflag, vop_cred, vop_proc);
      else
! 	code = afs_close(avc, ap->a_fflag, &afs_osi_cred, vop_proc);
      osi_FlushPages(avc, vop_cred);	/* hold bozon lock, but not basic vnode lock */
      /* This is legit; it just forces the fstrace event to happen */
      code = afs_CheckCode(code, NULL, 60);
--- 538,546 ----
      struct vcache *avc = VTOAFS(vp);
      AFS_GLOCK();
      if (vop_cred)
! 	code = afs_close(avc, ap->a_fflag, vop_cred);
      else
! 	code = afs_close(avc, ap->a_fflag, &afs_osi_cred);
      osi_FlushPages(avc, vop_cred);	/* hold bozon lock, but not basic vnode lock */
      /* This is legit; it just forces the fstrace event to happen */
      code = afs_CheckCode(code, NULL, 60);
***************
*** 1097,1104 ****
      if (((ap->a_command >> 8) & 0xff) == 'V') {
  	/* This is a VICEIOCTL call */
  	AFS_GLOCK();
! 	error = HandleIoctl(tvc, (struct file *)0 /*Not used */ ,
! 			    ap->a_command, ap->a_data);
  	AFS_GUNLOCK();
  	return (error);
      } else {
--- 1097,1103 ----
      if (((ap->a_command >> 8) & 0xff) == 'V') {
  	/* This is a VICEIOCTL call */
  	AFS_GLOCK();
! 	error = HandleIoctl(tvc, ap->a_command, ap->a_data);
  	AFS_GUNLOCK();
  	return (error);
      } else {
Index: openafs/src/afs/IRIX/osi_vnodeops.c
diff -c openafs/src/afs/IRIX/osi_vnodeops.c:1.16 openafs/src/afs/IRIX/osi_vnodeops.c:1.16.8.1
*** openafs/src/afs/IRIX/osi_vnodeops.c:1.16	Thu Nov  4 23:21:29 2004
--- openafs/src/afs/IRIX/osi_vnodeops.c	Tue Dec 16 16:49:08 2008
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.16 2004/11/05 04:21:29 shadow Exp $");
  
  #ifdef	AFS_SGI62_ENV
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.16.8.1 2008/12/16 21:49:08 shadow Exp $");
  
  #ifdef	AFS_SGI62_ENV
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 679,685 ****
  #ifdef AFS_SGI61_ENV
  	if (((ioflag & IO_SYNC) || (ioflag & IO_DSYNC)) && (rw == UIO_WRITE)
  	    && !AFS_NFSXLATORREQ(cr)) {
! 	    error = afs_fsync(avc, 0, cr);
  	}
  #else /* AFS_SGI61_ENV */
  	if ((ioflag & IO_SYNC) && (rw == UIO_WRITE) && !AFS_NFSXLATORREQ(cr)) {
--- 679,689 ----
  #ifdef AFS_SGI61_ENV
  	if (((ioflag & IO_SYNC) || (ioflag & IO_DSYNC)) && (rw == UIO_WRITE)
  	    && !AFS_NFSXLATORREQ(cr)) {
! 	    error = afs_fsync(avc, 0, cr
! #ifdef AFS_SGI65_ENV
! 	                      , 0, 0
! #endif
! 	                      );
  	}
  #else /* AFS_SGI61_ENV */
  	if ((ioflag & IO_SYNC) && (rw == UIO_WRITE) && !AFS_NFSXLATORREQ(cr)) {
Index: openafs/src/afs/LINUX/osi_alloc.c
diff -c openafs/src/afs/LINUX/osi_alloc.c:1.23.8.2 openafs/src/afs/LINUX/osi_alloc.c:1.23.8.3
*** openafs/src/afs/LINUX/osi_alloc.c:1.23.8.2	Mon Sep 22 15:35:26 2008
--- openafs/src/afs/LINUX/osi_alloc.c	Sat Nov 29 13:20:26 2008
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_alloc.c,v 1.23.8.2 2008/09/22 19:35:26 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_alloc.c,v 1.23.8.3 2008/11/29 18:20:26 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 223,229 ****
   *    1 - success
   */
  static int
! linux_alloc_init()
  {
      /* initiate our pool of osi_linux_mem structs */
      al_mem_pool =
--- 223,229 ----
   *    1 - success
   */
  static int
! linux_alloc_init(void)
  {
      /* initiate our pool of osi_linux_mem structs */
      al_mem_pool =
***************
*** 270,276 ****
  
  /* get_hash_stats() : get hash table statistics */
  static void
! get_hash_stats()
  {
      int i;
  
--- 270,276 ----
  
  /* get_hash_stats() : get hash table statistics */
  static void
! get_hash_stats(void)
  {
      int i;
  
Index: openafs/src/afs/LINUX/osi_inode.c
diff -c openafs/src/afs/LINUX/osi_inode.c:1.7 openafs/src/afs/LINUX/osi_inode.c:1.7.14.1
*** openafs/src/afs/LINUX/osi_inode.c:1.7	Mon Apr  5 18:39:53 2004
--- openafs/src/afs/LINUX/osi_inode.c	Sat Nov 29 13:20:26 2008
***************
*** 21,27 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_inode.c,v 1.7 2004/04/05 22:39:53 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 21,27 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_inode.c,v 1.7.14.1 2008/11/29 18:20:26 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 29,47 ****
  #include "afs/afs_stats.h"	/* statistics stuff */
  
  int
! afs_syscall_icreate(void)
  {
      return 0;
  }
  
  int
! afs_syscall_iopen(void)
  {
      return 0;
  }
  
  int
! afs_syscall_iincdec(void)
  {
      return 0;
  }
--- 29,47 ----
  #include "afs/afs_stats.h"	/* statistics stuff */
  
  int
! afs_syscall_icreate(long a, long b, long c, long d, long e, long f)
  {
      return 0;
  }
  
  int
! afs_syscall_iopen(int a, int b, int c)
  {
      return 0;
  }
  
  int
! afs_syscall_iincdec(int a, int v, int c, int d)
  {
      return 0;
  }
Index: openafs/src/afs/LINUX/osi_syscall.c
diff -c openafs/src/afs/LINUX/osi_syscall.c:1.7.4.2 openafs/src/afs/LINUX/osi_syscall.c:1.7.4.3
*** openafs/src/afs/LINUX/osi_syscall.c:1.7.4.2	Mon Mar 26 23:23:41 2007
--- openafs/src/afs/LINUX/osi_syscall.c	Sat Nov 29 13:20:26 2008
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.7.4.2 2007/03/27 03:23:41 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.7.4.3 2008/11/29 18:20:26 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 105,115 ****
  };
  #endif
  
! extern long afs_xsetgroups();
  asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist);
  
  #ifdef AFS_LINUX24_ENV
! extern int afs_xsetgroups32();
  asmlinkage int (*sys_setgroups32p) (int gidsetsize,
  				    __kernel_gid32_t * grouplist);
  #endif
--- 105,115 ----
  };
  #endif
  
! extern long afs_xsetgroups(int gidsetsize, gid_t * grouplist);
  asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist);
  
  #ifdef AFS_LINUX24_ENV
! extern int afs_xsetgroups32(int gidsetsize, gid_t * grouplist);
  asmlinkage int (*sys_setgroups32p) (int gidsetsize,
  				    __kernel_gid32_t * grouplist);
  #endif
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.38 openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.40
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.38	Sat Nov  8 11:49:45 2008
--- openafs/src/afs/LINUX/osi_vnodeops.c	Sun Nov 30 15:06:52 2008
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.126.2.38 2008/11/08 16:49:45 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.126.2.40 2008/11/30 20:06:52 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 187,193 ****
  static int
  afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir)
  {
-     extern struct DirEntry *afs_dir_GetBlob();
      struct vcache *avc = VTOAFS(FILE_INODE(fp));
      struct vrequest treq;
      register struct dcache *tdc;
--- 187,192 ----
***************
*** 668,674 ****
  		    (vcp->ddirty_flags == VDisconShadowed)) {
  
  		    ObtainWriteLock(&afs_DDirtyVCListLock, 710);
! 		    AFS_DISCON_ADD_DIRTY(vcp);
  		    ReleaseWriteLock(&afs_DDirtyVCListLock);
  		}
  
--- 667,673 ----
  		    (vcp->ddirty_flags == VDisconShadowed)) {
  
  		    ObtainWriteLock(&afs_DDirtyVCListLock, 710);
! 		    AFS_DISCON_ADD_DIRTY(vcp, 1);
  		    ReleaseWriteLock(&afs_DDirtyVCListLock);
  		}
  
***************
*** 1240,1246 ****
  				&& !(tvc->states & CUnlinked)) {
  	struct dentry *__dp;
  	char *__name;
- 	extern char *afs_newname();
  
  	__dp = NULL;
  	__name = NULL;
--- 1239,1244 ----
Index: openafs/src/afs/SOLARIS/osi_file.c
diff -c openafs/src/afs/SOLARIS/osi_file.c:1.13.14.3 openafs/src/afs/SOLARIS/osi_file.c:1.13.14.4
*** openafs/src/afs/SOLARIS/osi_file.c:1.13.14.3	Mon Mar 17 11:28:33 2008
--- openafs/src/afs/SOLARIS/osi_file.c	Sun Nov 30 15:21:08 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_file.c,v 1.13.14.3 2008/03/17 15:28:33 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_file.c,v 1.13.14.4 2008/11/30 20:21:08 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 175,196 ****
  osi_UfsOpen(afs_int32 ainode)
  #endif
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
      afs_int32 code = 0;
      int dummy;
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
      code =
  	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode, &ip,
  		  CRED(), &dummy);
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
! 	osi_Panic("UfsOpen: igetinode failed");
      }
      afile->vnode = ITOV(ip);
      afile->size = VTOI(afile->vnode)->i_size;
      afile->offset = 0;
      afile->proc = (int (*)())0;
      afile->inum = ainode;	/* for hint validity checking */
--- 175,259 ----
  osi_UfsOpen(afs_int32 ainode)
  #endif
  {
+ #ifdef AFS_CACHE_VNODE_PATH
+     struct vnode *vp;
+ #else
      struct inode *ip;
+ #endif
      register struct osi_file *afile = NULL;
      afs_int32 code = 0;
+ #ifdef AFS_CACHE_VNODE_PATH
      int dummy;
+     char fname[1024];
+     char namebuf[1024];
+     struct pathname lookpn;
+ #endif
+     struct osi_stat tstat;
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
+ 
+ /*
+  * AFS_CACHE_VNODE_PATH can be used with any file system, including ZFS or tmpfs.
+  * The ainode is not an inode number but a signed index used to generate file names. 
+  */
+ #ifdef AFS_CACHE_VNODE_PATH
+ 	switch (ainode) {
+ 	case AFS_CACHE_CELLS_INODE:
+ 	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
+ 	    break;
+ 	case AFS_CACHE_ITEMS_INODE:
+ 	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CacheItems");
+ 	    break;
+ 	case AFS_CACHE_VOLUME_INODE:
+ 	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
+ 	    break;
+ 	default:
+ 		dummy = ainode / afs_numfilesperdir;
+ 		snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode);
+     }
+ 		
+ 	/* Can not use vn_open or lookupname, they use user's CRED() 
+      * We need to run as root So must use low level lookuppnvp 
+      * assume fname starts with /
+ 	 */
+ 
+ 	code = pn_get_buf(fname, AFS_UIOSYS, &lookpn, namebuf, sizeof(namebuf));
+     if (code != 0) 
+         osi_Panic("UfsOpen: pn_get_buf failed %ld %s %ld", code, fname, ainode);
+  
+ 	VN_HOLD(rootdir); /* released in loopuppnvp */
+ 	code = lookuppnvp(&lookpn, NULL, FOLLOW, NULL, &vp, 
+            rootdir, rootdir, &afs_osi_cred); 
+     if (code != 0)  
+         osi_Panic("UfsOpen: lookuppnvp failed %ld %s %ld", code, fname, ainode);
+ 	
+ #ifdef AFS_SUN511_ENV
+     code = VOP_OPEN(&vp, FREAD|FWRITE, &afs_osi_cred, NULL);
+ #else
+     code = VOP_OPEN(&vp, FREAD|FWRITE, &afs_osi_cred);
+ #endif
+ 
+     if (code != 0)
+         osi_Panic("UfsOpen: VOP_OPEN failed %ld %s %ld", code, fname, ainode);
+ 
+ #else
      code =
  	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode, &ip,
  		  CRED(), &dummy);
+ #endif
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
! 	osi_Panic("UfsOpen: igetinode failed %ld %s %ld", code, fname, ainode);
      }
+ #ifdef AFS_CACHE_VNODE_PATH
+ 	afile->vnode = vp;
+ 	code = afs_osi_Stat(afile, &tstat);
+ 	afile->size = tstat.size;
+ #else
      afile->vnode = ITOV(ip);
      afile->size = VTOI(afile->vnode)->i_size;
+ #endif
      afile->offset = 0;
      afile->proc = (int (*)())0;
      afile->inum = ainode;	/* for hint validity checking */
***************
*** 304,315 ****
--- 367,380 ----
  osi_DisableAtimes(struct vnode *avp)
  {
      if (afs_CacheFSType == AFS_SUN_UFS_CACHE) {
+ #ifndef AFS_CACHE_VNODE_PATH 
  	struct inode *ip = VTOI(avp);
  	rw_enter(&ip->i_contents, RW_READER);
  	mutex_enter(&ip->i_tlock);
  	ip->i_flag &= ~IACC;
  	mutex_exit(&ip->i_tlock);
  	rw_exit(&ip->i_contents);
+ #endif
      }
  }
  
Index: openafs/src/afs/SOLARIS/osi_vnodeops.c
diff -c openafs/src/afs/SOLARIS/osi_vnodeops.c:1.28.2.4 openafs/src/afs/SOLARIS/osi_vnodeops.c:1.28.2.5
*** openafs/src/afs/SOLARIS/osi_vnodeops.c:1.28.2.4	Mon Mar 17 11:28:33 2008
--- openafs/src/afs/SOLARIS/osi_vnodeops.c	Sat Dec 13 16:31:09 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.28.2.4 2008/03/17 15:28:33 shadow Exp $");
  
  /*
   * SOLARIS/osi_vnodeops.c
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.28.2.5 2008/12/13 21:31:09 shadow Exp $");
  
  /*
   * SOLARIS/osi_vnodeops.c
***************
*** 55,81 ****
  #include <sys/debug.h>
  #include <sys/fs_subr.h>
  
- /* 
-  * XXX Temporary fix for problems with Solaris rw_tryupgrade() lock.
-  * It isn't very persistent in getting the upgrade when others are
-  * waiting for it and returns 0.  So the UpgradeSToW() macro that the
-  * rw_tryupgrade used to map to wasn't good enough and we need to use
-  * the following code instead.  Obviously this isn't the proper place
-  * for it but it's only called from here for now
-  * 
-  */
- #ifndef	AFS_SUN54_ENV
- AFS_TRYUP(lock)
-      afs_rwlock_t *lock;
- {
-     if (!rw_tryupgrade(lock)) {
- 	rw_exit(lock);
- 	rw_enter(lock, RW_WRITER);
-     }
- }
- #endif
- 
- 
  /* Translate a faultcode_t as returned by some of the vm routines
   * into a suitable errno value.
   */
--- 55,60 ----
***************
*** 106,131 ****
  int afs_pvn_vptrunc;
  
  int
! afs_addmap(avp, offset, asp, addr, length, prot, maxprot, flags, credp)
!      register struct vnode *avp;
!      offset_t offset;
!      struct as *asp;
!      caddr_t addr;
!      int length, prot, maxprot, flags;
!      struct AFS_UCRED *credp;
  {
      /* XXX What should we do here?? XXX */
      return (0);
  }
  
  int
! afs_delmap(avp, offset, asp, addr, length, prot, maxprot, flags, credp)
!      register struct vnode *avp;
!      offset_t offset;
!      struct as *asp;
!      caddr_t addr;
!      int length, prot, maxprot, flags;
!      struct AFS_UCRED *credp;
  {
      /* XXX What should we do here?? XXX */
      return (0);
--- 85,102 ----
  int afs_pvn_vptrunc;
  
  int
! afs_addmap(register struct vnode *avp, offset_t offset, struct as *asp, 
! 	   caddr_t addr, int length, int prot, int maxprot, int flags, 
! 	   struct AFS_UCRED *credp)
  {
      /* XXX What should we do here?? XXX */
      return (0);
  }
  
  int
! afs_delmap(register struct vnode *avp, offset_t offset, struct as *asp, 
! 	   caddr_t addr, int length, int prot, int maxprot, int flags, 
! 	   struct AFS_UCRED *credp)
  {
      /* XXX What should we do here?? XXX */
      return (0);
***************
*** 133,151 ****
  
  #ifdef AFS_SUN510_ENV
  int
! afs_vmread(avp, auio, ioflag, acred, ct)
!      register struct vnode *avp;
!      struct uio *auio;
!      int ioflag;
!      struct AFS_UCRED *acred;
!      caller_context_t *ct;
  #else
  int
! afs_vmread(avp, auio, ioflag, acred)
!      register struct vnode *avp;
!      struct uio *auio;
!      int ioflag;
!      struct AFS_UCRED *acred;
  #endif
  {
      register int code;
--- 104,115 ----
  
  #ifdef AFS_SUN510_ENV
  int
! afs_vmread(register struct vnode *avp, struct uio *auio, int ioflag, 
! 	   struct AFS_UCRED *acred, caller_context_t *ct)
  #else
  int
! afs_vmread(register struct vnode *avp, struct uio *auio, int ioflag, 
! 	   struct AFS_UCRED *acred)
  #endif
  {
      register int code;
***************
*** 161,179 ****
  
  #ifdef AFS_SUN510_ENV
  int
! afs_vmwrite(avp, auio, ioflag, acred, ct)
!      register struct vnode *avp;
!      struct uio *auio;
!      int ioflag;
!      struct AFS_UCRED *acred;
!      caller_context_t *ct;
  #else
  int
! afs_vmwrite(avp, auio, ioflag, acred)
!      register struct vnode *avp;
!      struct uio *auio;
!      int ioflag;
!      struct AFS_UCRED *acred;
  #endif
  {
      register int code;
--- 125,136 ----
  
  #ifdef AFS_SUN510_ENV
  int
! afs_vmwrite(register struct vnode *avp, struct uio *auio, int ioflag, 
! 	    struct AFS_UCRED *acred, caller_context_t *ct)
  #else
  int
! afs_vmwrite(register struct vnode *avp, struct uio *auio, int ioflag, 
! 	    struct AFS_UCRED *acred)
  #endif
  {
      register int code;
***************
*** 187,203 ****
  }
  
  int
! afs_getpage(vp, off, len, protp, pl, plsz, seg, addr, rw, acred)
!      struct vnode *vp;
!      u_int len;
!      u_int *protp;
!      struct page *pl[];
!      u_int plsz;
!      struct seg *seg;
!      offset_t off;
!      caddr_t addr;
!      enum seg_rw rw;
!      struct AFS_UCRED *acred;
  {
      register afs_int32 code = 0;
      AFS_STATCNT(afs_getpage);
--- 144,152 ----
  }
  
  int
! afs_getpage(struct vnode *vp, offset_t off, u_int len, u_int *protp, 
! 	    struct page *pl[], u_int plsz, struct seg *seg, caddr_t addr, 
! 	    enum seg_rw rw, struct AFS_UCRED *acred)
  {
      register afs_int32 code = 0;
      AFS_STATCNT(afs_getpage);
***************
*** 207,238 ****
  
      AFS_GLOCK();
  
- #if	defined(AFS_SUN56_ENV)
      if (len <= PAGESIZE)
  	code =
! 	    afs_GetOnePage(vp, off, len, protp, pl, plsz, seg, addr, rw,
! 			   acred);
! #else
!     if (len <= PAGESIZE)
! 	code =
! 	    afs_GetOnePage(vp, (u_int) off, len, protp, pl, plsz, seg, addr,
! 			   rw, acred);
  #endif
      else {
  	struct vcache *vcp = VTOAFS(vp);
  	ObtainWriteLock(&vcp->vlock, 548);
  	vcp->multiPage++;
  	ReleaseWriteLock(&vcp->vlock);
  	afs_BozonLock(&vcp->pvnLock, vcp);
- #if	defined(AFS_SUN56_ENV)
  	code =
! 	    pvn_getpages(afs_GetOnePage, vp, off, len, protp, pl, plsz, seg,
! 			 addr, rw, acred);
! #else
! 	code =
! 	    pvn_getpages(afs_GetOnePage, vp, (u_int) off, len, protp, pl,
! 			 plsz, seg, addr, rw, acred);
  #endif
  	afs_BozonUnlock(&vcp->pvnLock, vcp);
  	ObtainWriteLock(&vcp->vlock, 549);
  	vcp->multiPage--;
--- 156,180 ----
  
      AFS_GLOCK();
  
      if (len <= PAGESIZE)
  	code =
! 	    afs_GetOnePage(vp, 
! #if !defined(AFS_SUN56_ENV)
! 			   (u_int)
  #endif
+ 			   off, len, protp, pl, plsz, seg, addr, rw, acred);
      else {
  	struct vcache *vcp = VTOAFS(vp);
  	ObtainWriteLock(&vcp->vlock, 548);
  	vcp->multiPage++;
  	ReleaseWriteLock(&vcp->vlock);
  	afs_BozonLock(&vcp->pvnLock, vcp);
  	code =
! 	    pvn_getpages(afs_GetOnePage, vp, 
! #if !defined(AFS_SUN56_ENV)
! 			 (u_int)
  #endif
+ 			 off, len, protp, pl, plsz, seg, addr, rw, acred);
  	afs_BozonUnlock(&vcp->pvnLock, vcp);
  	ObtainWriteLock(&vcp->vlock, 549);
  	vcp->multiPage--;
***************
*** 244,264 ****
  
  /* Return all the pages from [off..off+len) in file */
  int
- afs_GetOnePage(vp, off, alen, protp, pl, plsz, seg, addr, rw, acred)
-      u_int alen;
-      struct vnode *vp;
  #if	defined(AFS_SUN56_ENV)
!      u_offset_t off;
! #else
!      u_int off;
  #endif
-      u_int *protp;
-      struct page *pl[];
-      u_int plsz;
-      struct seg *seg;
-      caddr_t addr;
-      enum seg_rw rw;
-      struct AFS_UCRED *acred;
  {
      register struct page *page;
      register afs_int32 code = 0;
--- 186,200 ----
  
  /* Return all the pages from [off..off+len) in file */
  int
  #if	defined(AFS_SUN56_ENV)
! afs_GetOnePage(struct vnode *vp, u_offset_t off, u_int alen, u_int *protp, 
! 	       struct page *pl[], u_int plsz, struct seg *seg, caddr_t addr, 
! 	       enum seg_rw rw, struct AFS_UCRED *acred)
! #else
! afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp, 
! 	       struct page *pl[], u_int plsz, struct seg *seg, caddr_t addr, 
! 	       enum seg_rw rw, struct AFS_UCRED *acred)
  #endif
  {
      register struct page *page;
      register afs_int32 code = 0;
***************
*** 544,555 ****
  }
  
  int
! afs_putpage(vp, off, len, flags, cred)
!      struct vnode *vp;
!      offset_t off;
!      u_int len;
!      int flags;
!      struct AFS_UCRED *cred;
  {
      struct vcache *avc;
      struct page *pages;
--- 480,487 ----
  }
  
  int
! afs_putpage(struct vnode *vp, offset_t off, u_int len, int flags, 
! 	    struct AFS_UCRED *cred)
  {
      struct vcache *avc;
      struct page *pages;
***************
*** 652,669 ****
  
  
  int
! afs_putapage(struct vnode *vp, struct page *pages,
! #if	defined(AFS_SUN56_ENV)
! 	     u_offset_t * offp,
  #else
! 	     u_int * offp,
  #endif
- #if    defined(AFS_SUN58_ENV)
- 	     size_t * lenp,
- #else
- 	     u_int * lenp,
- #endif
- 	     int flags, struct AFS_UCRED *credp)
  {
      struct buf *tbuf;
      struct vcache *avc = VTOAFS(vp);
--- 584,599 ----
  
  
  int
! #if defined(AFS_SUN58_ENV)
! afs_putapage(struct vnode *vp, struct page *pages, u_offset_t * offp,
! 	     size_t * lenp, int flags, struct AFS_UCRED *credp)
! #elif defined(AFS_SUN56_ENV)
! afs_putapage(struct vnode *vp, struct page *pages, u_offset_t * offp,
! 	     u_int * lenp, int flags, struct AFS_UCRED *credp)
  #else
! afs_putapage(struct vnode *vp, struct page *pages, u_int * offp,
! 	     u_int * lenp, int flags, struct AFS_UCRED *credp)
  #endif
  {
      struct buf *tbuf;
      struct vcache *avc = VTOAFS(vp);
***************
*** 717,728 ****
  }
  
  int
! afs_nfsrdwr(avc, auio, arw, ioflag, acred)
!      register struct vcache *avc;
!      struct uio *auio;
!      enum uio_rw arw;
!      int ioflag;
!      struct AFS_UCRED *acred;
  {
      register afs_int32 code;
      afs_int32 code2;
--- 647,654 ----
  }
  
  int
! afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw,
! 	    int ioflag, struct AFS_UCRED *acred)
  {
      register afs_int32 code;
      afs_int32 code2;
***************
*** 1084,1098 ****
      return afs_CheckCode(code, &treq, 46);
  }
  
! afs_map(vp, off, as, addr, len, prot, maxprot, flags, cred)
!      struct vnode *vp;
!      struct as *as;
!      offset_t off;
!      caddr_t *addr;
!      u_int len;
!      u_char prot, maxprot;
!      u_int flags;
!      struct AFS_UCRED *cred;
  {
      struct segvn_crargs crargs;
      register afs_int32 code;
--- 1010,1017 ----
      return afs_CheckCode(code, &treq, 46);
  }
  
! int
! afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, u_int len, u_char prot, u_char maxprot, u_int flags, struct AFS_UCRED *cred)
  {
      struct segvn_crargs crargs;
      register afs_int32 code;
***************
*** 1182,1192 ****
   * For Now We use standard local kernel params for AFS system values. Change this
   * at some point.
   */
! afs_pathconf(vp, cmd, outdatap, credp)
!      register struct AFS_UCRED *credp;
!      struct vnode *vp;
!      int cmd;
!      u_long *outdatap;
  {
      AFS_STATCNT(afs_cntl);
      switch (cmd) {
--- 1101,1109 ----
   * For Now We use standard local kernel params for AFS system values. Change this
   * at some point.
   */
! int
! afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap, 
! 	     register struct AFS_UCRED *credp)
  {
      AFS_STATCNT(afs_cntl);
      switch (cmd) {
***************
*** 1211,1248 ****
      return 0;
  }
  
! afs_ioctl(vnp, com, arg, flag, credp, rvalp)
!      struct vnode *vnp;
!      int com, arg, flag;
!      cred_t *credp;
!      int *rvalp;
  {
      return (ENOTTY);
  }
  
  void
! afs_rwlock(vnp, wlock)
!      struct vnode *vnp;
!      int wlock;
  {
      rw_enter(&(VTOAFS(vnp))->rwlock, (wlock ? RW_WRITER : RW_READER));
  }
  
  
  void
! afs_rwunlock(vnp, wlock)
!      struct vnode *vnp;
!      int wlock;
  {
      rw_exit(&(VTOAFS(vnp))->rwlock);
  }
  
  
  /* NOT SUPPORTED */
! afs_seek(vnp, ooff, noffp)
!      struct vnode *vnp;
!      offset_t ooff;
!      offset_t *noffp;
  {
      register int code = 0;
  
--- 1128,1157 ----
      return 0;
  }
  
! int
! afs_ioctl(struct vnode *vnp, int com, int arg, int flag, cred_t *credp, 
! 	  int *rvalp)
  {
      return (ENOTTY);
  }
  
  void
! afs_rwlock(struct vnode *vnp, int wlock)
  {
      rw_enter(&(VTOAFS(vnp))->rwlock, (wlock ? RW_WRITER : RW_READER));
  }
  
  
  void
! afs_rwunlock(struct vnode *vnp, int wlock)
  {
      rw_exit(&(VTOAFS(vnp))->rwlock);
  }
  
  
  /* NOT SUPPORTED */
! int
! afs_seek(struct vnode *vnp, offset_t ooff, offset_t *noffp)
  {
      register int code = 0;
  
***************
*** 1258,1281 ****
  }
  
  int
- afs_frlock(vnp, cmd, ap, flag, off,
  #ifdef AFS_SUN59_ENV
! 	   flkcb,
! #endif
! 	   credp)
!      struct vnode *vnp;
!      int cmd;
! #if	defined(AFS_SUN56_ENV)
!      struct flock64 *ap;
  #else
!      struct flock *ap;
! #endif
!      int flag;
!      offset_t off;
! #ifdef AFS_SUN59_ENV
!      struct flk_callback *flkcb;
  #endif
-      struct AFS_UCRED *credp;
  {
      register afs_int32 code = 0;
      /*
--- 1167,1182 ----
  }
  
  int
  #ifdef AFS_SUN59_ENV
! afs_frlock(struct vnode *vnp, int cmd, struct flock64 *ap, int flag, 
! 	   offset_t off, struct flk_callback *flkcb, struct AFS_UCRED *credp)
! #elif defined(AFS_SUN56_ENV)
! afs_frlock(struct vnode *vnp, int cmd, struct flock64 *ap, int flag, 
! 	   offset_t off, struct AFS_UCRED *credp)
  #else
! afs_frlock(struct vnode *vnp, int cmd, struct flock *ap, int flag, 
! 	   offset_t off, struct AFS_UCRED *credp)
  #endif
  {
      register afs_int32 code = 0;
      /*
***************
*** 1314,1330 ****
  
  
  int
- afs_space(vnp, cmd, ap, flag, off, credp)
-      struct vnode *vnp;
-      int cmd;
  #if	defined(AFS_SUN56_ENV)
!      struct flock64 *ap;
  #else
!      struct flock *ap;
  #endif
-      int flag;
-      offset_t off;
-      struct AFS_UCRED *credp;
  {
      register afs_int32 code = EINVAL;
      struct vattr vattr;
--- 1215,1227 ----
  
  
  int
  #if	defined(AFS_SUN56_ENV)
! afs_space(struct vnode *vnp, int cmd, struct flock64 *ap, int flag, 
! 	  offset_t off, struct AFS_UCRED *credp)
  #else
! afs_space(struct vnode *vnp, int cmd, struct flock *ap, int flag, 
! 	  offset_t off, struct AFS_UCRED *credp)
  #endif
  {
      register afs_int32 code = EINVAL;
      struct vattr vattr;
***************
*** 1347,1356 ****
  }
  
  int
! afs_dump(vp, addr, i1, i2)
!      struct vnode *vp;
!      caddr_t addr;
!      int i1, i2;
  {
      AFS_STATCNT(afs_dump);
      afs_warn("AFS_DUMP. MUST IMPLEMENT THIS!!!\n");
--- 1244,1250 ----
  }
  
  int
! afs_dump(struct vnode *vp, caddr_t addr, int i1, int i2)
  {
      AFS_STATCNT(afs_dump);
      afs_warn("AFS_DUMP. MUST IMPLEMENT THIS!!!\n");
***************
*** 1359,1366 ****
  
  
  /* Nothing fancy here; just compare if vnodes are identical ones */
! afs_cmp(vp1, vp2)
!      struct vnode *vp1, *vp2;
  {
      AFS_STATCNT(afs_cmp);
      return (vp1 == vp2);
--- 1253,1260 ----
  
  
  /* Nothing fancy here; just compare if vnodes are identical ones */
! int
! afs_cmp(struct vnode *vp1, struct vnode *vp2)
  {
      AFS_STATCNT(afs_cmp);
      return (vp1 == vp2);
***************
*** 1376,1402 ****
  
  
  int
! afs_pageio(vp, pp, ui1, ui2, i1, credp)
!      struct vnode *vp;
!      struct page *pp;
!      u_int ui1, ui2;
!      int i1;
!      struct cred *credp;
  {
      afs_warn("afs_pageio: Not implemented\n");
      return EINVAL;
  }
  
  int
- afs_dumpctl(vp, i
- #ifdef AFS_SUN59_ENV
- 	    , blkp
- #endif
-     )
-      struct vnode *vp;
-      int i;
  #ifdef AFS_SUN59_ENV
!      int *blkp;
  #endif
  {
      afs_warn("afs_dumpctl: Not implemented\n");
--- 1270,1287 ----
  
  
  int
! afs_pageio(struct vnode *vp, struct page *pp, u_int ui1, u_int ui2, int i1, 
! 	   struct cred *credp)
  {
      afs_warn("afs_pageio: Not implemented\n");
      return EINVAL;
  }
  
  int
  #ifdef AFS_SUN59_ENV
! afs_dumpctl(struct vnode *vp, int i, int *blkp)
! #else
! afs_dumpctl(struct vnode *vp, int i)
  #endif
  {
      afs_warn("afs_dumpctl: Not implemented\n");
***************
*** 1424,1454 ****
  }
  #else
  extern void
! afs_dispose(vp, p, fl, dn, cr)
!      struct vnode *vp;
!      struct page *p;
!      int fl, dn;
!      struct cred *cr;
  {
      fs_dispose(vp, p, fl, dn, cr);
  }
  
  int
! afs_setsecattr(vp, vsecattr, flag, creds)
!      struct vnode *vp;
!      vsecattr_t *vsecattr;
!      int flag;
!      struct cred *creds;
  {
      return ENOSYS;
  }
  
  int
! afs_getsecattr(vp, vsecattr, flag, creds)
!      struct vnode *vp;
!      vsecattr_t *vsecattr;
!      int flag;
!      struct cred *creds;
  {
      return fs_fab_acl(vp, vsecattr, flag, creds);
  }
--- 1309,1328 ----
  }
  #else
  extern void
! afs_dispose(struct vnode *vp, struct page *p, int fl, int dn, struct cred *cr)
  {
      fs_dispose(vp, p, fl, dn, cr);
  }
  
  int
! afs_setsecattr(struct vnode *vp, vsecattr_t *vsecattr, int flag, 
! 	       struct cred *creds)
  {
      return ENOSYS;
  }
  
  int
! afs_getsecattr(struct vnode *vp, vsecattr_t *vsecattr, int flag, struct cred *creds)
  {
      return fs_fab_acl(vp, vsecattr, flag, creds);
  }
***************
*** 1456,1468 ****
  #endif
  
  #ifdef	AFS_GLOBAL_SUNLOCK
! extern int gafs_open(), gafs_close(), afs_ioctl(), gafs_access();
! extern int gafs_getattr(), gafs_setattr(), gafs_lookup(), gafs_create();
! extern int gafs_remove(), gafs_link(), gafs_rename(), gafs_mkdir();
! extern int gafs_rmdir(), gafs_readdir(), gafs_fsync(), gafs_symlink();
! extern int gafs_fid(), gafs_readlink(), fs_setfl(), afs_pathconf();
! extern int afs_lockctl();
! extern void gafs_inactive();
  
  #if defined(AFS_SUN511_ENV)
  /* The following list must always be NULL-terminated */
--- 1330,1385 ----
  #endif
  
  #ifdef	AFS_GLOBAL_SUNLOCK
! extern int gafs_open(register struct vcache **avcp, afs_int32 aflags, 
! 		     struct AFS_UCRED *acred);
! extern int gafs_close(register struct vcache *avc, afs_int32 aflags, 
! 		      int count, offset_t offset, struct AFS_UCRED *acred);
! extern int afs_ioctl(struct vnode *vnp, int com, int arg, int flag, 
! 		     cred_t *credp, int *rvalp);
! extern int gafs_access(register struct vcache *avc, register afs_int32 amode,
! 		       int flags, struct AFS_UCRED *acred);
! extern int gafs_getattr(register struct vcache *avc, 
! 			register struct vattr *attrs, int flags, 
! 			struct AFS_UCRED *acred);
! extern int gafs_setattr(register struct vcache *avc, 
! 			register struct vattr *attrs, int flags, 
! 			struct AFS_UCRED *acred);
! extern int gafs_lookup(register struct vcache *adp, char *aname, 
! 		       register struct vcache **avcp, struct pathname *pnp,
! 		       int flags, struct vnode *rdir, struct AFS_UCRED *acred);
! extern int gafs_remove(register struct vcache *adp, char *aname, 
! 		       struct AFS_UCRED *acred);
! extern int gafs_link(register struct vcache *adp, register struct vcache *avc,
! 		     char *aname, struct AFS_UCRED *acred);
! extern int gafs_rename(register struct vcache *aodp, char *aname1,
! 		       register struct vcache *andp, char *aname2,
! 		       struct AFS_UCRED *acred);
! extern int gafs_symlink(register struct vcache *adp, char *aname, 
! 			struct vattr *attrs, register char *atargetName, 
! 			struct AFS_UCRED *acred);
! extern int gafs_rmdir(register struct vcache *adp, char *aname, 
! 		      struct vnode *cdirp, struct AFS_UCRED *acred);
! extern int gafs_mkdir(register struct vcache *adp, char *aname, 
! 		      struct vattr *attrs, register struct vcache **avcp, 
! 		      struct AFS_UCRED *acred);
! extern int
! #ifdef  AFS_SUN53_ENV
! gafs_fsync(register struct vcache *avc, int flag, struct AFS_UCRED *acred);
! #else
! gafs_fsync(register struct vcache *avc, struct AFS_UCRED *acred);
! #endif
! extern int gafs_readlink(register struct vcache *avc, struct uio *auio, 
! 			 struct AFS_UCRED *acred);
! extern int gafs_readdir(register struct vcache *avc, struct uio *auio,
! 			struct AFS_UCRED *acred, int *eofp);
! extern void gafs_inactive(register struct vcache *avc, 
! 			  struct AFS_UCRED *acred);
! extern int gafs_fid(struct vcache *avc, struct fid **fidpp);
! extern int gafs_create(register struct vcache *adp, char *aname, 
! 		       struct vattr *attrs, enum vcexcl aexcl, int amode, 
! 		       struct vcache **avcp, struct AFS_UCRED *acred);
! extern int afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap,
! 			register struct AFS_UCRED *credp);
  
  #if defined(AFS_SUN511_ENV)
  /* The following list must always be NULL-terminated */
***************
*** 1615,1626 ****
  struct vnodeops *afs_ops = &Afs_vnodeops;
  #endif
  
! 
! 
! gafs_open(avcp, aflags, acred)
!      register struct vcache **avcp;
!      afs_int32 aflags;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1532,1540 ----
  struct vnodeops *afs_ops = &Afs_vnodeops;
  #endif
  
! int
! gafs_open(register struct vcache **avcp, afs_int32 aflags, 
! 	  struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1630,1642 ****
      return (code);
  }
  
! 
! gafs_close(avc, aflags, count, offset, acred)
!      offset_t offset;
!      int count;
!      register struct vcache *avc;
!      afs_int32 aflags;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1544,1552 ----
      return (code);
  }
  
! int
! gafs_close(register struct vcache *avc, afs_int32 aflags, int count, 
! 	   offset_t offset, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1646,1657 ****
      return (code);
  }
  
! 
! gafs_getattr(avc, attrs, flags, acred)
!      int flags;
!      register struct vcache *avc;
!      register struct vattr *attrs;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1556,1564 ----
      return (code);
  }
  
! int
! gafs_getattr(register struct vcache *avc, register struct vattr *attrs, 
! 	     int flags, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1662,1672 ****
  }
  
  
! gafs_setattr(avc, attrs, flags, acred)
!      int flags;
!      register struct vcache *avc;
!      register struct vattr *attrs;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1569,1577 ----
  }
  
  
! int
! gafs_setattr(register struct vcache *avc, register struct vattr *attrs, 
! 	     int flags, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1677,1687 ****
  }
  
  
! gafs_access(avc, amode, flags, acred)
!      int flags;
!      register struct vcache *avc;
!      register afs_int32 amode;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1582,1590 ----
  }
  
  
! int
! gafs_access(register struct vcache *avc, register afs_int32 amode, int flags, 
! 	    struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1692,1704 ****
  }
  
  
! gafs_lookup(adp, aname, avcp, pnp, flags, rdir, acred)
!      struct pathname *pnp;
!      int flags;
!      struct vnode *rdir;
!      register struct vcache *adp, **avcp;
!      char *aname;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1595,1604 ----
  }
  
  
! int
! gafs_lookup(register struct vcache *adp, char *aname, 
! 	    register struct vcache **avcp, struct pathname *pnp, int flags, 
! 	    struct vnode *rdir, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1709,1722 ****
  }
  
  
! gafs_create(adp, aname, attrs, aexcl, amode, avcp, acred)
!      register struct vcache *adp;
!      char *aname;
!      struct vattr *attrs;
!      enum vcexcl aexcl;
!      int amode;
!      struct vcache **avcp;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1609,1618 ----
  }
  
  
! int
! gafs_create(register struct vcache *adp, char *aname, struct vattr *attrs, 
! 	    enum vcexcl aexcl, int amode, struct vcache **avcp, 
! 	    struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1726,1735 ****
      return (code);
  }
  
! gafs_remove(adp, aname, acred)
!      register struct vcache *adp;
!      char *aname;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1622,1629 ----
      return (code);
  }
  
! int
! gafs_remove(register struct vcache *adp, char *aname, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1739,1749 ****
      return (code);
  }
  
! gafs_link(adp, avc, aname, acred)
!      register struct vcache *avc;
!      register struct vcache *adp;
!      char *aname;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1633,1641 ----
      return (code);
  }
  
! int
! gafs_link(register struct vcache *adp, register struct vcache *avc, 
! 	  char *aname, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1753,1762 ****
      return (code);
  }
  
! gafs_rename(aodp, aname1, andp, aname2, acred)
!      register struct vcache *aodp, *andp;
!      char *aname1, *aname2;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1645,1654 ----
      return (code);
  }
  
! int
! gafs_rename(register struct vcache *aodp, char *aname1, 
! 	    register struct vcache *andp, char *aname2, 
! 	    struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1786,1797 ****
      return (code);
  }
  
! gafs_mkdir(adp, aname, attrs, avcp, acred)
!      register struct vcache *adp;
!      register struct vcache **avcp;
!      char *aname;
!      struct vattr *attrs;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1678,1686 ----
      return (code);
  }
  
! int
! gafs_mkdir(register struct vcache *adp, char *aname, struct vattr *attrs, 
! 	   register struct vcache **avcp, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1801,1812 ****
      return (code);
  }
  
! 
! gafs_rmdir(adp, aname, cdirp, acred)
!      struct vnode *cdirp;
!      register struct vcache *adp;
!      char *aname;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1690,1698 ----
      return (code);
  }
  
! int
! gafs_rmdir(register struct vcache *adp, char *aname, struct vnode *cdirp, 
! 	   struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1817,1827 ****
  }
  
  
! gafs_readdir(avc, auio, acred, eofp)
!      int *eofp;
!      register struct vcache *avc;
!      struct uio *auio;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1703,1711 ----
  }
  
  
! int
! gafs_readdir(register struct vcache *avc, struct uio *auio,
! 	     struct AFS_UCRED *acred, int *eofp)
  {
      register int code;
  
***************
*** 1831,1842 ****
      return (code);
  }
  
! gafs_symlink(adp, aname, attrs, atargetName, acred)
!      register struct vcache *adp;
!      register char *atargetName;
!      char *aname;
!      struct vattr *attrs;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1715,1723 ----
      return (code);
  }
  
! int
! gafs_symlink(register struct vcache *adp, char *aname, struct vattr *attrs,
! 	     register char *atargetName, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1847,1856 ****
  }
  
  
! gafs_readlink(avc, auio, acred)
!      register struct vcache *avc;
!      struct uio *auio;
!      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1728,1735 ----
  }
  
  
! int
! gafs_readlink(register struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred)
  {
      register int code;
  
***************
*** 1860,1873 ****
      return (code);
  }
  
  #ifdef	AFS_SUN53_ENV
! gafs_fsync(avc, flag, acred)
!      int flag;
  #else
! gafs_fsync(avc, acred)
  #endif
-      register struct vcache *avc;
-      struct AFS_UCRED *acred;
  {
      register int code;
  
--- 1739,1750 ----
      return (code);
  }
  
+ int
  #ifdef	AFS_SUN53_ENV
! gafs_fsync(register struct vcache *avc, int flag, struct AFS_UCRED *acred)
  #else
! gafs_fsync(register struct vcache *avc, struct AFS_UCRED *acred)
  #endif
  {
      register int code;
  
***************
*** 1881,1892 ****
      return (code);
  }
  
! void
  afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
  {
      struct vnode *vp = AFSTOV(avc);
      if (afs_shuttingdown)
! 	return;
  
      /*
       * In Solaris and HPUX s800 and HP-UX10.0 they actually call us with
--- 1758,1769 ----
      return (code);
  }
  
! int
  afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
  {
      struct vnode *vp = AFSTOV(avc);
      if (afs_shuttingdown)
! 	return 0;
  
      /*
       * In Solaris and HPUX s800 and HP-UX10.0 they actually call us with
***************
*** 1902,1908 ****
      vp->v_count--;
      if (vp->v_count > 0) {
  	mutex_exit(&vp->v_lock);
! 	return;
      }
      mutex_exit(&vp->v_lock);
  
--- 1779,1785 ----
      vp->v_count--;
      if (vp->v_count > 0) {
  	mutex_exit(&vp->v_lock);
! 	return 0;
      }
      mutex_exit(&vp->v_lock);
  
***************
*** 1918,1939 ****
  	avc->opens = avc->execsOrWriters = 0;
  
      afs_InactiveVCache(avc, acred);
  }
  
  void
! gafs_inactive(avc, acred)
!      register struct vcache *avc;
!      struct AFS_UCRED *acred;
  {
      AFS_GLOCK();
!     afs_inactive(avc, acred);
      AFS_GUNLOCK();
  }
  
  
! gafs_fid(avc, fidpp)
!      struct vcache *avc;
!      struct fid **fidpp;
  {
      register int code;
  
--- 1795,1814 ----
  	avc->opens = avc->execsOrWriters = 0;
  
      afs_InactiveVCache(avc, acred);
+     return 0;
  }
  
  void
! gafs_inactive(register struct vcache *avc, struct AFS_UCRED *acred)
  {
      AFS_GLOCK();
!     (void)afs_inactive(avc, acred);
      AFS_GUNLOCK();
  }
  
  
! int
! gafs_fid(struct vcache *avc, struct fid **fidpp)
  {
      register int code;
  
Index: openafs/src/afs/UKERNEL/afs_usrops.c
diff -c openafs/src/afs/UKERNEL/afs_usrops.c:1.30.6.9 openafs/src/afs/UKERNEL/afs_usrops.c:1.30.6.11
*** openafs/src/afs/UKERNEL/afs_usrops.c:1.30.6.9	Mon Oct 27 19:53:46 2008
--- openafs/src/afs/UKERNEL/afs_usrops.c	Mon Dec 29 16:26:12 2008
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.30.6.9 2008/10/27 23:53:46 shadow Exp $");
  
  
  #ifdef	UKERNEL
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.30.6.11 2008/12/29 21:26:12 shadow Exp $");
  
  
  #ifdef	UKERNEL
***************
*** 56,62 ****
  
  struct usr_vnode *afs_FileTable[MAX_OSI_FILES];
  int afs_FileFlags[MAX_OSI_FILES];
! int afs_FileOffsets[MAX_OSI_FILES];
  
  #define MAX_CACHE_LOOPS 4
  
--- 56,62 ----
  
  struct usr_vnode *afs_FileTable[MAX_OSI_FILES];
  int afs_FileFlags[MAX_OSI_FILES];
! off_t afs_FileOffsets[MAX_OSI_FILES];
  
  #define MAX_CACHE_LOOPS 4
  
***************
*** 107,114 ****
  
  usr_key_t afs_global_u_key;
  
! struct usr_proc *afs_global_procp;
! struct usr_ucred *afs_global_ucredp;
  struct usr_sysent usr_sysent[200];
  
  #ifdef AFS_USR_OSF_ENV
--- 107,114 ----
  
  usr_key_t afs_global_u_key;
  
! struct usr_proc *afs_global_procp = NULL;
! struct usr_ucred *afs_global_ucredp = NULL;
  struct usr_sysent usr_sysent[200];
  
  #ifdef AFS_USR_OSF_ENV
***************
*** 254,274 ****
   * We do not support the inode related system calls
   */
  int
! afs_syscall_icreate(void)
  {
      usr_assert(0);
      return 0;
  }
  
  int
! afs_syscall_iincdec(void)
  {
      usr_assert(0);
      return 0;
  }
  
  int
! afs_syscall_iopen(void)
  {
      usr_assert(0);
      return 0;
--- 254,274 ----
   * We do not support the inode related system calls
   */
  int
! afs_syscall_icreate(long a, long b, long c, long d, long e, long f)
  {
      usr_assert(0);
      return 0;
  }
  
  int
! afs_syscall_iincdec(int dev, int inode, int inode_p1, int amount)
  {
      usr_assert(0);
      return 0;
  }
  
  int
! afs_syscall_iopen(int dev, int inode, int usrmod)
  {
      usr_assert(0);
      return 0;
***************
*** 1561,1567 ****
  	cacheStatEntries = cacheStatEntriesParam;
      }
      strcpy(cacheBaseDir, cacheBaseDirParam);
!     if (nDaemons != 0) {
  	nDaemons = nDaemonsParam;
      } else {
  	nDaemons = 3;
--- 1561,1567 ----
  	cacheStatEntries = cacheStatEntriesParam;
      }
      strcpy(cacheBaseDir, cacheBaseDirParam);
!     if (nDaemonsParam != 0) {
  	nDaemons = nDaemonsParam;
      } else {
  	nDaemons = 3;
***************
*** 1846,1852 ****
  			 (long)pathname_for_V[currVFile], 0, 0, 0);
  	}
      /*end for */
! #ifndef NETSCAPE_NSAPI
      /*
       * Copy our tokens from the kernel to the user space client
       */
--- 1846,1856 ----
  			 (long)pathname_for_V[currVFile], 0, 0, 0);
  	}
      /*end for */
! /*#ifndef NETSCAPE_NSAPI*/
! #if 0
! /* this breaks solaris if the kernel-mode client has never been installed,
!  * and it doesn't seem to work now anyway, so just disable it */
! 
      /*
       * Copy our tokens from the kernel to the user space client
       */
***************
*** 2691,2696 ****
--- 2695,2701 ----
  		errno = code;
  		return -1;
  	    }
+ 	    fileP = AFSTOV(vc);
  	} else {
  	    fileP = NULL;
  	    code = uafs_LookupName(nameP, dirP, &fileP, 1, 0);
***************
*** 2763,2768 ****
--- 2768,2774 ----
       */
      if ((flags & O_TRUNC) && (attrs.va_size != 0)) {
  	usr_vattr_null(&attrs);
+ 	attrs.va_mask = ATTR_SIZE;
  	attrs.va_size = 0;
  	code = afs_setattr(VTOAFS(fileP), &attrs, u.u_cred);
  	if (code != 0) {
***************
*** 2834,2846 ****
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_write_r(fd, buf, len);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_write_r(int fd, char *buf, int len)
  {
      int code;
      struct usr_uio uio;
--- 2840,2862 ----
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_pwrite_r(fd, buf, len, afs_FileOffsets[fd]);
!     AFS_GUNLOCK();
!     return retval;
! }
! 
! int
! uafs_pwrite(int fd, char *buf, int len, off_t offset)
! {
!     int retval;
!     AFS_GLOCK();
!     retval = uafs_pwrite_r(fd, buf, len, offset);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_pwrite_r(int fd, char *buf, int len, off_t offset)
  {
      int code;
      struct usr_uio uio;
***************
*** 2863,2869 ****
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = afs_FileOffsets[fd];
      uio.uio_segflg = 0;
      uio.uio_fmode = FWRITE;
      uio.uio_resid = len;
--- 2879,2885 ----
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = offset;
      uio.uio_segflg = 0;
      uio.uio_fmode = FWRITE;
      uio.uio_resid = len;
***************
*** 2890,2902 ****
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_read_r(fd, buf, len);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_read_r(int fd, char *buf, int len)
  {
      int code;
      struct usr_uio uio;
--- 2906,2928 ----
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_pread_r(fd, buf, len, afs_FileOffsets[fd]);
!     AFS_GUNLOCK();
!     return retval;
! }
! 
! int
! uafs_pread(int fd, char *buf, int len, off_t offset)
! {
!     int retval;
!     AFS_GLOCK();
!     retval = uafs_pread_r(fd, buf, len, offset);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_pread_r(int fd, char *buf, int len, off_t offset)
  {
      int code;
      struct usr_uio uio;
***************
*** 2920,2926 ****
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = afs_FileOffsets[fd];
      uio.uio_segflg = 0;
      uio.uio_fmode = FREAD;
      uio.uio_resid = len;
--- 2946,2952 ----
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = offset;
      uio.uio_segflg = 0;
      uio.uio_fmode = FREAD;
      uio.uio_resid = len;
***************
*** 3104,3109 ****
--- 3130,3136 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_MODE;
      attrs.va_mode = mode;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      VN_RELE(vp);
***************
*** 3140,3145 ****
--- 3167,3173 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_MODE;
      attrs.va_mode = mode;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      if (code != 0) {
***************
*** 3175,3180 ****
--- 3203,3209 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_SIZE;
      attrs.va_size = length;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      VN_RELE(vp);
***************
*** 3211,3216 ****
--- 3240,3246 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_SIZE;
      attrs.va_size = length;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      if (code != 0) {
Index: openafs/src/afs/UKERNEL/afs_usrops.h
diff -c openafs/src/afs/UKERNEL/afs_usrops.h:1.5 openafs/src/afs/UKERNEL/afs_usrops.h:1.5.14.1
*** openafs/src/afs/UKERNEL/afs_usrops.h:1.5	Tue May  4 05:31:11 2004
--- openafs/src/afs/UKERNEL/afs_usrops.h	Mon Dec 29 16:26:12 2008
***************
*** 61,67 ****
  extern struct usr_vnode *afs_CurrentDir;
  extern struct usr_vnode *afs_FileTable[];
  extern int afs_FileFlags[];
! extern int afs_FileOffsets[];
  
  extern char afs_mountDir[];
  extern int afs_mountDirLen;
--- 61,67 ----
  extern struct usr_vnode *afs_CurrentDir;
  extern struct usr_vnode *afs_FileTable[];
  extern int afs_FileFlags[];
! extern off_t afs_FileOffsets[];
  
  extern char afs_mountDir[];
  extern int afs_mountDirLen;
***************
*** 90,98 ****
  extern int uafs_creat(char *path, int mode);
  extern int uafs_creat_r(char *path, int mode);
  extern int uafs_write(int fd, char *buf, int len);
! extern int uafs_write_r(int fd, char *buf, int len);
  extern int uafs_read(int fd, char *buf, int len);
! extern int uafs_read_r(int fd, char *buf, int len);
  extern int uafs_fsync(int fd);
  extern int uafs_fsync_r(int fd);
  extern int uafs_close(int fd);
--- 90,100 ----
  extern int uafs_creat(char *path, int mode);
  extern int uafs_creat_r(char *path, int mode);
  extern int uafs_write(int fd, char *buf, int len);
! extern int uafs_pwrite(int fd, char *buf, int len, off_t offset);
! extern int uafs_pwrite_r(int fd, char *buf, int len, off_t offset);
  extern int uafs_read(int fd, char *buf, int len);
! extern int uafs_pread(int fd, char *buf, int leni, off_t offset);
! extern int uafs_pread_r(int fd, char *buf, int len, off_t offset);
  extern int uafs_fsync(int fd);
  extern int uafs_fsync_r(int fd);
  extern int uafs_close(int fd);
Index: openafs/src/afs/UKERNEL/osi_vnodeops.c
diff -c openafs/src/afs/UKERNEL/osi_vnodeops.c:1.7 openafs/src/afs/UKERNEL/osi_vnodeops.c:1.7.14.1
*** openafs/src/afs/UKERNEL/osi_vnodeops.c:1.7	Tue Jul 15 19:14:29 2003
--- openafs/src/afs/UKERNEL/osi_vnodeops.c	Sat Nov 29 13:20:27 2008
***************
*** 11,44 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/osi_vnodeops.c,v 1.7 2003/07/15 23:14:29 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
  #include "afs/afs_stats.h"	/* statistics */
! 
! extern int afs_noop();
! extern int afs_badop();
! 
! extern int afs_open();
! extern int afs_close();
! extern int afs_getattr();
! extern int afs_setattr();
! extern int afs_access();
! extern int afs_lookup();
! extern int afs_create();
! extern int afs_remove();
! extern int afs_link();
! extern int afs_rename();
! extern int afs_mkdir();
! extern int afs_rmdir();
! extern int afs_readdir();
! extern int afs_symlink();
! extern int afs_readlink();
! extern int afs_fsync();
! extern int afs_lockctl();
! extern int afs_fid();
! 
  int
  afs_vrdwr(struct usr_vnode *avc, struct usr_uio *uio, int rw, int io,
  	  struct usr_ucred *cred)
--- 11,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/osi_vnodeops.c,v 1.7.14.1 2008/11/29 18:20:27 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
  #include "afs/afs_stats.h"	/* statistics */
!     
  int
  afs_vrdwr(struct usr_vnode *avc, struct usr_uio *uio, int rw, int io,
  	  struct usr_ucred *cred)
Index: openafs/src/afs/UKERNEL/sysincludes.h
diff -c openafs/src/afs/UKERNEL/sysincludes.h:1.15.14.2 openafs/src/afs/UKERNEL/sysincludes.h:1.15.14.4
*** openafs/src/afs/UKERNEL/sysincludes.h:1.15.14.2	Thu Nov  9 19:11:08 2006
--- openafs/src/afs/UKERNEL/sysincludes.h	Mon Dec 29 16:26:12 2008
***************
*** 1017,1038 ****
      unsigned long f_files;
  };
  
  struct usr_vattr {
!     long va_mask;
      usr_vtype_t va_type;
!     unsigned short va_mode;
!     long va_uid;
!     long va_gid;
!     unsigned long va_fsid;
!     unsigned long va_nodeid;
!     unsigned long va_nlink;
!     unsigned long va_size;
      struct timeval va_atime;
      struct timeval va_mtime;
      struct timeval va_ctime;
!     unsigned long va_rdev;
      unsigned long va_blocksize;
!     unsigned long va_blocks;
      unsigned long va_vcode;
  };
  
--- 1017,1044 ----
      unsigned long f_files;
  };
  
+ #define ATTR_MODE	(1 << 0)
+ #define ATTR_UID	(1 << 1)
+ #define ATTR_GID	(1 << 2)
+ #define ATTR_MTIME	(1 << 3)
+ #define ATTR_SIZE	(1 << 4)
+ 
  struct usr_vattr {
!     int va_mask;	/* bitmask of ATTR_* values above */
      usr_vtype_t va_type;
!     mode_t va_mode;
!     uid_t va_uid;
!     gid_t va_gid;
!     int va_fsid;
!     ino_t va_nodeid;
!     nlink_t va_nlink;
!     afs_size_t va_size;
      struct timeval va_atime;
      struct timeval va_mtime;
      struct timeval va_ctime;
!     dev_t va_rdev;
      unsigned long va_blocksize;
!     blkcnt_t va_blocks;
      unsigned long va_vcode;
  };
  
***************
*** 1092,1098 ****
  	unsigned long ic_spare[4];
      } i_ic;
  };
- extern struct usr_inode *iget();
  
  struct usr_fileops {
      int (*vno_rw) (void);
--- 1098,1103 ----
***************
*** 1109,1115 ****
      char *f_data;
      long f_type;
  };
! extern struct usr_file *falloc();
  extern struct usr_file *getf(int);
  
  #ifdef	fid_len
--- 1114,1120 ----
      char *f_data;
      long f_type;
  };
! 
  extern struct usr_file *getf(int);
  
  #ifdef	fid_len
***************
*** 1200,1232 ****
  #define NDIRSIZ_LEN(len) \
  ((sizeof (struct usr_dirent)+4 - (MAXNAMLEN+1)) + (((len)+1 + 3) &~ 3))
  
  struct usr_vnodeops {
      int (*vn_open) (char *path, int flags, int mode);
      int (*vn_close) (int fd);
!     int (*vn_rdwr) ();
      int (*vn_ioctl) (void);
      int (*vn_select) (void);
!     int (*vn_getattr) ();
!     int (*vn_setattr) ();
!     int (*vn_access) ();
!     int (*vn_lookup) ();
!     int (*vn_create) ();
!     int (*vn_remove) ();
!     int (*vn_link) ();
!     int (*vn_rename) ();
!     int (*vn_mkdir) ();
!     int (*vn_rmdir) ();
!     int (*vn_readdir) ();
!     int (*vn_symlink) ();
!     int (*vn_readlink) ();
!     int (*vn_fsync) ();
!     int (*vn_inactive) ();
!     int (*vn_bmap) ();
!     int (*vn_strategy) ();
!     int (*vn_bread) ();
!     int (*vn_brelse) ();
!     int (*vn_lockctl) ();
!     int (*vn_fid) ();
  };
  
  struct usr_fs {
--- 1205,1250 ----
  #define NDIRSIZ_LEN(len) \
  ((sizeof (struct usr_dirent)+4 - (MAXNAMLEN+1)) + (((len)+1 + 3) &~ 3))
  
+ struct vcache;
+ #define AFS_UCRED usr_ucred
+ #define AFS_FLOCK       flock
+ 
+ 
  struct usr_vnodeops {
      int (*vn_open) (char *path, int flags, int mode);
      int (*vn_close) (int fd);
!     int (*vn_rdwr) (struct usr_vnode *avc, struct usr_uio *uio, 
! 		    int rw, int io, struct usr_ucred *cred);
      int (*vn_ioctl) (void);
      int (*vn_select) (void);
!     int (*vn_getattr) (struct vcache *avc, struct vattr *, struct AFS_UCRED *);
!     int (*vn_setattr) (struct vcache *avc, struct vattr *, struct AFS_UCRED *);
!     int (*vn_access) (struct vcache *avc, afs_int32, struct AFS_UCRED *);
!     int (*vn_lookup) (struct vcache *adp, char *, struct vcache **, 
! 		      struct AFS_UCRED *, int);
!     int (*vn_create) (struct vcache *adp, char *, struct vattr *, 
! 		      enum vcexcl, int, struct vcache **, struct AFS_UCRED *);
!     int (*vn_remove) (struct vcache *adp, char *, struct AFS_UCRED *);
!     int (*vn_link) (struct vcache *avc, struct vcache *adp, char *, 
! 		    struct AFS_UCRED *);
!     int (*vn_rename) (struct vcache *aodp, char *, struct vcache *, char *,
! 		      struct AFS_UCRED *);
!     int (*vn_mkdir) (struct vcache *adp, char *, struct vattr *, 
! 		     struct vcache **, struct AFS_UCRED *);
!     int (*vn_rmdir) (struct vcache *adp, char *, struct AFS_UCRED *);
!     int (*vn_readdir) (struct vcache *avc, struct uio *, struct AFS_UCRED *);
!     int (*vn_symlink) (struct vcache *adp, char *, struct vattr *, char *,
! 		       struct AFS_UCRED *);
!     int (*vn_readlink) (struct vcache *avc, struct uio *, struct AFS_UCRED *);
!     int (*vn_fsync) (struct vcache *avc, struct AFS_UCRED *);
!     int (*vn_inactive) (struct vcache *avc, struct AFS_UCRED *acred);
!     int (*vn_bmap) (void);
!     int (*vn_strategy) (void);
!     int (*vn_bread) (void);
!     int (*vn_brelse) (void);
!     int (*vn_lockctl) (struct vcache *, struct AFS_FLOCK *, int,
! 		       struct AFS_UCRED *);
!     int (*vn_fid) (struct vcache *avc, struct fid **);
  };
  
  struct usr_fs {
***************
*** 1245,1256 ****
  typedef long usr_whymountroot_t;
  
  struct usr_vfsops {
!     int (*vfs_mount) ();
!     int (*vfs_unmount) ();
!     int (*vfs_root) ();
!     int (*vfs_statfs) ();
!     int (*vfs_mountroot) ();
!     int (*vfs_swapvp) ();
  };
  
  struct usr_vfs {
--- 1263,1274 ----
  typedef long usr_whymountroot_t;
  
  struct usr_vfsops {
!     int (*vfs_mount) (struct vfs *, char *, caddr_t);
!     int (*vfs_unmount) (struct vfs *);
!     int (*vfs_root) (struct vfs *, struct vnode **);
!     int (*vfs_statfs) (struct vfs *, struct statfs *);
!     int (*vfs_mountroot) (struct vfs *);
!     int (*vfs_swapvp) (void);
  };
  
  struct usr_vfs {
***************
*** 1266,1272 ****
  
  struct usr_sysent {
      char sy_narg;
!     int (*sy_call) ();
  };
  extern struct usr_sysent usr_sysent[];
  
--- 1284,1290 ----
  
  struct usr_sysent {
      char sy_narg;
!     int (*sy_call) (void);
  };
  extern struct usr_sysent usr_sysent[];
  
Index: openafs/src/afs/VNOPS/afs_vnop_access.c
diff -c openafs/src/afs/VNOPS/afs_vnop_access.c:1.11.8.7 openafs/src/afs/VNOPS/afs_vnop_access.c:1.11.8.8
*** openafs/src/afs/VNOPS/afs_vnop_access.c:1.11.8.7	Mon Sep 22 15:29:55 2008
--- openafs/src/afs/VNOPS/afs_vnop_access.c	Sat Nov 29 13:20:27 2008
***************
*** 23,29 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_access.c,v 1.11.8.7 2008/09/22 19:29:55 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 23,29 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_access.c,v 1.11.8.8 2008/11/29 18:20:27 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 77,83 ****
  	 * _is_ cached, obviously), make sure this user has valid tokens
  	 * before bothering with the RPC.  */
  	struct unixuser *tu;
- 	extern struct unixuser *afs_FindUser();
  	tu = afs_FindUser(areq->uid, avc->fid.Cell, READ_LOCK);
  	if (!tu) {
  	    return (arights & avc->anyAccess);
--- 77,82 ----
Index: openafs/src/afs/VNOPS/afs_vnop_attrs.c
diff -c openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.41.2.3 openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.41.2.5
*** openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.41.2.3	Mon Sep 22 15:29:55 2008
--- openafs/src/afs/VNOPS/afs_vnop_attrs.c	Mon Dec 29 16:26:13 2008
***************
*** 24,30 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.41.2.3 2008/09/22 19:29:55 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 24,30 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.41.2.5 2008/12/29 21:26:13 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 192,198 ****
  {
      afs_int32 code;
      struct vrequest treq;
-     extern struct unixuser *afs_FindUser();
      struct unixuser *au;
      int inited = 0;
      OSI_VC_CONVERT(avc);
--- 192,197 ----
***************
*** 353,359 ****
  #elif	defined(AFS_AIX_ENV)
  /* Boy, was this machine dependent bogosity hard to swallow????.... */
      if (av->va_mode != -1) {
! #elif	defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_MODE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MODE) {
--- 352,358 ----
  #elif	defined(AFS_AIX_ENV)
  /* Boy, was this machine dependent bogosity hard to swallow????.... */
      if (av->va_mode != -1) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_MODE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MODE) {
***************
*** 372,378 ****
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_gid)) {
! #elif defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_GID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_GID) {
--- 371,377 ----
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_gid)) {
! #elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_GID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_GID) {
***************
*** 392,398 ****
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_uid)) {
! #elif defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_UID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_UID) {
--- 391,397 ----
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_uid)) {
! #elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_UID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_UID) {
***************
*** 412,418 ****
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_modify_time)) {
! #elif	defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_MTIME) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MTIME) {
--- 411,417 ----
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_modify_time)) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_MTIME) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MTIME) {
***************
*** 493,499 ****
       */
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
--- 492,498 ----
       */
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
***************
*** 531,544 ****
  #endif
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
  #elif	defined(AFS_OSF_ENV) || defined(AFS_XBSD_ENV)
      if (attrs->va_size != VNOVAL) {
! #else
      if (attrs->va_size != -1) {
  #endif
  	afs_size_t tsize = attrs->va_size;
  	ObtainWriteLock(&avc->lock, 128);
--- 530,545 ----
  #endif
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
  #elif	defined(AFS_OSF_ENV) || defined(AFS_XBSD_ENV)
      if (attrs->va_size != VNOVAL) {
! #elif	defined(AFS_AIX41_ENV)
      if (attrs->va_size != -1) {
+ #else
+     if (attrs->va_size != ~0) {
  #endif
  	afs_size_t tsize = attrs->va_size;
  	ObtainWriteLock(&avc->lock, 128);
Index: openafs/src/afs/VNOPS/afs_vnop_create.c
diff -c openafs/src/afs/VNOPS/afs_vnop_create.c:1.23.4.6 openafs/src/afs/VNOPS/afs_vnop_create.c:1.23.4.9
*** openafs/src/afs/VNOPS/afs_vnop_create.c:1.23.4.6	Thu Sep 25 05:02:56 2008
--- openafs/src/afs/VNOPS/afs_vnop_create.c	Mon Dec 29 16:26:13 2008
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.23.4.6 2008/09/25 09:02:56 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.23.4.9 2008/12/29 21:26:13 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 224,229 ****
--- 224,231 ----
  		    VATTR_INIT(attrs);
  		    VATTR_SET_SUPPORTED(attrs, va_data_size);
  		    VATTR_SET_ACTIVE(attrs, va_data_size);
+ #elif defined(UKERNEL)
+ 		    attrs->va_mask = ATTR_SIZE;
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
  		    attrs->va_mask = AT_SIZE;
  #else
***************
*** 339,345 ****
--- 341,351 ----
  	    code = afs_lookup(adp, aname, avcp, NULL, 0, NULL, acred);
  #endif /* AFS_SGI64_ENV */
  #else /* SUN5 || SGI */
+ #if defined(UKERNEL)
+ 	    code = afs_lookup(adp, aname, avcp, acred, 0);
+ #else /* UKERNEL */
  	    code = afs_lookup(adp, aname, avcp, acred);
+ #endif /* UKERNEL */
  #endif /* SUN5 || SGI */
  #endif /* !(AFS_OSF_ENV || AFS_DARWIN_ENV) */
  	goto done;
***************
*** 461,468 ****
  		if (!tvc->ddirty_flags ||
  			(tvc->ddirty_flags == VDisconShadowed)) {
  	    	    /* Put it in the list only if it's fresh. */
! 	    	    ObtainWriteLock(&afs_DDirtyVCListLock, 729);
! 	    	    AFS_DISCON_ADD_DIRTY(tvc);
  	    	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  		}
  
--- 467,474 ----
  		if (!tvc->ddirty_flags ||
  			(tvc->ddirty_flags == VDisconShadowed)) {
  	    	    /* Put it in the list only if it's fresh. */
! 		    ObtainWriteLock(&afs_DDirtyVCListLock, 729);
! 	    	    AFS_DISCON_ADD_DIRTY(tvc, 0);
  	    	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  		}
  
Index: openafs/src/afs/VNOPS/afs_vnop_dirops.c
diff -c openafs/src/afs/VNOPS/afs_vnop_dirops.c:1.21.4.4 openafs/src/afs/VNOPS/afs_vnop_dirops.c:1.21.4.5
*** openafs/src/afs/VNOPS/afs_vnop_dirops.c:1.21.4.4	Sun Oct 12 14:10:14 2008
--- openafs/src/afs/VNOPS/afs_vnop_dirops.c	Sun Nov 30 15:06:53 2008
***************
*** 21,27 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.21.4.4 2008/10/12 18:10:14 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 21,27 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.21.4.5 2008/11/30 20:06:53 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 229,235 ****
  
  	    /* Put it in the list only if it's fresh. */
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 730);
! 	    AFS_DISCON_ADD_DIRTY(tvc);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  
--- 229,235 ----
  
  	    /* Put it in the list only if it's fresh. */
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 730);
! 	    AFS_DISCON_ADD_DIRTY(tvc, 1);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  
***************
*** 438,444 ****
  	if (!tvc->ddirty_flags) {
  	    /* Put it in the list only if it's fresh or has only been shadowed. */
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 728);
! 	    AFS_DISCON_ADD_DIRTY(tvc);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  
--- 438,444 ----
  	if (!tvc->ddirty_flags) {
  	    /* Put it in the list only if it's fresh or has only been shadowed. */
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 728);
! 	    AFS_DISCON_ADD_DIRTY(tvc, 1);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  
***************
*** 476,484 ****
  	ObtainWriteLock(&tvc->lock, 155);
  	tvc->states &= ~CUnique;	/* For the dfs xlator */
  	ReleaseWriteLock(&tvc->lock);
! 	/* If disconnected, keep this vcache around for resync. */
! 	if (!AFS_IS_DISCON_RW)
! 	    afs_PutVCache(tvc);
      }
      ReleaseWriteLock(&adp->lock);
      /* don't worry about link count since dirs can not be hardlinked */
--- 476,482 ----
  	ObtainWriteLock(&tvc->lock, 155);
  	tvc->states &= ~CUnique;	/* For the dfs xlator */
  	ReleaseWriteLock(&tvc->lock);
! 	afs_PutVCache(tvc);
      }
      ReleaseWriteLock(&adp->lock);
      /* don't worry about link count since dirs can not be hardlinked */
Index: openafs/src/afs/VNOPS/afs_vnop_link.c
diff -c openafs/src/afs/VNOPS/afs_vnop_link.c:1.19.8.2 openafs/src/afs/VNOPS/afs_vnop_link.c:1.19.8.3
*** openafs/src/afs/VNOPS/afs_vnop_link.c:1.19.8.2	Fri May 23 10:25:16 2008
--- openafs/src/afs/VNOPS/afs_vnop_link.c	Sat Nov 29 13:20:27 2008
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.19.8.2 2008/05/23 14:25:16 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.19.8.3 2008/11/29 18:20:27 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 33,46 ****
  
  int
  #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
! afs_link(OSI_VC_ARG(adp), avc, aname, acred)
  #else
! afs_link(avc, OSI_VC_ARG(adp), aname, acred)
  #endif
-      OSI_VC_DECL(adp);
-      struct vcache *avc;
-      char *aname;
-      struct AFS_UCRED *acred;
  {
      struct vrequest treq;
      register struct dcache *tdc;
--- 33,44 ----
  
  int
  #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
! afs_link(OSI_VC_DECL(adp), struct vcache *avc, char *aname, 
! 	 struct AFS_UCRED *acred)
  #else
! afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, 
! 	 struct AFS_UCRED *acred)
  #endif
  {
      struct vrequest treq;
      register struct dcache *tdc;
Index: openafs/src/afs/VNOPS/afs_vnop_readdir.c
diff -c openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.33.4.1 openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.33.4.2
*** openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.33.4.1	Fri May 23 10:25:16 2008
--- openafs/src/afs/VNOPS/afs_vnop_readdir.c	Sat Nov 29 13:20:27 2008
***************
*** 23,29 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.33.4.1 2008/05/23 14:25:16 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 23,29 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.33.4.2 2008/11/29 18:20:27 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 38,49 ****
  #else
  #define DIRPAD 3
  #endif
- /**
-  * A few definitions. This is until we have a proper header file
-  * which ahs prototypes for all functions
-  */
  
- extern struct DirEntry *afs_dir_GetBlob();
  /*
   * AFS readdir vnodeop and bulk stat support.
   */
--- 38,44 ----
***************
*** 234,242 ****
  
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  int
! afs_readdir_type(avc, ade)
!      struct DirEntry *ade;
!      struct vcache *avc;
  {
      struct VenusFid tfid;
      struct vcache *tvc;
--- 229,235 ----
  
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  int
! afs_readdir_type(struct vcache *avc, struct DirEntry *ade)
  {
      struct VenusFid tfid;
      struct vcache *tvc;
***************
*** 284,301 ****
  #endif
  char bufofzeros[64];		/* gotta fill with something */
  
- int
- afs_readdir_move(de, vc, auio, slen, rlen, off)
-      struct DirEntry *de;
-      struct vcache *vc;
-      struct uio *auio;
-      int slen;
  #ifdef AFS_SGI65_ENV
!      ssize_t rlen;
  #else
!      int rlen;
  #endif
-      afs_size_t off;
  {
      int code = 0;
      struct volume *tvp;
--- 277,291 ----
  #endif
  char bufofzeros[64];		/* gotta fill with something */
  
  #ifdef AFS_SGI65_ENV
! int
! afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, 
! 		 int slen, ssize_t rlen, afs_size_t off)
  #else
! int
! afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, 
! 		 int slen, int rlen, afs_size_t off)
  #endif
  {
      int code = 0;
      struct volume *tvp;
***************
*** 550,558 ****
   */
  
  void
! afs_bulkstat_send(avc, req)
!      struct vcache *avc;
!      struct vrequest *req;
  {
      afs_rd_stash_i = 0;
  }
--- 540,546 ----
   */
  
  void
! afs_bulkstat_send(struct vcache *avc, struct vrequest *req)
  {
      afs_rd_stash_i = 0;
  }
***************
*** 564,581 ****
  
  int
  #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! afs_readdir(OSI_VC_ARG(avc), auio, acred, eofp)
!      int *eofp;
  #else
  #if defined(AFS_HPUX100_ENV)
! afs_readdir2(OSI_VC_ARG(avc), auio, acred)
  #else
! afs_readdir(OSI_VC_ARG(avc), auio, acred)
  #endif
  #endif
-      OSI_VC_DECL(avc);
-      struct uio *auio;
-      struct AFS_UCRED *acred;
  {
      struct vrequest treq;
      register struct dcache *tdc;
--- 552,566 ----
  
  int
  #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! afs_readdir(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred, 
! 	    int *eofp)
  #else
  #if defined(AFS_HPUX100_ENV)
! afs_readdir2(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred)
  #else
! afs_readdir(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred)
  #endif
  #endif
  {
      struct vrequest treq;
      register struct dcache *tdc;
***************
*** 921,934 ****
  
  #if	defined(AFS_HPUX_ENV) || defined(AFS_OSF_ENV)
  #ifdef	AFS_OSF_ENV
! afs1_readdir(avc, auio, acred, eofp)
!      int *eofp;
  #else
! afs1_readdir(avc, auio, acred)
  #endif
-      struct vcache *avc;
-      struct uio *auio;
-      struct AFS_UCRED *acred;
  {
      struct vrequest treq;
      register struct dcache *tdc;
--- 906,918 ----
  
  #if	defined(AFS_HPUX_ENV) || defined(AFS_OSF_ENV)
  #ifdef	AFS_OSF_ENV
! int
! afs1_readdir(struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred, 
! 	     int *eofp)
  #else
! int
! afs1_readdir(struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred)
  #endif
  {
      struct vrequest treq;
      register struct dcache *tdc;
Index: openafs/src/afs/VNOPS/afs_vnop_remove.c
diff -c openafs/src/afs/VNOPS/afs_vnop_remove.c:1.52.2.6 openafs/src/afs/VNOPS/afs_vnop_remove.c:1.52.2.8
*** openafs/src/afs/VNOPS/afs_vnop_remove.c:1.52.2.6	Mon Sep 22 15:29:55 2008
--- openafs/src/afs/VNOPS/afs_vnop_remove.c	Sun Nov 30 15:06:53 2008
***************
*** 21,27 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.52.2.6 2008/09/22 19:29:55 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 21,27 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.52.2.8 2008/11/30 20:06:53 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 46,55 ****
  afs_Wire(avc, areq)
  #else /* AFS_OSF_ENV */
  static void
! FetchWholeEnchilada(avc, areq)
  #endif
-      struct vrequest *areq;
-      register struct vcache *avc;
  {
      register afs_int32 nextChunk;
      register struct dcache *tdc;
--- 46,53 ----
  afs_Wire(avc, areq)
  #else /* AFS_OSF_ENV */
  static void
! FetchWholeEnchilada(register struct vcache *avc, struct vrequest *areq)
  #endif
  {
      register afs_int32 nextChunk;
      register struct dcache *tdc;
***************
*** 86,93 ****
   *  Tests whether file is wired down, after unwiring the file if it
   *  is found to be inactive (ie not open and not being paged from).
   */
! afs_IsWired(avc)
!      register struct vcache *avc;
  {
      if (avc->states & CWired) {
  	if (osi_Active(avc)) {
--- 84,90 ----
   *  Tests whether file is wired down, after unwiring the file if it
   *  is found to be inactive (ie not open and not being paged from).
   */
! afs_IsWired(register struct vcache *avc)
  {
      if (avc->states & CWired) {
  	if (osi_Active(avc)) {
***************
*** 187,197 ****
  #ifdef AFS_BOZONLOCK_ENV
  	afs_BozonUnlock(&tvc->pvnLock, tvc);
  #endif
! 	/* Don't decrease refcount for this vcache if disconnected, we will
! 	 * need it during replay.
! 	 */
! 	if (!AFS_IS_DISCON_RW)
! 	    afs_PutVCache(tvc);
      }
      return (0);
  }
--- 184,190 ----
  #ifdef AFS_BOZONLOCK_ENV
  	afs_BozonUnlock(&tvc->pvnLock, tvc);
  #endif
! 	afs_PutVCache(tvc);
      }
      return (0);
  }
***************
*** 222,231 ****
  /* Note that we don't set CDirty here, this is OK because the unlink
   * RPC is called synchronously */
  int
! afs_remove(OSI_VC_ARG(adp), aname, acred)
!      OSI_VC_DECL(adp);
!      char *aname;
!      struct AFS_UCRED *acred;
  {
      struct vrequest treq;
      register struct dcache *tdc;
--- 215,221 ----
  /* Note that we don't set CDirty here, this is OK because the unlink
   * RPC is called synchronously */
  int
! afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred)
  {
      struct vrequest treq;
      register struct dcache *tdc;
***************
*** 380,386 ****
  		(tvc->ddirty_flags == VDisconShadowed)) {
  	    /* Add to list only if fresh. */
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 725);
! 	    AFS_DISCON_ADD_DIRTY(tvc);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  
--- 370,376 ----
  		(tvc->ddirty_flags == VDisconShadowed)) {
  	    /* Add to list only if fresh. */
  	    ObtainWriteLock(&afs_DDirtyVCListLock, 725);
! 	    AFS_DISCON_ADD_DIRTY(tvc, 1);
  	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  	}
  
Index: openafs/src/afs/VNOPS/afs_vnop_rename.c
diff -c openafs/src/afs/VNOPS/afs_vnop_rename.c:1.28.4.3 openafs/src/afs/VNOPS/afs_vnop_rename.c:1.28.4.5
*** openafs/src/afs/VNOPS/afs_vnop_rename.c:1.28.4.3	Mon Sep 22 15:29:55 2008
--- openafs/src/afs/VNOPS/afs_vnop_rename.c	Sun Nov 30 15:11:19 2008
***************
*** 18,24 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.28.4.3 2008/09/22 19:29:55 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 18,24 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.28.4.5 2008/11/30 20:11:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 230,237 ****
  			(tvc->ddirty_flags == VDisconShadowed)) {
  	    	    /* Add in dirty list.*/
  	 	    ObtainWriteLock(&afs_DDirtyVCListLock, 751);
! 	    	    AFS_DISCON_ADD_DIRTY(tvc);
! 	    	    ReleaseWriteLock(&afs_DDirtyVCListLock);
  		}
  
  	    	ObtainWriteLock(&tvc->lock, 750);
--- 230,237 ----
  			(tvc->ddirty_flags == VDisconShadowed)) {
  	    	    /* Add in dirty list.*/
  	 	    ObtainWriteLock(&afs_DDirtyVCListLock, 751);
! 		    AFS_DISCON_ADD_DIRTY(tvc, 1);
! 		    ReleaseWriteLock(&afs_DDirtyVCListLock);
  		}
  
  	    	ObtainWriteLock(&tvc->lock, 750);
***************
*** 246,251 ****
--- 246,253 ----
  		    tvc->ddirty_flags |= VDisconRenameSameDir;
  	    	ReleaseWriteLock(&tvc->lock);
  	    }			/* if not previously renamed */
+ 
+ 	    afs_PutVCache(tvc);
  	} else {
  	    code = ENOENT;
  	}			/* if (tvc) */
Index: openafs/src/afs/VNOPS/afs_vnop_strategy.c
diff -c openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.22 openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.22.4.1
*** openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.22	Thu Oct 13 11:12:08 2005
--- openafs/src/afs/VNOPS/afs_vnop_strategy.c	Sat Nov 29 13:20:27 2008
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.22 2005/10/13 15:12:08 shadow Exp $");
  
  #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
  
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.22.4.1 2008/11/29 18:20:27 shadow Exp $");
  
  #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
  
***************
*** 29,42 ****
  
  
  
- int
  #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! afs_ustrategy(abp, credp)
!      struct AFS_UCRED *credp;
  #else
! afs_ustrategy(abp)
  #endif
-      register struct buf *abp;
  {
      register afs_int32 code;
      struct uio tuio;
--- 29,39 ----
  
  
  
  #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
! int afs_ustrategy(register struct buf *abp, struct AFS_UCRED *credp)
  #else
! int afs_ustrategy(register struct buf *abp)
  #endif
  {
      register afs_int32 code;
      struct uio tuio;
Index: openafs/src/afs/VNOPS/afs_vnop_symlink.c
diff -c openafs/src/afs/VNOPS/afs_vnop_symlink.c:1.24.4.7 openafs/src/afs/VNOPS/afs_vnop_symlink.c:1.24.4.8
*** openafs/src/afs/VNOPS/afs_vnop_symlink.c:1.24.4.7	Sat Nov  8 11:34:42 2008
--- openafs/src/afs/VNOPS/afs_vnop_symlink.c	Sat Nov 29 13:20:27 2008
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.24.4.7 2008/11/08 16:34:42 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.24.4.8 2008/11/29 18:20:27 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 41,53 ****
  
  
  /* don't set CDirty in here because RPC is called synchronously */
! int afs_symlink
!   (OSI_VC_ARG(adp), aname, attrs, atargetName, acred)
!      OSI_VC_DECL(adp);
!      char *atargetName;
!      char *aname;
!      struct vattr *attrs;
!      struct AFS_UCRED *acred;
  {
      afs_uint32 now = 0;
      struct vrequest treq;
--- 41,49 ----
  
  
  /* don't set CDirty in here because RPC is called synchronously */
! int 
! afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, 
! 	    char *atargetName, struct AFS_UCRED *acred)
  {
      afs_uint32 now = 0;
      struct vrequest treq;
***************
*** 360,369 ****
  }
  
  int
! afs_readlink(OSI_VC_ARG(avc), auio, acred)
!      OSI_VC_DECL(avc);
!      struct uio *auio;
!      struct AFS_UCRED *acred;
  {
      register afs_int32 code;
      struct vrequest treq;
--- 356,362 ----
  }
  
  int
! afs_readlink(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred)
  {
      register afs_int32 code;
      struct vrequest treq;
Index: openafs/src/afs/VNOPS/afs_vnop_write.c
diff -c openafs/src/afs/VNOPS/afs_vnop_write.c:1.50.2.5 openafs/src/afs/VNOPS/afs_vnop_write.c:1.50.2.8
*** openafs/src/afs/VNOPS/afs_vnop_write.c:1.50.2.5	Sat Nov  8 11:34:42 2008
--- openafs/src/afs/VNOPS/afs_vnop_write.c	Tue Dec 16 16:05:35 2008
***************
*** 21,27 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.50.2.5 2008/11/08 16:34:42 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 21,27 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.50.2.8 2008/12/16 21:05:35 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 91,99 ****
  
  	if (!avc->ddirty_flags ||
  		(avc->ddirty_flags == VDisconShadowed)) {
    	    /* Add to disconnected dirty list. */
! 	    AFS_DISCON_ADD_DIRTY(avc);
!   	}
  
  	/* Set disconnected write flag. */
  	avc->ddirty_flags |= VDisconWriteClose;
--- 91,100 ----
  
  	if (!avc->ddirty_flags ||
  		(avc->ddirty_flags == VDisconShadowed)) {
+ 
    	    /* Add to disconnected dirty list. */
! 	    AFS_DISCON_ADD_DIRTY(avc, 1);
! 	}
  
  	/* Set disconnected write flag. */
  	avc->ddirty_flags |= VDisconWriteClose;
***************
*** 850,882 ****
  
  /* handle any closing cleanup stuff */
  int
! #ifdef	AFS_SGI_ENV
! afs_close(OSI_VC_ARG(avc), aflags, lastclose,
! #if !defined(AFS_SGI65_ENV)
! 	  offset,
! #endif
! 	  acred
! #if defined(AFS_SGI64_ENV) && !defined(AFS_SGI65_ENV)
! 	  , flp
! #endif
!     )
!      lastclose_t lastclose;
! #if !defined(AFS_SGI65_ENV)
!      off_t offset;
! #if defined(AFS_SGI64_ENV)
!      struct flid *flp;
! #endif
! #endif
  #elif defined(AFS_SUN5_ENV)
! afs_close(OSI_VC_ARG(avc), aflags, count, offset, acred)
!      offset_t offset;
!      int count;
! #else
! afs_close(OSI_VC_ARG(avc), aflags, acred)
! #endif
!      OSI_VC_DECL(avc);
!      afs_int32 aflags;
!      struct AFS_UCRED *acred;
  {
      register afs_int32 code;
      register struct brequest *tb;
--- 851,871 ----
  
  /* handle any closing cleanup stuff */
  int
! #if defined(AFS_SGI65_ENV)
! afs_close(OSI_VC_DECL(avc), afs_int32 aflags, lastclose_t lastclose,
! 	  struct AFS_UCRED *acred)
! #elif defined(AFS_SGI64_ENV)
! afs_close(OSI_VC_DECL(avc), afs_int32 aflags, lastclose_t lastclose,
! 	  off_t offset, struct AFS_UCRED *acred, struct flid *flp)
! #elif defined(AFS_SGI_ENV)
! afs_close(OSI_VC_DECL(avc), afs_int32 aflags, lastclose_t lastclose
! 	  off_t offset, struct AFS_UCRED *acred)
  #elif defined(AFS_SUN5_ENV)
! afs_close(OSI_VC_DECL(avc), afs_int32 aflags, int count, offset_t offset, 
! 	 struct AFS_UCRED *acred)
! #else
! afs_close(OSI_VC_DECL(avc), afs_int32 aflags, struct AFS_UCRED *acred)
! #endif
  {
      register afs_int32 code;
      register struct brequest *tb;
***************
*** 1102,1108 ****
  	    	(avc->ddirty_flags == VDisconShadowed)) {
  
  		/* Add to disconnected dirty list. */
! 		AFS_DISCON_ADD_DIRTY(avc);
  	    }
  
  	    UpgradeSToWLock(&avc->lock, 711);
--- 1091,1097 ----
  	    	(avc->ddirty_flags == VDisconShadowed)) {
  
  		/* Add to disconnected dirty list. */
! 		AFS_DISCON_ADD_DIRTY(avc, 1);
  	    }
  
  	    UpgradeSToWLock(&avc->lock, 711);
Index: openafs/src/audit/audit.c
diff -c openafs/src/audit/audit.c:1.20.2.5 openafs/src/audit/audit.c:1.20.2.8
*** openafs/src/audit/audit.c:1.20.2.5	Fri Jan  5 18:06:55 2007
--- openafs/src/audit/audit.c	Sun Dec 21 00:47:25 2008
***************
*** 11,21 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/audit/audit.c,v 1.20.2.5 2007/01/05 23:06:55 shadow Exp $");
  
  #include <fcntl.h>
  #include <stdarg.h>
  #include <string.h>
  #ifdef AFS_AIX32_ENV
  #include <sys/audit.h>
  #else
--- 11,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/audit/audit.c,v 1.20.2.8 2008/12/21 05:47:25 jaltman Exp $");
  
  #include <fcntl.h>
  #include <stdarg.h>
  #include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #ifndef AFS_NT40_ENV
+ #include <unistd.h>
+ #else
+ #include <io.h>
+ #endif
  #ifdef AFS_AIX32_ENV
  #include <sys/audit.h>
  #else
***************
*** 233,256 ****
  	    break;
  	case AUD_FIDS:		/* array of Fids */
  	    vaFids = va_arg(vaList, struct AFSCBFids *);
- 	    vaFid = NULL;
  
  	    if (vaFids) {
                  int i;
!                 if (vaFid)
                      fprintf(out, "FIDS %u FID %u:%u:%u ", vaFids->AFSCBFids_len, vaFid->Volume,
                               vaFid->Vnode, vaFid->Unique);
!                 else
                      fprintf(out, "FIDS 0 FID 0:0:0 ");
  
-                 for ( i = 1; i < vaFids->AFSCBFids_len; i++ ) {
-                     vaFid = vaFids->AFSCBFids_val;
-                     if (vaFid)
-                         fprintf(out, "FID %u:%u:%u ", vaFid->Volume,
-                                  vaFid->Vnode, vaFid->Unique);
-                     else
-                         fprintf(out, "FID 0:0:0 ");
-                 }
              }
  	    break;
  	default:
--- 240,260 ----
  	    break;
  	case AUD_FIDS:		/* array of Fids */
  	    vaFids = va_arg(vaList, struct AFSCBFids *);
  
  	    if (vaFids) {
                  int i;
!                 
!                 vaFid = vaFids->AFSCBFids_val;
!                 
!                 if (vaFid) {
                      fprintf(out, "FIDS %u FID %u:%u:%u ", vaFids->AFSCBFids_len, vaFid->Volume,
                               vaFid->Vnode, vaFid->Unique);
!                     for ( i = 1; i < vaFids->AFSCBFids_len; i++, vaFid++ ) 
!                         fprintf(out, "FID %u:%u:%u ", vaFid->Volume,
!                                 vaFid->Vnode, vaFid->Unique);
!                 } else
                      fprintf(out, "FIDS 0 FID 0:0:0 ");
  
              }
  	    break;
  	default:
***************
*** 558,565 ****
  }
  
  int
! osi_audit_file(FILE *out)
  {
!     auditout = out;
      return 0;
  }
--- 562,596 ----
  }
  
  int
! osi_audit_file(char *fileName)
  {
!     int tempfd, flags;
!     char oldName[MAXPATHLEN];
!     
! #ifndef AFS_NT40_ENV
!     struct stat statbuf;
!     
!     if ((lstat(fileName, &statbuf) == 0)
!         && (S_ISFIFO(statbuf.st_mode))) {
!         flags = O_WRONLY | O_NONBLOCK;
!     } else 
! #endif
!     {
!         strcpy(oldName, fileName);
!         strcat(oldName, ".old");
!         renamefile(fileName, oldName);
!         flags = O_WRONLY | O_TRUNC | O_CREAT;
!     }
!     tempfd = open(fileName, flags, 0666);
!     if (tempfd > -1) {
!         auditout = fdopen(tempfd, "a");
!         if (!auditout) {
!             printf("Warning: auditlog %s not writable, ignored.\n", fileName);
!             return 1;
!         }
!     } else { 
!         printf("Warning: auditlog %s not writable, ignored.\n", fileName);
!         return 1;
!     }
      return 0;
  }
Index: openafs/src/audit/audit.h
diff -c openafs/src/audit/audit.h:1.10 openafs/src/audit/audit.h:1.10.4.1
*** openafs/src/audit/audit.h:1.10	Mon Nov 14 01:04:24 2005
--- openafs/src/audit/audit.h	Wed Dec 17 13:14:59 2008
***************
*** 291,296 ****
  /* prototypes for audit functions */
  int osi_audit(char *audEvent, afs_int32 errCode, ...);
  int osi_auditU(struct rx_call *call, char *audEvent, int errCode, ...);
! int osi_audit_file(FILE *out);
  void osi_audit_init(void);
  
--- 291,296 ----
  /* prototypes for audit functions */
  int osi_audit(char *audEvent, afs_int32 errCode, ...);
  int osi_auditU(struct rx_call *call, char *audEvent, int errCode, ...);
! int osi_audit_file(char *filename);
  void osi_audit_init(void);
  
Index: openafs/src/auth/cellconfig.c
diff -c openafs/src/auth/cellconfig.c:1.47.2.15 openafs/src/auth/cellconfig.c:1.47.2.16
*** openafs/src/auth/cellconfig.c:1.47.2.15	Thu Jun 26 12:48:30 2008
--- openafs/src/auth/cellconfig.c	Sat Nov 29 13:08:53 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.47.2.15 2008/06/26 16:48:30 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.47.2.16 2008/11/29 18:08:53 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
***************
*** 1328,1334 ****
  
  /* get a particular key */
  int
! afsconf_GetKey(void *rock, afs_int32 avno, struct ktc_encryptionKey *akey)
  {
      struct afsconf_dir *adir = (struct afsconf_dir *) rock;
      register int i, maxa;
--- 1328,1334 ----
  
  /* get a particular key */
  int
! afsconf_GetKey(void *rock, int avno, struct ktc_encryptionKey *akey)
  {
      struct afsconf_dir *adir = (struct afsconf_dir *) rock;
      register int i, maxa;
Index: openafs/src/auth/cellconfig.p.h
diff -c openafs/src/auth/cellconfig.p.h:1.11.14.3 openafs/src/auth/cellconfig.p.h:1.11.14.4
*** openafs/src/auth/cellconfig.p.h:1.11.14.3	Sat Jul 19 01:47:17 2008
--- openafs/src/auth/cellconfig.p.h	Sat Nov 29 13:08:53 2008
***************
*** 128,134 ****
  extern afs_int32 afsconf_GetLatestKey(struct afsconf_dir *adir,
  				      afs_int32 * avno, 
  				      struct ktc_encryptionKey *akey);
! extern int afsconf_GetKey(void *rock, afs_int32 avno,
  			  struct ktc_encryptionKey *akey);
  extern int afsconf_AddKey(struct afsconf_dir *adir, afs_int32 akvno,
  			  char akey[8], afs_int32 overwrite);
--- 128,134 ----
  extern afs_int32 afsconf_GetLatestKey(struct afsconf_dir *adir,
  				      afs_int32 * avno, 
  				      struct ktc_encryptionKey *akey);
! extern int afsconf_GetKey(void *rock, int avno,
  			  struct ktc_encryptionKey *akey);
  extern int afsconf_AddKey(struct afsconf_dir *adir, afs_int32 akvno,
  			  char akey[8], afs_int32 overwrite);
Index: openafs/src/bozo/bosserver.c
diff -c openafs/src/bozo/bosserver.c:1.32.2.12 openafs/src/bozo/bosserver.c:1.32.2.14
*** openafs/src/bozo/bosserver.c:1.32.2.12	Sat Oct 18 11:09:07 2008
--- openafs/src/bozo/bosserver.c	Wed Dec 17 13:15:01 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bosserver.c,v 1.32.2.12 2008/10/18 15:09:07 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bosserver.c,v 1.32.2.14 2008/12/17 18:15:01 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 840,873 ****
  	    }
  	}
  	else if (strcmp(argv[code], "-auditlog") == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++code];
  
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	}
  	else {
  
--- 840,848 ----
  	    }
  	}
  	else if (strcmp(argv[code], "-auditlog") == 0) {
  	    char *fileName = argv[++code];
  
!             osi_audit_file(fileName);
  	}
  	else {
  
***************
*** 1041,1047 ****
  
      if (rxBind) {
  	afs_int32 ccode;
- #ifndef AFS_NT40_ENV
          if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
              AFSDIR_SERVER_NETINFO_FILEPATH) {
              char reason[1024];
--- 1016,1021 ----
***************
*** 1050,1056 ****
                                             AFSDIR_SERVER_NETINFO_FILEPATH,
                                             AFSDIR_SERVER_NETRESTRICT_FILEPATH);
          } else 
- #endif	
  	{
              ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
          }
--- 1024,1029 ----
Index: openafs/src/budb/server.c
diff -c openafs/src/budb/server.c:1.16.2.10 openafs/src/budb/server.c:1.16.2.13
*** openafs/src/budb/server.c:1.16.2.10	Thu May 29 00:04:25 2008
--- openafs/src/budb/server.c	Mon Dec 22 14:23:17 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.16.2.10 2008/05/29 04:04:25 jaltman Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.16.2.13 2008/12/22 19:23:17 shadow Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
***************
*** 229,261 ****
  	ubik_nBuffers = 0;
  
      if (as->parms[7].items != 0) {
- 	int tempfd, flags;
- 	FILE *auditout;
- 	char oldName[MAXPATHLEN];
  	char *fileName = as->parms[7].items->data;
- #ifndef AFS_NT40_ENV
- 	struct stat statbuf;
  
! 	if ((lstat(fileName, &statbuf) == 0) 
! 	    && (S_ISFIFO(statbuf.st_mode))) {
! 	    flags = O_WRONLY | O_NONBLOCK;
! 	} else 
! #endif
! 	{
! 	    strcpy(oldName, fileName);
! 	    strcat(oldName, ".old");
! 	    renamefile(fileName, oldName);
! 	    flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	}
! 	tempfd = open(fileName, flags, 0666);
! 	if (tempfd > -1) {
! 	    auditout = fdopen(tempfd, "a");
! 	    if (auditout) {
! 		osi_audit_file(auditout);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	} else
! 	    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
      }
  
      /* user provided the number of threads    */
--- 229,237 ----
  	ubik_nBuffers = 0;
  
      if (as->parms[7].items != 0) {
  	char *fileName = as->parms[7].items->data;
  
!         osi_audit_file(fileName);
      }
  
      /* user provided the number of threads    */
***************
*** 542,548 ****
  
      if (rxBind) {
  	afs_int32 ccode;
- #ifndef AFS_NT40_ENV
          if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
              AFSDIR_SERVER_NETINFO_FILEPATH) {
              char reason[1024];
--- 518,523 ----
***************
*** 551,557 ****
                                             AFSDIR_SERVER_NETINFO_FILEPATH,
                                             AFSDIR_SERVER_NETRESTRICT_FILEPATH);
          } else 
- #endif	
  	{
              ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
          }
--- 526,531 ----
***************
*** 564,570 ****
      code = ubik_ServerInitByInfo (globalConfPtr->myHost,
  				  htons(AFSCONF_BUDBPORT), 
  				  &cellinfo,
! 				  &clones,              
  				  dbNamePtr,           /* name prefix */
  				  &BU_dbase);
  
--- 538,544 ----
      code = ubik_ServerInitByInfo (globalConfPtr->myHost,
  				  htons(AFSCONF_BUDBPORT), 
  				  &cellinfo,
! 				  clones,              
  				  dbNamePtr,           /* name prefix */
  				  &BU_dbase);
  
Index: openafs/src/butc/afsxbsa.c
diff -c openafs/src/butc/afsxbsa.c:1.1.2.2 openafs/src/butc/afsxbsa.c:1.1.2.3
*** openafs/src/butc/afsxbsa.c:1.1.2.2	Tue Jul 15 06:32:45 2008
--- openafs/src/butc/afsxbsa.c	Mon Dec 15 17:20:48 2008
***************
*** 648,653 ****
--- 648,655 ----
  #endif
  #if defined(AFS_AIX_ENV)
          dynlib = dlopen("/usr/lib/libApiDS.a(dsmapish.o)", RTLD_NOW | RTLD_LOCAL | RTLD_MEMBER);
+ #elif defined (AFS_AMD64_LINUX26_ENV)
+ 	dynlib = dlopen("/usr/lib64/libApiTSM64.so", RTLD_NOW | RTLD_LOCAL);
  #elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
          dynlib = dlopen("/usr/lib/libApiDS.so", RTLD_NOW | RTLD_LOCAL);
  #else
Index: openafs/src/butc/tcmain.c
diff -c openafs/src/butc/tcmain.c:1.16.8.7 openafs/src/butc/tcmain.c:1.16.8.8
*** openafs/src/butc/tcmain.c:1.16.8.7	Mon Mar 10 18:32:33 2008
--- openafs/src/butc/tcmain.c	Sat Nov 29 13:55:43 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcmain.c,v 1.16.8.7 2008/03/10 22:32:33 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcmain.c,v 1.16.8.8 2008/11/29 18:55:43 jaltman Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
***************
*** 1034,1040 ****
  
      if (rxBind) {
          afs_int32 ccode;
- #ifndef AFS_NT40_ENV
          if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
              AFSDIR_SERVER_NETINFO_FILEPATH) {
              char reason[1024];
--- 1034,1039 ----
***************
*** 1043,1049 ****
                                             AFSDIR_SERVER_NETINFO_FILEPATH,
                                             AFSDIR_SERVER_NETRESTRICT_FILEPATH);
          } else 
- #endif	
  	{
              ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
          }
--- 1042,1047 ----
Index: openafs/src/cf/osconf.m4
diff -c openafs/src/cf/osconf.m4:1.83.2.12 openafs/src/cf/osconf.m4:1.83.2.14
*** openafs/src/cf/osconf.m4:1.83.2.12	Wed Sep  3 14:27:23 2008
--- openafs/src/cf/osconf.m4	Mon Dec 29 12:29:17 2008
***************
*** 240,246 ****
  		SHLIB_LINKER="ld -b"
  		;;
  
! 	*fbsd_*)
  		LEX="flex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
--- 240,246 ----
  		SHLIB_LINKER="ld -b"
  		;;
  
! 	i386_fbsd_*)
  		LEX="flex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
***************
*** 253,258 ****
--- 253,270 ----
  		YACC="byacc"
  		;;
  
+ 	amd64_fbsd_*)
+ 		LEX="flex -l"
+ 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
+ 		MT_LIBS="-pthread"
+ 		PAM_CFLAGS="-O2 -pipe -fPIC"
+ 		SHLIB_LDFLAGS="-shared -Xlinker -x"
+ 		SHLIB_LINKER="${MT_CC} -shared"
+ 		TXLIBS="-lncurses"
+ 		XCFLAGS="-O2 -pipe -fPIC"
+ 		YACC="byacc"
+ 		;;
+ 
  	*nbsd2*|*nbsd3*|*nbsd4*)
  		LEX="flex -l"
  		MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT '
***************
*** 492,498 ****
  		;;
  
  	ppc_darwin_70)
! 		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration"
  		LEX="lex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}'
  		KROOT=
--- 504,510 ----
  		;;
  
  	ppc_darwin_70)
! 		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
  		LEX="lex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}'
  		KROOT=
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.24.2.50 openafs/src/config/NTMakefile.amd64_w2k:1.24.2.51
*** openafs/src/config/NTMakefile.amd64_w2k:1.24.2.50	Fri Nov  7 21:08:36 2008
--- openafs/src/config/NTMakefile.amd64_w2k	Mon Dec 29 23:27:54 2008
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5600
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.84.2.48 openafs/src/config/NTMakefile.i386_nt40:1.84.2.49
*** openafs/src/config/NTMakefile.i386_nt40:1.84.2.48	Fri Nov  7 21:08:36 2008
--- openafs/src/config/NTMakefile.i386_nt40	Mon Dec 29 23:27:54 2008
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5600
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.23.2.52 openafs/src/config/NTMakefile.i386_w2k:1.23.2.53
*** openafs/src/config/NTMakefile.i386_w2k:1.23.2.52	Fri Nov  7 21:08:36 2008
--- openafs/src/config/NTMakefile.i386_w2k	Mon Dec 29 23:27:54 2008
***************
*** 88,94 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 88,94 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5600
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.77.2.7 openafs/src/config/afs_sysnames.h:1.77.2.8
*** openafs/src/config/afs_sysnames.h:1.77.2.7	Wed Sep  3 14:27:23 2008
--- openafs/src/config/afs_sysnames.h	Mon Dec 15 15:38:07 2008
***************
*** 187,193 ****
  #define SYS_NAME_ID_i386_fbsd_61        2113
  #define SYS_NAME_ID_i386_fbsd_62        2114
  #define SYS_NAME_ID_i386_fbsd_70        2115
! #define SYS_NAME_ID_i386_fbsd_80        2116
  
  #define SYS_NAME_ID_ia64_linux2		2200
  #define SYS_NAME_ID_ia64_linux22	2201
--- 187,194 ----
  #define SYS_NAME_ID_i386_fbsd_61        2113
  #define SYS_NAME_ID_i386_fbsd_62        2114
  #define SYS_NAME_ID_i386_fbsd_70        2115
! #define SYS_NAME_ID_i386_fbsd_71        2116
! #define SYS_NAME_ID_i386_fbsd_80        2117
  
  #define SYS_NAME_ID_ia64_linux2		2200
  #define SYS_NAME_ID_ia64_linux22	2201
***************
*** 261,266 ****
--- 262,270 ----
  #define SYS_NAME_ID_ppc64_linux26	2903
  
  #define SYS_NAME_ID_amd64_fbsd_53        3008
+ #define SYS_NAME_ID_amd64_fbsd_70        3009
+ #define SYS_NAME_ID_amd64_fbsd_71        3010
+ #define SYS_NAME_ID_amd64_fbsd_80        3011
  
  #define SYS_NAME_ID_amd64_w2k           3400
  
Index: openafs/src/config/config.c
diff -c openafs/src/config/config.c:1.6 openafs/src/config/config.c:1.6.14.1
*** openafs/src/config/config.c:1.6	Wed Jul 28 23:57:03 2004
--- openafs/src/config/config.c	Sat Nov 29 13:16:15 2008
***************
*** 13,20 ****
--- 13,22 ----
  #include <sys/time.h>
  #include <stdio.h>
  #include <string.h>
+ #include <stdlib.h>
  #include <errno.h>
  
+ 
  #include "AFS_component_version_number.c"
  
  /* prototypes */
Index: openafs/src/config/param.amd64_fbsd_70.h
diff -c /dev/null openafs/src/config/param.amd64_fbsd_70.h:1.1.2.2
*** /dev/null	Tue Dec 30 14:49:44 2008
--- openafs/src/config/param.amd64_fbsd_70.h	Mon Dec 15 15:38:07 2008
***************
*** 0 ****
--- 1,213 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"amd64_fbsd_70"
+ #define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_70
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.amd64_fbsd_71.h
diff -c /dev/null openafs/src/config/param.amd64_fbsd_71.h:1.1.2.2
*** /dev/null	Tue Dec 30 14:49:44 2008
--- openafs/src/config/param.amd64_fbsd_71.h	Mon Dec 15 15:38:07 2008
***************
*** 0 ****
--- 1,216 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"amd64_fbsd_71"
+ #define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_71
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.amd64_fbsd_80.h
diff -c /dev/null openafs/src/config/param.amd64_fbsd_80.h:1.1.2.2
*** /dev/null	Tue Dec 30 14:49:44 2008
--- openafs/src/config/param.amd64_fbsd_80.h	Mon Dec 15 15:38:07 2008
***************
*** 0 ****
--- 1,219 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"amd64_fbsd_80"
+ #define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_80
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
+ #define AFS_FBSD80_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
+ #define AFS_X86_FBSD80_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
+ #define AFS_USR_FBSD80_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BITPOINTER_ENV  1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_fbsd_71.h
diff -c /dev/null openafs/src/config/param.i386_fbsd_71.h:1.1.2.2
*** /dev/null	Tue Dec 30 14:49:44 2008
--- openafs/src/config/param.i386_fbsd_71.h	Mon Dec 15 15:38:07 2008
***************
*** 0 ****
--- 1,214 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"i386_fbsd_71"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_71
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_fbsd_80.h
diff -c /dev/null openafs/src/config/param.i386_fbsd_80.h:1.2.2.2
*** /dev/null	Tue Dec 30 14:49:44 2008
--- openafs/src/config/param.i386_fbsd_80.h	Mon Dec 15 15:38:07 2008
***************
*** 0 ****
--- 1,217 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"i386_fbsd_80"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_80
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
+ #define AFS_FBSD80_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
+ #define AFS_X86_FBSD80_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
+ #define AFS_USR_FBSD80_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.ppc_darwin_70.h
diff -c openafs/src/config/param.ppc_darwin_70.h:1.6 openafs/src/config/param.ppc_darwin_70.h:1.6.4.1
*** openafs/src/config/param.ppc_darwin_70.h:1.6	Mon Nov 28 23:58:51 2005
--- openafs/src/config/param.ppc_darwin_70.h	Mon Dec 29 12:29:19 2008
***************
*** 6,12 ****
  
  #define AFS_ENV                 1
  #define AFS_64BIT_ENV           1	/* Defines afs_int32 as int, not long. */
- #define AFS_64BIT_CLIENT        1
  #define AFS_64BIT_IOPS_ENV 1
  #define AFS_PPC_ENV 1
  #define AFS_VFSINCL_ENV 1
--- 6,11 ----
Index: openafs/src/config/param.sun4x_510.h
diff -c openafs/src/config/param.sun4x_510.h:1.8 openafs/src/config/param.sun4x_510.h:1.8.4.2
*** openafs/src/config/param.sun4x_510.h:1.8	Fri Dec 23 20:07:46 2005
--- openafs/src/config/param.sun4x_510.h	Mon Dec 22 15:34:23 2008
***************
*** 34,39 ****
--- 34,41 ----
  #define AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
  #endif /* AFS_NAMEI_ENV */
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 53,58 ****
--- 55,61 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sun4x_511.h
diff -c openafs/src/config/param.sun4x_511.h:1.1.4.2 openafs/src/config/param.sun4x_511.h:1.1.4.4
*** openafs/src/config/param.sun4x_511.h:1.1.4.2	Thu Dec 28 17:02:16 2006
--- openafs/src/config/param.sun4x_511.h	Mon Dec 22 15:34:23 2008
***************
*** 35,40 ****
--- 35,42 ----
  #define AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
  #endif /* AFS_NAMEI_ENV */
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 54,59 ****
--- 56,62 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sun4x_58.h
diff -c openafs/src/config/param.sun4x_58.h:1.16 openafs/src/config/param.sun4x_58.h:1.16.4.1
*** openafs/src/config/param.sun4x_58.h:1.16	Fri Dec 23 20:07:46 2005
--- openafs/src/config/param.sun4x_58.h	Mon Dec 22 15:34:23 2008
***************
*** 51,56 ****
--- 51,57 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sun4x_59.h
diff -c openafs/src/config/param.sun4x_59.h:1.10 openafs/src/config/param.sun4x_59.h:1.10.4.1
*** openafs/src/config/param.sun4x_59.h:1.10	Fri Dec 23 20:07:46 2005
--- openafs/src/config/param.sun4x_59.h	Mon Dec 22 15:34:23 2008
***************
*** 52,57 ****
--- 52,58 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_510.h
diff -c openafs/src/config/param.sunx86_510.h:1.10 openafs/src/config/param.sunx86_510.h:1.10.4.2
*** openafs/src/config/param.sunx86_510.h:1.10	Fri Dec 23 20:07:46 2005
--- openafs/src/config/param.sunx86_510.h	Mon Dec 22 15:34:23 2008
***************
*** 38,43 ****
--- 38,45 ----
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 63,68 ****
--- 65,71 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_511.h
diff -c openafs/src/config/param.sunx86_511.h:1.1.4.2 openafs/src/config/param.sunx86_511.h:1.1.4.4
*** openafs/src/config/param.sunx86_511.h:1.1.4.2	Thu Dec 28 17:02:16 2006
--- openafs/src/config/param.sunx86_511.h	Mon Dec 22 15:34:23 2008
***************
*** 39,44 ****
--- 39,46 ----
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 64,69 ****
--- 66,72 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_58.h
diff -c openafs/src/config/param.sunx86_58.h:1.11 openafs/src/config/param.sunx86_58.h:1.11.4.1
*** openafs/src/config/param.sunx86_58.h:1.11	Fri Dec 23 20:07:46 2005
--- openafs/src/config/param.sunx86_58.h	Mon Dec 22 15:34:23 2008
***************
*** 62,67 ****
--- 62,68 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_59.h
diff -c openafs/src/config/param.sunx86_59.h:1.7 openafs/src/config/param.sunx86_59.h:1.7.4.1
*** openafs/src/config/param.sunx86_59.h:1.7	Fri Dec 23 20:07:46 2005
--- openafs/src/config/param.sunx86_59.h	Mon Dec 22 15:34:23 2008
***************
*** 63,68 ****
--- 63,69 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/des/des.c
diff -c openafs/src/des/des.c:1.19.4.1 openafs/src/des/des.c:1.19.4.2
*** openafs/src/des/des.c:1.19.4.1	Tue Jul  3 00:23:12 2007
--- openafs/src/des/des.c	Sat Nov 29 13:16:06 2008
***************
*** 37,46 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/des.c,v 1.19.4.1 2007/07/03 04:23:12 shadow Exp $");
  
  #ifndef KERNEL
  #include <stdio.h>
  #endif
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
--- 37,47 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/des.c,v 1.19.4.2 2008/11/29 18:16:06 shadow Exp $");
  
  #ifndef KERNEL
  #include <stdio.h>
+ #include <string.h>
  #endif
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
Index: openafs/src/des/pcbc_encrypt.c
diff -c openafs/src/des/pcbc_encrypt.c:1.10.8.1 openafs/src/des/pcbc_encrypt.c:1.10.8.2
*** openafs/src/des/pcbc_encrypt.c:1.10.8.1	Mon Jul  9 15:15:26 2007
--- openafs/src/des/pcbc_encrypt.c	Sat Nov 29 13:16:06 2008
***************
*** 23,28 ****
--- 23,29 ----
  #include <mit-cpyright.h>
  #ifndef KERNEL
  #include <stdio.h>
+ #include <string.h>
  #endif
  #include <afsconfig.h>
  #include <afs/param.h>
***************
*** 30,36 ****
  #include "des_prototypes.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/pcbc_encrypt.c,v 1.10.8.1 2007/07/09 19:15:26 shadow Exp $");
  
  #include "des_internal.h"
  
--- 31,37 ----
  #include "des_prototypes.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/pcbc_encrypt.c,v 1.10.8.2 2008/11/29 18:16:06 shadow Exp $");
  
  #include "des_internal.h"
  
Index: openafs/src/kauth/kaserver.c
diff -c openafs/src/kauth/kaserver.c:1.19.2.6 openafs/src/kauth/kaserver.c:1.19.2.9
*** openafs/src/kauth/kaserver.c:1.19.2.6	Mon Mar 10 18:32:33 2008
--- openafs/src/kauth/kaserver.c	Mon Dec 22 14:23:19 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/kaserver.c,v 1.19.2.6 2008/03/10 22:32:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/kaserver.c,v 1.19.2.9 2008/12/22 19:23:19 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 249,282 ****
  		lclpath = dbpath;
  	}
  	else if (strncmp(arg, "-auditlog", arglen) == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++a];
  	    
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	} else if (strcmp(arg, "-localfiles") == 0)
  	    lclpath = argv[++a];
  	else if (strcmp(arg, "-servers") == 0)
--- 249,257 ----
  		lclpath = dbpath;
  	}
  	else if (strncmp(arg, "-auditlog", arglen) == 0) {
  	    char *fileName = argv[++a];
  	    
! 	    osi_audit_file(fileName);
  	} else if (strcmp(arg, "-localfiles") == 0)
  	    lclpath = argv[++a];
  	else if (strcmp(arg, "-servers") == 0)
***************
*** 390,396 ****
  
      if (rxBind) {
  	afs_int32 ccode;
- #ifndef AFS_NT40_ENV
          if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
              AFSDIR_SERVER_NETINFO_FILEPATH) {
              char reason[1024];
--- 365,370 ----
***************
*** 399,405 ****
                                             AFSDIR_SERVER_NETINFO_FILEPATH,
                                             AFSDIR_SERVER_NETRESTRICT_FILEPATH);
          } else 
- #endif	
  	{
              ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
          }
--- 373,378 ----
***************
*** 416,422 ****
      else
  	code =
  	    ubik_ServerInitByInfo(myHost, htons(AFSCONF_KAUTHPORT), &cellinfo,
! 				  &clones, dbpath, &KA_dbase);
  
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
--- 389,395 ----
      else
  	code =
  	    ubik_ServerInitByInfo(myHost, htons(AFSCONF_KAUTHPORT), &cellinfo,
! 				  clones, dbpath, &KA_dbase);
  
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
Index: openafs/src/libafs/MakefileProto.FBSD.in
diff -c openafs/src/libafs/MakefileProto.FBSD.in:1.27.4.2 openafs/src/libafs/MakefileProto.FBSD.in:1.27.4.4
*** openafs/src/libafs/MakefileProto.FBSD.in:1.27.4.2	Tue Aug 26 10:01:38 2008
--- openafs/src/libafs/MakefileProto.FBSD.in	Mon Dec 15 15:51:09 2008
***************
*** 31,54 ****
  KSRC = @BSD_KERNEL_PATH@
  KBLD = @BSD_KERNEL_BUILD@
  KDEFS=-Wall -nostdinc -I/usr/include -D_KERNEL -DKLD_MODULE \
! 	-elf -mpreferred-stack-boundary=2 \
  <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>
  	-fformat-extensions \
- <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>
  	-include ${KBLD}/opt_global.h \
  <i386_fbsd_60>
  	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 \
  <all -i386_fbsd_42 -i386_fbsd_43 -i386_fbsd_44 -i386_fbsd_45 -i386_fbsd_46 -i386_fbsd_47>
  	-mno-align-long-strings -fno-common -ffreestanding \
  	-I${KBLD} -include opt_global.h -fno-strict-aliasing \
  <all>
  
- 
  DBUG = -O2
  #DBUG = -O -g
  DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
- OPTF=${OPT} 
- OPTF2=${OPT2} 
  CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
  
--- 31,55 ----
  KSRC = @BSD_KERNEL_PATH@
  KBLD = @BSD_KERNEL_BUILD@
  KDEFS=-Wall -nostdinc -I/usr/include -D_KERNEL -DKLD_MODULE \
! 	-elf \
  <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>
+ 	-mpreferred-stack-boundary=2 \
  	-fformat-extensions \
  	-include ${KBLD}/opt_global.h \
+ <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>
+ 	-include ${KBLD}/opt_global.h -mpreferred-stack-boundary=2 \
  <i386_fbsd_60>
  	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 \
  <all -i386_fbsd_42 -i386_fbsd_43 -i386_fbsd_44 -i386_fbsd_45 -i386_fbsd_46 -i386_fbsd_47>
  	-mno-align-long-strings -fno-common -ffreestanding \
  	-I${KBLD} -include opt_global.h -fno-strict-aliasing \
+ <amd64_fbsd_70 amd64_fbsd_71 amd64_fbsd_80>
+ KOPTS=-fPIC
  <all>
  
  DBUG = -O2
  #DBUG = -O -g
  DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
  CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
  
***************
*** 72,80 ****
  	-ln -fs ${KSRC}/@HOST_CPU@/include machine
  	-ln -fs ${KSRC}/netinet netinet
  	-ln -fs ${KSRC}/nfs nfs
! <all -i386_fbsd_80>
  	-ln -fs /usr/include/rpc rpc
! <i386_fbsd_80>
  	-ln -fs ${KSRC}/rpc rpc
  <all>
  	-ln -fs ${KSRC}/sys sys
--- 73,81 ----
  	-ln -fs ${KSRC}/@HOST_CPU@/include machine
  	-ln -fs ${KSRC}/netinet netinet
  	-ln -fs ${KSRC}/nfs nfs
! <all -fbsd_71 -fbsd_80>
  	-ln -fs /usr/include/rpc rpc
! <fbsd_71 fbsd_80>
  	-ln -fs ${KSRC}/rpc rpc
  <all>
  	-ln -fs ${KSRC}/sys sys
Index: openafs/src/libafsrpc/NTMakefile
diff -c openafs/src/libafsrpc/NTMakefile:1.11.4.3 openafs/src/libafsrpc/NTMakefile:1.11.4.4
*** openafs/src/libafsrpc/NTMakefile:1.11.4.3	Wed Jul  2 08:49:22 2008
--- openafs/src/libafsrpc/NTMakefile	Sat Dec 27 14:22:47 2008
***************
*** 19,25 ****
  COMERR = ..\comerr
  
  # Additional debugging flag for RX.
! AFSDEV_AUXCDEFINES = -DRXDEBUG -DAFS_PTHREAD_ENV
  
  LIBFILE = $(DESTDIR)\lib\afsrpc.dll
  
--- 19,25 ----
  COMERR = ..\comerr
  
  # Additional debugging flag for RX.
! AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DRXDEBUG -DAFS_PTHREAD_ENV
  
  LIBFILE = $(DESTDIR)\lib\afsrpc.dll
  
Index: openafs/src/libafsrpc/afsrpc.def
diff -c openafs/src/libafsrpc/afsrpc.def:1.11.4.9 openafs/src/libafsrpc/afsrpc.def:1.11.4.11
*** openafs/src/libafsrpc/afsrpc.def:1.11.4.9	Wed Oct  8 17:15:10 2008
--- openafs/src/libafsrpc/afsrpc.def	Mon Dec 29 17:38:29 2008
***************
*** 236,241 ****
--- 236,242 ----
          rx_SetRxDeadTime                        @241
          rx_GetMinUdpBufSize                     @242
          rx_SetUdpBufSize                        @243        
+         rx_getAllAddrMaskMtu                    @244        
  
  ; for performance testing
          rx_TSFPQGlobSize                        @2001 DATA
***************
*** 246,248 ****
--- 247,252 ----
          rx_WritevAlloc                          @2006
          rxi_MorePackets                         @2007
  
+ ; for debugging
+         rx_DumpCalls                            @9998
+         rx_DumpPackets                          @9999
Index: openafs/src/libuafs/MakefileProto.FBSD.in
diff -c openafs/src/libuafs/MakefileProto.FBSD.in:1.11.14.2 openafs/src/libuafs/MakefileProto.FBSD.in:1.11.14.3
*** openafs/src/libuafs/MakefileProto.FBSD.in:1.11.14.2	Tue Aug 26 10:01:37 2008
--- openafs/src/libuafs/MakefileProto.FBSD.in	Mon Dec 15 15:38:07 2008
***************
*** 19,27 ****
  
  TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_FBSD40_ENV
  TEST_LDFLAGS=
! <all -i386_fbsd_62 -i386_fbsd_70 -i386_fbsd_80>
  TEST_LIBS=-lc_r
! <i386_fbsd_62 i386_fbsd_70 i386_fbsd_80>
  TEST_LIBS=-lpthread
  <all>
  
--- 19,27 ----
  
  TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_FBSD40_ENV
  TEST_LDFLAGS=
! <all -i386_fbsd_62 -i386_fbsd_70 -i386_fbsd_71 -i386_fbsd_80 -amd64_fbsd_62 -amd64_fbsd_70 -amd64_fbsd_71 -amd64_fbsd_80>
  TEST_LIBS=-lc_r
! <i386_fbsd_62 i386_fbsd_70 i386_fbsd_71 i386_fbsd_80 amd64_fbsd_62 amd64_fbsd_70 amd64_fbsd_71 amd64_fbsd_80>
  TEST_LIBS=-lpthread
  <all>
  
Index: openafs/src/lwp/process.amd64.s
diff -c openafs/src/lwp/process.amd64.s:1.1 openafs/src/lwp/process.amd64.s:1.1.8.1
*** openafs/src/lwp/process.amd64.s:1.1	Sat Feb 12 19:23:52 2005
--- openafs/src/lwp/process.amd64.s	Mon Dec 15 15:38:07 2008
***************
*** 1,4 ****
! /* $Id: process.amd64.s,v 1.1 2005/02/13 00:23:52 shadow Exp $ */
  
  /*
   * Copyright (c) 2003,2005 Kungliga Tekniska Högskolan
--- 1,4 ----
! /* $Id: process.amd64.s,v 1.1.8.1 2008/12/15 20:38:07 shadow Exp $ */
  
  /*
   * Copyright (c) 2003,2005 Kungliga Tekniska Högskolan
***************
*** 85,91 ****
  	movq	%rsi, area1(%rbp)	/* i multiples of 24, so 32 it is) */
  	movq	%rdx, newsp(%rbp)	/* and copy them there. */
  
! 	movl    $1,_C_LABEL(PRE_Block)  /* Do not allow any interrupts */
  
  	pushq	%rsp			/* Push all registers onto the stack */
  	pushq	%rax			/* Probably not _all_ are necessary */
--- 85,92 ----
  	movq	%rsi, area1(%rbp)	/* i multiples of 24, so 32 it is) */
  	movq	%rdx, newsp(%rbp)	/* and copy them there. */
  
! 	movq	PRE_Block@GOTPCREL(%rip), %rax
! 	movl	$1,(%rax)		/* Do not allow any interrupts */
  
  	pushq	%rsp			/* Push all registers onto the stack */
  	pushq	%rax			/* Probably not _all_ are necessary */
***************
*** 149,156 ****
  	popq	%rcx
  	popq	%rax
  	popq	%rsp			/* See savecontext */
! 	
! 	movl    $0,_C_LABEL(PRE_Block)  /* clear it up... */
  	addq	$32, %rsp		/* We did rsp-32 above, correct that */
  	popq    %rbp
  	ret
--- 150,158 ----
  	popq	%rcx
  	popq	%rax
  	popq	%rsp			/* See savecontext */
! 
! 	movq    PRE_Block@GOTPCREL(%rip), %rax
! 	movl    $0,(%rax)	
  	addq	$32, %rsp		/* We did rsp-32 above, correct that */
  	popq    %rbp
  	ret
Index: openafs/src/pinstall/install.c
diff -c openafs/src/pinstall/install.c:1.23.14.1 openafs/src/pinstall/install.c:1.23.14.2
*** openafs/src/pinstall/install.c:1.23.14.1	Mon Jul 28 08:16:06 2008
--- openafs/src/pinstall/install.c	Sat Nov 29 13:24:39 2008
***************
*** 50,56 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pinstall/Attic/install.c,v 1.23.14.1 2008/07/28 12:16:06 shadow Exp $");
  
  #include <stdio.h>
  #include <pwd.h>
--- 50,56 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pinstall/Attic/install.c,v 1.23.14.2 2008/11/29 18:24:39 shadow Exp $");
  
  #include <stdio.h>
  #include <pwd.h>
***************
*** 487,494 ****
--- 487,496 ----
  #endif /* AFS_HPUX_ENV */
      char pnametmp[1024];
      int pnamelen;
+ #if     !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DECOSF_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD_ENV) && !defined(AFS_NBSD_ENV)
      afs_int32 newcode;
      static char diskBuffer[BUFSIZE];	/* must be static to avoid compiler bugs for large stuff */
+ #endif
      char myHostName[100];
      struct timeval tvp[2];
      int isDir;
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.11.4.7 openafs/src/ptserver/pt_util.c:1.11.4.8
*** openafs/src/ptserver/pt_util.c:1.11.4.7	Mon Oct 27 19:53:46 2008
--- openafs/src/ptserver/pt_util.c	Sun Nov 30 15:24:38 2008
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.11.4.7 2008/10/27 23:53:46 shadow Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.11.4.8 2008/11/30 20:24:38 shadow Exp $ */
  
  /*
   *
***************
*** 21,29 ****
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.11.4.7 2008/10/27 23:53:46 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <afs/afsutil.h>
--- 21,30 ----
  
  #include <afsconfig.h>
  #include <afs/param.h>
+ #include <afs/com_err.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.11.4.8 2008/11/30 20:24:38 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <afs/afsutil.h>
Index: openafs/src/ptserver/ptserver.c
diff -c openafs/src/ptserver/ptserver.c:1.25.2.10 openafs/src/ptserver/ptserver.c:1.25.2.13
*** openafs/src/ptserver/ptserver.c:1.25.2.10	Wed Sep 24 17:36:54 2008
--- openafs/src/ptserver/ptserver.c	Mon Dec 22 14:23:19 2008
***************
*** 112,118 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.25.2.10 2008/09/24 21:36:54 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 112,118 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.25.2.13 2008/12/22 19:23:19 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 335,369 ****
  	}
  #endif
  	else if (strncmp(arg, "-auditlog", alen) == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++a];
  
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		    osi_audit(PTS_StartEvent, 0, AUD_END);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	}
  	else if (!strncmp(arg, "-rxmaxmtu", alen)) {
  	    if ((a + 1) >= argc) {
--- 335,344 ----
  	}
  #endif
  	else if (strncmp(arg, "-auditlog", alen) == 0) {
  	    char *fileName = argv[++a];
  
!             osi_audit_file(fileName);
!             osi_audit(PTS_StartEvent, 0, AUD_END);
  	}
  	else if (!strncmp(arg, "-rxmaxmtu", alen)) {
  	    if ((a + 1) >= argc) {
***************
*** 515,521 ****
  
      if (rxBind) {
  	afs_int32 ccode;
- #ifndef AFS_NT40_ENV
  	if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
  	    AFSDIR_SERVER_NETINFO_FILEPATH) {
  	    char reason[1024];
--- 490,495 ----
***************
*** 524,530 ****
  					   AFSDIR_SERVER_NETINFO_FILEPATH,
  					   AFSDIR_SERVER_NETRESTRICT_FILEPATH);
  	} else 
- #endif
  	{
  	    ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
  	}
--- 498,503 ----
***************
*** 539,545 ****
      }
  
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info, &clones,
  			      pr_dbaseName, &dbase);
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
--- 512,518 ----
      }
  
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info, clones,
  			      pr_dbaseName, &dbase);
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.97.2.40 openafs/src/rx/rx.c:1.97.2.42
*** openafs/src/rx/rx.c:1.97.2.40	Sat Oct  4 01:05:20 2008
--- openafs/src/rx/rx.c	Mon Dec 29 17:38:29 2008
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.40 2008/10/04 05:05:20 jaltman Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.42 2008/12/29 22:38:29 jaltman Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 2013,2019 ****
      call->nLeft = call->nFree = call->curlen = 0;
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
!     rxi_FreePackets(0, &call->iovq);
  
      CALL_RELE(call, RX_CALL_REFCOUNT_BEGIN);
      MUTEX_EXIT(&call->lock);
--- 2013,2022 ----
      call->nLeft = call->nFree = call->curlen = 0;
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
! #ifdef DEBUG
!     call->iovqc -=
! #endif /* DEBUG */
!         rxi_FreePackets(0, &call->iovq);
  
      CALL_RELE(call, RX_CALL_REFCOUNT_BEGIN);
      MUTEX_EXIT(&call->lock);
***************
*** 2130,2135 ****
--- 2133,2146 ----
      return 0;
  }
  
+ #ifdef DEBUG
+ #ifdef KDUMP_RX_LOCK
+ static struct rx_call_rx_lock *rx_allCallsp = 0;
+ #else
+ static struct rx_call *rx_allCallsp = 0;
+ #endif
+ #endif /* DEBUG */
+ 
  /* Allocate a call structure, for the indicated channel of the
   * supplied connection.  The mode and state of the call must be set by
   * the caller. Returns the call with mutex locked. */
***************
*** 2184,2191 ****
      } else {
  
  	call = (struct rx_call *)rxi_Alloc(sizeof(struct rx_call));
!         rx_MutexIncrement(rx_stats.nCallStructs, rx_stats_mutex);
! 	MUTEX_EXIT(&rx_freeCallQueue_lock);
  	MUTEX_INIT(&call->lock, "call lock", MUTEX_DEFAULT, NULL);
  	MUTEX_ENTER(&call->lock);
  	CV_INIT(&call->cv_twind, "call twind", CV_DEFAULT, 0);
--- 2195,2208 ----
      } else {
  
  	call = (struct rx_call *)rxi_Alloc(sizeof(struct rx_call));
! #ifdef DEBUG
!         call->allNextp = rx_allCallsp;
!         rx_allCallsp = call;
!         call->call_id = 
! #endif /* DEBUG */
!             rx_MutexIncrement(rx_stats.nCallStructs, rx_stats_mutex);
!         
!         MUTEX_EXIT(&rx_freeCallQueue_lock);
  	MUTEX_INIT(&call->lock, "call lock", MUTEX_DEFAULT, NULL);
  	MUTEX_ENTER(&call->lock);
  	CV_INIT(&call->cv_twind, "call twind", CV_DEFAULT, 0);
***************
*** 2196,2201 ****
--- 2213,2221 ----
  	queue_Init(&call->tq);
  	queue_Init(&call->rq);
  	queue_Init(&call->iovq);
+ #ifdef DEBUG
+         call->rqc = call->tqc = call->iovqc = 0;
+ #endif /* DEBUG */
  	/* Bind the call to its connection structure (prereq for reset) */
  	call->conn = conn;
  	rxi_ResetCall(call, 1);
***************
*** 3277,3282 ****
--- 3297,3305 ----
  	     * the reader once all packets have been processed */
  	    np->flags |= RX_PKTFLAG_RQ;
  	    queue_Prepend(&call->rq, np);
+ #ifdef DEBUG
+             call->rqc++;
+ #endif /* DEBUG */
  	    call->nSoftAcks++;
  	    np = NULL;		/* We can't use this anymore */
  	    newPackets = 1;
***************
*** 3405,3410 ****
--- 3428,3437 ----
  	     * packet before which to insert the new packet, or at the
  	     * queue head if the queue is empty or the packet should be
  	     * appended. */
+             np->flags |= RX_PKTFLAG_RQ;
+ #ifdef DEBUG
+             call->rqc++;
+ #endif /* DEBUG */
  	    queue_InsertBefore(tp, np);
  	    call->nSoftAcks++;
  	    np = NULL;
***************
*** 3723,3728 ****
--- 3750,3758 ----
  	{
  	    queue_Remove(tp);
  	    tp->flags &= ~RX_PKTFLAG_TQ;
+ #ifdef DEBUG
+             call->tqc--;
+ #endif /* DEBUG */
  	    rxi_FreePacket(tp);	/* rxi_FreePacket mustn't wake up anyone, preemptively. */
  	}
      }
***************
*** 4336,4342 ****
  	}
      } else {
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
! 	rxi_FreePackets(0, &call->tq);
  #ifdef	AFS_GLOBAL_RXLOCK_KERNEL
  	call->flags &= ~RX_CALL_TQ_CLEARME;
      }
--- 4366,4375 ----
  	}
      } else {
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
! #ifdef DEBUG
!         call->tqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->tq);
  #ifdef	AFS_GLOBAL_RXLOCK_KERNEL
  	call->flags &= ~RX_CALL_TQ_CLEARME;
      }
***************
*** 4361,4367 ****
  rxi_ClearReceiveQueue(register struct rx_call *call)
  {
      if (queue_IsNotEmpty(&call->rq)) {
! 	rx_packetReclaims += rxi_FreePackets(0, &call->rq);
  	call->flags &= ~(RX_CALL_RECEIVE_DONE | RX_CALL_HAVE_LAST);
      }
      if (call->state == RX_STATE_PRECALL) {
--- 4394,4408 ----
  rxi_ClearReceiveQueue(register struct rx_call *call)
  {
      if (queue_IsNotEmpty(&call->rq)) {
!         u_short count;
!         
!         count = rxi_FreePackets(0, &call->rq);
! 	rx_packetReclaims += count;
! #ifdef DEBUG
!         call->rqc -= count;
!         if ( call->rqc != 0 ) 
!             dpf(("rxi_ClearReceiveQueue call %x rqc %u != 0", call, call->rqc));
! #endif
  	call->flags &= ~(RX_CALL_RECEIVE_DONE | RX_CALL_HAVE_LAST);
      }
      if (call->state == RX_STATE_PRECALL) {
***************
*** 4497,4502 ****
--- 4538,4546 ----
  void
  rxi_CallError(register struct rx_call *call, afs_int32 error)
  {
+ #ifdef DEBUG
+     osirx_AssertMine(&call->lock, "rxi_CallError");
+ #endif
      dpf(("rxi_CallError call %x error %d call->error %d", call, error, call->error));
      if (call->error)
  	error = call->error;
***************
*** 4528,4534 ****
      register int flags;
      register struct rx_peer *peer;
      struct rx_packet *packet;
! 
      dpf(("rxi_ResetCall(call %x, newcall %d)\n", call, newcall));
  
      /* Notify anyone who is waiting for asynchronous packet arrival */
--- 4572,4580 ----
      register int flags;
      register struct rx_peer *peer;
      struct rx_packet *packet;
! #ifdef DEBUG
!     osirx_AssertMine(&call->lock, "rxi_ResetCall");
! #endif
      dpf(("rxi_ResetCall(call %x, newcall %d)\n", call, newcall));
  
      /* Notify anyone who is waiting for asynchronous packet arrival */
***************
*** 4606,4617 ****
      
      if (call->currentPacket) {
          call->currentPacket->flags &= ~RX_PKTFLAG_CP;
! 	rxi_FreePacket(call->currentPacket);
! 	call->currentPacket = (struct rx_packet *)0;
      }
      call->curlen = call->nLeft = call->nFree = 0;
  
!     rxi_FreePackets(0, &call->iovq);
  
      call->error = 0;
      call->twind = call->conn->twind[call->channel];
--- 4652,4670 ----
      
      if (call->currentPacket) {
          call->currentPacket->flags &= ~RX_PKTFLAG_CP;
!         call->currentPacket->flags |= RX_PKTFLAG_IOVQ;
!         queue_Prepend(&call->iovq, call->currentPacket);
! #ifdef DEBUG
!         call->iovqc++;
! #endif /* DEBUG */
!         call->currentPacket = (struct rx_packet *)0;
      }
      call->curlen = call->nLeft = call->nFree = 0;
  
! #ifdef DEBUG
!     call->iovqc -= 
! #endif
!         rxi_FreePackets(0, &call->iovq);
  
      call->error = 0;
      call->twind = call->conn->twind[call->channel];
***************
*** 5382,5387 ****
--- 5435,5443 ----
  			    && (p->flags & RX_PKTFLAG_ACKED)) {
  			    queue_Remove(p);
  			    p->flags &= ~RX_PKTFLAG_TQ;
+ #ifdef DEBUG
+                             call->tqc--;
+ #endif
  			    rxi_FreePacket(p);
  			} else
  			    missing = 1;
***************
*** 5499,5505 ****
       * idle connections) */
      conn->lastSendTime = call->lastSendTime = clock_Sec();
      /* Don't count keepalives here, so idleness can be tracked. */
!     if (p->header.type != RX_PACKET_TYPE_ACK)
  	call->lastSendData = call->lastSendTime;
  }
  
--- 5555,5561 ----
       * idle connections) */
      conn->lastSendTime = call->lastSendTime = clock_Sec();
      /* Don't count keepalives here, so idleness can be tracked. */
!     if ((p->header.type != RX_PACKET_TYPE_ACK) || (((struct rx_ackPacket *)rx_DataOf(p))->reason != RX_ACK_PING))
  	call->lastSendData = call->lastSendTime;
  }
  
***************
*** 6553,6559 ****
  {
      struct rx_debugIn in;
      afs_int32 *lp = (afs_int32 *) stat;
-     int i;
      afs_int32 rc = 0;
  
      *supportedValues = 0;
--- 6609,6614 ----
***************
*** 7928,7932 ****
--- 7983,8048 ----
  	return FALSE;
      }
  }
+ 
+ #ifdef AFS_NT40_ENV
+ int rx_DumpCalls(FILE *outputFile, char *cookie)
+ {
+ #ifdef DEBUG
+     int zilch;
+ #ifdef KDUMP_RX_LOCK
+     struct rx_call_rx_lock *c;
+ #else
+     struct rx_call *c;
+ #endif
+     char output[2048];
+ 
+     sprintf(output, "%s - Start dumping all Rx Calls - count=%u\r\n", cookie, rx_stats.nCallStructs);
+     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+ 
+     for (c = rx_allCallsp; c; c = c->allNextp) {
+         u_short rqc, tqc, iovqc;
+         struct rx_packet *p, *np;
+ 
+         MUTEX_ENTER(&c->lock);
+         queue_Count(&c->rq, p, np, rx_packet, rqc);
+         queue_Count(&c->tq, p, np, rx_packet, tqc);
+         queue_Count(&c->iovq, p, np, rx_packet, iovqc);
+ 
+         sprintf(output, "%s - call=0x%p, id=%u, state=%u, mode=%u, conn=%p, epoch=%u, cid=%u, callNum=%u, connFlags=0x%x, flags=0x%x, "
+                 "rqc=%u,%u, tqc=%u,%u, iovqc=%u,%u, "
+                 "lstatus=%u, rstatus=%u, error=%d, timeout=%u, "
+                 "resendEvent=%d, timeoutEvt=%d, keepAliveEvt=%d, delayedAckEvt=%d, delayedAbortEvt=%d, abortCode=%d, abortCount=%d, "
+                 "lastSendTime=%u, lastRecvTime=%u, lastSendData=%u"
+ #ifdef RX_ENABLE_LOCKS
+                 ", refCount=%u"
+ #endif
+ #ifdef RX_REFCOUNT_CHECK
+                 ", refCountBegin=%u, refCountResend=%u, refCountDelay=%u, "
+                 "refCountAlive=%u, refCountPacket=%u, refCountSend=%u, refCountAckAll=%u, refCountAbort=%u"
+ #endif
+                 "\r\n",
+                 cookie, c, c->call_id, (afs_uint32)c->state, (afs_uint32)c->mode, c->conn, c->conn?c->conn->epoch:0, c->conn?c->conn->cid:0,
+                 c->callNumber?*c->callNumber:0, c->conn?c->conn->flags:0, c->flags,
+                 (afs_uint32)c->rqc, (afs_uint32)rqc, (afs_uint32)c->tqc, (afs_uint32)tqc, (afs_uint32)c->iovqc, (afs_uint32)iovqc, 
+                 (afs_uint32)c->localStatus, (afs_uint32)c->remoteStatus, c->error, c->timeout, 
+                 c->resendEvent?1:0, c->timeoutEvent?1:0, c->keepAliveEvent?1:0, c->delayedAckEvent?1:0, c->delayedAbortEvent?1:0,
+                 c->abortCode, c->abortCount, c->lastSendTime, c->lastReceiveTime, c->lastSendData
+ #ifdef RX_ENABLE_LOCKS
+                 , (afs_uint32)c->refCount
+ #endif
+ #ifdef RX_REFCOUNT_CHECK
+                 , c->refCDebug[0],c->refCDebug[1],c->refCDebug[2],c->refCDebug[3],c->refCDebug[4],c->refCDebug[5],c->refCDebug[6],c->refCDebug[7]
+ #endif
+                 );
+         MUTEX_EXIT(&c->lock);
+ 
+         WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+     }
+     sprintf(output, "%s - End dumping all Rx Calls\r\n", cookie);
+     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+ #endif /* DEBUG */
+     return 0;
+ }
+ #endif /* AFS_NT40_ENV */
  #endif
  
Index: openafs/src/rx/rx.h
diff -c openafs/src/rx/rx.h:1.28.4.13 openafs/src/rx/rx.h:1.28.4.14
*** openafs/src/rx/rx.h:1.28.4.13	Thu Sep 25 15:41:00 2008
--- openafs/src/rx/rx.h	Mon Dec 29 17:38:30 2008
***************
*** 496,502 ****
      u_short nCwindAcks;		/* Number acks received at current cwind */
      u_short ssthresh;		/* The slow start threshold */
      u_short nDgramPackets;	/* Packets per AFS 3.5 jumbogram */
!     u_short nAcks;		/* The number of consecttive acks */
      u_short nNacks;		/* Number packets acked that follow the
  				 * first negatively acked packet */
      u_short nSoftAcks;		/* The number of delayed soft acks */
--- 496,502 ----
      u_short nCwindAcks;		/* Number acks received at current cwind */
      u_short ssthresh;		/* The slow start threshold */
      u_short nDgramPackets;	/* Packets per AFS 3.5 jumbogram */
!     u_short nAcks;		/* The number of consecutive acks */
      u_short nNacks;		/* Number packets acked that follow the
  				 * first negatively acked packet */
      u_short nSoftAcks;		/* The number of delayed soft acks */
***************
*** 546,551 ****
--- 546,564 ----
      afs_hyper_t bytesSent;	/* Number bytes sent */
      afs_hyper_t bytesRcvd;	/* Number bytes received */
      u_short tqWaiters;
+ 
+ #ifdef DEBUG
+     u_short tqc;                /* packet count in tq */
+     u_short rqc;                /* packet count in rq */
+     u_short iovqc;              /* packet count in iovq */
+ 
+ #ifdef KDUMP_RX_LOCK
+     struct rx_call_rx_lock *allNextp;
+ #else
+     struct rx_call *allNextp;
+ #endif
+     afs_uint32 call_id;
+ #endif
  };
  
  #ifndef KDUMP_RX_LOCK
***************
*** 1060,1065 ****
--- 1073,1080 ----
  #define RX_STATS_SERVICE_ID 409
  
  #ifdef AFS_NT40_ENV
+ extern int rx_DumpCalls(FILE *outputFile, char *cookie);
+ 
  #define rx_MutexIncrement(object, mutex) InterlockedIncrement(&object)
  #define rx_MutexAdd(object, addend, mutex) InterlockedAdd(&object, addend)
  #define rx_MutexDecrement(object, mutex) InterlockedDecrement(&object)
Index: openafs/src/rx/rx_getaddr.c
diff -c openafs/src/rx/rx_getaddr.c:1.23.4.6 openafs/src/rx/rx_getaddr.c:1.23.4.7
*** openafs/src/rx/rx_getaddr.c:1.23.4.6	Wed Sep 24 17:36:53 2008
--- openafs/src/rx/rx_getaddr.c	Sat Nov 29 13:55:44 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_getaddr.c,v 1.23.4.6 2008/09/24 21:36:53 shadow Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_getaddr.c,v 1.23.4.7 2008/11/29 18:55:44 jaltman Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
***************
*** 222,229 ****
  }
  
  int
! rxi_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[],
! 		      afs_uint32 mtuBuffer[], int maxSize)
  {
      int s;
  
--- 222,229 ----
  }
  
  int
! rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[],
! 		     afs_uint32 mtuBuffer[], int maxSize)
  {
      int s;
  
***************
*** 419,426 ****
   * by afsi_SetServerIPRank().
   */
  int
! rxi_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[],
! 		      afs_uint32 mtuBuffer[], int maxSize)
  {
      int s;
      int i, len, count = 0;
--- 419,426 ----
   * by afsi_SetServerIPRank().
   */
  int
! rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[],
!                      afs_uint32 mtuBuffer[], int maxSize)
  {
      int s;
      int i, len, count = 0;
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.56.2.10 openafs/src/rx/rx_kcommon.c:1.56.2.11
*** openafs/src/rx/rx_kcommon.c:1.56.2.10	Fri Oct  3 10:55:12 2008
--- openafs/src/rx/rx_kcommon.c	Mon Dec 15 14:12:21 2008
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.56.2.10 2008/10/03 14:55:12 jaltman Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.56.2.11 2008/12/15 19:12:21 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 126,139 ****
--- 126,149 ----
  
  #if !defined(AFS_LINUX26_ENV)
  void
+ #ifdef AFS_AIX_ENV
+ osi_Panic(char *msg, void *a1, void *a2, void *a3)
+ #else
  osi_Panic(char *msg, ...)
+ #endif
  {
+ #ifdef AFS_AIX_ENV
+     if (!msg)
+         msg = "Unknown AFS panic";
+     printf(msg, a1, a2, a3);
+ #else
      va_list ap;
      if (!msg)
  	msg = "Unknown AFS panic";
  
      va_start(ap, msg);
      vprintf(msg, ap);
+ #endif
  #ifdef AFS_LINUX20_ENV
      * ((char *) 0) = 0; 
  #else
Index: openafs/src/rx/rx_packet.c
diff -c openafs/src/rx/rx_packet.c:1.62.2.18 openafs/src/rx/rx_packet.c:1.62.2.19
*** openafs/src/rx/rx_packet.c:1.62.2.18	Thu Sep 25 15:36:34 2008
--- openafs/src/rx/rx_packet.c	Mon Dec 29 17:38:30 2008
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_packet.c,v 1.62.2.18 2008/09/25 19:36:34 shadow Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_packet.c,v 1.62.2.19 2008/12/29 22:38:30 jaltman Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
***************
*** 98,104 ****
  /* rxdb_fileID is used to identify the lock location, along with line#. */
  static int rxdb_fileID = RXDB_FILE_RX_PACKET;
  #endif /* RX_LOCKS_DB */
! struct rx_packet *rx_mallocedP = 0;
  
  extern char cml_version_number[];
  
--- 98,107 ----
  /* rxdb_fileID is used to identify the lock location, along with line#. */
  static int rxdb_fileID = RXDB_FILE_RX_PACKET;
  #endif /* RX_LOCKS_DB */
! static struct rx_packet *rx_mallocedP = 0;
! #ifdef DEBUG
! static afs_uint32       rx_packet_id = 0;
! #endif
  
  extern char cml_version_number[];
  
***************
*** 562,567 ****
--- 565,574 ----
  
          NETPRI;
          MUTEX_ENTER(&rx_freePktQ_lock);
+ #ifdef DEBUG
+         p->packetId = rx_packet_id++;
+         p->allNextp = rx_mallocedP;
+ #endif /* DEBUG */
          rx_mallocedP = p;
          MUTEX_EXIT(&rx_freePktQ_lock);
          USERPRI;
***************
*** 603,608 ****
--- 610,619 ----
  	p->niovecs = 2;
  
  	queue_Append(&rx_freePacketQueue, p);
+ #ifdef DEBUG
+         p->packetId = rx_packet_id++;
+         p->allNextp = rx_mallocedP;
+ #endif /* DEBUG */
  	rx_mallocedP = p;
      }
  
***************
*** 645,650 ****
--- 656,665 ----
  	
          NETPRI;
          MUTEX_ENTER(&rx_freePktQ_lock);
+ #ifdef DEBUG
+         p->packetId = rx_packet_id++;
+         p->allNextp = rx_mallocedP;
+ #endif /* DEBUG */
          rx_mallocedP = p;
          MUTEX_EXIT(&rx_freePktQ_lock);
          USERPRI;
***************
*** 702,707 ****
--- 717,726 ----
  	p->niovecs = 2;
  
  	queue_Append(&rx_freePacketQueue, p);
+ #ifdef DEBUG
+         p->packetId = rx_packet_id++;
+         p->allNextp = rx_mallocedP;
+ #endif /* DEBUG */
  	rx_mallocedP = p;
      }
  
***************
*** 906,911 ****
--- 925,932 ----
   *
   * [IN] p             -- packet from which continuation buffers will be freed
   * [IN] first         -- iovec offset of first continuation buffer to free
+  *                       any value less than 2, the min number of iovecs,
+  *                       is treated as if it is 2.
   * [IN] flush_global  -- if nonzero, we will flush overquota packets to the
   *                       global free pool before returning
   *
***************
*** 2658,2666 ****
          MUTEX_EXIT(&rx_freePktQ_lock);
  #endif /* !RX_ENABLE_TSFPQ */
  
! 	p->niovecs = i;
      }
!     p->wirevec[i - 1].iov_len += len;
      RXS_PreparePacket(conn->securityObject, call, p);
  }
  
--- 2679,2688 ----
          MUTEX_EXIT(&rx_freePktQ_lock);
  #endif /* !RX_ENABLE_TSFPQ */
  
!         p->niovecs = i;
      }
!     if (len)
!         p->wirevec[i - 1].iov_len += len;
      RXS_PreparePacket(conn->securityObject, call, p);
  }
  
***************
*** 2718,2720 ****
--- 2740,2781 ----
      }
      return (2 + (maxMTU / (RX_JUMBOBUFFERSIZE + RX_JUMBOHEADERSIZE)));
  }
+ 
+ #ifdef AFS_NT40_ENV
+ /* 
+  * This function can be used by the Windows Cache Manager
+  * to dump the list of all rx packets so that we can determine
+  * where the packet leakage is.
+  */
+ int rx_DumpPackets(FILE *outputFile, char *cookie)
+ {
+ #ifdef DEBUG
+     int zilch;
+     struct rx_packet *p;
+     char output[2048];
+ 
+     NETPRI;
+     MUTEX_ENTER(&rx_freePktQ_lock);
+     sprintf(output, "%s - Start dumping all Rx Packets - count=%u\r\n", cookie, rx_packet_id);
+     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+ 
+     for (p = rx_mallocedP; p; p = p->allNextp) {
+         sprintf(output, "%s - packet=0x%p, id=%u, firstSent=%u.%08u, timeSent=%u.%08u, retryTime=%u.%08u, firstSerial=%u, niovecs=%u, flags=0x%x, backoff=%u, length=%u  header: epoch=%u, cid=%u, callNum=%u, seq=%u, serial=%u, type=%u, flags=0x%x, userStatus=%u, securityIndex=%u, serviceId=%u\r\n",
+                 cookie, p, p->packetId, p->firstSent.sec, p->firstSent.usec, p->timeSent.sec, p->timeSent.usec, p->retryTime.sec, p->retryTime.usec, 
+                 p->firstSerial, p->niovecs, (afs_uint32)p->flags, (afs_uint32)p->backoff, (afs_uint32)p->length,
+                 p->header.epoch, p->header.cid, p->header.callNumber, p->header.seq, p->header.serial,
+                 (afs_uint32)p->header.type, (afs_uint32)p->header.flags, (afs_uint32)p->header.userStatus, 
+                 (afs_uint32)p->header.securityIndex, (afs_uint32)p->header.serviceId);
+         WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+     }
+ 
+     sprintf(output, "%s - End dumping all Rx Packets\r\n", cookie);
+     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+ 
+     MUTEX_EXIT(&rx_freePktQ_lock);
+     USERPRI;
+ #endif /* DEBUG */
+     return 0;
+ }
+ #endif /* AFS_NT40_ENV */
+ 
Index: openafs/src/rx/rx_packet.h
diff -c openafs/src/rx/rx_packet.h:1.14.4.3 openafs/src/rx/rx_packet.h:1.14.4.4
*** openafs/src/rx/rx_packet.h:1.14.4.3	Thu Sep 25 15:36:34 2008
--- openafs/src/rx/rx_packet.h	Mon Dec 29 17:38:30 2008
***************
*** 271,276 ****
--- 271,281 ----
      afs_uint32 wirehead[RX_HEADER_SIZE / sizeof(afs_int32)];
      afs_uint32 localdata[RX_CBUFFERSIZE / sizeof(afs_int32)];
      afs_uint32 extradata[RX_EXTRABUFFERSIZE / sizeof(afs_int32)];
+ #ifdef DEBUG
+     /* For debugging */
+     struct rx_packet *allNextp; /* A list of all packets */
+     afs_uint32  packetId;       /* An unique id number for debugging */
+ #endif
  };
  
  /* Macro to convert continuation buffer pointers to packet pointers */
***************
*** 358,361 ****
--- 363,371 ----
  /* DEPRECATED */
  #define	rx_UserDataOf(conn, packet)	(((char *) (packet)->wirevec[1].iov_base) + (conn)->securityHeaderSize)
  
+ #ifdef AFS_NT40_ENV
+ /* Debugging for Windows Cache Manager - fs memdump */
+ int rx_DumpPackets(FILE *outputFile, char *cookie);
+ #endif /* AFS_NT40_ENV */
+ 
  #endif /* _RX_PACKET_ */
Index: openafs/src/rx/rx_prototypes.h
diff -c openafs/src/rx/rx_prototypes.h:1.29.4.13 openafs/src/rx/rx_prototypes.h:1.29.4.15
*** openafs/src/rx/rx_prototypes.h:1.29.4.13	Fri Oct  3 10:55:12 2008
--- openafs/src/rx/rx_prototypes.h	Mon Dec 15 14:12:21 2008
***************
*** 334,340 ****
  extern void rxi_setaddr(afs_uint32 x);
  extern afs_uint32 rxi_getaddr(void);
  extern int rx_getAllAddr(afs_uint32 * buffer, int maxSize);
! extern int rxi_getAllAddrMaskMtu(afs_uint32 addrBuffer[], 
  			  	 afs_uint32 maskBuffer[],
  				 afs_uint32 mtuBuffer[],
  				 int maxSize);
--- 334,340 ----
  extern void rxi_setaddr(afs_uint32 x);
  extern afs_uint32 rxi_getaddr(void);
  extern int rx_getAllAddr(afs_uint32 * buffer, int maxSize);
! extern int rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[], 
  			  	 afs_uint32 maskBuffer[],
  				 afs_uint32 mtuBuffer[],
  				 int maxSize);
***************
*** 362,369 ****
--- 362,373 ----
  #define osi_Assert(expr) \
      do { if (!(expr)) { osi_AssertFailK(#expr, __FILE__, __LINE__); BUG(); } } while (0)
  #else
+ #if defined(KERNEL) && defined(AFS_AIX_ENV)
+ extern void osi_Panic(char *fmt, void *a1, void *a2, void *a3);
+ #else
  extern void osi_Panic(char *fmt, ...);
  #endif
+ #endif
  extern int osi_utoa(char *buf, size_t len, unsigned long val);
  extern void rxi_InitPeerParams(register struct rx_peer *pp);
  extern void shutdown_rxkernel(void);
Index: openafs/src/rx/rx_rdwr.c
diff -c openafs/src/rx/rx_rdwr.c:1.29.2.10 openafs/src/rx/rx_rdwr.c:1.29.2.12
*** openafs/src/rx/rx_rdwr.c:1.29.2.10	Sun Oct 26 17:17:41 2008
--- openafs/src/rx/rx_rdwr.c	Mon Dec 29 17:38:30 2008
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_rdwr.c,v 1.29.2.10 2008/10/26 21:17:41 jaltman Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_rdwr.c,v 1.29.2.12 2008/12/29 22:38:30 jaltman Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 114,120 ****
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
!         rxi_FreePackets(0, &call->iovq);
      }
  
      do {
--- 114,123 ----
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      do {
***************
*** 138,143 ****
--- 141,149 ----
  			register struct rx_connection *conn = call->conn;
  			queue_Remove(rp);
  			rp->flags &= ~RX_PKTFLAG_RQ;
+ #ifdef DEBUG
+                         call->rqc--;
+ #endif /* DEBUG */
  
  			/* RXS_CheckPacket called to undo RXS_PreparePacket's
  			 * work.  It may reduce the length of the packet by up
***************
*** 311,317 ****
       * ReadvProc/WritevProc.
       */
      if (!queue_IsEmpty(&call->iovq)) {
!         rxi_FreePackets(0, &call->iovq);
      }
  
      /*
--- 317,326 ----
       * ReadvProc/WritevProc.
       */
      if (!queue_IsEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      /*
***************
*** 368,374 ****
       * ReadvProc/WritevProc.
       */
      if (!queue_IsEmpty(&call->iovq)) {
! 	rxi_FreePackets(0, &call->iovq);
      }
  
      /*
--- 377,386 ----
       * ReadvProc/WritevProc.
       */
      if (!queue_IsEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      /*
***************
*** 441,446 ****
--- 453,461 ----
  		    register struct rx_connection *conn = call->conn;
  		    queue_Remove(rp);
  		    rp->flags &= ~RX_PKTFLAG_RQ;
+ #ifdef DEBUG
+                     call->rqc--;
+ #endif /* DEBUG */
  
  		    /* RXS_CheckPacket called to undo RXS_PreparePacket's
  		     * work.  It may reduce the length of the packet by up
***************
*** 522,527 ****
--- 537,545 ----
                  curp->flags &= ~RX_PKTFLAG_CP;
                  curp->flags |= RX_PKTFLAG_IOVQ;
  		queue_Append(&call->iovq, curp);
+ #ifdef DEBUG
+                 call->iovqc++;
+ #endif /* DEBUG */
  		curp = call->currentPacket = (struct rx_packet *)0;
  	    } else if (!call->curlen) {
  		/* need to get another struct iov */
***************
*** 531,536 ****
--- 549,557 ----
  		    curp->flags &= ~RX_PKTFLAG_CP;
  		    curp->flags |= RX_PKTFLAG_IOVQ;
  		    queue_Append(&call->iovq, curp);
+ #ifdef DEBUG
+                     call->iovqc++;
+ #endif /* DEBUG */
  		    curp = call->currentPacket = (struct rx_packet *)0;
  		    call->nLeft = 0;
  		} else {
***************
*** 590,596 ****
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
!         rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode == RX_MODE_SENDING) {
--- 611,620 ----
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode == RX_MODE_SENDING) {
***************
*** 672,678 ****
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
! 	rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode != RX_MODE_SENDING) {
--- 696,705 ----
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode != RX_MODE_SENDING) {
***************
*** 698,703 ****
--- 725,737 ----
      do {
  	if (call->nFree == 0) {
  	    if (!call->error && cp) {
+                 /* Clear the current packet now so that if
+                  * we are forced to wait and drop the lock 
+                  * the packet we are planning on using 
+                  * cannot be freed.
+                  */
+                 cp->flags &= ~RX_PKTFLAG_CP;
+ 		call->currentPacket = (struct rx_packet *)0;
  #ifdef AFS_GLOBAL_RXLOCK_KERNEL
  		/* Wait until TQ_BUSY is reset before adding any
  		 * packets to the transmit queue
***************
*** 718,727 ****
  		 * conn->securityMaxTrailerSize */
  		hadd32(call->bytesSent, cp->length);
  		rxi_PrepareSendPacket(call, cp, 0);
- 		cp->flags &= ~RX_PKTFLAG_CP;
  		cp->flags |= RX_PKTFLAG_TQ;
  		queue_Append(&call->tq, cp);
! 		cp = call->currentPacket = (struct rx_packet *)0;
  		if (!
  		    (call->
  		     flags & (RX_CALL_FAST_RECOVER |
--- 752,763 ----
  		 * conn->securityMaxTrailerSize */
  		hadd32(call->bytesSent, cp->length);
  		rxi_PrepareSendPacket(call, cp, 0);
  		cp->flags |= RX_PKTFLAG_TQ;
  		queue_Append(&call->tq, cp);
! #ifdef DEBUG
!                 call->tqc++;
! #endif /* DEBUG */
!                 cp = (struct rx_packet *)0;
  		if (!
  		    (call->
  		     flags & (RX_CALL_FAST_RECOVER |
***************
*** 848,854 ****
       * ReadvProc/WritevProc.
       */
      if (queue_IsNotEmpty(&call->iovq)) {
! 	rxi_FreePackets(0, &call->iovq);
      }
  
      /*
--- 884,893 ----
       * ReadvProc/WritevProc.
       */
      if (queue_IsNotEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      /*
***************
*** 895,901 ****
       * ReadvProc/WritevProc.
       */
      if (queue_IsNotEmpty(&call->iovq)) {
! 	rxi_FreePackets(0, &call->iovq);
      }
  
      /*
--- 934,943 ----
       * ReadvProc/WritevProc.
       */
      if (queue_IsNotEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      /*
***************
*** 955,961 ****
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
!         rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode != RX_MODE_SENDING) {
--- 997,1006 ----
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode != RX_MODE_SENDING) {
***************
*** 992,997 ****
--- 1037,1045 ----
  	    }
  	    cp->flags |= RX_PKTFLAG_IOVQ;
  	    queue_Append(&call->iovq, cp);
+ #ifdef DEBUG
+             call->iovqc++;
+ #endif /* DEBUG */
  	    tnFree = cp->length;
  	    tcurvec = 1;
  	    tcurpos =
***************
*** 1069,1077 ****
--- 1117,1129 ----
  rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
  {
      struct rx_packet *cp = call->currentPacket;
+     struct rx_call *p, *np;
      int nextio;
      int requestCount;
      struct rx_queue tmpq;
+ #ifdef DEBUG
+     u_short tmpqc;
+ #endif
  
      requestCount = nbytes;
      nextio = 0;
***************
*** 1097,1105 ****
              cp->flags &= ~RX_PKTFLAG_CP;
              cp->flags |= RX_PKTFLAG_IOVQ;
  	    queue_Prepend(&call->iovq, cp);
  	    cp = call->currentPacket = (struct rx_packet *)0;
  	}
! 	rxi_FreePackets(0, &call->iovq);
  	return 0;
      }
  
--- 1149,1163 ----
              cp->flags &= ~RX_PKTFLAG_CP;
              cp->flags |= RX_PKTFLAG_IOVQ;
  	    queue_Prepend(&call->iovq, cp);
+ #ifdef DEBUG
+             call->iovqc++;
+ #endif /* DEBUG */
  	    cp = call->currentPacket = (struct rx_packet *)0;
  	}
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
  	return 0;
      }
  
***************
*** 1110,1115 ****
--- 1168,1176 ----
       * a zero length write will push a short packet. */
      nextio = 0;
      queue_Init(&tmpq);
+ #ifdef DEBUG
+     tmpqc = 0;
+ #endif /* DEBUG */
      do {
  	if (call->nFree == 0 && cp) {
  	    clock_NewTime();	/* Bogus:  need new time package */
***************
*** 1119,1138 ****
  	     * conn->securityMaxTrailerSize */
  	    hadd32(call->bytesSent, cp->length);
  	    rxi_PrepareSendPacket(call, cp, 0);
- 	    cp->flags |= RX_PKTFLAG_TQ;
  	    queue_Append(&tmpq, cp);
              cp = call->currentPacket = (struct rx_packet *)0;
  
  	    /* The head of the iovq is now the current packet */
  	    if (nbytes) {
  		if (queue_IsEmpty(&call->iovq)) {
  		    call->error = RX_PROTOCOL_ERROR;
! 		    rxi_FreePackets(0, &tmpq);
  		    return 0;
  		}
  		cp = queue_First(&call->iovq, rx_packet);
  		queue_Remove(cp);
                  cp->flags &= ~RX_PKTFLAG_IOVQ;
                  cp->flags |= RX_PKTFLAG_CP;
  		call->currentPacket = cp;
  		call->nFree = cp->length;
--- 1180,1207 ----
  	     * conn->securityMaxTrailerSize */
  	    hadd32(call->bytesSent, cp->length);
  	    rxi_PrepareSendPacket(call, cp, 0);
  	    queue_Append(&tmpq, cp);
+ #ifdef DEBUG
+             tmpqc++;
+ #endif /* DEBUG */
              cp = call->currentPacket = (struct rx_packet *)0;
  
  	    /* The head of the iovq is now the current packet */
  	    if (nbytes) {
  		if (queue_IsEmpty(&call->iovq)) {
  		    call->error = RX_PROTOCOL_ERROR;
! #ifdef DEBUG
!                     tmpqc -=
! #endif /* DEBUG */
!                         rxi_FreePackets(0, &tmpq);
  		    return 0;
  		}
  		cp = queue_First(&call->iovq, rx_packet);
  		queue_Remove(cp);
                  cp->flags &= ~RX_PKTFLAG_IOVQ;
+ #ifdef DEBUG
+                 call->iovqc--;
+ #endif /* DEBUG */
                  cp->flags |= RX_PKTFLAG_CP;
  		call->currentPacket = cp;
  		call->nFree = cp->length;
***************
*** 1152,1161 ****
  		call->error = RX_PROTOCOL_ERROR;
  		if (cp) {
  		    cp->flags &= ~RX_PKTFLAG_CP;
! 		    queue_Prepend(&tmpq, cp);
                      cp = call->currentPacket = (struct rx_packet *)0;
  		}
! 		rxi_FreePackets(0, &tmpq);
  		return 0;
  	    }
  	    nbytes -= iov[nextio].iov_len;
--- 1221,1236 ----
  		call->error = RX_PROTOCOL_ERROR;
  		if (cp) {
  		    cp->flags &= ~RX_PKTFLAG_CP;
!                     queue_Prepend(&tmpq, cp);
! #ifdef DEBUG
!                     tmpqc++;
! #endif /* DEBUG */
                      cp = call->currentPacket = (struct rx_packet *)0;
  		}
! #ifdef DEBUG
!                 tmpqc -=
! #endif /* DEBUG */
!                     rxi_FreePackets(0, &tmpq);
  		return 0;
  	    }
  	    nbytes -= iov[nextio].iov_len;
***************
*** 1176,1181 ****
--- 1251,1265 ----
  
      /* Move the packets from the temporary queue onto the transmit queue.
       * We may end up with more than call->twind packets on the queue. */
+     
+ #ifdef KDUMP_RX_LOCK
+     for (queue_Scan(&tmpq, p, np, rx_call_rx_lock))
+ #else
+     for (queue_Scan(&tmpq, p, np, rx_call))
+ #endif
+     {
+         p->flags |= RX_PKTFLAG_TQ;
+     }
      queue_SpliceAppend(&call->tq, &tmpq);
  
      if (!(call->flags & (RX_CALL_FAST_RECOVER | RX_CALL_FAST_RECOVER_WAIT))) {
***************
*** 1230,1236 ****
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
! 	rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode == RX_MODE_SENDING) {
--- 1314,1323 ----
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
! #ifdef DEBUG
!         call->iovqc -=
! #endif /* DEBUG */
!             rxi_FreePackets(0, &call->iovq);
      }
  
      if (call->mode == RX_MODE_SENDING) {
***************
*** 1290,1295 ****
--- 1377,1385 ----
  	rxi_PrepareSendPacket(call, cp, 1);
  	cp->flags |= RX_PKTFLAG_TQ;
  	queue_Append(&call->tq, cp);
+ #ifdef DEBUG
+         call->tqc++;
+ #endif /* DEBUG */
  	if (!
  	    (call->
  	     flags & (RX_CALL_FAST_RECOVER | RX_CALL_FAST_RECOVER_WAIT))) {
Index: openafs/src/rx/rx_user.c
diff -c openafs/src/rx/rx_user.c:1.24.4.7 openafs/src/rx/rx_user.c:1.24.4.8
*** openafs/src/rx/rx_user.c:1.24.4.7	Fri Oct  3 10:55:12 2008
--- openafs/src/rx/rx_user.c	Sat Nov 29 13:55:44 2008
***************
*** 13,19 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_user.c,v 1.24.4.7 2008/10/03 14:55:12 jaltman Exp $");
  
  # include <sys/types.h>
  # include <errno.h>
--- 13,19 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_user.c,v 1.24.4.8 2008/11/29 18:55:44 jaltman Exp $");
  
  # include <sys/types.h>
  # include <errno.h>
***************
*** 309,322 ****
      /* The IP address list can change so we must query for it */
      rx_GetIFInfo();
  
! #ifndef AFS_NT40_ENV
      /* we don't want to use the loopback adapter which is first */
      /* this is a bad bad hack.
       * and doesn't hold true on Windows.
       */
      if ( rxi_numNetAddrs > 1 )
          offset = 1;
! #endif /* AFS_NT40_ENV */
  
      for (count = 0; offset < rxi_numNetAddrs && maxSize > 0;
  	 count++, offset++, maxSize--)
--- 309,322 ----
      /* The IP address list can change so we must query for it */
      rx_GetIFInfo();
  
! #ifdef AFS_DJGPP_ENV
      /* we don't want to use the loopback adapter which is first */
      /* this is a bad bad hack.
       * and doesn't hold true on Windows.
       */
      if ( rxi_numNetAddrs > 1 )
          offset = 1;
! #endif /* AFS_DJGPP_ENV */
  
      for (count = 0; offset < rxi_numNetAddrs && maxSize > 0;
  	 count++, offset++, maxSize--)
***************
*** 324,329 ****
--- 324,362 ----
  
      return count;
  }
+ 
+ /* this function returns the total number of interface addresses
+  * the buffer has to be passed in by the caller. It also returns
+  * the matching interface mask and mtu.  All values are returned
+  * in network byte order.
+  */
+ int
+ rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[],
+                      afs_uint32 mtuBuffer[], int maxSize)
+ {
+     int count = 0, offset = 0;
+ 
+     /* The IP address list can change so we must query for it */
+     rx_GetIFInfo();
+ 
+ #ifdef AFS_DJGPP_ENV
+     /* we don't want to use the loopback adapter which is first */
+     /* this is a bad bad hack.
+      * and doesn't hold true on Windows.
+      */
+     if ( rxi_numNetAddrs > 1 )
+         offset = 1;
+ #endif /* AFS_DJGPP_ENV */
+ 
+     for (count = 0; 
+          offset < rxi_numNetAddrs && maxSize > 0;
+          count++, offset++, maxSize--) {
+ 	addrBuffer[count] = htonl(rxi_NetAddrs[offset]);
+ 	maskBuffer[count] = htonl(myNetMasks[offset]);
+ 	mtuBuffer[count]  = htonl(myNetMTUs[offset]);
+     }
+     return count;
+ }
  #endif
  
  #ifdef AFS_NT40_ENV
Index: openafs/src/rxdebug/rxdebug.c
diff -c openafs/src/rxdebug/rxdebug.c:1.6.8.5 openafs/src/rxdebug/rxdebug.c:1.6.8.6
*** openafs/src/rxdebug/rxdebug.c:1.6.8.5	Thu Sep 25 15:55:16 2008
--- openafs/src/rxdebug/rxdebug.c	Tue Dec 16 12:26:03 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxdebug/rxdebug.c,v 1.6.8.5 2008/09/25 19:55:16 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxdebug/rxdebug.c,v 1.6.8.6 2008/12/16 17:26:03 jaltman Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
***************
*** 409,414 ****
--- 409,422 ----
  		    printf(" DESTROYED");
  		if (tconn.flags & RX_CONN_USING_PACKET_CKSUM)
  		    printf(" pktCksum");
+                 if (tconn.flags & RX_CONN_KNOW_WINDOW)
+                     printf(" knowWindow");
+                 if (tconn.flags & RX_CONN_RESET)
+                     printf(" reset");
+                 if (tconn.flags & RX_CONN_BUSY)
+                     printf(" busy");
+                 if (tconn.flags & RX_CONN_ATTACHWAIT)
+                     printf(" attachWait");
  		printf(", ");
  	    }
  	    printf("security index %d, ", tconn.securityIndex);
Index: openafs/src/rxgen/rpc_main.c
diff -c openafs/src/rxgen/rpc_main.c:1.23.4.6 openafs/src/rxgen/rpc_main.c:1.23.4.7
*** openafs/src/rxgen/rpc_main.c:1.23.4.6	Mon Jun 30 19:37:34 2008
--- openafs/src/rxgen/rpc_main.c	Sun Dec 21 01:05:33 2008
***************
*** 37,43 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxgen/rpc_main.c,v 1.23.4.6 2008/06/30 23:37:34 rra Exp $");
  
  #include <limits.h>
  #include <stdio.h>
--- 37,43 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxgen/rpc_main.c,v 1.23.4.7 2008/12/21 06:05:33 jaltman Exp $");
  
  #include <limits.h>
  #include <stdio.h>
***************
*** 94,104 ****
--- 94,108 ----
  char yflag = 0;			/* if set, only emit function name arrays to xdr file */
  int debug = 0;
  static char *cmdname;
+ #ifdef AFS_NT40_ENV
+ static char *CPP = NULL;
+ #else /* AFS_NT40_ENV */
  #ifdef PATH_CPP
  static char CPP[] = PATH_CPP;
  #else
  static char CPP[] = "/lib/cpp";
  #endif
+ #endif /* AFS_NT40_ENV */
  static char CPPFLAGS[] = "-C";
  
  #ifdef	AFS_ALPHA_ENV
***************
*** 144,159 ****
  main(int argc, char *argv[])
  {
      struct commandline cmd;
- #ifdef AFS_NT40_ENV
-     char *ep;
  
!     /* initialize CPP with the correct pre-processor on NT */
!     ep = getenv("RXGEN_CPPCMD");
!     if (ep)
! 	strcpy(CPP, ep);
!     else
! 	strcpy(CPP, "cl /EP /C /nologo");
! #endif
  #ifdef	AFS_AIX32_ENV
      /*
       * The following signal action for AIX is necessary so that in case of a 
--- 148,161 ----
  main(int argc, char *argv[])
  {
      struct commandline cmd;
  
! #ifdef AFS_NT40_ENV
!     /* initialize CPP with the correct pre-processor for Windows */
!     CPP = getenv("RXGEN_CPPCMD");
!     if (!CPP)
! 	CPP = "cl /EP /C /nologo";
! #endif /* AFS_NT40_ENV */
!     
  #ifdef	AFS_AIX32_ENV
      /*
       * The following signal action for AIX is necessary so that in case of a 
Index: openafs/src/rxkad/fc_test.c
diff -c openafs/src/rxkad/fc_test.c:1.5 openafs/src/rxkad/fc_test.c:1.5.14.1
*** openafs/src/rxkad/fc_test.c:1.5	Wed Mar 10 02:46:34 2004
--- openafs/src/rxkad/fc_test.c	Sat Nov 29 13:08:49 2008
***************
*** 104,110 ****
  
      /*
       * Use key1 and key2 as iv */
!     fc_keysched(key1, sched);
      memcpy(iv, key2, sizeof(iv));
      fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
      if (memcmp(ciph1, ciph, sizeof(ciph1)) != 0) {
--- 104,110 ----
  
      /*
       * Use key1 and key2 as iv */
!     fc_keysched((struct ktc_encryptionKey *)key1, sched);
      memcpy(iv, key2, sizeof(iv));
      fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
      if (memcmp(ciph1, ciph, sizeof(ciph1)) != 0) {
***************
*** 121,127 ****
      /*
       * Use key2 and key1 as iv
       */
!     fc_keysched(key2, sched);
      memcpy(iv, key1, sizeof(iv));
      fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
      if (memcmp(ciph2, ciph, sizeof(ciph2)) != 0) {
--- 121,127 ----
      /*
       * Use key2 and key1 as iv
       */
!     fc_keysched((struct ktc_encryptionKey *)key2, sched);
      memcpy(iv, key1, sizeof(iv));
      fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
      if (memcmp(ciph2, ciph, sizeof(ciph2)) != 0) {
***************
*** 138,144 ****
      /*
       * Test Encrypt- and Decrypt-Packet, use key1 and key2 as iv
       */
!     fc_keysched(key1, sched);
      memcpy(iv, key2, sizeof(iv));
      strcpy(clear, the_quick);
      packet.wirevec[1].iov_base = clear;
--- 138,144 ----
      /*
       * Test Encrypt- and Decrypt-Packet, use key1 and key2 as iv
       */
!     fc_keysched((struct ktc_encryptionKey *)key1, sched);
      memcpy(iv, key2, sizeof(iv));
      strcpy(clear, the_quick);
      packet.wirevec[1].iov_base = clear;
***************
*** 159,168 ****
  	struct timeval start, stop;
  	int i;
  
! 	fc_keysched(key1, sched);
  	gettimeofday(&start, 0);
  	for (i = 0; i < 1000000; i++)
! 	    fc_keysched(key1, sched);
  	gettimeofday(&stop, 0);
  	printf("fc_keysched    = %2.2f us\n",
  	       (stop.tv_sec - start.tv_sec +
--- 159,168 ----
  	struct timeval start, stop;
  	int i;
  
! 	fc_keysched((struct ktc_encryptionKey *)key1, sched);
  	gettimeofday(&start, 0);
  	for (i = 0; i < 1000000; i++)
! 	    fc_keysched((struct ktc_encryptionKey *)key1, sched);
  	gettimeofday(&stop, 0);
  	printf("fc_keysched    = %2.2f us\n",
  	       (stop.tv_sec - start.tv_sec +
Index: openafs/src/rxkad/private_data.h
diff -c openafs/src/rxkad/private_data.h:1.4.14.4 openafs/src/rxkad/private_data.h:1.4.14.5
*** openafs/src/rxkad/private_data.h:1.4.14.4	Tue Jan 22 23:18:16 2008
--- openafs/src/rxkad/private_data.h	Sat Nov 29 13:08:49 2008
***************
*** 74,82 ****
  struct rxkad_sprivate {
      rxkad_type type;		/* always server */
      rxkad_level level;		/* minimum security level of server */
!     char *get_key_rock;		/* rock for get_key function */
!     int (*get_key) ();		/* func. of kvno and server key ptr */
!     int (*user_ok) ();		/* func called with new client name */
      afs_uint32 flags;		/* configuration flags */
  };
  
--- 74,86 ----
  struct rxkad_sprivate {
      rxkad_type type;		/* always server */
      rxkad_level level;		/* minimum security level of server */
!     void *get_key_rock;		/* rock for get_key function */
!     int (*get_key) (void *, int,
! 		    struct ktc_encryptionKey *);
! 				/* func. of kvno and server key ptr */
!     int (*user_ok) (char *, char *,
! 		    char *, afs_int32);
! 				/* func called with new client name */
      afs_uint32 flags;		/* configuration flags */
  };
  
Index: openafs/src/rxkad/rxkad_common.c
diff -c openafs/src/rxkad/rxkad_common.c:1.29.2.2 openafs/src/rxkad/rxkad_common.c:1.29.2.3
*** openafs/src/rxkad/rxkad_common.c:1.29.2.2	Tue Oct 30 11:16:46 2007
--- openafs/src/rxkad/rxkad_common.c	Sat Nov 29 13:08:49 2008
***************
*** 23,29 ****
  #define INCLUDE_RXKAD_PRIVATE_DECLS
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_common.c,v 1.29.2.2 2007/10/30 15:16:46 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 23,29 ----
  #define INCLUDE_RXKAD_PRIVATE_DECLS
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_common.c,v 1.29.2.3 2008/11/29 18:08:49 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 108,121 ****
  	assert((head) && ((head)->prev == NULL)); \
      } while(0)
  
! void rxkad_global_stats_init() {
      assert(pthread_mutex_init(&rxkad_global_stats_lock, (const pthread_mutexattr_t *)0) == 0);
      assert(pthread_key_create(&rxkad_stats_key, NULL) == 0);
      memset(&rxkad_global_stats, 0, sizeof(rxkad_global_stats));
  }
  
  rxkad_stats_t * 
! rxkad_thr_stats_init() {
      rxkad_stats_t * rxkad_stats;
      rxkad_stats = (rxkad_stats_t *)malloc(sizeof(rxkad_stats_t));
      assert(rxkad_stats != NULL && pthread_setspecific(rxkad_stats_key,rxkad_stats) == 0);
--- 108,121 ----
  	assert((head) && ((head)->prev == NULL)); \
      } while(0)
  
! void rxkad_global_stats_init(void) {
      assert(pthread_mutex_init(&rxkad_global_stats_lock, (const pthread_mutexattr_t *)0) == 0);
      assert(pthread_key_create(&rxkad_stats_key, NULL) == 0);
      memset(&rxkad_global_stats, 0, sizeof(rxkad_global_stats));
  }
  
  rxkad_stats_t * 
! rxkad_thr_stats_init(void) {
      rxkad_stats_t * rxkad_stats;
      rxkad_stats = (rxkad_stats_t *)malloc(sizeof(rxkad_stats_t));
      assert(rxkad_stats != NULL && pthread_setspecific(rxkad_stats_key,rxkad_stats) == 0);
Index: openafs/src/rxkad/rxkad_prototypes.h
diff -c openafs/src/rxkad/rxkad_prototypes.h:1.13.6.1 openafs/src/rxkad/rxkad_prototypes.h:1.13.6.2
*** openafs/src/rxkad/rxkad_prototypes.h:1.13.6.1	Tue Jan 22 23:18:16 2008
--- openafs/src/rxkad/rxkad_prototypes.h	Sat Nov 29 13:08:49 2008
***************
*** 78,95 ****
  extern rxkad_level rxkad_StringToLevel(char *string);
  extern char *rxkad_LevelToString(rxkad_level level);
  
  
  /* rxkad_errs.c */
  
  /* rxkad_server.c */
  extern struct rx_securityClass *rxkad_NewServerSecurityObject(rxkad_level
! 							      level, char
  							      *get_key_rock,
  							      int (*get_key)
  
  
  							       
! 							      (char
  							       *get_key_rock,
  							       int kvno,
  							       struct
--- 78,96 ----
  extern rxkad_level rxkad_StringToLevel(char *string);
  extern char *rxkad_LevelToString(rxkad_level level);
  
+ extern void rxkad_global_stats_init(void);
  
  /* rxkad_errs.c */
  
  /* rxkad_server.c */
  extern struct rx_securityClass *rxkad_NewServerSecurityObject(rxkad_level
! 							      level, void
  							      *get_key_rock,
  							      int (*get_key)
  
  
  							       
! 							      (void
  							       *get_key_rock,
  							       int kvno,
  							       struct
Index: openafs/src/rxkad/rxkad_server.c
diff -c openafs/src/rxkad/rxkad_server.c:1.21.2.5 openafs/src/rxkad/rxkad_server.c:1.21.2.6
*** openafs/src/rxkad/rxkad_server.c:1.21.2.5	Tue Jan 22 23:18:16 2008
--- openafs/src/rxkad/rxkad_server.c	Sat Nov 29 13:08:49 2008
***************
*** 15,21 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_server.c,v 1.21.2.5 2008/01/23 04:18:16 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 15,21 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_server.c,v 1.21.2.6 2008/11/29 18:08:49 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 42,48 ****
   * Currently only used by the AFS/DFS protocol translator to recognize
   * Kerberos V5 tickets. The actual code to do that is provided externally.
   */
! afs_int32(*rxkad_AlternateTicketDecoder) ();
  
  static struct rx_securityOps rxkad_server_ops = {
      rxkad_Close,
--- 42,52 ----
   * Currently only used by the AFS/DFS protocol translator to recognize
   * Kerberos V5 tickets. The actual code to do that is provided externally.
   */
! afs_int32(*rxkad_AlternateTicketDecoder) (afs_int32, char *, afs_int32, 
! 		                          char *, char *, char *,
! 					  struct ktc_encryptionKey *,
! 					  afs_int32 *, afs_uint32 *,
! 					  afs_uint32 *);
  
  static struct rx_securityOps rxkad_server_ops = {
      rxkad_Close,
***************
*** 127,134 ****
  */
  
  struct rx_securityClass *
! rxkad_NewServerSecurityObject(rxkad_level level, char *get_key_rock,
! 			      int (*get_key) (char *get_key_rock, int kvno,
  					      struct ktc_encryptionKey *
  					      serverKey),
  			      int (*user_ok) (char *name, char *instance,
--- 131,138 ----
  */
  
  struct rx_securityClass *
! rxkad_NewServerSecurityObject(rxkad_level level, void *get_key_rock,
! 			      int (*get_key) (void *get_key_rock, int kvno,
  					      struct ktc_encryptionKey *
  					      serverKey),
  			      int (*user_ok) (char *name, char *instance,
Index: openafs/src/sys/pioctl_nt.c
diff -c openafs/src/sys/pioctl_nt.c:1.34.4.19 openafs/src/sys/pioctl_nt.c:1.34.4.21
*** openafs/src/sys/pioctl_nt.c:1.34.4.19	Sun Oct 26 17:52:43 2008
--- openafs/src/sys/pioctl_nt.c	Fri Dec 26 16:18:20 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.34.4.19 2008/10/26 21:52:43 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <windows.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.34.4.21 2008/12/26 21:18:20 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <windows.h>
***************
*** 397,402 ****
--- 397,441 ----
      return success;
  }
  
+ //
+ // Recursively evaluate drivestr to find the final
+ // dos drive letter to which the source is mapped.
+ //
+ static BOOL
+ DriveSubstitution(char *drivestr, char *subststr)
+ {
+     char device[MAX_PATH];
+ 
+     if ( QueryDosDevice(drivestr, device, MAX_PATH) )
+     {
+         if ( device[0] == '\\' &&
+              device[1] == '?' &&
+              device[2] == '?' &&
+              device[3] == '\\' &&
+              isalpha(device[4]) &&
+              device[5] == ':')
+         {
+             device[0] = device[4];
+             device[1] = ':';
+             device[2] = '\0';
+             if ( DriveSubstitution(device, subststr) )
+             {
+                 return TRUE;
+             } else {
+                 subststr[0] = device[0];
+                 subststr[1] = ':';
+                 subststr[2] = '\0';
+                 return TRUE;
+             }
+         }
+     }
+ 
+     return FALSE;
+ }
+ 
+ // 
+ // drivestr - is "<drive-letter>:"
+ //
  static BOOL
  DriveIsMappedToAFS(char *drivestr, char *NetbiosName)
  {
***************
*** 407,412 ****
--- 446,462 ----
      LPNETRESOURCE lpnrLocal;    // pointer to enumerated structures
      DWORD i;
      BOOL  bIsAFS = FALSE;
+     char  subststr[3];
+ 
+     //
+     // Handle drive letter substitution created with "SUBST <drive> <path>".
+     // If a substitution has occurred, use the target drive letter instead
+     // of the source.
+     //
+     if ( DriveSubstitution(drivestr, subststr) )
+     {
+         drivestr = subststr;
+     }
  
      //
      // Call the WNetOpenEnum function to begin the enumeration.
***************
*** 478,483 ****
--- 528,559 ----
      return bIsAFS;
  }
  
+ static BOOL
+ DriveIsGlobalAutoMapped(char *drivestr)
+ {
+     DWORD dwResult;
+     HKEY hKey;
+     DWORD dwSubMountSize;
+     char szSubMount[260];
+     DWORD dwType;
+ 
+     dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, 
+                             AFSREG_CLT_SVC_PARAM_SUBKEY "\\GlobalAutoMapper", 
+                             0, KEY_QUERY_VALUE, &hKey);
+     if (dwResult != ERROR_SUCCESS)
+         return FALSE;
+ 
+     dwSubMountSize = sizeof(szSubMount);
+     dwType = REG_SZ;
+     dwResult = RegQueryValueEx(hKey, drivestr, 0, &dwType, szSubMount, &dwSubMountSize);
+     RegCloseKey(hKey);
+ 
+     if (dwResult == ERROR_SUCCESS && dwType == REG_SZ)
+         return TRUE;
+     else
+         return FALSE;
+ }
+ 
  static long
  GetIoctlHandle(char *fileNamep, HANDLE * handlep)
  {
***************
*** 497,502 ****
--- 573,579 ----
      DWORD gle;
      DWORD dwSize = sizeof(szUser);
      int saveerrno;
+     UINT driveType;
  
      memset(HostName, '\0', sizeof(HostName));
      gethostname(HostName, sizeof(HostName));
***************
*** 511,533 ****
      if (fileNamep) {
          drivep = strchr(fileNamep, ':');
          if (drivep && (drivep - fileNamep) >= 1) {
-             UINT driveType;
              tbuffer[0] = *(drivep - 1);
              tbuffer[1] = ':';
!             tbuffer[2] = '\\';
!             tbuffer[3] = '\0';
  
              driveType = GetDriveType(tbuffer);
              switch (driveType) {
              case DRIVE_UNKNOWN:
              case DRIVE_REMOTE:
!                 if (DriveIsMappedToAFS(tbuffer, netbiosName))
                      strcpy(&tbuffer[2], SMB_IOCTL_FILENAME);
                  else 
                      return -1;
                  break;
              default:
!                 return -1;
              }
          } else if (fileNamep[0] == fileNamep[1] && 
  		   (fileNamep[0] == '\\' || fileNamep[0] == '/'))
--- 588,612 ----
      if (fileNamep) {
          drivep = strchr(fileNamep, ':');
          if (drivep && (drivep - fileNamep) >= 1) {
              tbuffer[0] = *(drivep - 1);
              tbuffer[1] = ':';
!             tbuffer[2] = '\0';
  
              driveType = GetDriveType(tbuffer);
              switch (driveType) {
              case DRIVE_UNKNOWN:
              case DRIVE_REMOTE:
!                 if (DriveIsMappedToAFS(tbuffer, netbiosName) ||
!                     DriveIsGlobalAutoMapped(tbuffer))
                      strcpy(&tbuffer[2], SMB_IOCTL_FILENAME);
                  else 
                      return -1;
                  break;
              default:
!                 if (DriveIsGlobalAutoMapped(tbuffer))
!                     strcpy(&tbuffer[2], SMB_IOCTL_FILENAME);
!                 else 
!                     return -1;
              }
          } else if (fileNamep[0] == fileNamep[1] && 
  		   (fileNamep[0] == '\\' || fileNamep[0] == '/'))
***************
*** 552,558 ****
              if ( curdir[1] == ':' ) {
                  tbuffer[0] = curdir[0];
                  tbuffer[1] = ':';
!                 strcpy(tbuffer + 2, SMB_IOCTL_FILENAME);
              } else if (curdir[0] == curdir[1] &&
                         (curdir[0] == '\\' || curdir[0] == '/')) 
              {
--- 631,654 ----
              if ( curdir[1] == ':' ) {
                  tbuffer[0] = curdir[0];
                  tbuffer[1] = ':';
!                 tbuffer[2] = '\0';
! 
!                 driveType = GetDriveType(tbuffer);
!                 switch (driveType) {
!                 case DRIVE_UNKNOWN:
!                 case DRIVE_REMOTE:
!                     if (DriveIsMappedToAFS(tbuffer, netbiosName) ||
!                         DriveIsGlobalAutoMapped(tbuffer))
!                         strcpy(&tbuffer[2], SMB_IOCTL_FILENAME);
!                     else 
!                         return -1;
!                     break;
!                 default:
!                     if (DriveIsGlobalAutoMapped(tbuffer))
!                         strcpy(&tbuffer[2], SMB_IOCTL_FILENAME);
!                     else 
!                         return -1;
!                 }
              } else if (curdir[0] == curdir[1] &&
                         (curdir[0] == '\\' || curdir[0] == '/')) 
              {
Index: openafs/src/tsm41/Makefile.in
diff -c openafs/src/tsm41/Makefile.in:1.8.2.2 openafs/src/tsm41/Makefile.in:1.8.2.3
*** openafs/src/tsm41/Makefile.in:1.8.2.2	Fri Jul 13 15:55:00 2007
--- openafs/src/tsm41/Makefile.in	Mon Nov 17 18:05:41 2008
***************
*** 71,77 ****
  install install.noversion:
  
  clean:
! 	$(RM) -f $(AUTHLIBS) $(AUTHFILES) so_locations
  
  afs_dynamic_auth: ${AUTH_OBJS} ${AFSLIBS} ${AUTHFILES}
  	$(LD) -o $@ ${AUTH_OBJS} $(AFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
--- 71,77 ----
  install install.noversion:
  
  clean:
! 	$(RM) -f *.o $(AUTHLIBS) $(AUTHFILES) so_locations
  
  afs_dynamic_auth: ${AUTH_OBJS} ${AFSLIBS} ${AUTHFILES}
  	$(LD) -o $@ ${AUTH_OBJS} $(AFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
***************
*** 100,105 ****
--- 100,107 ----
  		${CC} ${CFLAGS} -c ${srcdir}/aix41_auth.c -o $@ ;; \
  	rs_aix5*) \
  		${CC} ${CFLAGS} -c ${srcdir}/aix5_auth.c -o $@ ;; \
+ 	rs_aix6*) \
+ 		${CC} ${CFLAGS} -c ${srcdir}/aix5_auth.c -o $@ ;; \
  	*) \
  		echo "not building aix lam binary for ${SYS_NAME}" ;; \
  	esac
***************
*** 114,120 ****
--- 116,126 ----
  ${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth: afs_dynamic_kerbauth
  	${INSTALL} $? $@
  
+ ${DEST}/root.client/usr/vice/etc/aklog_dynamic_auth: aklog_dynamic_auth
+ 	${INSTALL} $? $@
+ 
  dest: \
  	${DEST}/root.client/usr/vice/etc/afs_dynamic_auth \
+ 	${DEST}/root.client/usr/vice/etc/aklog_dynamic_auth \
  	${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth
  
Index: openafs/src/tsm41/aix_aklog.c
diff -c openafs/src/tsm41/aix_aklog.c:1.1.2.6 openafs/src/tsm41/aix_aklog.c:1.1.2.7
*** openafs/src/tsm41/aix_aklog.c:1.1.2.6	Thu Jan  3 13:03:46 2008
--- openafs/src/tsm41/aix_aklog.c	Sun Nov 30 15:24:38 2008
***************
*** 9,17 ****
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tsm41/aix_aklog.c,v 1.1.2.6 2008/01/03 18:03:46 shadow Exp $");
  
  #if defined(AFS_AIX51_ENV)
  #include <sys/types.h>
--- 9,18 ----
  
  #include <afsconfig.h>
  #include <afs/param.h>
+ #include <afs/com_err.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tsm41/aix_aklog.c,v 1.1.2.7 2008/11/30 20:24:38 shadow Exp $");
  
  #if defined(AFS_AIX51_ENV)
  #include <sys/types.h>
Index: openafs/src/ubik/beacon.c
diff -c openafs/src/ubik/beacon.c:1.21.8.6 openafs/src/ubik/beacon.c:1.21.8.8
*** openafs/src/ubik/beacon.c:1.21.8.6	Sat Jul 19 02:15:02 2008
--- openafs/src/ubik/beacon.c	Sat Nov 29 13:55:44 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/beacon.c,v 1.21.8.6 2008/07/19 06:15:02 rra Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/beacon.c,v 1.21.8.8 2008/11/29 18:55:44 jaltman Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 40,52 ****
  #include "ubik.h"
  #include "ubik_int.h"
  
! /* statics used to determine if we're the sync site */
! static afs_int32 syncSiteUntil = 0;	/* valid only if amSyncSite */
! int ubik_amSyncSite = 0;	/* flag telling if I'm sync site */
! static nServers;		/* total number of servers */
! static char amIMagic = 0;	/* is this host the magic host */
! char amIClone = 0;		/* is this a clone which doesn't vote */
  static char ubik_singleServer = 0;
  int (*ubik_CRXSecurityProc) ();
  char *ubik_CRXSecurityRock;
  afs_int32 ubikSecIndex;
--- 40,53 ----
  #include "ubik.h"
  #include "ubik_int.h"
  
! /*! \name statics used to determine if we're the sync site */
! static afs_int32 syncSiteUntil = 0;	/*!< valid only if amSyncSite */
! int ubik_amSyncSite = 0;	/*!< flag telling if I'm sync site */
! static nServers;		/*!< total number of servers */
! static char amIMagic = 0;	/*!< is this host the magic host */
! char amIClone = 0;		/*!< is this a clone which doesn't vote */
  static char ubik_singleServer = 0;
+ /*\}*/
  int (*ubik_CRXSecurityProc) ();
  char *ubik_CRXSecurityRock;
  afs_int32 ubikSecIndex;
***************
*** 54,60 ****
  static verifyInterfaceAddress();
  
  
! /* Module responsible for both deciding if we're currently the sync site,
   * and keeping collecting votes so as to stay sync site.
   *
   * The basic module contacts all of the servers it can, trying to get them to vote
--- 55,62 ----
  static verifyInterfaceAddress();
  
  
! /*! \file
!  * Module responsible for both deciding if we're currently the sync site,
   * and keeping collecting votes so as to stay sync site.
   *
   * The basic module contacts all of the servers it can, trying to get them to vote
***************
*** 76,82 ****
   * votes and decides for how long it is the synchronization site.
   */
  
! /* procedure called from debug rpc call to get this module's state for debugging */
  void
  ubeacon_Debug(aparm)
       register struct ubik_debug *aparm;
--- 78,84 ----
   * votes and decides for how long it is the synchronization site.
   */
  
! /*! \brief procedure called from debug rpc call to get this module's state for debugging */
  void
  ubeacon_Debug(aparm)
       register struct ubik_debug *aparm;
***************
*** 86,101 ****
      aparm->nServers = nServers;
  }
  
! /* procedure that determines whether this site has enough current votes to remain sync site.
!  *  called from higher-level modules (everything but the vote module).
   *
!  * If we're the sync site, check that our guarantees, obtained by the ubeacon_Interact
   * light-weight process, haven't expired.  We're sync site as long as a majority of the
!  * servers in existence have promised us unexpired guarantees.  The variable ubik_syncSiteUntil
   * contains the time at which the latest of the majority of the sync site guarantees expires
!  * (if the variable ubik_amSyncSite is true)
   * This module also calls up to the recovery module if it thinks that the recovery module
!  * may have to pick up a new database (which offucr sif we lose the sync site votes).
   */
  ubeacon_AmSyncSite()
  {
--- 88,108 ----
      aparm->nServers = nServers;
  }
  
! /*!
!  * \brief Procedure that determines whether this site has enough current votes to remain sync site.
   *
!  * Called from higher-level modules (everything but the vote module).
!  *
!  * If we're the sync site, check that our guarantees, obtained by the ubeacon_Interact()
   * light-weight process, haven't expired.  We're sync site as long as a majority of the
!  * servers in existence have promised us unexpired guarantees.  The variable #ubik_syncSiteUntil
   * contains the time at which the latest of the majority of the sync site guarantees expires
!  * (if the variable #ubik_amSyncSite is true)
   * This module also calls up to the recovery module if it thinks that the recovery module
!  * may have to pick up a new database (which offucr sif [sic] we lose the sync site votes).
!  *
!  * \return 1 if local site is the sync site
!  * \return 0 if sync site is elsewhere
   */
  ubeacon_AmSyncSite()
  {
***************
*** 126,145 ****
      return rcode;
  }
  
! /* setup server list; called with two parms, first is my address, second is list of other servers
!  * called only at initialization to set up the list of servers to contact for votes.  Just creates
!  * the server structure.  Note that there are two connections in every server structure, one for
!  * vote calls (which must always go through quickly) and one for database operations, which
!  * are subject to waiting for locks.  If we used only one, the votes would sometimes get
!  * held up behind database operations, and the sync site guarantees would timeout
!  * even though the host would be up for communication.
!  *
!  * The "magic" host is the one with the lowest internet address.  It is
!  * magic because its vote counts epsilon more than the others.  This acts
!  * as a tie-breaker when we have an even number of hosts in the system.
!  * For example, if the "magic" host is up in a 2 site system, then it
!  * is sync site.  Without the magic host hack, if anyone crashed in a 2
!  * site system, we'd be out of business.
   */
  ubeacon_InitServerListByInfo(ame, info, clones)
       afs_int32 ame;
--- 133,140 ----
      return rcode;
  }
  
! /*!
!  * \see ubeacon_InitServerListCommon()
   */
  ubeacon_InitServerListByInfo(ame, info, clones)
       afs_int32 ame;
***************
*** 152,157 ****
--- 147,158 ----
      return code;
  }
  
+ /*!
+  * \param ame "address of me"
+  * \param aservers list of other servers
+  *
+  * \see ubeacon_InitServerListCommon()
+  */
  ubeacon_InitServerList(ame, aservers)
       afs_int32 ame;
       register afs_int32 aservers[];
***************
*** 164,169 ****
--- 165,194 ----
      return code;
  }
  
+ /*!
+  * \brief setup server list
+  *
+  * \param ame "address of me"
+  * \param aservers list of other servers
+  *
+  * called only at initialization to set up the list of servers to contact for votes.  Just creates
+  * the server structure.  
+  *
+  * The "magic" host is the one with the lowest internet address.  It is
+  * magic because its vote counts epsilon more than the others.  This acts
+  * as a tie-breaker when we have an even number of hosts in the system.
+  * For example, if the "magic" host is up in a 2 site system, then it
+  * is sync site.  Without the magic host hack, if anyone crashed in a 2
+  * site system, we'd be out of business.
+  *
+  * \note There are two connections in every server structure, one for
+  * vote calls (which must always go through quickly) and one for database operations, which
+  * are subject to waiting for locks.  If we used only one, the votes would sometimes get
+  * held up behind database operations, and the sync site guarantees would timeout
+  * even though the host would be up for communication.
+  *
+  * \see ubeacon_InitServerList(), ubeacon_InitServerListByInfo()
+  */
  ubeacon_InitServerListCommon(ame, info, clones, aservers)
       afs_int32 ame;
       struct afsconf_cell *info;
***************
*** 301,309 ****
      return 0;
  }
  
! /* main lwp loop for code that sends out beacons.  This code only runs while
!  * we're sync site or we want to be the sync site.  It runs in its very own light-weight
!  * process.
   */
  void *
  ubeacon_Interact(void *dummy)
--- 326,336 ----
      return 0;
  }
  
! /*! 
!  * \brief main lwp loop for code that sends out beacons.
!  * 
!  * This code only runs while we're sync site or we want to be the sync site.
!  * It runs in its very own light-weight process.
   */
  void *
  ubeacon_Interact(void *dummy)
***************
*** 466,485 ****
      return NULL;
  }
  
! /* 
! * Input Param   : ame is the pointer to my IP address specified in the
! *                 CellServDB file. aservers is an array containing IP 
! *                 addresses of remote ubik servers. The array is 
! *                 terminated by a zero address.
! *
! * Algorithm     : Verify that my IP addresses 'ame' does actually exist
! *                 on this machine.  If any of my IP addresses are there 
! *                 in the remote server list 'aserver', remove them from 
! *                 this list.  Update global variable ubik_host[] with 
! *                 my IP addresses.
! *
! * Return Values : 0 on success, non-zero on failure
! */
  static
  verifyInterfaceAddress(ame, info, aservers)
       afs_uint32 *ame;		/* one of my interface addr in net byte order */
--- 493,515 ----
      return NULL;
  }
  
! /*!
!  * \brief Verify that a given IP addresses does actually exist on this machine.
!  *
!  * \param ame      the pointer to my IP address specified in the
!  *                 CellServDB file. 
!  * \param aservers an array containing IP 
!  *                 addresses of remote ubik servers. The array is 
!  *                 terminated by a zero address.
!  *
!  * Algorithm     : Verify that my IP addresses \p ame does actually exist
!  *                 on this machine.  If any of my IP addresses are there 
!  *                 in the remote server list \p aserver, remove them from 
!  *                 this list.  Update global variable \p ubik_host[] with 
!  *                 my IP addresses.
!  *
!  * \return 0 on success, non-zero on failure
!  */
  static
  verifyInterfaceAddress(ame, info, aservers)
       afs_uint32 *ame;		/* one of my interface addr in net byte order */
***************
*** 498,507 ****
  	    totalServers++;
      }
  
- #ifdef AFS_NT40_ENV
-     /* get all my interface addresses in net byte order */
-     count = rx_getAllAddr(myAddr, UBIK_MAX_INTERFACE_ADDR);
- #else
      if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || AFSDIR_SERVER_NETINFO_FILEPATH) {
  	/*
  	 * Find addresses we are supposed to register as per the netrestrict file
--- 528,533 ----
***************
*** 524,530 ****
  	/* get all my interface addresses in net byte order */
  	count = rx_getAllAddr(myAddr, UBIK_MAX_INTERFACE_ADDR);
      }
- #endif
  
      if (count <= 0) {		/* no address found */
  	ubik_print("ubik: No network addresses found, aborting..");
--- 550,555 ----
***************
*** 621,635 ****
  }
  
  
! /* 
! * Input Param   : ubik_host is an array containing all my IP addresses.
! *
! * Algorithm     : Do an RPC to all remote ubik servers infroming them 
! *                 about my IP addresses. Get their IP addresses and
! *                 update my linked list of ubik servers 'ubik_servers'
! *
! * Return Values : 0 on success, non-zero on failure
! */
  int
  updateUbikNetworkAddress(ubik_host)
       afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR];
--- 646,662 ----
  }
  
  
! /*! 
!  * \brief Exchange IP address information with remote servers.
!  *
!  * \param ubik_host an array containing all my IP addresses.
!  *
!  * Algorithm     : Do an RPC to all remote ubik servers infroming them 
!  *                 about my IP addresses. Get their IP addresses and
!  *                 update my linked list of ubik servers \p ubik_servers
!  *
!  * \return 0 on success, non-zero on failure
!  */
  int
  updateUbikNetworkAddress(ubik_host)
       afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR];
Index: openafs/src/ubik/disk.c
diff -c openafs/src/ubik/disk.c:1.15.4.3 openafs/src/ubik/disk.c:1.15.4.4
*** openafs/src/ubik/disk.c:1.15.4.3	Sat Jul 19 02:15:02 2008
--- openafs/src/ubik/disk.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/disk.c,v 1.15.4.3 2008/07/19 06:15:02 rra Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/disk.c,v 1.15.4.4 2008/11/21 07:09:55 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 33,54 ****
  
  #define	PHSIZE	128
  static struct buffer {
!     struct ubik_dbase *dbase;	/* dbase within which the buffer resides */
!     afs_int32 file;		/* Unique cache key */
!     afs_int32 page;		/* page number */
      struct buffer *lru_next;
      struct buffer *lru_prev;
!     struct buffer *hashNext;	/* next dude in hash table */
!     char *data;			/* ptr to the data */
!     char lockers;		/* usage ref count */
!     char dirty;			/* is buffer modified */
!     char hashIndex;		/* back ptr to hash table */
  } *Buffers;
  
  #define pHash(page) ((page) & (PHSIZE-1))
  
  afs_int32 ubik_nBuffers = NBUFFERS;
! static struct buffer *phTable[PHSIZE];	/* page hash table */
  static struct buffer *LruBuffer;
  static int nbuffers;
  static int calls = 0, ios = 0, lastb = 0;
--- 33,54 ----
  
  #define	PHSIZE	128
  static struct buffer {
!     struct ubik_dbase *dbase;	/*!< dbase within which the buffer resides */
!     afs_int32 file;		/*!< Unique cache key */
!     afs_int32 page;		/*!< page number */
      struct buffer *lru_next;
      struct buffer *lru_prev;
!     struct buffer *hashNext;	/*!< next dude in hash table */
!     char *data;			/*!< ptr to the data */
!     char lockers;		/*!< usage ref count */
!     char dirty;			/*!< is buffer modified */
!     char hashIndex;		/*!< back ptr to hash table */
  } *Buffers;
  
  #define pHash(page) ((page) & (PHSIZE-1))
  
  afs_int32 ubik_nBuffers = NBUFFERS;
! static struct buffer *phTable[PHSIZE];	/*!< page hash table */
  static struct buffer *LruBuffer;
  static int nbuffers;
  static int calls = 0, ios = 0, lastb = 0;
***************
*** 62,68 ****
  
  static struct ubik_trunc *freeTruncList = 0;
  
! /* remove a transaction from the database's active transaction list.  Don't free it */
  static int
  unthread(struct ubik_trans *atrans)
  {
--- 62,70 ----
  
  static struct ubik_trunc *freeTruncList = 0;
  
! /*!
!  * \brief Remove a transaction from the database's active transaction list.  Don't free it.
!  */
  static int
  unthread(struct ubik_trans *atrans)
  {
***************
*** 78,84 ****
      return 2;			/* no entry */
  }
  
! /* some debugging assistance */
  int
  udisk_Debug(struct ubik_debug *aparm)
  {
--- 80,88 ----
      return 2;			/* no entry */
  }
  
! /*!
!  * \brief some debugging assistance
!  */
  int
  udisk_Debug(struct ubik_debug *aparm)
  {
***************
*** 100,119 ****
      return 0;
  }
  
! /* log format is defined here, and implicitly in recovery.c
   *
   * 4 byte opcode, followed by parameters, each 4 bytes long.  All integers
   * are in logged in network standard byte order, in case we want to move logs
   * from machine-to-machine someday.
   *
!  * Begin transaction: opcode
!  * Commit transaction: opcode, version (8 bytes)
!  * Truncate file: opcode, file number, length
!  * Abort transaction: opcode
!  * Write data: opcode, file, position, length, <length> data bytes
   */
- 
- /* write an opcode to the log */
  int
  udisk_LogOpcode(struct ubik_dbase *adbase, afs_int32 aopcode, int async)
  {
--- 104,124 ----
      return 0;
  }
  
! /*!
!  * \brief Write an opcode to the log.
!  *
!  * log format is defined here, and implicitly in recovery.c
   *
   * 4 byte opcode, followed by parameters, each 4 bytes long.  All integers
   * are in logged in network standard byte order, in case we want to move logs
   * from machine-to-machine someday.
   *
!  * Begin transaction: opcode \n
!  * Commit transaction: opcode, version (8 bytes) \n
!  * Truncate file: opcode, file number, length \n
!  * Abort transaction: opcode \n
!  * Write data: opcode, file, position, length, <length> data bytes \n
   */
  int
  udisk_LogOpcode(struct ubik_dbase *adbase, afs_int32 aopcode, int async)
  {
***************
*** 141,147 ****
      return code;
  }
  
! /* log a commit, never syncing */
  int
  udisk_LogEnd(struct ubik_dbase *adbase, struct ubik_version *aversion)
  {
--- 146,154 ----
      return code;
  }
  
! /*!
!  * \brief Log a commit, never syncing.
!  */
  int
  udisk_LogEnd(struct ubik_dbase *adbase, struct ubik_version *aversion)
  {
***************
*** 171,177 ****
      return code;
  }
  
! /* log a truncate operation, never syncing */
  int
  udisk_LogTruncate(struct ubik_dbase *adbase, afs_int32 afile,
  		  afs_int32 alength)
--- 178,186 ----
      return code;
  }
  
! /*!
!  * \brief Log a truncate operation, never syncing.
!  */
  int
  udisk_LogTruncate(struct ubik_dbase *adbase, afs_int32 afile,
  		  afs_int32 alength)
***************
*** 199,205 ****
      return 0;
  }
  
! /* write some data to the log, never syncing */
  int
  udisk_LogWriteData(struct ubik_dbase *adbase, afs_int32 afile, char *abuffer,
  		   afs_int32 apos, afs_int32 alen)
--- 208,216 ----
      return 0;
  }
  
! /*!
!  * \brief Write some data to the log, never syncing.
!  */
  int
  udisk_LogWriteData(struct ubik_dbase *adbase, afs_int32 afile, char *abuffer,
  		   afs_int32 apos, afs_int32 alen)
***************
*** 261,267 ****
      return 0;
  }
  
! /* Take a buffer and mark it as the least recently used buffer */
  static void
  Dlru(struct buffer *abuf)
  {
--- 272,280 ----
      return 0;
  }
  
! /*!
!  * \brief Take a buffer and mark it as the least recently used buffer.
!  */
  static void
  Dlru(struct buffer *abuf)
  {
***************
*** 281,287 ****
      LruBuffer = abuf;
  }
  
! /* Take a buffer and mark it as the most recently used buffer */
  static void
  Dmru(struct buffer *abuf)
  {
--- 294,302 ----
      LruBuffer = abuf;
  }
  
! /*!
!  * \brief Take a buffer and mark it as the most recently used buffer.
!  */
  static void
  Dmru(struct buffer *abuf)
  {
***************
*** 301,307 ****
      LruBuffer->lru_prev = abuf;
  }
  
! /* get a pointer to a particular buffer */
  static char *
  DRead(struct ubik_dbase *dbase, afs_int32 fid, int page)
  {
--- 316,324 ----
      LruBuffer->lru_prev = abuf;
  }
  
! /*!
!  * \brief Get a pointer to a particular buffer.
!  */
  static char *
  DRead(struct ubik_dbase *dbase, afs_int32 fid, int page)
  {
***************
*** 351,357 ****
      return tb->data;
  }
  
! /* zap truncated pages */
  static int
  DTrunc(struct ubik_dbase *dbase, afs_int32 fid, afs_int32 length)
  {
--- 368,376 ----
      return tb->data;
  }
  
! /*!
!  * \brief Zap truncated pages.
!  */
  static int
  DTrunc(struct ubik_dbase *dbase, afs_int32 fid, afs_int32 length)
  {
***************
*** 369,378 ****
      return 0;
  }
  
! /* allocate a truncation entry.  We allocate special entries representing truncations, rather than
!     performing them immediately, so that we can abort a transaction easily by simply purging
!     the in-core memory buffers and discarding these truncation entries.
! */
  static struct ubik_trunc *
  GetTrunc(void)
  {
--- 388,400 ----
      return 0;
  }
  
! /*!
!  * \brief Allocate a truncation entry.
!  *
!  * We allocate special entries representing truncations, rather than
!  * performing them immediately, so that we can abort a transaction easily by simply purging
!  * the in-core memory buffers and discarding these truncation entries.
!  */
  static struct ubik_trunc *
  GetTrunc(void)
  {
***************
*** 387,393 ****
      return tt;
  }
  
! /* free a truncation entry */
  static int
  PutTrunc(struct ubik_trunc *at)
  {
--- 409,417 ----
      return tt;
  }
  
! /*!
!  * \brief Free a truncation entry.
!  */
  static int
  PutTrunc(struct ubik_trunc *at)
  {
***************
*** 396,402 ****
      return 0;
  }
  
! /* find a truncation entry for a file, if any */
  static struct ubik_trunc *
  FindTrunc(struct ubik_trans *atrans, afs_int32 afile)
  {
--- 420,428 ----
      return 0;
  }
  
! /*!
!  * \brief Find a truncation entry for a file, if any.
!  */
  static struct ubik_trunc *
  FindTrunc(struct ubik_trans *atrans, afs_int32 afile)
  {
***************
*** 408,414 ****
      return (struct ubik_trunc *)0;
  }
  
! /* do truncates associated with trans, and free them */
  static int
  DoTruncs(struct ubik_trans *atrans)
  {
--- 434,442 ----
      return (struct ubik_trunc *)0;
  }
  
! /*!
!  * \brief Do truncates associated with \p atrans, and free them.
!  */
  static int
  DoTruncs(struct ubik_trans *atrans)
  {
***************
*** 430,436 ****
      return (rcode);
  }
  
! /* mark a fid as invalid */
  int
  udisk_Invalidate(struct ubik_dbase *adbase, afs_int32 afid)
  {
--- 458,466 ----
      return (rcode);
  }
  
! /*!
!  * \brief Mark an \p fid as invalid.
!  */
  int
  udisk_Invalidate(struct ubik_dbase *adbase, afs_int32 afid)
  {
***************
*** 446,452 ****
      return 0;
  }
  
! /* move this page into the correct hash bucket */
  static int
  FixupBucket(struct buffer *ap)
  {
--- 476,484 ----
      return 0;
  }
  
! /*!
!  * \brief Move this page into the correct hash bucket.
!  */
  static int
  FixupBucket(struct buffer *ap)
  {
***************
*** 470,476 ****
      return 0;
  }
  
! /* create a new slot for a particular dbase page */
  static struct buffer *
  newslot(struct ubik_dbase *adbase, afs_int32 afid, afs_int32 apage)
  {
--- 502,510 ----
      return 0;
  }
  
! /*!
!  * \brief Create a new slot for a particular dbase page.
!  */
  static struct buffer *
  newslot(struct ubik_dbase *adbase, afs_int32 afid, afs_int32 apage)
  {
***************
*** 503,509 ****
      return pp;
  }
  
! /* Release a buffer, specifying whether or not the buffer has been modified by the locker. */
  static void
  DRelease(char *ap, int flag)
  {
--- 537,545 ----
      return pp;
  }
  
! /*!
!  * \brief Release a buffer, specifying whether or not the buffer has been modified by the locker.
!  */
  static void
  DRelease(char *ap, int flag)
  {
***************
*** 520,528 ****
      return;
  }
  
! /* flush all modified buffers, leaves dirty bits set (they're cleared
!  * by DSync).  Note interaction with DSync: you call this thing first,
!  * writing the buffers to the disk.  Then you call DSync to sync all the
   * files that were written, and to clear the dirty bits.  You should
   * always call DFlush/DSync as a pair.
   */
--- 556,567 ----
      return;
  }
  
! /*!
!  * \brief Flush all modified buffers, leaves dirty bits set (they're cleared
!  * by DSync()).  
!  *
!  * \note Note interaction with DSync(): you call this thing first,
!  * writing the buffers to the disk.  Then you call DSync() to sync all the
   * files that were written, and to clear the dirty bits.  You should
   * always call DFlush/DSync as a pair.
   */
***************
*** 547,553 ****
      return 0;
  }
  
! /* flush all modified buffers */
  static int
  DAbort(struct ubik_dbase *adbase)
  {
--- 586,594 ----
      return 0;
  }
  
! /*!
!  * \brief Flush all modified buffers.
!  */
  static int
  DAbort(struct ubik_dbase *adbase)
  {
***************
*** 565,571 ****
      return 0;
  }
  
! /* must only be called after DFlush, due to its interpretation of dirty flag */
  static int
  DSync(struct ubik_dbase *adbase)
  {
--- 606,614 ----
      return 0;
  }
  
! /*!
!  * \attention DSync() must only be called after DFlush(), due to its interpretation of dirty flag.
!  */
  static int
  DSync(struct ubik_dbase *adbase)
  {
***************
*** 596,602 ****
      return rCode;
  }
  
! /* Same as read, only do not even try to read the page */
  static char *
  DNew(struct ubik_dbase *dbase, afs_int32 fid, int page)
  {
--- 639,647 ----
      return rCode;
  }
  
! /*!
!  * \brief Same as DRead(), only do not even try to read the page.
!  */
  static char *
  DNew(struct ubik_dbase *dbase, afs_int32 fid, int page)
  {
***************
*** 609,615 ****
      return tb->data;
  }
  
! /* read data from database */
  int
  udisk_read(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
  	   afs_int32 apos, afs_int32 alen)
--- 654,662 ----
      return tb->data;
  }
  
! /*!
!  * \brief Read data from database.
!  */
  int
  udisk_read(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
  	   afs_int32 apos, afs_int32 alen)
***************
*** 641,647 ****
      return 0;
  }
  
! /* truncate file */
  int
  udisk_truncate(struct ubik_trans *atrans, afs_int32 afile, afs_int32 alength)
  {
--- 688,696 ----
      return 0;
  }
  
! /*!
!  * \brief Truncate file.
!  */
  int
  udisk_truncate(struct ubik_trans *atrans, afs_int32 afile, afs_int32 alength)
  {
***************
*** 673,679 ****
      return code;
  }
  
! /* write data to database, using logs */
  int
  udisk_write(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
  	    afs_int32 apos, afs_int32 alen)
--- 722,730 ----
      return code;
  }
  
! /*!
!  * \brief Write data to database, using logs.
!  */
  int
  udisk_write(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
  	    afs_int32 apos, afs_int32 alen)
***************
*** 728,734 ****
      return 0;
  }
  
! /* begin a new local transaction */
  int
  udisk_begin(struct ubik_dbase *adbase, int atype, struct ubik_trans **atrans)
  {
--- 779,787 ----
      return 0;
  }
  
! /*!
!  * \brief Begin a new local transaction.
!  */
  int
  udisk_begin(struct ubik_dbase *adbase, int atype, struct ubik_trans **atrans)
  {
***************
*** 762,768 ****
      return 0;
  }
  
! /* commit transaction */
  int
  udisk_commit(struct ubik_trans *atrans)
  {
--- 815,823 ----
      return 0;
  }
  
! /*!
!  * \brief Commit transaction.
!  */
  int
  udisk_commit(struct ubik_trans *atrans)
  {
***************
*** 841,847 ****
      return code;
  }
  
! /* abort transaction */
  int
  udisk_abort(struct ubik_trans *atrans)
  {
--- 896,904 ----
      return code;
  }
  
! /*!
!  * \brief Abort transaction.
!  */
  int
  udisk_abort(struct ubik_trans *atrans)
  {
***************
*** 874,881 ****
      return 0;
  }
  
! /* destroy a transaction after it has been committed or aborted.  if
!  * it hasn't committed before you call this routine, we'll abort the
   * transaction for you.
   */
  int
--- 931,940 ----
      return 0;
  }
  
! /*!
!  * \brief Destroy a transaction after it has been committed or aborted.
!  *
!  * If it hasn't committed before you call this routine, we'll abort the
   * transaction for you.
   */
  int
Index: openafs/src/ubik/lock.c
diff -c openafs/src/ubik/lock.c:1.13 openafs/src/ubik/lock.c:1.13.14.1
*** openafs/src/ubik/lock.c:1.13	Fri Dec 12 18:16:12 2003
--- openafs/src/ubik/lock.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/lock.c,v 1.13 2003/12/12 23:16:12 shadow Exp $");
  
  #include <sys/types.h>
  #ifndef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/lock.c,v 1.13.14.1 2008/11/21 07:09:55 shadow Exp $");
  
  #include <sys/types.h>
  #ifndef AFS_NT40_ENV
***************
*** 25,31 ****
  #include "ubik.h"
  #include "ubik_int.h"
  
! /* Locks hang off of each transaction, with all the transaction hanging off of
   * the appropriate dbase.  This package expects to be used in a two-phase locking
   * protocol, so it doesn't provide a way to release anything but all of the locks in the
   * transaction.
--- 25,32 ----
  #include "ubik.h"
  #include "ubik_int.h"
  
! /*! \file
!  * Locks hang off of each transaction, with all the transaction hanging off of
   * the appropriate dbase.  This package expects to be used in a two-phase locking
   * protocol, so it doesn't provide a way to release anything but all of the locks in the
   * transaction.
***************
*** 36,47 ****
   *
   * It is the responsibility of the user to avoid deadlock by setting locks in a partial order.
   *
!  * EWOULDBLOCK has been replaced in this file by EAGAIN. Many Unix's but not
!  * all (eg. HP) do not replace EWOULDBLOCK with EAGAIN. The bad news is this
   * goes over the wire. The good news is that the code path is never triggered
   * as it requires ulock_getLock to be called with await = 0. And ulock_SetLock
   * isn't even used in this code base. Since NT doesn't have a native
!  * EAGAIN, we are replacing all instances of EWOULDBLOCK with EAGAIN.
   * 
   */
  
--- 37,48 ----
   *
   * It is the responsibility of the user to avoid deadlock by setting locks in a partial order.
   *
!  * #EWOULDBLOCK has been replaced in this file by #EAGAIN. Many Unix's but not
!  * all (eg. HP) do not replace #EWOULDBLOCK with #EAGAIN. The bad news is this
   * goes over the wire. The good news is that the code path is never triggered
   * as it requires ulock_getLock to be called with await = 0. And ulock_SetLock
   * isn't even used in this code base. Since NT doesn't have a native
!  * #EAGAIN, we are replacing all instances of #EWOULDBLOCK with #EAGAIN.
   * 
   */
  
***************
*** 53,63 ****
  struct Lock rwlock;
  int rwlockinit = 1;
  
! /* Set a transaction lock.  Atype is LOCKREAD or LOCKWRITE, await is
!  * true if you want to wait for the lock instead of returning
!  * EWOULDLBOCK.
   *
!  * The DBHOLD lock must be held.
   */
  ulock_getLock(atrans, atype, await)
       struct ubik_trans *atrans;
--- 54,66 ----
  struct Lock rwlock;
  int rwlockinit = 1;
  
! /*!
!  * \brief Set a transaction lock.
!  * \param atype is #LOCKREAD or #LOCKWRITE.
!  * \param await is TRUE if you want to wait for the lock instead of returning
!  * #EWOULDBLOCK.
   *
!  * \note The #DBHOLD lock must be held.
   */
  ulock_getLock(atrans, atype, await)
       struct ubik_trans *atrans;
***************
*** 144,150 ****
      return 0;
  }
  
! /* Release the transaction lock */
  void
  ulock_relLock(atrans)
       struct ubik_trans *atrans;
--- 147,155 ----
      return 0;
  }
  
! /*!
!  * \brief Release the transaction lock.
!  */
  void
  ulock_relLock(atrans)
       struct ubik_trans *atrans;
***************
*** 167,173 ****
      return;
  }
  
! /* debugging hooks */
  ulock_Debug(aparm)
       struct ubik_debug *aparm;
  {
--- 172,180 ----
      return;
  }
  
! /*!
!  * \brief debugging hooks
!  */
  ulock_Debug(aparm)
       struct ubik_debug *aparm;
  {
Index: openafs/src/ubik/phys.c
diff -c openafs/src/ubik/phys.c:1.9.2.6 openafs/src/ubik/phys.c:1.9.2.7
*** openafs/src/ubik/phys.c:1.9.2.6	Tue Oct  7 13:44:13 2008
--- openafs/src/ubik/phys.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/phys.c,v 1.9.2.6 2008/10/07 17:44:13 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/phys.c,v 1.9.2.7 2008/11/21 07:09:55 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 38,45 ****
  #define	UBIK_INTERNALS 1
  #include "ubik.h"
  
! /* these routines are called via the proc ptr in the ubik_dbase structure.  They provide access to
!  * the physical disk, by converting the file numbers being processed (>= 0 for user data space, < 0
   * for ubik system files, such as the log) to actual pathnames to open, read, write, truncate, sync,
   * etc.
   */
--- 38,46 ----
  #define	UBIK_INTERNALS 1
  #include "ubik.h"
  
! /*! \file
!  * These routines are called via the proc ptr in the ubik_dbase structure.  They provide access to
!  * the physical disk, by converting the file numbers being processed ( >= 0 for user data space, < 0
   * for ubik system files, such as the log) to actual pathnames to open, read, write, truncate, sync,
   * etc.
   */
***************
*** 53,59 ****
  
  static char pbuffer[1024];
  
! /* beware, when using this function, of the header in front of most files */
  static int
  uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
  {
--- 54,62 ----
  
  static char pbuffer[1024];
  
! /*!
!  * \warning Beware, when using this function, of the header in front of most files.
!  */
  static int
  uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
  {
***************
*** 126,132 ****
      return fd;
  }
  
! /* close the file, maintaining ref count in cache structure */
  int
  uphys_close(register int afd)
  {
--- 129,137 ----
      return fd;
  }
  
! /*!
!  * \brief Close the file, maintaining ref count in cache structure.
!  */
  int
  uphys_close(register int afd)
  {
***************
*** 238,244 ****
      return code;
  }
  
! /* get number of dbase files */
  int
  uphys_getnfiles(register struct ubik_dbase *adbase)
  {
--- 243,253 ----
      return code;
  }
  
! /*!
!  * \brief Get number of dbase files.
!  *
!  * \todo Really should scan dir for data.
!  */
  int
  uphys_getnfiles(register struct ubik_dbase *adbase)
  {
***************
*** 246,252 ****
      return 1;
  }
  
! /* get database label, with aversion in host order */
  int
  uphys_getlabel(register struct ubik_dbase *adbase, afs_int32 afile,
  	       struct ubik_version *aversion)
--- 255,263 ----
      return 1;
  }
  
! /*!
!  * \brief Get database label, with \p aversion in host order.
!  */
  int
  uphys_getlabel(register struct ubik_dbase *adbase, afs_int32 afile,
  	       struct ubik_version *aversion)
***************
*** 268,274 ****
      return 0;
  }
  
! /* label database, with aversion in host order */
  int
  uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile,
  	       struct ubik_version *aversion)
--- 279,287 ----
      return 0;
  }
  
! /*!
!  * \brief Label database, with \p aversion in host order.
!  */
  int
  uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile,
  	       struct ubik_version *aversion)
Index: openafs/src/ubik/recovery.c
diff -c openafs/src/ubik/recovery.c:1.14.4.9 openafs/src/ubik/recovery.c:1.14.4.11
*** openafs/src/ubik/recovery.c:1.14.4.9	Sat Oct 18 11:24:45 2008
--- openafs/src/ubik/recovery.c	Sun Nov 30 14:49:29 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/recovery.c,v 1.14.4.9 2008/10/18 15:24:45 jaltman Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/recovery.c,v 1.14.4.11 2008/11/30 19:49:29 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 35,58 ****
  #include "ubik.h"
  #include "ubik_int.h"
  
! /* This module is responsible for determining when the system has
   * recovered to the point that it can handle new transactions.  It
   * replays logs, polls to determine the current dbase after a crash,
   * and distributes the new database to the others.
!  */
! 
! /* The sync site associates a version number with each database.  It
   * broadcasts the version associated with its current dbase in every
   * one of its beacon messages.  When the sync site send a dbase to a
   * server, it also sends the db's version.  A non-sync site server can
   * tell if it has the right dbase version by simply comparing the
!  * version from the beacon message (uvote_dbVersion) with the version
!  * associated with the database (ubik_dbase->version).  The sync site
   * itself simply has one counter to keep track of all of this (again
!  * ubik_dbase->version).
!  */
! 
! /* sync site: routine called when the sync site loses its quorum; this
   * procedure is called "up" from the beacon package.  It resyncs the
   * dbase and nudges the recovery daemon to try to propagate out the
   * changes.  It also resets the recovery daemon's state, since
--- 35,57 ----
  #include "ubik.h"
  #include "ubik_int.h"
  
! /*! \file
!  * This module is responsible for determining when the system has
   * recovered to the point that it can handle new transactions.  It
   * replays logs, polls to determine the current dbase after a crash,
   * and distributes the new database to the others.
!  *
!  * The sync site associates a version number with each database.  It
   * broadcasts the version associated with its current dbase in every
   * one of its beacon messages.  When the sync site send a dbase to a
   * server, it also sends the db's version.  A non-sync site server can
   * tell if it has the right dbase version by simply comparing the
!  * version from the beacon message \p uvote_dbVersion with the version
!  * associated with the database \p ubik_dbase->version.  The sync site
   * itself simply has one counter to keep track of all of this (again
!  * \p ubik_dbase->version).
!  *
!  * sync site: routine called when the sync site loses its quorum; this
   * procedure is called "up" from the beacon package.  It resyncs the
   * dbase and nudges the recovery daemon to try to propagate out the
   * changes.  It also resets the recovery daemon's state, since
***************
*** 61,71 ****
   * servers.
   */
  
! /* if this flag is set, then ubik will use only the primary address 
! ** ( the address specified in the CellServDB) to contact other 
! ** ubik servers. Ubik recovery will not try opening connections 
! ** to the alternate interface addresses. 
! */
  int ubikPrimaryAddrOnly;
  
  int
--- 60,71 ----
   * servers.
   */
  
! /*!
!  * if this flag is set, then ubik will use only the primary address 
!  * (the address specified in the CellServDB) to contact other 
!  * ubik servers. Ubik recovery will not try opening connections 
!  * to the alternate interface addresses. 
!  */
  int ubikPrimaryAddrOnly;
  
  int
***************
*** 79,87 ****
      return 0;
  }
  
! /* sync site: routine called when a non-sync site server goes down; restarts recovery
   * process to send missing server the new db when it comes back up.
!  * This routine should not do anything with variables used by non-sync site servers. 
   */
  int
  urecovery_LostServer(void)
--- 79,91 ----
      return 0;
  }
  
! /*!
!  * \brief sync site
!  *
!  * routine called when a non-sync site server goes down; restarts recovery
   * process to send missing server the new db when it comes back up.
!  *
!  * \note This routine should not do anything with variables used by non-sync site servers. 
   */
  int
  urecovery_LostServer(void)
***************
*** 93,99 ****
  #endif
  }
  
! /* return true iff we have a current database (called by both sync
   * sites and non-sync sites) How do we determine this?  If we're the
   * sync site, we wait until recovery has finished fetching and
   * re-labelling its dbase (it may still be trying to propagate it out
--- 97,104 ----
  #endif
  }
  
! /*!
!  * return true iff we have a current database (called by both sync
   * sites and non-sync sites) How do we determine this?  If we're the
   * sync site, we wait until recovery has finished fetching and
   * re-labelling its dbase (it may still be trying to propagate it out
***************
*** 133,139 ****
      return rcode;
  }
  
! /* abort all transactions on this database */
  int
  urecovery_AbortAll(struct ubik_dbase *adbase)
  {
--- 138,146 ----
      return rcode;
  }
  
! /*!
!  * \brief abort all transactions on this database
!  */
  int
  urecovery_AbortAll(struct ubik_dbase *adbase)
  {
***************
*** 144,150 ****
      return 0;
  }
  
! /* this routine aborts the current remote transaction, if any, if the tid is wrong */
  int
  urecovery_CheckTid(register struct ubik_tid *atid)
  {
--- 151,159 ----
      return 0;
  }
  
! /*!
!  * \brief this routine aborts the current remote transaction, if any, if the tid is wrong
!  */
  int
  urecovery_CheckTid(register struct ubik_tid *atid)
  {
***************
*** 168,184 ****
      return 0;
  }
  
! /* log format is defined here, and implicitly in disk.c
   *
   * 4 byte opcode, followed by parameters, each 4 bytes long.  All integers
   * are in logged in network standard byte order, in case we want to move logs
   * from machine-to-machine someday.
   *
!  * Begin transaction: opcode
!  * Commit transaction: opcode, version (8 bytes)
!  * Truncate file: opcode, file number, length
!  * Abort transaction: opcode
!  * Write data: opcode, file, position, length, <length> data bytes
   *
   * A very simple routine, it just replays the log.  Note that this is a new-value only log, which
   * implies that no uncommitted data is written to the dbase: one writes data to the log, including
--- 177,196 ----
      return 0;
  }
  
! /*!
!  * \brief replay logs
!  *
!  * log format is defined here, and implicitly in disk.c
   *
   * 4 byte opcode, followed by parameters, each 4 bytes long.  All integers
   * are in logged in network standard byte order, in case we want to move logs
   * from machine-to-machine someday.
   *
!  * Begin transaction: opcode \n
!  * Commit transaction: opcode, version (8 bytes) \n
!  * Truncate file: opcode, file number, length \n
!  * Abort transaction: opcode \n
!  * Write data: opcode, file, position, length, <length> data bytes \n
   *
   * A very simple routine, it just replays the log.  Note that this is a new-value only log, which
   * implies that no uncommitted data is written to the dbase: one writes data to the log, including
***************
*** 189,196 ****
   * abort and the remaining dbase on the disk is exactly the right dbase, without having to read
   * the log.
   */
- 
- /* replay logs */
  static int
  ReplayLog(register struct ubik_dbase *adbase)
  {
--- 201,206 ----
***************
*** 349,355 ****
      return code;
  }
  
! /* Called at initialization to figure out version of the dbase we really have.
   * This routine is called after replaying the log; it reads the restored labels.
   */
  static int
--- 359,367 ----
      return code;
  }
  
! /*! \brief
!  * Called at initialization to figure out version of the dbase we really have.
!  *
   * This routine is called after replaying the log; it reads the restored labels.
   */
  static int
***************
*** 378,384 ****
      return 0;
  }
  
! /* initialize the local dbase
   * We replay the logs and then read the resulting file to figure out what version we've really got.
   */
  int
--- 390,398 ----
      return 0;
  }
  
! /*!
!  * \brief initialize the local ubik_dbase
!  *
   * We replay the logs and then read the resulting file to figure out what version we've really got.
   */
  int
***************
*** 393,404 ****
      return code;
  }
  
! /* Main interaction loop for the recovery manager
   * The recovery light-weight process only runs when you're the
   * synchronization site.  It performs the following tasks, if and only
   * if the prerequisite tasks have been performed successfully (it
   * keeps track of which ones have been performed in its bit map,
!  * urecovery_state).
   *
   * First, it is responsible for probing that all servers are up.  This
   * is the only operation that must be performed even if this is not
--- 407,420 ----
      return code;
  }
  
! /*!
!  * \brief Main interaction loop for the recovery manager
!  *
   * The recovery light-weight process only runs when you're the
   * synchronization site.  It performs the following tasks, if and only
   * if the prerequisite tasks have been performed successfully (it
   * keeps track of which ones have been performed in its bit map,
!  * \p urecovery_state).
   *
   * First, it is responsible for probing that all servers are up.  This
   * is the only operation that must be performed even if this is not
***************
*** 663,677 ****
  #endif
  		if (!code) 
  		    code = rename(pbuffer, tbuffer);
! 		if (!code) 
! 		    code = (*ubik_dbase->open) (ubik_dbase, 0);
! 		if (!code)
  #endif
! 		/* after data is good, sync disk with correct label */
! 		code =
! 		    (*ubik_dbase->setlabel) (ubik_dbase, 0,
! 					     &ubik_dbase->version);
  #ifndef OLD_URECOVERY
  #ifdef AFS_NT40_ENV
  		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
  		unlink(pbuffer);
--- 679,693 ----
  #endif
  		if (!code) 
  		    code = rename(pbuffer, tbuffer);
! 		if (!code) {
! 		    (*ubik_dbase->open) (ubik_dbase, 0);
  #endif
! 		    /* after data is good, sync disk with correct label */
! 		    code =
! 			(*ubik_dbase->setlabel) (ubik_dbase, 0,
! 						 &ubik_dbase->version);
  #ifndef OLD_URECOVERY
+ 		}
  #ifdef AFS_NT40_ENV
  		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
  		unlink(pbuffer);
***************
*** 838,847 ****
      return NULL;
  }
  
! /*
! ** send a Probe to all the network address of this server 
! ** Return 0  if success, else return 1
! */
  int
  DoProbe(struct ubik_server *server)
  {
--- 854,864 ----
      return NULL;
  }
  
! /*!
!  * \brief send a Probe to all the network address of this server 
!  * 
!  * \return 0 if success, else return 1
!  */
  int
  DoProbe(struct ubik_server *server)
  {
Index: openafs/src/ubik/remote.c
diff -c openafs/src/ubik/remote.c:1.15.4.9 openafs/src/ubik/remote.c:1.15.4.11
*** openafs/src/ubik/remote.c:1.15.4.9	Mon Oct 27 19:53:46 2008
--- openafs/src/ubik/remote.c	Sun Nov 30 14:49:29 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.15.4.9 2008/10/27 23:53:46 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.15.4.11 2008/11/30 19:49:29 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 35,44 ****
  char *ubik_CheckRXSecurityRock;
  void printServerInfo();
  
! /* routines for handling requests remotely-submitted by the sync site.  These are
!     only write transactions (we don't propagate read trans), and there is at most one
!     write transaction extant at any one time.
! */
  
  struct ubik_trans *ubik_currentTrans = 0;
  
--- 35,45 ----
  char *ubik_CheckRXSecurityRock;
  void printServerInfo();
  
! /*! \file
!  * routines for handling requests remotely-submitted by the sync site.  These are
!  * only write transactions (we don't propagate read trans), and there is at most one
!  * write transaction extant at any one time.
!  */
  
  struct ubik_trans *ubik_currentTrans = 0;
  
***************
*** 261,267 ****
      return code;
  }
  
! /* Write a vector of data */
  afs_int32
  SDISK_WriteV(rxcall, atid, io_vector, io_buffer)
       register struct rx_call *rxcall;
--- 262,270 ----
      return code;
  }
  
! /*!
!  * \brief Write a vector of data
!  */
  afs_int32
  SDISK_WriteV(rxcall, atid, io_vector, io_buffer)
       register struct rx_call *rxcall;
***************
*** 615,626 ****
  #endif
      if (!code) 
  	code = rename(pbuffer, tbuffer);
!     if (!code) 
! 	code = (*ubik_dbase->open) (ubik_dbase, 0);
!     if (!code)
  #endif
!     code = (*ubik_dbase->setlabel) (dbase, file, avers);
  #ifndef OLD_URECOVERY
  #ifdef AFS_NT40_ENV
      afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
      unlink(pbuffer);
--- 618,629 ----
  #endif
      if (!code) 
  	code = rename(pbuffer, tbuffer);
!     if (!code) {
! 	(*ubik_dbase->open) (ubik_dbase, 0);
  #endif
! 	code = (*ubik_dbase->setlabel) (dbase, file, avers);
  #ifndef OLD_URECOVERY
+     }
  #ifdef AFS_NT40_ENV
      afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
      unlink(pbuffer);
***************
*** 661,671 ****
      return 0;
  }
  
! /*
! * Update remote machines addresses in my server list
! * Send back my addresses to caller of this RPC
! * Returns zero on success, else 1.
! */
  afs_int32
  SDISK_UpdateInterfaceAddr(rxcall, inAddr, outAddr)
       register struct rx_call *rxcall;
--- 664,675 ----
      return 0;
  }
  
! /*!
!  * \brief Update remote machines addresses in my server list
!  *
!  * Send back my addresses to caller of this RPC
!  * \return zero on success, else 1.
!  */
  afs_int32
  SDISK_UpdateInterfaceAddr(rxcall, inAddr, outAddr)
       register struct rx_call *rxcall;
Index: openafs/src/ubik/ubik.c
diff -c openafs/src/ubik/ubik.c:1.15.14.7 openafs/src/ubik/ubik.c:1.15.14.8
*** openafs/src/ubik/ubik.c:1.15.14.7	Sat Jul 19 02:15:02 2008
--- openafs/src/ubik/ubik.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.15.14.7 2008/07/19 06:15:02 rra Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.15.14.8 2008/11/21 07:09:55 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 36,77 ****
  
  #define ERROR_EXIT(code) {error=(code); goto error_exit;}
  
! /*  This system is organized in a hierarchical set of related modules.  Modules
!     at one level can only call modules at the same level or below.
!     
!     At the bottom level (0) we have R, RFTP, LWP and IOMGR, i.e. the basic
!     operating system primitives.
!     
!     At the next level (1) we have
! 
! 	VOTER--The module responsible for casting votes when asked.  It is also
! 	responsible for determining whether this server should try to become
! 	a synchronization site.
! 	
! 	BEACONER--The module responsible for sending keep-alives out when a
! 	server is actually the sync site, or trying to become a sync site.
! 	
! 	DISK--The module responsible for representing atomic transactions
! 	on the local disk.  It maintains a new-value only log.
! 	
! 	LOCK--The module responsible for locking byte ranges in the database file.
! 	
!     At the next level (2) we have
! 	  
! 	RECOVERY--The module responsible for ensuring that all members of a quorum
! 	have the same up-to-date database after a new synchronization site is
! 	elected.  This module runs only on the synchronization site.
! 	
!     At the next level (3) we have
!     
! 	REMOTE--The module responsible for interpreting requests from the sync
! 	site and applying them to the database, after obtaining the appropriate
! 	locks.
! 	
!     At the next level (4) we have
!     
! 	UBIK--The module users call to perform operations on the database.
! */
  
  
  /* some globals */
--- 36,76 ----
  
  #define ERROR_EXIT(code) {error=(code); goto error_exit;}
  
! /*!
!  * \file
!  * This system is organized in a hierarchical set of related modules.  Modules
!  * at one level can only call modules at the same level or below.
!  * 
!  * At the bottom level (0) we have R, RFTP, LWP and IOMGR, i.e. the basic
!  * operating system primitives.
!  *
!  * At the next level (1) we have
!  *
!  * \li VOTER--The module responsible for casting votes when asked.  It is also
!  * responsible for determining whether this server should try to become
!  * a synchronization site.
!  * \li BEACONER--The module responsible for sending keep-alives out when a
!  * server is actually the sync site, or trying to become a sync site.
!  * \li DISK--The module responsible for representing atomic transactions
!  * on the local disk.  It maintains a new-value only log.
!  * \li LOCK--The module responsible for locking byte ranges in the database file.
!  * 	
!  * At the next level (2) we have
!  *  
!  * \li RECOVERY--The module responsible for ensuring that all members of a quorum
!  * have the same up-to-date database after a new synchronization site is
!  * elected.  This module runs only on the synchronization site.
!  *	
!  * At the next level (3) we have
!  *
!  * \li REMOTE--The module responsible for interpreting requests from the sync
!  * site and applying them to the database, after obtaining the appropriate
!  * locks.
!  *
!  * At the next level (4) we have
!  *
!  * \li UBIK--The module users call to perform operations on the database.
!  */
  
  
  /* some globals */
***************
*** 90,107 ****
  
  struct rx_securityClass *ubik_sc[3];
  
- /* perform an operation at a quorum, handling error conditions.  return 0 if
-     all worked, otherwise mark failing server as down and return UERROR
- 
-     Note that if any server misses an update, we must wait BIGTIME seconds before
-     allowing the transaction to commit, to ensure that the missing and possibly still
-     functioning server times out and stop handing out old data.  This is done in the commit
-     code, where we wait for a server marked down to have stayed down for BIGTIME seconds
-     before we allow a transaction to commit.  A server that fails but comes back up won't give
-     out old data because it is sent the sync count along with the beacon message that
-     marks it as *really* up (beaconSinceDown).
- */
  #define	CStampVersion	    1	/* meaning set ts->version */
  afs_int32
  ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, aparm4,
  	      aparm5)
--- 89,109 ----
  
  struct rx_securityClass *ubik_sc[3];
  
  #define	CStampVersion	    1	/* meaning set ts->version */
+ 
+ /*! 
+  * \brief Perform an operation at a quorum, handling error conditions.
+  * \return 0 if all worked and a quorum was contacted successfully
+  * \return otherwise mark failing server as down and return #UERROR
+  *
+  * \note If any server misses an update, we must wait #BIGTIME seconds before
+  * allowing the transaction to commit, to ensure that the missing and possibly still
+  * functioning server times out and stops handing out old data.  This is done in the commit
+  * code, where we wait for a server marked down to have stayed down for #BIGTIME seconds
+  * before we allow a transaction to commit.  A server that fails but comes back up won't give
+  * out old data because it is sent the sync count along with the beacon message that
+  * marks it as \b really up (\p beaconSinceDown).
+  */
  afs_int32
  ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, aparm4,
  	      aparm5)
***************
*** 176,186 ****
  	return rcode;
  }
  
! /* This routine initializes the ubik system for a set of servers.  It returns 0 for success, or an error code on failure.  The set of servers is specified by serverList; nServers gives the number of entries in this array.  Finally, dbase is the returned structure representing this instance of a ubik; it is passed to various calls below.  The variable pathName provides an initial prefix used for naming storage files used by this system.  It should perhaps be generalized to a low-level disk interface providing read, write, file enumeration and sync operations.
! 
!     Note that the host named by myHost should not also be listed in serverList.
! */
! 
  int
  ubik_ServerInitCommon(afs_int32 myHost, short myPort,
  		      struct afsconf_cell *info, char clones[],
--- 178,196 ----
  	return rcode;
  }
  
! /*! 
!  * \brief This routine initializes the ubik system for a set of servers.
!  * \return 0 for success, or an error code on failure.
!  * \param serverList set of servers specified; nServers gives the number of entries in this array.
!  * \param pathName provides an initial prefix used for naming storage files used by this system.  
!  * \param dbase the returned structure representing this instance of an ubik; it is passed to various calls below.  
!  *
!  * \todo This routine should perhaps be generalized to a low-level disk interface providing read, write, file enumeration and sync operations.
!  *
!  * \warning The host named by myHost should not also be listed in serverList.
!  *
!  * \see ubik_ServerInit(), ubik_ServerInitByInfo()
!  */
  int
  ubik_ServerInitCommon(afs_int32 myHost, short myPort,
  		      struct afsconf_cell *info, char clones[],
***************
*** 354,359 ****
--- 364,372 ----
  
  }
  
+ /*!
+  * \see ubik_ServerInitCommon()
+  */
  int
  ubik_ServerInitByInfo(afs_int32 myHost, short myPort,
  		      struct afsconf_cell *info, char clones[],
***************
*** 367,372 ****
--- 380,388 ----
      return code;
  }
  
+ /*!
+  * \see ubik_ServerInitCommon()
+  */
  int
  ubik_ServerInit(afs_int32 myHost, short myPort, afs_int32 serverList[],
  		char *pathName, struct ubik_dbase **dbase)
***************
*** 379,395 ****
      return code;
  }
  
! /*  This routine begins a read or write transaction on the transaction
!     identified by transPtr, in the dbase named by dbase.  An open mode of
!     ubik_READTRANS identifies this as a read transaction, while a mode of
!     ubik_WRITETRANS identifies this as a write transaction.  transPtr 
!     is set to the returned transaction control block. The readAny flag is
!     set to 0 or 1 by the wrapper functions ubik_BeginTrans() or 
!     ubik_BeginTransReadAny() below.
! 
!     We can only begin transaction when we have an up-to-date database.
! */
! 
  static int
  BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode,
  	   struct ubik_trans **transPtr, int readAny)
--- 395,412 ----
      return code;
  }
  
! /*!
!  * \brief This routine begins a read or write transaction on the transaction
!  * identified by transPtr, in the dbase named by dbase.
!  *
!  * An open mode of ubik_READTRANS identifies this as a read transaction, 
!  * while a mode of ubik_WRITETRANS identifies this as a write transaction.
!  * transPtr is set to the returned transaction control block. 
!  * The readAny flag is set to 0 or 1 by the wrapper functions ubik_BeginTrans() or 
!  * ubik_BeginTransReadAny() below.
!  *
!  * \note We can only begin transaction when we have an up-to-date database.
!  */
  static int
  BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode,
  	   struct ubik_trans **transPtr, int readAny)
***************
*** 503,508 ****
--- 520,528 ----
      return 0;
  }
  
+ /*!
+  * \see BeginTrans()
+  */
  int
  ubik_BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode,
  		struct ubik_trans **transPtr)
***************
*** 510,515 ****
--- 530,538 ----
      return BeginTrans(dbase, transMode, transPtr, 0);
  }
  
+ /*!
+  * \see BeginTrans()
+  */
  int
  ubik_BeginTransReadAny(register struct ubik_dbase *dbase, afs_int32 transMode,
  		       struct ubik_trans **transPtr)
***************
*** 517,523 ****
      return BeginTrans(dbase, transMode, transPtr, 1);
  }
  
! /* this routine ends a read or write transaction by aborting it */
  int
  ubik_AbortTrans(register struct ubik_trans *transPtr)
  {
--- 540,548 ----
      return BeginTrans(dbase, transMode, transPtr, 1);
  }
  
! /*!
!  * \brief This routine ends a read or write transaction by aborting it.
!  */
  int
  ubik_AbortTrans(register struct ubik_trans *transPtr)
  {
***************
*** 559,565 ****
      return (code ? code : code2);
  }
  
! /* This routine ends a read or write transaction on the open transaction identified by transPtr.  It returns an error code. */
  int
  ubik_EndTrans(register struct ubik_trans *transPtr)
  {
--- 584,593 ----
      return (code ? code : code2);
  }
  
! /*!
!  * \brief This routine ends a read or write transaction on the open transaction identified by transPtr.
!  * \return an error code.
!  */
  int
  ubik_EndTrans(register struct ubik_trans *transPtr)
  {
***************
*** 673,680 ****
      return 0;
  }
  
! /* This routine reads length bytes into buffer from the current position in the database.  The file pointer is updated appropriately (by adding the number of bytes actually transferred), and the length actually transferred is stored in the long integer pointed to by length.  Note that *length is an INOUT parameter: at the start it represents the size of the buffer, and when done, it contains the number of bytes actually transferred.  A short read returns zero for an error code. */
! 
  int
  ubik_Read(register struct ubik_trans *transPtr, char *buffer,
  	  afs_int32 length)
--- 701,713 ----
      return 0;
  }
  
! /*!
!  * \brief This routine reads length bytes into buffer from the current position in the database.
!  * 
!  * The file pointer is updated appropriately (by adding the number of bytes actually transferred), and the length actually transferred is stored in the long integer pointed to by length.  A short read returns zero for an error code.
!  *
!  * \note *length is an INOUT parameter: at the start it represents the size of the buffer, and when done, it contains the number of bytes actually transferred.
!  */
  int
  ubik_Read(register struct ubik_trans *transPtr, char *buffer,
  	  afs_int32 length)
***************
*** 698,706 ****
      return code;
  }
  
! /* This routine will flush the io data in the iovec structures. It first
!  * flushes to the local disk and then uses ContactQuorum to write it to 
!  * the other servers.
   */
  int
  ubik_Flush(struct ubik_trans *transPtr)
--- 731,741 ----
      return code;
  }
  
! /*!
!  * \brief This routine will flush the io data in the iovec structures. 
!  *
!  * It first flushes to the local disk and then uses ContactQuorum to write it
!  * to the other servers.
   */
  int
  ubik_Flush(struct ubik_trans *transPtr)
***************
*** 826,833 ****
      return error;
  }
  
! /* This sets the file pointer associated with the current transaction to the appropriate file and byte position.  Unlike Unix files, a transaction is labelled by both a file number (fileid) and a byte position relative to the specified file (position). */
! 
  int
  ubik_Seek(register struct ubik_trans *transPtr, afs_int32 fileid,
  	  afs_int32 position)
--- 861,873 ----
      return error;
  }
  
! /*!
!  * \brief This sets the file pointer associated with the current transaction
!  * to the appropriate file and byte position.
!  *
!  * Unlike Unix files, a transaction is labelled by both a file number \p fileid
!  * and a byte position relative to the specified file \p position.
!  */
  int
  ubik_Seek(register struct ubik_trans *transPtr, afs_int32 fileid,
  	  afs_int32 position)
***************
*** 846,853 ****
      return code;
  }
  
! /* This call returns the file pointer associated with the specified transaction in fileid and position. */
! 
  int
  ubik_Tell(register struct ubik_trans *transPtr, afs_int32 * fileid,
  	  afs_int32 * position)
--- 886,895 ----
      return code;
  }
  
! /*!
!  * \brief This call returns the file pointer associated with the specified
!  * transaction in \p fileid and \p position.
!  */
  int
  ubik_Tell(register struct ubik_trans *transPtr, afs_int32 * fileid,
  	  afs_int32 * position)
***************
*** 859,866 ****
      return 0;
  }
  
! /* This sets the file size for the currently-selected file to length bytes, if length is less than the file's current size. */
! 
  int
  ubik_Truncate(register struct ubik_trans *transPtr, afs_int32 length)
  {
--- 901,910 ----
      return 0;
  }
  
! /*!
!  * \brief This sets the file size for the currently-selected file to \p length
!  * bytes, if length is less than the file's current size.
!  */
  int
  ubik_Truncate(register struct ubik_trans *transPtr, afs_int32 length)
  {
***************
*** 897,903 ****
      return error;
  }
  
! /* set a lock; all locks are released on transaction end (commit/abort) */
  int
  ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen,
  	     int atype)
--- 941,949 ----
      return error;
  }
  
! /*!
!  * \brief set a lock; all locks are released on transaction end (commit/abort)
!  */
  int
  ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen,
  	     int atype)
***************
*** 943,949 ****
      return error;
  }
  
! /* utility to wait for a version # to change */
  int
  ubik_WaitVersion(register struct ubik_dbase *adatabase,
  		 register struct ubik_version *aversion)
--- 989,997 ----
      return error;
  }
  
! /*!
!  * \brief utility to wait for a version # to change
!  */
  int
  ubik_WaitVersion(register struct ubik_dbase *adatabase,
  		 register struct ubik_version *aversion)
***************
*** 962,968 ****
      }
  }
  
! /* utility to get the version of the dbase a transaction is dealing with */
  int
  ubik_GetVersion(register struct ubik_trans *atrans,
  		register struct ubik_version *avers)
--- 1010,1018 ----
      }
  }
  
! /*!
!  * \brief utility to get the version of the dbase a transaction is dealing with
!  */
  int
  ubik_GetVersion(register struct ubik_trans *atrans,
  		register struct ubik_version *avers)
***************
*** 971,981 ****
      return 0;
  }
  
! /* Facility to simplify database caching.  Returns zero if last trans was done
!    on the local server and was successful.  If return value is non-zero and the
!    caller is a server caching part of the Ubik database, it should invalidate
!    that cache.  A return value of -1 means bad (NULL) argument. */
! 
  int
  ubik_CacheUpdate(register struct ubik_trans *atrans)
  {
--- 1021,1034 ----
      return 0;
  }
  
! /*!
!  * \brief Facility to simplify database caching.  
!  * \return zero if last trans was done on the local server and was successful.
!  * \return -1 means bad (NULL) argument.
!  * 
!  * If return value is non-zero and the caller is a server caching part of the 
!  * Ubik database, it should invalidate that cache.
!  */
  int
  ubik_CacheUpdate(register struct ubik_trans *atrans)
  {
***************
*** 984,989 ****
--- 1037,1050 ----
      return vcmp(atrans->dbase->cachedVersion, atrans->dbase->version) != 0;
  }
  
+ /*!
+  * "Who said anything about panicking?" snapped Arthur. 
+  * "This is still just the culture shock. You wait till I've settled down
+  * into the situation and found my bearings. \em Then I'll start panicking!"
+  * --Authur Dent
+  *
+  * \returns There is no return from panic.
+  */
  int
  panic(char *a, char *b, char *c, char *d)
  {
***************
*** 994,1003 ****
      exit(1);			/* never know, though  */
  }
  
! /*
! ** This functions takes an IP addresses as its parameter. It returns the
! ** the primary IP address that is on the host passed in.
! */
  afs_uint32
  ubikGetPrimaryInterfaceAddr(afs_uint32 addr)
  {
--- 1055,1064 ----
      exit(1);			/* never know, though  */
  }
  
! /*!
!  * This function takes an IP addresses as its parameter. It returns the
!  * the primary IP address that is on the host passed in, or 0 if not found.
!  */
  afs_uint32
  ubikGetPrimaryInterfaceAddr(afs_uint32 addr)
  {
Index: openafs/src/ubik/ubik.p.h
diff -c openafs/src/ubik/ubik.p.h:1.18.8.5 openafs/src/ubik/ubik.p.h:1.18.8.6
*** openafs/src/ubik/ubik.p.h:1.18.8.5	Sat Jul 19 02:15:02 2008
--- openafs/src/ubik/ubik.p.h	Fri Nov 21 02:09:55 2008
***************
*** 40,74 ****
  #include <ubik_int.h>
  #endif /* defined(UKERNEL) */
  
! /* ubik_trans types */
  #define	UBIK_READTRANS	    0
  #define	UBIK_WRITETRANS	    1
  
! /* ubik_lock types */
  #define	LOCKREAD	    1
  #define	LOCKWRITE	    2
  #if !defined(UBIK_PAUSE)
  #define	LOCKWAIT	    3
  #endif /* UBIK_PAUSE */
  
! /* ubik client flags */
! #define UPUBIKONLY 	    1	/* only check servers presumed functional */
  
! /* RX services types */
  #define	VOTE_SERVICE_ID	    50
  #define	DISK_SERVICE_ID	    51
! #define	USER_SERVICE_ID	    52	/* Since most applications use same port! */
  
  #define	UBIK_MAGIC	0x354545
  
! /* global ubik parameters */
! #define	MAXSERVERS	    20	/* max number of servers */
  
! /* version comparison macro */
  #define vcmp(a,b) ((a).epoch == (b).epoch? ((a).counter - (b).counter) : ((a).epoch - (b).epoch))
  
! /* ubik_client state bits */
! #define	CFLastFailed	    1	/* last call failed to this guy (to detect down hosts) */
  
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
--- 40,80 ----
  #include <ubik_int.h>
  #endif /* defined(UKERNEL) */
  
! /*! \name ubik_trans types */
  #define	UBIK_READTRANS	    0
  #define	UBIK_WRITETRANS	    1
+ /*\}*/
  
! /*! \name ubik_lock types */
  #define	LOCKREAD	    1
  #define	LOCKWRITE	    2
  #if !defined(UBIK_PAUSE)
  #define	LOCKWAIT	    3
  #endif /* UBIK_PAUSE */
+ /*\}*/
  
! /*! \name ubik client flags */
! #define UPUBIKONLY 	    1	/*!< only check servers presumed functional */
! /*\}*/
  
! /*! \name RX services types */
  #define	VOTE_SERVICE_ID	    50
  #define	DISK_SERVICE_ID	    51
! #define	USER_SERVICE_ID	    52	/*!< Since most applications use same port! */
! /*\}*/
  
  #define	UBIK_MAGIC	0x354545
  
! /*! \name global ubik parameters */
! #define	MAXSERVERS	    20	/*!< max number of servers */
! /*\}*/
  
! /*! version comparison macro */
  #define vcmp(a,b) ((a).epoch == (b).epoch? ((a).counter - (b).counter) : ((a).epoch - (b).epoch))
  
! /*! \name ubik_client state bits */
! #define	CFLastFailed	    1	/*!< last call failed to this guy (to detect down hosts) */
! /*\}*/
  
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
***************
*** 77,86 ****
  #include <lwp.h>
  #endif
  
! /* per-client structure for ubik */
  struct ubik_client {
!     short initializationState;	/* ubik client init state */
!     short states[MAXSERVERS];	/* state bits */
      struct rx_connection *conns[MAXSERVERS];
      afs_int32 syncSite;
  #ifdef AFS_PTHREAD_ENV
--- 83,94 ----
  #include <lwp.h>
  #endif
  
! /*!
!  * \brief per-client structure for ubik
!  */
  struct ubik_client {
!     short initializationState;	/*!< ubik client init state */
!     short states[MAXSERVERS];	/*!< state bits */
      struct rx_connection *conns[MAXSERVERS];
      afs_int32 syncSite;
  #ifdef AFS_PTHREAD_ENV
***************
*** 99,133 ****
  #define	ubik_GetRPCConn(astr,aindex)	((aindex) >= MAXSERVERS? 0 : (astr)->conns[aindex])
  #define	ubik_GetRPCHost(astr,aindex)	((aindex) >= MAXSERVERS? 0 : (astr)->hosts[aindex])
  
! /* ubik header file structure */
  struct ubik_hdr {
!     afs_int32 magic;		/* magic number */
!     short pad1;			/* some 0-initd padding */
!     short size;			/* header allocation size */
!     struct ubik_version version;	/* the version for this file */
  };
  
! /* representation of a ubik transaction */
  struct ubik_trans {
!     struct ubik_dbase *dbase;	/* corresponding database */
!     struct ubik_trans *next;	/* in the list */
!     afs_int32 locktype;		/* transaction lock */
!     struct ubik_trunc *activeTruncs;	/* queued truncates */
!     struct ubik_tid tid;	/* transaction id of this trans (if write trans.) */
!     afs_int32 minCommitTime;	/* time before which this trans can't commit */
!     afs_int32 seekFile;		/* seek ptr: file number */
!     afs_int32 seekPos;		/* seek ptr: offset therein */
!     short flags;		/* trans flag bits */
!     char type;			/* type of trans */
      iovec_wrt iovec_info;
      iovec_buf iovec_data;
  };
  
! /* representation of a truncation operation */
  struct ubik_trunc {
      struct ubik_trunc *next;
!     afs_int32 file;		/* file to truncate */
!     afs_int32 length;		/* new size */
  };
  
  struct ubik_stat {
--- 107,147 ----
  #define	ubik_GetRPCConn(astr,aindex)	((aindex) >= MAXSERVERS? 0 : (astr)->conns[aindex])
  #define	ubik_GetRPCHost(astr,aindex)	((aindex) >= MAXSERVERS? 0 : (astr)->hosts[aindex])
  
! /*!
!  * \brief ubik header file structure
!  */
  struct ubik_hdr {
!     afs_int32 magic;		/*!< magic number */
!     short pad1;			/*!< some 0-initd padding */
!     short size;			/*!< header allocation size */
!     struct ubik_version version;	/*!< the version for this file */
  };
  
! /*!
!  * \brief representation of a ubik transaction
!  */
  struct ubik_trans {
!     struct ubik_dbase *dbase;	/*!< corresponding database */
!     struct ubik_trans *next;	/*!< in the list */
!     afs_int32 locktype;		/*!< transaction lock */
!     struct ubik_trunc *activeTruncs;	/*!< queued truncates */
!     struct ubik_tid tid;	/*!< transaction id of this trans (if write trans.) */
!     afs_int32 minCommitTime;	/*!< time before which this trans can't commit */
!     afs_int32 seekFile;		/*!< seek ptr: file number */
!     afs_int32 seekPos;		/*!< seek ptr: offset therein */
!     short flags;		/*!< trans flag bits */
!     char type;			/*!< type of trans */
      iovec_wrt iovec_info;
      iovec_buf iovec_data;
  };
  
! /*!
!  * \brief representation of a truncation operation
!  */
  struct ubik_trunc {
      struct ubik_trunc *next;
!     afs_int32 file;		/*!< file to truncate */
!     afs_int32 length;		/*!< new size */
  };
  
  struct ubik_stat {
***************
*** 138,161 ****
  #if defined(UKERNEL)
  #include "afs/lock.h"
  #else /* defined(UKERNEL) */
! #include <lock.h>		/* just to make sure we've go this */
  #endif /* defined(UKERNEL) */
  
! /* representation of a ubik database.  Contains info on low-level disk access routines
!     for use by disk transaction module.
! */
  struct ubik_dbase {
!     char *pathName;		/* root name for dbase */
!     struct ubik_trans *activeTrans;	/* active transaction list */
!     struct ubik_version version;	/* version number */
  #if defined(UKERNEL)
!     struct afs_lock versionLock;	/* lock on version number */
  #else				/* defined(UKERNEL) */
!     struct Lock versionLock;	/* lock on version number */
  #endif				/* defined(UKERNEL) */
!     afs_int32 tidCounter;	/* last RW or RO trans tid counter */
!     afs_int32 writeTidCounter;	/* last write trans tid counter */
!     afs_int32 flags;		/* flags */
      /* physio procedures */
      int (*read) (struct ubik_dbase * adbase, afs_int32 afile, char *abuffer,
  		 afs_int32 apos, afs_int32 alength);
--- 152,178 ----
  #if defined(UKERNEL)
  #include "afs/lock.h"
  #else /* defined(UKERNEL) */
! #include <lock.h>		/* just to make sure we've got this */
  #endif /* defined(UKERNEL) */
  
! /*!
!  * \brief representation of a ubik database.
!  *
!  * Contains info on low-level disk access routines 
!  * for use by disk transaction module.
!  */
  struct ubik_dbase {
!     char *pathName;		/*!< root name for dbase */
!     struct ubik_trans *activeTrans;	/*!< active transaction list */
!     struct ubik_version version;	/*!< version number */
  #if defined(UKERNEL)
!     struct afs_lock versionLock;	/*!< lock on version number */
  #else				/* defined(UKERNEL) */
!     struct Lock versionLock;	/*!< lock on version number */
  #endif				/* defined(UKERNEL) */
!     afs_int32 tidCounter;	/*!< last RW or RO trans tid counter */
!     afs_int32 writeTidCounter;	/*!< last write trans tid counter */
!     afs_int32 flags;		/*!< flags */
      /* physio procedures */
      int (*read) (struct ubik_dbase * adbase, afs_int32 afile, char *abuffer,
  		 afs_int32 apos, afs_int32 alength);
***************
*** 167,281 ****
      int (*stat) (struct ubik_dbase * adbase, afs_int32 afid,
  		 struct ubik_stat * astat);
      int (*open) (struct ubik_dbase * adbase, afs_int32 afid);
!     int (*setlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/* set the version label */
!     int (*getlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/* retrieve the version label */
!     int (*getnfiles) (struct ubik_dbase * adbase);	/* find out number of files */
!     short readers;		/* number of current read transactions */
!     struct ubik_version cachedVersion;	/* version of caller's cached data */
  #ifdef AFS_PTHREAD_ENV
!     pthread_cond_t version_cond;    /* condition variable to manage changes to version */
!     pthread_cond_t flags_cond;      /* condition variable to manage changes to flags */
    pthread_mutex_t version_mutex;
    pthread_mutex_t flags_mutex;
  #endif
  };
  
! /* procedures for automatically authenticating ubik connections */
  extern int (*ubik_CRXSecurityProc) ();
  extern char *ubik_CRXSecurityRock;
  extern int (*ubik_SRXSecurityProc) ();
  extern char *ubik_SRXSecurityRock;
  extern int (*ubik_CheckRXSecurityProc) ();
  extern char *ubik_CheckRXSecurityRock;
  
  /****************INTERNALS BELOW ****************/
  
  #ifdef UBIK_INTERNALS
! /* some ubik parameters */
! #define	UBIK_PAGESIZE	    1024	/* fits in current r packet */
! #define	UBIK_LOGPAGESIZE    10	/* base 2 log thereof */
! #define	NBUFFERS	    20	/* number of 1K buffers */
! #define	HDRSIZE		    64	/* bytes of header per dbfile */
  
! /* ubik_dbase flags */
! #define	DBWRITING	    1	/* are any write trans. in progress */
  #if defined(UBIK_PAUSE)
! #define DBVOTING            2	/* the beacon task is polling */
  #endif /* UBIK_PAUSE */
  
! /* ubik trans flags */
! #define	TRDONE		    1	/* commit or abort done */
! #define	TRABORT		    2	/* if TRDONE, tells if aborted */
! #define TRREADANY	    4	/* read any data available in trans */
  #if defined(UBIK_PAUSE)
! #define TRSETLOCK           8	/* SetLock is using trans */
! #define TRSTALE             16	/* udisk_end during getLock */
  #endif /* UBIK_PAUSE */
  
! /* ubik_lock flags */
  #define	LWANT		    1
  
! /* ubik system database numbers */
  #define	LOGFILE		    (-1)
  
! /* define log opcodes */
! #define	LOGNEW		    100	/* start transaction */
! #define	LOGEND		    101	/* commit (good) end transaction */
! #define	LOGABORT	    102	/* abort (fail) transaction */
! #define	LOGDATA		    103	/* data */
! #define	LOGTRUNCATE	    104	/* truncate operation */
! 
! /* time constant for replication algorithms: the R time period is 20 seconds.  Both SMALLTIME
!     and BIGTIME must be larger than RPCTIMEOUT+max(RPCTIMEOUT,POLLTIME),
!     so that timeouts do not prevent us from getting through to our servers in time.
! 
!     We use multi-R to time out multiple down hosts concurrently.
!     The only other restrictions:  BIGTIME > SMALLTIME and
!     BIGTIME-SMALLTIME > MAXSKEW (the clock skew).
! */
  #define MAXSKEW	10
  #define POLLTIME 15
  #define RPCTIMEOUT 20
  #define BIGTIME 75
  #define SMALLTIME 60
  
! /* the per-server state, used by the sync site to keep track of its charges */
  struct ubik_server {
!     struct ubik_server *next;	/* next ptr */
!     afs_uint32 addr[UBIK_MAX_INTERFACE_ADDR];	/* network order, addr[0] is primary */
!     afs_int32 lastVoteTime;	/* last time yes vote received */
!     afs_int32 lastBeaconSent;	/* last time beacon attempted */
!     struct ubik_version version;	/* version, only used during recovery */
!     struct rx_connection *vote_rxcid;	/* cid to use to contact dude for votes */
!     struct rx_connection *disk_rxcid;	/* cid to use to contact dude for disk reqs */
!     char lastVote;		/* true if last vote was yes */
!     char up;			/* is it up? */
!     char beaconSinceDown;	/* did beacon get through since last crash? */
!     char currentDB;		/* is dbase up-to-date */
!     char magic;			/* the one whose vote counts twice */
!     char isClone;		/* is only a clone, doesn't vote */
  };
  
! /* hold and release functions on a database */
  #define	DBHOLD(a)	ObtainWriteLock(&((a)->versionLock))
  #define	DBRELE(a)	ReleaseWriteLock(&((a)->versionLock))
  
  /* globals */
  
! /* list of all servers in the system */
  extern struct ubik_server *ubik_servers;
  extern char amIClone;
  
! /* network port info */
  extern short ubik_callPortal;
  
! /* urecovery state bits for sync site */
  #define	UBIK_RECSYNCSITE	1	/* am sync site */
  #define	UBIK_RECFOUNDDB		2	/* found acceptable dbase from quorum */
  #define	UBIK_RECHAVEDB		4	/* fetched best dbase */
  #define	UBIK_RECLABELDB		8	/* relabelled dbase */
  #define	UBIK_RECSENTDB		0x10	/* sent best db to *everyone* */
  #define	UBIK_RECSBETTER		UBIK_RECLABELDB	/* last state */
  
  extern afs_int32 ubik_quorum;	/* min hosts in quorum */
  extern struct ubik_dbase *ubik_dbase;	/* the database handled by this server */
--- 184,314 ----
      int (*stat) (struct ubik_dbase * adbase, afs_int32 afid,
  		 struct ubik_stat * astat);
      int (*open) (struct ubik_dbase * adbase, afs_int32 afid);
!     int (*setlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/*!< set the version label */
!     int (*getlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/*!< retrieve the version label */
!     int (*getnfiles) (struct ubik_dbase * adbase);	/*!< find out number of files */
!     short readers;		/*!< number of current read transactions */
!     struct ubik_version cachedVersion;	/*!< version of caller's cached data */
  #ifdef AFS_PTHREAD_ENV
!     pthread_cond_t version_cond;    /*!< condition variable to manage changes to version */
!     pthread_cond_t flags_cond;      /*!< condition variable to manage changes to flags */
    pthread_mutex_t version_mutex;
    pthread_mutex_t flags_mutex;
  #endif
  };
  
! /*! \name procedures for automatically authenticating ubik connections */
  extern int (*ubik_CRXSecurityProc) ();
  extern char *ubik_CRXSecurityRock;
  extern int (*ubik_SRXSecurityProc) ();
  extern char *ubik_SRXSecurityRock;
  extern int (*ubik_CheckRXSecurityProc) ();
  extern char *ubik_CheckRXSecurityRock;
+ /*\}*/
  
  /****************INTERNALS BELOW ****************/
  
  #ifdef UBIK_INTERNALS
! /*! \name some ubik parameters */
! #define	UBIK_PAGESIZE	    1024	/*!< fits in current r packet */
! #define	UBIK_LOGPAGESIZE    10	/*!< base 2 log thereof */
! #define	NBUFFERS	    20	/*!< number of 1K buffers */
! #define	HDRSIZE		    64	/*!< bytes of header per dbfile */
! /*\}*/
  
! /*! \name ubik_dbase flags */
! #define	DBWRITING	    1	/*!< are any write trans. in progress */
  #if defined(UBIK_PAUSE)
! #define DBVOTING            2	/*!< the beacon task is polling */
  #endif /* UBIK_PAUSE */
+ /*\}*/
  
! /*!\name ubik trans flags */
! #define	TRDONE		    1	/*!< commit or abort done */
! #define	TRABORT		    2	/*!< if #TRDONE, tells if aborted */
! #define TRREADANY	    4	/*!< read any data available in trans */
  #if defined(UBIK_PAUSE)
! #define TRSETLOCK           8	/*!< SetLock is using trans */
! #define TRSTALE             16	/*!< udisk_end during getLock */
  #endif /* UBIK_PAUSE */
+ /*\}*/
  
! /*! \name ubik_lock flags */
  #define	LWANT		    1
+ /*\}*/
  
! /*! \name ubik system database numbers */
  #define	LOGFILE		    (-1)
+ /*\}*/
  
! /*! \name define log opcodes */
! #define	LOGNEW		    100	/*!< start transaction */
! #define	LOGEND		    101	/*!< commit (good) end transaction */
! #define	LOGABORT	    102	/*!< abort (fail) transaction */
! #define	LOGDATA		    103	/*!< data */
! #define	LOGTRUNCATE	    104	/*!< truncate operation */
! /*\}*/
! 
! /*!
!  * \name timer constants
!  * time constant for replication algorithms: the R time period is 20 seconds.  Both 
!  * #SMALLTIME and #BIGTIME must be larger than #RPCTIMEOUT+max(#RPCTIMEOUT, #POLLTIME),
!  * so that timeouts do not prevent us from getting through to our servers in time.
!  *
!  * We use multi-R to time out multiple down hosts concurrently.
!  * The only other restrictions:  #BIGTIME > #SMALLTIME and
!  * #BIGTIME-#SMALLTIME > #MAXSKEW (the clock skew).
!  */
  #define MAXSKEW	10
  #define POLLTIME 15
  #define RPCTIMEOUT 20
  #define BIGTIME 75
  #define SMALLTIME 60
+ /*\}*/
  
! /*!
!  * \brief the per-server state, used by the sync site to keep track of its charges
!  */
  struct ubik_server {
!     struct ubik_server *next;	/*!< next ptr */
!     afs_uint32 addr[UBIK_MAX_INTERFACE_ADDR];	/*!< network order, addr[0] is primary */
!     afs_int32 lastVoteTime;	/*!< last time yes vote received */
!     afs_int32 lastBeaconSent;	/*!< last time beacon attempted */
!     struct ubik_version version;	/*!< version, only used during recovery */
!     struct rx_connection *vote_rxcid;	/*!< cid to use to contact dude for votes */
!     struct rx_connection *disk_rxcid;	/*!< cid to use to contact dude for disk reqs */
!     char lastVote;		/*!< true if last vote was yes */
!     char up;			/*!< is it up? */
!     char beaconSinceDown;	/*!< did beacon get through since last crash? */
!     char currentDB;		/*!< is dbase up-to-date */
!     char magic;			/*!< the one whose vote counts twice */
!     char isClone;		/*!< is only a clone, doesn't vote */
  };
  
! /*! \name hold and release functions on a database */
  #define	DBHOLD(a)	ObtainWriteLock(&((a)->versionLock))
  #define	DBRELE(a)	ReleaseWriteLock(&((a)->versionLock))
+ /*\}*/
  
  /* globals */
  
! /*!name list of all servers in the system */
  extern struct ubik_server *ubik_servers;
  extern char amIClone;
+ /*\}*/
  
! /*! \name network port info */
  extern short ubik_callPortal;
+ /*\}*/
  
! /*! \name urecovery state bits for sync site */
  #define	UBIK_RECSYNCSITE	1	/* am sync site */
  #define	UBIK_RECFOUNDDB		2	/* found acceptable dbase from quorum */
  #define	UBIK_RECHAVEDB		4	/* fetched best dbase */
  #define	UBIK_RECLABELDB		8	/* relabelled dbase */
  #define	UBIK_RECSENTDB		0x10	/* sent best db to *everyone* */
  #define	UBIK_RECSBETTER		UBIK_RECLABELDB	/* last state */
+ /*\}*/
  
  extern afs_int32 ubik_quorum;	/* min hosts in quorum */
  extern struct ubik_dbase *ubik_dbase;	/* the database handled by this server */
***************
*** 314,320 ****
  extern void uphys_invalidate(register struct ubik_dbase *adbase, 
  			     afs_int32 afid);
  
! /* recovery.c */
  extern int urecovery_ResetState(void);
  extern int urecovery_LostServer(void);
  extern int urecovery_AllBetter(register struct ubik_dbase *adbase,
--- 347,353 ----
  extern void uphys_invalidate(register struct ubik_dbase *adbase, 
  			     afs_int32 afid);
  
! /*! \name recovery.c */
  extern int urecovery_ResetState(void);
  extern int urecovery_LostServer(void);
  extern int urecovery_AllBetter(register struct ubik_dbase *adbase,
***************
*** 324,330 ****
  extern int urecovery_Initialize(register struct ubik_dbase *adbase);
  extern void *urecovery_Interact(void *);
  extern int DoProbe(struct ubik_server *server);
! 
  
  extern void *ubeacon_Interact(void *);
  extern int sdisk_Interact();
--- 357,363 ----
  extern int urecovery_Initialize(register struct ubik_dbase *adbase);
  extern void *urecovery_Interact(void *);
  extern int DoProbe(struct ubik_server *server);
! /*\}*/
  
  extern void *ubeacon_Interact(void *);
  extern int sdisk_Interact();
***************
*** 339,356 ****
  extern int DISK_Truncate();
  extern int DISK_SetVersion();
  
! /* disk.c */
  extern int udisk_abort(struct ubik_trans *atrans);
  
! /* lock.c */
  extern void ulock_relLock(struct ubik_trans *atrans);
  
  #endif /* UBIK_INTERNALS */
  
  extern afs_int32 ubik_nBuffers;
  
! /*
!  * Public function prototypes
   */
  
  extern int ubik_ParseClientList(int argc, char **argv, afs_int32 * aothers);
--- 372,391 ----
  extern int DISK_Truncate();
  extern int DISK_SetVersion();
  
! /*! \name disk.c */
  extern int udisk_abort(struct ubik_trans *atrans);
+ /*\}*/
  
! /*! \name lock.c */
  extern void ulock_relLock(struct ubik_trans *atrans);
+ /*\}*/
  
  #endif /* UBIK_INTERNALS */
  
  extern afs_int32 ubik_nBuffers;
  
! /*!
!  * \name Public function prototypes
   */
  
  extern int ubik_ParseClientList(int argc, char **argv, afs_int32 * aothers);
***************
*** 370,375 ****
--- 405,411 ----
  			       long p13, long p14, long p15, long p16);
  
  extern struct rx_connection *ubik_RefreshConn(struct rx_connection *tc);
+ /*\}*/
  
  /* ubik.c */
  extern int ubik_BeginTrans(register struct ubik_dbase *dbase,
Index: openafs/src/ubik/ubikclient.c
diff -c openafs/src/ubik/ubikclient.c:1.10.8.1 openafs/src/ubik/ubikclient.c:1.10.8.2
*** openafs/src/ubik/ubikclient.c:1.10.8.1	Mon Jul  3 15:07:15 2006
--- openafs/src/ubik/ubikclient.c	Fri Nov 21 02:09:55 2008
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubikclient.c,v 1.10.8.1 2006/07/03 19:07:15 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubikclient.c,v 1.10.8.2 2008/11/21 07:09:55 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
***************
*** 46,56 ****
  #endif /* defined(UKERNEL) */
  
  
! short ubik_initializationState;	/* initial state is zero */
  
  
! /*
!  * parse list for clients
   */
  int
  ubik_ParseClientList(int argc, char **argv, afs_int32 * aothers)
--- 46,56 ----
  #endif /* defined(UKERNEL) */
  
  
! short ubik_initializationState;	/*!< initial state is zero */
  
  
! /*!
!  * \brief Parse list for clients.
   */
  int
  ubik_ParseClientList(int argc, char **argv, afs_int32 * aothers)
***************
*** 115,148 ****
  }
  
  #endif
! /* 
!  * Random number generator and constants from KnuthV2 2d ed, p170
   *
!  * Rules:
!  * X = (aX + c) % m
!  * m is a power of two 
!  * a % 8 is 5
!  * a is 0.73m  should be 0.01m .. 0.99m
!  * c is more or less immaterial.  1 or a is suggested.
   *
   * NB:  LOW ORDER BITS are not very random.  To get small random numbers,
   *      treat result as <1, with implied binary point, and multiply by 
   *      desired modulus.
   * NB:  Has to be unsigned, since shifts on signed quantities may preserve
   *      the sign bit.
   * 
   * In this case, m == 2^32, the mod operation is implicit. a == pi, which
   * is used because it has some interesting characteristics (lacks any
   * interesting bit-patterns).   
-  * 
   */
- 
- /* 
-  * use time and pid to try to get some initial randomness.
-  */
- #if !defined(UKERNEL)
- #define	ranstage(x)	(x)= (afs_uint32) (3141592621U*((afs_uint32)x)+1)
- 
  unsigned int
  afs_random(void)
  {
--- 115,148 ----
  }
  
  #endif
! 
! #if !defined(UKERNEL)
! /*! 
!  * \brief use time and pid to try to get some initial randomness.
!  */
! #define	ranstage(x)	(x)= (afs_uint32) (3141592621U*((afs_uint32)x)+1)
! 
! /*! 
!  * \brief Random number generator and constants from KnuthV2 2d ed, p170
   *
!  * Rules: \n
!  * X = (aX + c) % m \n
!  * m is a power of two \n
!  * a % 8 is 5 \n
!  * a is 0.73m  should be 0.01m .. 0.99m \n
!  * c is more or less immaterial.  1 or a is suggested. \n
   *
   * NB:  LOW ORDER BITS are not very random.  To get small random numbers,
   *      treat result as <1, with implied binary point, and multiply by 
   *      desired modulus.
+  *
   * NB:  Has to be unsigned, since shifts on signed quantities may preserve
   *      the sign bit.
   * 
   * In this case, m == 2^32, the mod operation is implicit. a == pi, which
   * is used because it has some interesting characteristics (lacks any
   * interesting bit-patterns).   
   */
  unsigned int
  afs_random(void)
  {
***************
*** 171,184 ****
  
  }
  
! /*
!  * returns int 0..14 using the high bits of a pseudo-random number instead of
   * the low bits, as the low bits are "less random" than the high ones...
!  * slight roundoff error exists, an excercise for the reader.
!  * need to multiply by something with lots of ones in it, so multiply by 
   * 8 or 16 is right out.
   */
- 
  static unsigned int
  afs_randomMod15(void)
  {
--- 171,185 ----
  
  }
  
! /*!
!  * \brief Returns int 0..14 using the high bits of a pseudo-random number instead of
   * the low bits, as the low bits are "less random" than the high ones...
!  * 
!  * \todo Slight roundoff error exists, an excercise for the reader.
!  *
!  * Need to multiply by something with lots of ones in it, so multiply by 
   * 8 or 16 is right out.
   */
  static unsigned int
  afs_randomMod15(void)
  {
***************
*** 268,278 ****
      return 0;
  }
  
! /* 
!  * ubik_ClientDestroy - destroys a ubik connection.  It calls rx to destroy the
!  * component rx connections, then frees the ubik connection structure.
   */
- 
  afs_int32
  ubik_ClientDestroy(struct ubik_client * aclient)
  {
--- 269,280 ----
      return 0;
  }
  
! /*! 
!  * \brief Destroy an ubik connection.
!  *
!  * It calls rx to destroy the component rx connections, then frees the ubik
!  * connection structure.
   */
  afs_int32
  ubik_ClientDestroy(struct ubik_client * aclient)
  {
***************
*** 300,311 ****
      return 0;
  }
  
! /*
!  * RefreshConn -- So that intermittent failures that cause connections to die
   *     don't kill whole ubik connection, refresh them when the connection is in
   *     error.
   */
- 
  struct rx_connection *
  ubik_RefreshConn(struct rx_connection *tc)
  {
--- 302,312 ----
      return 0;
  }
  
! /*!
!  * \brief So that intermittent failures that cause connections to die
   *     don't kill whole ubik connection, refresh them when the connection is in
   *     error.
   */
  struct rx_connection *
  ubik_RefreshConn(struct rx_connection *tc)
  {
***************
*** 357,365 ****
  static int *calls_needsync[SYNCCOUNT];	/* proc calls that need the sync site */
  static int synccount = 0;
  
! /*
   * call this instead of stub and we'll guarantee to find a host that's up.
!  * in the future, we should also put in a protocol to find the sync site
   */
  afs_int32
  ubik_Call(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
--- 358,367 ----
  static int *calls_needsync[SYNCCOUNT];	/* proc calls that need the sync site */
  static int synccount = 0;
  
! /*!
   * call this instead of stub and we'll guarantee to find a host that's up.
!  * 
!  * \todo In the future, we should also put in a protocol to find the sync site.
   */
  afs_int32
  ubik_Call(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
***************
*** 514,525 ****
  
  
  
! /*
!  * call this after getting back a UNOTSYNC 
!  * note that getting a UNOTSYNC error code back does *not* guarantee
   * that there is a sync site yet elected.  However, if there is a sync
   * site out there somewhere, and you're trying an operation that
!  * requires a sync site, ubik will return UNOTSYNC, indicating the
   * operation won't work until you find a sync site
   */
  static int
--- 516,528 ----
  
  
  
! /*!
!  * \brief Call this after getting back a #UNOTSYNC.
!  *
!  * \note Getting a #UNOTSYNC error code back does \b not guarantee
   * that there is a sync site yet elected.  However, if there is a sync
   * site out there somewhere, and you're trying an operation that
!  * requires a sync site, ubik will return #UNOTSYNC, indicating the
   * operation won't work until you find a sync site
   */
  static int
***************
*** 570,584 ****
      return -1;
  }
  
- /* 
-  * Create an internal version of ubik_CallIter that takes an additional
-  * parameter - to indicate whether the ubik client handle has already
-  * been locked.
-  */
- 
  #define NEED_LOCK 1
  #define NO_LOCK 0
  
  static afs_int32
  CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, p8, p9,
  	 p10, p11, p12, p13, p14, p15, p16, needlock)
--- 573,586 ----
      return -1;
  }
  
  #define NEED_LOCK 1
  #define NO_LOCK 0
  
+ /*! 
+  * \brief Create an internal version of ubik_CallIter that takes an additional
+  * parameter - to indicate whether the ubik client handle has already
+  * been locked.
+  */
  static afs_int32
  CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, p8, p9,
  	 p10, p11, p12, p13, p14, p15, p16, needlock)
***************
*** 668,676 ****
      return code;
  }
  
! /* 
!  * call this instead of stub and we'll guarantee to find a host that's up.
!  * in the future, we should also put in a protocol to find the sync site
   */
  afs_int32
  ubik_Call_New(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
--- 670,679 ----
      return code;
  }
  
! /*! 
!  * \brief Call this instead of stub and we'll guarantee to find a host that's up.
!  *
!  * \todo In the future, we should also put in a protocol to find the sync site.
   */
  afs_int32
  ubik_Call_New(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
***************
*** 745,752 ****
      return rcode;
  }
  
! /* 
!  * This is part of an iterator.  It doesn't handle finding sync sites
   */
  afs_int32
  ubik_CallIter(int (*aproc) (), struct ubik_client *aclient,
--- 748,755 ----
      return rcode;
  }
  
! /*!
!  * \brief This is part of an iterator.  It doesn't handle finding sync sites.
   */
  afs_int32
  ubik_CallIter(int (*aproc) (), struct ubik_client *aclient,
Index: openafs/src/ubik/ubikcmd.c
diff -c openafs/src/ubik/ubikcmd.c:1.7.14.1 openafs/src/ubik/ubikcmd.c:1.7.14.2
*** openafs/src/ubik/ubikcmd.c:1.7.14.1	Tue Oct 30 11:16:47 2007
--- openafs/src/ubik/ubikcmd.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubikcmd.c,v 1.7.14.1 2007/10/30 15:16:47 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubikcmd.c,v 1.7.14.2 2008/11/21 07:09:55 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 31,40 ****
  #define UBIK_INTERNALS
  #include "ubik.h"
  
! /* This file contain useful subroutines for parsing command line args for ubik
!  *   applications.
   */
- 
  ubik_ParseServerList(argc, argv, ahost, aothers)
       int argc;
       char **argv;
--- 31,40 ----
  #define UBIK_INTERNALS
  #include "ubik.h"
  
! /*! \file
!  * This file contain useful subroutines for parsing command line args for ubik
!  * applications.
   */
  ubik_ParseServerList(argc, argv, ahost, aothers)
       int argc;
       char **argv;
Index: openafs/src/ubik/udebug.c
diff -c openafs/src/ubik/udebug.c:1.18.4.4 openafs/src/ubik/udebug.c:1.18.4.5
*** openafs/src/ubik/udebug.c:1.18.4.4	Sat May 10 11:21:19 2008
--- openafs/src/ubik/udebug.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/udebug.c,v 1.18.4.4 2008/05/10 15:21:19 jaltman Exp $");
  
  #include <sys/types.h>
  #include <stdlib.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/udebug.c,v 1.18.4.5 2008/11/21 07:09:55 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdlib.h>
***************
*** 40,46 ****
  #include "ubik.h"
  #include "ubik_int.h"
  
! /* needed by Irix. Include a header to get it, or leave it alone. */
  extern struct hostent *hostutil_GetHostByName();
  
  static short
--- 40,46 ----
  #include "ubik.h"
  #include "ubik_int.h"
  
! /*! needed by Irix. Include a header to get it, or leave it alone. */
  extern struct hostent *hostutil_GetHostByName();
  
  static short
Index: openafs/src/ubik/uinit.c
diff -c openafs/src/ubik/uinit.c:1.7.8.3 openafs/src/ubik/uinit.c:1.7.8.4
*** openafs/src/ubik/uinit.c:1.7.8.3	Tue Oct 30 11:16:47 2007
--- openafs/src/ubik/uinit.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/uinit.c,v 1.7.8.3 2007/10/30 15:16:47 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/uinit.c,v 1.7.8.4 2008/11/21 07:09:55 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
***************
*** 43,51 ****
  #include <afs/afsint.h>
  #include <afs/cmd.h>
  
! /*
!   Get the appropriate type of ubik client structure out from the system.
! */
  afs_int32
  ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
  	       struct ubik_client **uclientp, int (*secproc) (),
--- 43,51 ----
  #include <afs/afsint.h>
  #include <afs/cmd.h>
  
! /*!
!  * \brief Get the appropriate type of ubik client structure out from the system.
!  */
  afs_int32
  ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
  	       struct ubik_client **uclientp, int (*secproc) (),
Index: openafs/src/ubik/utst_server.c
diff -c openafs/src/ubik/utst_server.c:1.8.14.3 openafs/src/ubik/utst_server.c:1.8.14.4
*** openafs/src/ubik/utst_server.c:1.8.14.3	Sat Jul 19 02:15:02 2008
--- openafs/src/ubik/utst_server.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/utst_server.c,v 1.8.14.3 2008/07/19 06:15:02 rra Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/utst_server.c,v 1.8.14.4 2008/11/21 07:09:55 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 33,41 ****
  #include "utst_int.h"
  
  
! /* useful globals */
  struct ubik_dbase *dbase;
  afs_int32 sleepTime;
  
  SAMPLE_Inc(rxconn)
       struct rx_connection *rxconn;
--- 33,42 ----
  #include "utst_int.h"
  
  
! /*! \name useful globals */
  struct ubik_dbase *dbase;
  afs_int32 sleepTime;
+ /*\}*/
  
  SAMPLE_Inc(rxconn)
       struct rx_connection *rxconn;
Index: openafs/src/ubik/vote.c
diff -c openafs/src/ubik/vote.c:1.14.14.1 openafs/src/ubik/vote.c:1.14.14.2
*** openafs/src/ubik/vote.c:1.14.14.1	Tue Oct 30 11:16:47 2007
--- openafs/src/ubik/vote.c	Fri Nov 21 02:09:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/vote.c,v 1.14.14.1 2007/10/30 15:16:47 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/vote.c,v 1.14.14.2 2008/11/21 07:09:55 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 32,127 ****
  #include "ubik.h"
  #include "ubik_int.h"
  
! /*
!     General Ubik Goal:
!     The goal is to provide reliable operation among N servers, such that any
!     server can crash with the remaining servers continuing operation within a
!     short period of time.  While a *short* outage is acceptable, this time
!     should be order of 3 minutes or less.
!     
!     Theory of operation:
!     
!     Note: SMALLTIME and BIGTIME are essentially the same time value, separated
!     only by the clock skew, MAXSKEW.  In general, if you are making guarantees
!     for someone else, promise them no more than SMALLTIME seconds of whatever
!     invariant you provide.  If you are waiting to be sure some invariant is now
!     *false*, wait at least BIGTIME seconds to be sure that SMALLTIME seconds
!     has passed at the other site.
! 
!     Now, back to the design:
!     One site in the collection is a special site, designated the *sync* site.
!     The sync site sends periodic messages, which can be thought of as
!     keep-alive messages.  When a non-sync site hears from the sync site, it
!     knows that it is getting updates for the next SMALLTIME seconds from that
!     sync site.
!     
!     If a server does not hear from the sync site in SMALLTIME seconds, it
!     determines that it no longer is getting updates, and thus refuses to give
!     out potentially out-of-date data.  If a sync site can not muster a majority
!     of servers to agree that it is the sync site, then there is a possibility
!     that a network partition has occurred, allowing another server to claim to
!     be the sync site.  Thus, any time that the sync site has not heard from a
!     majority of the servers in the last SMALLTIME seconds, it voluntarily
!     relinquishes its role as sync site.
!     
!     While attempting to nominate a new sync site, certain rules apply.  First,
!     a server can not reply "ok" (return 1 from ServBeacon) to two different
!     hosts in less than BIGTIME seconds; this allows a server that has heard
!     affirmative replies from a majority of the servers to know that no other
!     server in the network has heard enough affirmative replies in the last
!     BIGTIME seconds to become sync site, too.  The variables ubik_lastYesTime
!     and lastYesHost are used by all servers to keep track of which host they
!     have last replied affirmatively to, when queried by a potential new sync
!     site.
!     
!     Once a sync site has become a sync site, it periodically sends beacon
!     messages with a parameter of 1, indicating that it already has determined
!     it is supposed to be the sync site.  The servers treat such a message as a
!     guarantee that no other site will become sync site for the next SMALLTIME
!     seconds.  In the interim, these servers can answer a query concerning which
!     site is the sync site without any communication with any server.  The
!     variables lastBeaconArrival and lastBeaconHost are used by all servers to
!     keep track of which sync site has last contacted them.
!     
!     One complication occurs while nominating a new sync site: each site may be
!     trying to nominate a different site (based on the value of lastYesHost),
!     yet we must nominate the smallest host (under some order), to prevent this
!     process from looping.  The process could loop by having each server give
!     one vote to another server, but with no server getting a majority of the
!     votes.  To avoid this, we try to withhold our votes for the server with the
!     lowest internet address (an easy-to-generate order).  To this effect, we
!     keep track (in lowestTime and lowestHost) of the lowest server trying to
!     become a sync site.  We wait for this server unless there is already a sync
!     site (indicated by ServBeacon's parameter being 1).
! */
! 
! afs_int32 ubik_debugFlag = 0;	/* print out debugging messages? */
! 
! /* these statics are used by all sites in nominating new sync sites */
! afs_int32 ubik_lastYesTime = 0;	/* time we sent the last *yes* vote */
! static afs_uint32 lastYesHost = 0xffffffff;	/* host to which we sent *yes* vote */
! /* Next is time sync site began this vote: guarantees sync site until this + SMALLTIME */
  static afs_int32 lastYesClaim = 0;
! static int lastYesState = 0;	/* did last site we voted for claim to be sync site? */
  
! /* used to guarantee that nomination process doesn't loop */
  static afs_int32 lowestTime = 0;
  static afs_uint32 lowestHost = 0xffffffff;
  static afs_int32 syncTime = 0;
  static afs_int32 syncHost = 0;
  
! /* used to remember which dbase version is the one at the sync site (for non-sync sites */
! struct ubik_version ubik_dbVersion;	/* sync site's dbase version */
! struct ubik_tid ubik_dbTid;	/* sync site's tid, or 0 if none */
  
! /* decide if we should try to become sync site.  The basic rule is that we
   * don't run if there is a valid sync site and it ain't us (we have to run if
   * it is us, in order to keep our votes).  If there is no sync site, then we
   * want to run if we're the lowest numbered host running, otherwise we defer to
   * the lowest host.  However, if the lowest host hasn't been heard from for a
   * while, then we start running again, in case he crashed.
   *
!  * This function returns true if we should run, and false otherwise.
   */
  int
  uvote_ShouldIRun(void)
--- 32,134 ----
  #include "ubik.h"
  #include "ubik_int.h"
  
! /*! \file
!  * General Ubik Goal:
!  * The goal is to provide reliable operation among N servers, such that any
!  * server can crash with the remaining servers continuing operation within a
!  * short period of time.  While a \b short outage is acceptable, this time
!  * should be order of 3 minutes or less.
!  *
!  * Theory of operation:
!  *
!  * Note: #SMALLTIME and #BIGTIME are essentially the same time value, separated
!  * only by the clock skew, #MAXSKEW.  In general, if you are making guarantees
!  * for someone else, promise them no more than #SMALLTIME seconds of whatever
!  * invariant you provide.  If you are waiting to be sure some invariant is now
!  * \b false, wait at least #BIGTIME seconds to be sure that #SMALLTIME seconds
!  * has passed at the other site.
!  *
!  * Now, back to the design:
!  * One site in the collection is a special site, designated the \b sync site.
!  * The sync site sends periodic messages, which can be thought of as
!  * keep-alive messages.  When a non-sync site hears from the sync site, it
!  * knows that it is getting updates for the next #SMALLTIME seconds from that
!  * sync site.
!  *
!  * If a server does not hear from the sync site in #SMALLTIME seconds, it
!  * determines that it no longer is getting updates, and thus refuses to give
!  * out potentially out-of-date data.  If a sync site can not muster a majority
!  * of servers to agree that it is the sync site, then there is a possibility
!  * that a network partition has occurred, allowing another server to claim to
!  * be the sync site.  Thus, any time that the sync site has not heard from a
!  * majority of the servers in the last #SMALLTIME seconds, it voluntarily
!  * relinquishes its role as sync site.
!  * 
!  * While attempting to nominate a new sync site, certain rules apply.  First,
!  * a server can not reply "ok" (return 1 from ServBeacon) to two different
!  * hosts in less than #BIGTIME seconds; this allows a server that has heard
!  * affirmative replies from a majority of the servers to know that no other
!  * server in the network has heard enough affirmative replies in the last
!  * #BIGTIME seconds to become sync site, too.  The variables #ubik_lastYesTime
!  * and #lastYesHost are used by all servers to keep track of which host they
!  * have last replied affirmatively to, when queried by a potential new sync
!  * site.
!  *
!  * Once a sync site has become a sync site, it periodically sends beacon
!  * messages with a parameter of 1, indicating that it already has determined
!  * it is supposed to be the sync site.  The servers treat such a message as a
!  * guarantee that no other site will become sync site for the next #SMALLTIME
!  * seconds.  In the interim, these servers can answer a query concerning which
!  * site is the sync site without any communication with any server.  The
!  * variables #lastBeaconArrival and #lastBeaconHost are used by all servers to
!  * keep track of which sync site has last contacted them.
!  *
!  * One complication occurs while nominating a new sync site: each site may be
!  * trying to nominate a different site (based on the value of #lastYesHost),
!  * yet we must nominate the smallest host (under some order), to prevent this
!  * process from looping.  The process could loop by having each server give
!  * one vote to another server, but with no server getting a majority of the
!  * votes.  To avoid this, we try to withhold our votes for the server with the
!  * lowest internet address (an easy-to-generate order).  To this effect, we
!  * keep track (in #lowestTime and #lowestHost) of the lowest server trying to
!  * become a sync site.  We wait for this server unless there is already a sync
!  * site (indicated by ServBeacon's parameter being 1).
!  */
! 
! afs_int32 ubik_debugFlag = 0;	/*!< print out debugging messages? */
! 
! /*! \name these statics are used by all sites in nominating new sync sites */
! afs_int32 ubik_lastYesTime = 0;	/*!< time we sent the last \b yes vote */
! static afs_uint32 lastYesHost = 0xffffffff;	/*!< host to which we sent \b yes vote */
! /*\}*/
! /*! \name Next is time sync site began this vote: guarantees sync site until this + SMALLTIME */
  static afs_int32 lastYesClaim = 0;
! static int lastYesState = 0;	/*!< did last site we voted for claim to be sync site? */
! /*\}*/
  
! /*! \name used to guarantee that nomination process doesn't loop */
  static afs_int32 lowestTime = 0;
  static afs_uint32 lowestHost = 0xffffffff;
  static afs_int32 syncTime = 0;
  static afs_int32 syncHost = 0;
+ /*\}*/
  
! /*! \name used to remember which dbase version is the one at the sync site (for non-sync sites) */
! struct ubik_version ubik_dbVersion;	/*!< sync site's dbase version */
! struct ubik_tid ubik_dbTid;	/*!< sync site's tid, or 0 if none */
! /*\}*/
  
! /*!
!  * \brief Decide if we should try to become sync site.
!  *
!  * The basic rule is that we
   * don't run if there is a valid sync site and it ain't us (we have to run if
   * it is us, in order to keep our votes).  If there is no sync site, then we
   * want to run if we're the lowest numbered host running, otherwise we defer to
   * the lowest host.  However, if the lowest host hasn't been heard from for a
   * while, then we start running again, in case he crashed.
   *
!  * \return true if we should run, and false otherwise.
   */
  int
  uvote_ShouldIRun(void)
***************
*** 139,155 ****
      return 1;
  }
  
! /* Return the current synchronization site, if any.  Simple approach: if the
   * last guy we voted yes for claims to be the sync site, then we we're happy to
   * use that guy for a sync site until the time his mandate expires.  If the guy
   * does not claim to be sync site, then, of course, there's none.
   *
!  * In addition, if we lost the sync, we set urecovery_syncSite to an invalid
   * value, indicating that we no longer know which version of the dbase is the
   * one we should have.  We'll get a new one when we next hear from the sync
   * site.
   *
!  * This function returns 0 or currently valid sync site.  It can return our own
   * address, if we're the sync site.
   */
  afs_int32
--- 146,165 ----
      return 1;
  }
  
! /*!
!  * \brief Return the current synchronization site, if any.
!  *
!  * Simple approach: if the
   * last guy we voted yes for claims to be the sync site, then we we're happy to
   * use that guy for a sync site until the time his mandate expires.  If the guy
   * does not claim to be sync site, then, of course, there's none.
   *
!  * In addition, if we lost the sync, we set #urecovery_syncSite to an invalid
   * value, indicating that we no longer know which version of the dbase is the
   * one we should have.  We'll get a new one when we next hear from the sync
   * site.
   *
!  * \return 0 or currently valid sync site.  It can return our own
   * address, if we're the sync site.
   */
  afs_int32
***************
*** 170,177 ****
      return code;
  }
  
! /* called by the sync site to handle vote beacons; if aconn is null, this is a
!  * local call; returns 0 or time whe the vote was sent.  It returns 0 if we are
   * not voting for this sync site, or the time we actually voted yes, if
   * non-zero.
   */
--- 180,190 ----
      return code;
  }
  
! /*!
!  * \brief called by the sync site to handle vote beacons; if aconn is null, this is a
!  * local call
!  *
!  * \returns 0 or time when the vote was sent.  It returns 0 if we are
   * not voting for this sync site, or the time we actually voted yes, if
   * non-zero.
   */
***************
*** 333,340 ****
      return vote;
  }
  
! /* handle per-server debug command, where 0 is the first server.  Basic network
!    debugging hooks. */
  afs_int32
  SVOTE_SDebug(struct rx_call * rxcall, afs_int32 awhich,
  	     register struct ubik_sdebug * aparm)
--- 346,356 ----
      return vote;
  }
  
! /*!
!  * \brief Handle per-server debug command, where 0 is the first server.
!  *
!  * Basic network debugging hooks.
!  */
  afs_int32
  SVOTE_SDebug(struct rx_call * rxcall, afs_int32 awhich,
  	     register struct ubik_sdebug * aparm)
***************
*** 382,388 ****
      return code;
  }
  
! /* handle basic network debug command.  This is the global state dumper */
  afs_int32
  SVOTE_Debug(struct rx_call * rxcall, register struct ubik_debug * aparm)
  {
--- 398,406 ----
      return code;
  }
  
! /*!
!  * \brief Handle basic network debug command.  This is the global state dumper.
!  */
  afs_int32
  SVOTE_Debug(struct rx_call * rxcall, register struct ubik_debug * aparm)
  {
***************
*** 466,472 ****
  }
  
  
! /* handle basic network debug command.  This is the global state dumper */
  afs_int32
  SVOTE_DebugOld(struct rx_call * rxcall,
  	       register struct ubik_debug_old * aparm)
--- 484,492 ----
  }
  
  
! /*!
!  * \brief Handle basic network debug command.  This is the global state dumper.
!  */
  afs_int32
  SVOTE_DebugOld(struct rx_call * rxcall,
  	       register struct ubik_debug_old * aparm)
***************
*** 523,529 ****
  }
  
  
! /* get the sync site; called by remote servers to find where they should go */
  afs_int32
  SVOTE_GetSyncSite(register struct rx_call * rxcall,
  		  register afs_int32 * ahost)
--- 543,551 ----
  }
  
  
! /*!
!  * \brief Get the sync site; called by remote servers to find where they should go.
!  */
  afs_int32
  SVOTE_GetSyncSite(register struct rx_call * rxcall,
  		  register afs_int32 * ahost)
***************
*** 551,557 ****
      return 0;
  }
  
! /* called once/run to init the vote module */
  int
  uvote_Init(void)
  {
--- 573,581 ----
      return 0;
  }
  
! /*!
!  * \brief Called once/run to init the vote module
!  */
  int
  uvote_Init(void)
  {
Index: openafs/src/update/server.c
diff -c openafs/src/update/server.c:1.13.14.4 openafs/src/update/server.c:1.13.14.5
*** openafs/src/update/server.c:1.13.14.4	Tue Oct 30 11:16:47 2007
--- openafs/src/update/server.c	Sat Nov 29 13:55:44 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/update/server.c,v 1.13.14.4 2007/10/30 15:16:47 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/update/server.c,v 1.13.14.5 2008/11/29 18:55:44 jaltman Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 278,284 ****
  
      if (rxBind) {
  	afs_int32 ccode;
- #ifndef AFS_NT40_ENV
          if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
              AFSDIR_SERVER_NETINFO_FILEPATH) {
              char reason[1024];
--- 278,283 ----
***************
*** 287,293 ****
                                             AFSDIR_SERVER_NETINFO_FILEPATH,
                                             AFSDIR_SERVER_NETRESTRICT_FILEPATH);
          } else 
- #endif	
  	{
              ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
          }
--- 286,291 ----
Index: openafs/src/util/NTMakefile
diff -c openafs/src/util/NTMakefile:1.14 openafs/src/util/NTMakefile:1.14.2.1
*** openafs/src/util/NTMakefile:1.14	Sun Apr  2 19:44:56 2006
--- openafs/src/util/NTMakefile	Sat Nov 29 13:55:45 2008
***************
*** 19,24 ****
--- 19,25 ----
  	$(INCFILEDIR)\errors.h \
  	$(INCFILEDIR)\itc.h \
  	$(INCFILEDIR)\vice.h \
+         $(INCFILEDIR)\netutils.h \
  	$(INCFILEDIR)\pthread_glock.h \
  	$(INCFILEDIR)\pthread_nosigs.h \
  	$(INCFILEDIR)\errmap_nt.h \
***************
*** 45,50 ****
--- 46,52 ----
  	$(OUT)\isathing.obj \
  	$(OUT)\kreltime.obj \
  	$(OUT)\ktime.obj \
+         $(OUT)\netutils.obj \
  	$(OUT)\regex.obj \
  	$(OUT)\readdir_nt.obj \
  	$(OUT)\serverLog.obj \
Index: openafs/src/util/afsutil.h
diff -c openafs/src/util/afsutil.h:1.21.2.3 openafs/src/util/afsutil.h:1.21.2.5
*** openafs/src/util/afsutil.h:1.21.2.3	Tue Aug 26 10:11:47 2008
--- openafs/src/util/afsutil.h	Sun Dec 21 01:00:41 2008
***************
*** 43,50 ****
  extern void SetLogThreadNumProgram(int (*func) (void) );
  
  /*@printflike@*/ extern void FSLog(const char *format, ...);
! #define ViceLog(level, str)  if ((level) <= LogLevel) (FSLog str)
! #define vViceLog(level, str) if ((level) <= LogLevel) (vFSLog str)
  
  extern int OpenLog(const char *filename);
  extern int ReOpenLog(const char *fileName);
--- 43,50 ----
  extern void SetLogThreadNumProgram(int (*func) (void) );
  
  /*@printflike@*/ extern void FSLog(const char *format, ...);
! #define ViceLog(level, str)  do { if ((level) <= LogLevel) (FSLog str); } while (0)
! #define vViceLog(level, str) do { if ((level) <= LogLevel) (vFSLog str); } while (0)
  
  extern int OpenLog(const char *filename);
  extern int ReOpenLog(const char *fileName);
Index: openafs/src/util/netutils.c
diff -c openafs/src/util/netutils.c:1.14.8.4 openafs/src/util/netutils.c:1.14.8.5
*** openafs/src/util/netutils.c:1.14.8.4	Wed Oct 31 08:36:18 2007
--- openafs/src/util/netutils.c	Sat Nov 29 13:55:45 2008
***************
*** 20,26 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/netutils.c,v 1.14.8.4 2007/10/31 12:36:18 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
--- 20,26 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/netutils.c,v 1.14.8.5 2008/11/29 18:55:45 jaltman Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
***************
*** 30,42 ****
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
  #else
  #ifdef __FreeBSD__
  #include <sys/types.h>
  #endif
  #include <netinet/in.h>
- #include <errno.h>
  #include <sys/errno.h>
  #endif
  
  #include "assert.h"
  #include "afsutil.h"
--- 30,46 ----
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
  #else
+ #ifdef AFS_NT40_ENV
+ #include <winsock2.h>
+ #else 
  #ifdef __FreeBSD__
  #include <sys/types.h>
  #endif
  #include <netinet/in.h>
  #include <sys/errno.h>
  #endif
+ #include <errno.h>
+ #endif
  
  #include "assert.h"
  #include "afsutil.h"
***************
*** 116,122 ****
   * caller can choose to ignore the entire file but should write
   * something to a log file).
   *
!  * All addresses should be in NBO (as returned by rx_getAllAddr() and
   * parsed by extract_Addr().
   */
  /*
--- 120,126 ----
   * caller can choose to ignore the entire file but should write
   * something to a log file).
   *
!  * All addresses should be in NBO (as returned by rx_getAllAddrMaskMtu() and
   * parsed by extract_Addr().
   */
  /*
***************
*** 154,160 ****
      strcpy(reason, "");
  
      /* get all network interfaces from the kernel */
!     neaddrs = rxi_getAllAddrMaskMtu(eAddrs, eMask, eMtu, MAXIPADDRS);
      if (neaddrs <= 0) {
  	sprintf(reason, "No existing IP interfaces found");
  	return -1;
--- 158,164 ----
      strcpy(reason, "");
  
      /* get all network interfaces from the kernel */
!     neaddrs = rx_getAllAddrMaskMtu(eAddrs, eMask, eMtu, MAXIPADDRS);
      if (neaddrs <= 0) {
  	sprintf(reason, "No existing IP interfaces found");
  	return -1;
***************
*** 269,275 ****
  
      /* get all network interfaces from the kernel */
      existNu =
! 	rxi_getAllAddrMaskMtu(existingAddr, existingMask, existingMtu,
  			      MAXIPADDRS);
      if (existNu < 0)
  	return existNu;
--- 273,279 ----
  
      /* get all network interfaces from the kernel */
      existNu =
! 	rx_getAllAddrMaskMtu(existingAddr, existingMask, existingMtu,
  			      MAXIPADDRS);
      if (existNu < 0)
  	return existNu;
Index: openafs/src/venus/fs.c
diff -c openafs/src/venus/fs.c:1.30.2.18 openafs/src/venus/fs.c:1.30.2.19
*** openafs/src/venus/fs.c:1.30.2.18	Mon Sep 22 15:35:29 2008
--- openafs/src/venus/fs.c	Sun Nov 30 15:24:39 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/fs.c,v 1.30.2.18 2008/09/22 19:35:29 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/fs.c,v 1.30.2.19 2008/11/30 20:24:39 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
***************
*** 45,50 ****
--- 45,51 ----
  #include <afs/vlserver.h>
  #include <afs/cmd.h>
  #include <afs/afsutil.h>
+ #include <afs/com_err.h>
  #include <stdlib.h>
  #include <assert.h>
  #include <afs/ptclient.h>
Index: openafs/src/venus/livesys.c
diff -c openafs/src/venus/livesys.c:1.4.14.3 openafs/src/venus/livesys.c:1.4.14.4
*** openafs/src/venus/livesys.c:1.4.14.3	Tue Oct 30 11:16:48 2007
--- openafs/src/venus/livesys.c	Sun Nov 30 15:24:39 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/livesys.c,v 1.4.14.3 2007/10/30 15:16:48 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/livesys.c,v 1.4.14.4 2008/11/30 20:24:39 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
***************
*** 24,29 ****
--- 24,30 ----
  #include <sys/stat.h>
  #include <string.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
  #include <afs/com_err.h>
Index: openafs/src/venus/twiddle.c
diff -c openafs/src/venus/twiddle.c:1.7.14.4 openafs/src/venus/twiddle.c:1.7.14.5
*** openafs/src/venus/twiddle.c:1.7.14.4	Wed Oct 31 00:09:41 2007
--- openafs/src/venus/twiddle.c	Sun Nov 30 15:24:39 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/twiddle.c,v 1.7.14.4 2007/10/31 04:09:41 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/twiddle.c,v 1.7.14.5 2008/11/30 20:24:39 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
***************
*** 22,27 ****
--- 22,28 ----
  #include <netinet/in.h>
  #include <sys/stat.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
  #ifdef	AFS_AIX32_ENV
Index: openafs/src/venus/whatfid.c
diff -c openafs/src/venus/whatfid.c:1.5.14.3 openafs/src/venus/whatfid.c:1.5.14.4
*** openafs/src/venus/whatfid.c:1.5.14.3	Wed Oct 31 00:09:41 2007
--- openafs/src/venus/whatfid.c	Sun Nov 30 15:24:39 2008
***************
*** 14,20 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/whatfid.c,v 1.5.14.3 2007/10/31 04:09:41 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 14,20 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/whatfid.c,v 1.5.14.4 2008/11/30 20:24:39 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 26,31 ****
--- 26,32 ----
  #include <netdb.h>
  #include <netinet/in.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
  #include "afs/prs_fs.h"
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.75.2.25 openafs/src/viced/viced.c:1.75.2.27
*** openafs/src/viced/viced.c:1.75.2.25	Wed Sep 24 17:36:49 2008
--- openafs/src/viced/viced.c	Wed Dec 17 13:15:03 2008
***************
*** 22,28 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.75.2.25 2008/09/24 21:36:49 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 22,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.75.2.27 2008/12/17 18:15:03 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 1346,1379 ****
  	    rx_enableProcessRPCStats();
  	}
  	else if (strcmp(argv[i], "-auditlog") == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++i];
! 	    
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	}
  #ifndef AFS_NT40_ENV
  	else if (strcmp(argv[i], "-syslog") == 0) {
--- 1346,1354 ----
  	    rx_enableProcessRPCStats();
  	}
  	else if (strcmp(argv[i], "-auditlog") == 0) {
  	    char *fileName = argv[++i];
! 
!             osi_audit_file(fileName);
  	}
  #ifndef AFS_NT40_ENV
  	else if (strcmp(argv[i], "-syslog") == 0) {
***************
*** 1812,1818 ****
      extern int rxi_numNetAddrs;
      extern afs_uint32 rxi_NetAddrs[];
  
- #ifndef AFS_NT40_ENV
      if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || AFSDIR_SERVER_NETINFO_FILEPATH) {
  	/*
  	 * Find addresses we are supposed to register as per the netrestrict 
--- 1787,1792 ----
***************
*** 1830,1836 ****
  	}
  	FS_HostAddr_cnt = (afs_uint32) code;
      } else
- #endif
      {
  	FS_HostAddr_cnt = rx_getAllAddr(FS_HostAddrs, ADDRSPERSITE);
      }
--- 1804,1809 ----
Index: openafs/src/viced/viced.h
diff -c openafs/src/viced/viced.h:1.8.2.3 openafs/src/viced/viced.h:1.8.2.4
*** openafs/src/viced/viced.h:1.8.2.3	Wed Apr 23 14:57:16 2008
--- openafs/src/viced/viced.h	Tue Nov 11 15:31:30 2008
***************
*** 192,198 ****
  
  #define MAX_FILESERVER_THREAD	128	/* max number of threads in fileserver, subject to system limits. match to FD_HANDLE_SETASIDE */
  
! #define FILESERVER_HELPER_THREADS 7	/* Listner, IOMGR, FiveMinute, 
  					 * HostCheck, Signal, min 2 for RXSTATS */
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
--- 192,198 ----
  
  #define MAX_FILESERVER_THREAD	128	/* max number of threads in fileserver, subject to system limits. match to FD_HANDLE_SETASIDE */
  
! #define FILESERVER_HELPER_THREADS 8	/* Listner, IOMGR, FiveMinute, FsyncCk 
  					 * HostCheck, Signal, min 2 for RXSTATS */
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
Index: openafs/src/vlserver/vlserver.c
diff -c openafs/src/vlserver/vlserver.c:1.22.2.12 openafs/src/vlserver/vlserver.c:1.22.2.14
*** openafs/src/vlserver/vlserver.c:1.22.2.12	Sat Oct 18 11:09:07 2008
--- openafs/src/vlserver/vlserver.c	Mon Dec 22 14:23:19 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.22.2.12 2008/10/18 15:09:07 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.22.2.14 2008/12/22 19:23:19 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 215,248 ****
  	    strcpy(rxi_tracename, argv[++index]);
  
         } else if (strcmp(argv[index], "-auditlog") == 0) {
- 	   int tempfd, flags;
-            FILE *auditout;
-            char oldName[MAXPATHLEN];
             char *fileName = argv[++index];
  
! #ifndef AFS_NT40_ENV
!            struct stat statbuf;
! 
!            if ((lstat(fileName, &statbuf) == 0) 
!                && (S_ISFIFO(statbuf.st_mode))) {
!                flags = O_WRONLY | O_NONBLOCK;
!            } else 
! #endif
!            {
!                strcpy(oldName, fileName);
!                strcat(oldName, ".old");
!                renamefile(fileName, oldName);
!                flags = O_WRONLY | O_TRUNC | O_CREAT;
!            }
!            tempfd = open(fileName, flags, 0666);
!            if (tempfd > -1) {
!                auditout = fdopen(tempfd, "a");
!                if (auditout) {
!                    osi_audit_file(auditout);
!                } else
!                    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
!            } else
!                printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	} else if (strcmp(argv[index], "-enable_peer_stats") == 0) {
  	    rx_enablePeerRPCStats();
  	} else if (strcmp(argv[index], "-enable_process_stats") == 0) {
--- 215,223 ----
  	    strcpy(rxi_tracename, argv[++index]);
  
         } else if (strcmp(argv[index], "-auditlog") == 0) {
             char *fileName = argv[++index];
  
!            osi_audit_file(fileName);
  	} else if (strcmp(argv[index], "-enable_peer_stats") == 0) {
  	    rx_enablePeerRPCStats();
  	} else if (strcmp(argv[index], "-enable_process_stats") == 0) {
***************
*** 366,372 ****
      ubik_CheckRXSecurityProc = afsconf_CheckAuth;
      ubik_CheckRXSecurityRock = (char *)tdir;
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info, &clones,
  			      vl_dbaseName, &VL_dbase);
      if (code) {
  	printf("vlserver: Ubik init failed with code %d\n", code);
--- 341,347 ----
      ubik_CheckRXSecurityProc = afsconf_CheckAuth;
      ubik_CheckRXSecurityRock = (char *)tdir;
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info, clones,
  			      vl_dbaseName, &VL_dbase);
      if (code) {
  	printf("vlserver: Ubik init failed with code %d\n", code);
Index: openafs/src/vol/common.c
diff -c openafs/src/vol/common.c:1.6 openafs/src/vol/common.c:1.6.14.1
*** openafs/src/vol/common.c:1.6	Tue Jul 15 19:17:37 2003
--- openafs/src/vol/common.c	Sat Nov 29 13:16:14 2008
***************
*** 16,26 ****
  
  #include <sys/types.h>
  #include <stdio.h>
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/common.c,v 1.6 2003/07/15 23:17:37 shadow Exp $");
  
  #include <afs/afsutil.h>
  
--- 16,27 ----
  
  #include <sys/types.h>
  #include <stdio.h>
+ #include <stdlib.h>
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/common.c,v 1.6.14.1 2008/11/29 18:16:14 shadow Exp $");
  
  #include <afs/afsutil.h>
  
Index: openafs/src/vol/gi.c
diff -c openafs/src/vol/gi.c:1.8 openafs/src/vol/gi.c:1.8.14.1
*** openafs/src/vol/gi.c:1.8	Tue Jul 15 19:17:38 2003
--- openafs/src/vol/gi.c	Sat Nov 29 13:16:14 2008
***************
*** 11,21 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/gi.c,v 1.8 2003/07/15 23:17:38 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <stdio.h>
  
  int statflag;
  
--- 11,22 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/gi.c,v 1.8.14.1 2008/11/29 18:16:14 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <stdio.h>
+ #include <stdlib.h>
  
  int statflag;
  
Index: openafs/src/vol/vol-salvage.c
diff -c openafs/src/vol/vol-salvage.c:1.51.2.20 openafs/src/vol/vol-salvage.c:1.51.2.21
*** openafs/src/vol/vol-salvage.c:1.51.2.20	Sat Nov  8 10:58:18 2008
--- openafs/src/vol/vol-salvage.c	Tue Dec  9 12:05:11 2008
***************
*** 87,93 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.51.2.20 2008/11/08 15:58:18 shadow Exp $");
  
  #ifndef AFS_NT40_ENV
  #include <sys/param.h>
--- 87,93 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.51.2.21 2008/12/09 17:05:11 shadow Exp $");
  
  #ifndef AFS_NT40_ENV
  #include <sys/param.h>
***************
*** 3551,3557 ****
  RemoveTheForce(char *path)
  {
      char target[1024];
!     struct afs_stat force; // so we can use afs_stat to find it
      strcpy(target,path);
      strcat(target,"/FORCESALVAGE");
      if (!Testing && ForceSalvage) {
--- 3551,3557 ----
  RemoveTheForce(char *path)
  {
      char target[1024];
!     struct afs_stat force; /* so we can use afs_stat to find it */
      strcpy(target,path);
      strcat(target,"/FORCESALVAGE");
      if (!Testing && ForceSalvage) {
Index: openafs/src/volser/vol-dump.c
diff -c openafs/src/volser/vol-dump.c:1.2.4.3 openafs/src/volser/vol-dump.c:1.2.4.4
*** openafs/src/volser/vol-dump.c:1.2.4.3	Mon Oct 27 19:41:47 2008
--- openafs/src/volser/vol-dump.c	Mon Dec 22 14:01:58 2008
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vol-dump.c,v 1.2.4.3 2008/10/27 23:41:47 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vol-dump.c,v 1.2.4.4 2008/12/22 19:01:58 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
***************
*** 90,100 ****
  int verbose = 0;
  
  /* Forward Declarations */
! void HandleVolume(struct DiskPartition64 *partP, char *name, char *filename);
  Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
  		     register struct VolumeHeader *header);
  static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp,
! 			char *dumpfile);
  
  #ifndef AFS_NT40_ENV
  #include "AFS_component_version_number.c"
--- 90,100 ----
  int verbose = 0;
  
  /* Forward Declarations */
! void HandleVolume(struct DiskPartition64 *partP, char *name, char *filename, int fromtime);
  Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
  		     register struct VolumeHeader *header);
  static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp,
! 			char *dumpfile, int fromtime);
  
  #ifndef AFS_NT40_ENV
  #include "AFS_component_version_number.c"
***************
*** 176,181 ****
--- 176,183 ----
      struct DiskPartition64 *partP = NULL;
      char name1[128];
      char tmpPartName[20];
+     int fromtime = 0;
+     afs_int32 code;
  
  
  #ifndef AFS_NT40_ENV
***************
*** 195,200 ****
--- 197,210 ----
  	fileName = ti->data;
      if ((ti = as->parms[3].items))
  	verbose = 1;
+     if (as->parms[4].items && strcmp(as->parms[4].items->data, "0")) {
+ 	code = ktime_DateToInt32(as->parms[4].items->data, &fromtime);
+ 	if (code) {
+ 	    fprintf(STDERR, "failed to parse date '%s' (error=%d))\n",
+ 		as->parms[4].items->data, code);
+ 		return code;
+ 	}
+     }
  
      DInit(10);
  
***************
*** 232,243 ****
      }
  
      (void)afs_snprintf(name1, sizeof name1, VFORMAT, (unsigned long)volumeId);
!     HandleVolume(partP, name1, fileName);
      return 0;
  }
  
  void
! HandleVolume(struct DiskPartition64 *dp, char *name, char *filename)
  {
      struct VolumeHeader header;
      struct VolumeDiskHeader diskHeader;
--- 242,253 ----
      }
  
      (void)afs_snprintf(name1, sizeof name1, VFORMAT, (unsigned long)volumeId);
!     HandleVolume(partP, name1, fileName, fromtime);
      return 0;
  }
  
  void
! HandleVolume(struct DiskPartition64 *dp, char *name, char *filename, int fromtime)
  {
      struct VolumeHeader header;
      struct VolumeDiskHeader diskHeader;
***************
*** 279,285 ****
  	exit(1);
      }
  
!     DoMyVolDump(vp, dp, filename);
  }
  
  
--- 289,295 ----
  	exit(1);
      }
  
!     DoMyVolDump(vp, dp, filename, fromtime);
  }
  
  
***************
*** 298,303 ****
--- 308,314 ----
      cmd_AddParm(ts, "-file", CMD_LIST, CMD_OPTIONAL, "Dump filename");
      cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL,
  		"Trace dump progress (very verbose)");
+     cmd_AddParm(ts, "-time", CMD_SINGLE, CMD_OPTIONAL, "dump from time");
      code = cmd_Dispatch(argc, argv);
      return code;
  }
***************
*** 834,850 ****
  
  
  static void
! DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile)
  {
      int code = 0;
-     int fromtime = 0;
      int dumpAllDirs = 0;
      int dumpfd = 0;
  
      if (dumpfile) {
  	unlink(dumpfile);
  	dumpfd =
! 	    open(dumpfile, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
  	if (dumpfd < 0) {
  	    fprintf(stderr, "Failed to open dump file! Exiting.\n");
  	    exit(1);
--- 845,860 ----
  
  
  static void
! DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile, int fromtime)
  {
      int code = 0;
      int dumpAllDirs = 0;
      int dumpfd = 0;
  
      if (dumpfile) {
  	unlink(dumpfile);
  	dumpfd =
! 	    afs_open(dumpfile, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
  	if (dumpfd < 0) {
  	    fprintf(stderr, "Failed to open dump file! Exiting.\n");
  	    exit(1);
Index: openafs/src/volser/volmain.c
diff -c openafs/src/volser/volmain.c:1.22.2.13 openafs/src/volser/volmain.c:1.22.2.15
*** openafs/src/volser/volmain.c:1.22.2.13	Wed Sep 24 17:36:52 2008
--- openafs/src/volser/volmain.c	Wed Dec 17 13:15:05 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.22.2.13 2008/09/24 21:36:52 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.22.2.15 2008/12/17 18:15:05 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
***************
*** 310,344 ****
  		lwps = MAXLWP;
  	    }
  	} else if (strcmp(argv[code], "-auditlog") == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++code];
  
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		    osi_audit(VS_StartEvent, 0, AUD_END);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	} else if (strcmp(argv[code], "-nojumbo") == 0) {
  	    rxJumbograms = 0;
  	} else if (strcmp(argv[code], "-jumbo") == 0) {
--- 310,319 ----
  		lwps = MAXLWP;
  	    }
  	} else if (strcmp(argv[code], "-auditlog") == 0) {
  	    char *fileName = argv[++code];
  
!             osi_audit_file(fileName);
!             osi_audit(VS_StartEvent, 0, AUD_END);
  	} else if (strcmp(argv[code], "-nojumbo") == 0) {
  	    rxJumbograms = 0;
  	} else if (strcmp(argv[code], "-jumbo") == 0) {
***************
*** 450,456 ****
  	rx_SetUdpBufSize(udpBufSize);	/* set the UDP buffer size for receive */
      if (rxBind) {
  	afs_int32 ccode;
- #ifndef AFS_NT40_ENV
          if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
              AFSDIR_SERVER_NETINFO_FILEPATH) {
              char reason[1024];
--- 425,430 ----
***************
*** 459,465 ****
                                             AFSDIR_SERVER_NETINFO_FILEPATH,
                                             AFSDIR_SERVER_NETRESTRICT_FILEPATH);
          } else 
- #endif	
  	{
              ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
          }
--- 433,438 ----
