dread-do-validation-20041012
[openafs.git] / src / afs / afs_buffer.c
index 8528c21..0b56b26 100644 (file)
@@ -8,42 +8,43 @@
  */
 
 #include <afsconfig.h>
-#include "../afs/param.h"
+#include "afs/param.h"
 
-RCSID("$Header$");
+RCSID
+    ("$Header$");
 
-#include "../afs/sysincludes.h"
-#include "../afs/afsincludes.h"
+#include "afs/sysincludes.h"
+#include "afsincludes.h"
 #if !defined(UKERNEL)
-#include "../h/param.h"
-#include "../h/types.h"
-#include "../h/time.h"
+#include "h/param.h"
+#include "h/types.h"
+#include "h/time.h"
 #if    defined(AFS_AIX31_ENV) || defined(AFS_DEC_ENV)
-#include "../h/limits.h"
+#include "h/limits.h"
 #endif
 #if    !defined(AFS_AIX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
-#include "../h/kernel.h"    /* Doesn't needed, so it should go */
+#include "h/kernel.h"          /* Doesn't needed, so it should go */
 #endif
 #endif /* !defined(UKERNEL) */
 
-#include "../afs/afs_osi.h"
-#include "../afsint/afsint.h"
-#include "../afs/lock.h"
+#include "afs/afs_osi.h"
+#include "afsint.h"
+#include "afs/lock.h"
 
 #if !defined(UKERNEL) && !defined(AFS_LINUX20_ENV)
-#include "../h/buf.h"
+#include "h/buf.h"
 #endif /* !defined(UKERNEL) */
 
-#include "../afs/stds.h"
-#include "../afs/volerrors.h"
-#include "../afs/exporter.h"
-#include "../afs/prs_fs.h"
-#include "../afs/afs_chunkops.h"
-#include "../afs/dir.h"
+#include "afs/stds.h"
+#include "afs/volerrors.h"
+#include "afs/exporter.h"
+#include "afs/prs_fs.h"
+#include "afs/afs_chunkops.h"
+#include "afs/dir.h"
 
-#include "../afs/afs_stats.h"
-#include "../afs/longc_procs.h"
-#include "../afs/afs.h"
+#include "afs/afs_stats.h"
+#include "afs/longc_procs.h"
+#include "afs/afs.h"
 
 #ifndef        BUF_TIME_MAX
 #define        BUF_TIME_MAX    0x7fffffff
@@ -62,11 +63,11 @@ RCSID("$Header$");
 /* page hash table size - this is pretty intertwined with pHash */
 #define PHSIZE (PHPAGEMASK + PHFIDMASK + 1)
 /* the pHash macro */
-#define pHash(fid,page) ((((afs_int32)((fid)[0])) & PHFIDMASK) \
+#define pHash(fid,page) ((((afs_int32)((fid)->inode)) & PHFIDMASK) \
                         | (page & PHPAGEMASK))
 
 #ifdef dirty
-#undef dirty   /* XXX */
+#undef dirty                   /* XXX */
 #endif
 
 static struct buffer *Buffers = 0;
@@ -87,73 +88,78 @@ static int nbuffers;
 static afs_int32 timecounter;
 
 /* Prototypes for static routines */
-static struct buffer *afs_newslot (ino_t *afid, afs_int32 apage,register struct buffer *lp);
+static struct buffer *afs_newslot(struct fcache * afid, afs_int32 apage,
+                                 register struct buffer *lp);
 
 static int dinit_flag = 0;
-void DInit (int abuffers)
+void
+DInit(int abuffers)
 {
     /* Initialize the venus buffer system. */
     register int i;
     register struct buffer *tb;
 #if AFS_USEBUFFERS
-    struct buf *tub;       /* unix buffer for allocation */
+    struct buf *tub;           /* unix buffer for allocation */
 #endif
 
     AFS_STATCNT(DInit);
-    if (dinit_flag) return;
+    if (dinit_flag)
+       return;
     dinit_flag = 1;
 #if AFS_USEBUFFERS
     /* round up to next multiple of NPB, since we allocate multiple pages per chunk */
-    abuffers = ((abuffers-1) | (NPB-1)) + 1;
+    abuffers = ((abuffers - 1) | (NPB - 1)) + 1;
 #endif
     LOCK_INIT(&afs_bufferLock, "afs_bufferLock");
-    Buffers = (struct buffer *) afs_osi_Alloc(abuffers * sizeof(struct buffer));
+    Buffers =
+       (struct buffer *)afs_osi_Alloc(abuffers * sizeof(struct buffer));
 #if !AFS_USEBUFFERS
-    BufferData = (char *) afs_osi_Alloc(abuffers * AFS_BUFFER_PAGESIZE);
+    BufferData = (char *)afs_osi_Alloc(abuffers * AFS_BUFFER_PAGESIZE);
 #endif
     timecounter = 1;
     afs_stats_cmperf.bufAlloced = nbuffers = abuffers;
-    for(i=0;i<PHSIZE;i++) phTable[i] = 0;
-    for (i=0;i<abuffers;i++) {
+    for (i = 0; i < PHSIZE; i++)
+       phTable[i] = 0;
+    for (i = 0; i < abuffers; i++) {
 #if AFS_USEBUFFERS
-       if ((i & (NPB-1)) == 0) {
+       if ((i & (NPB - 1)) == 0) {
            /* time to allocate a fresh buffer */
-           tub = geteblk(AFS_BUFFER_PAGESIZE*NPB);
-           BufferData = (char *) tub->b_un.b_addr;
+           tub = geteblk(AFS_BUFFER_PAGESIZE * NPB);
+           BufferData = (char *)tub->b_un.b_addr;
        }
 #endif
-        /* Fill in each buffer with an empty indication. */
+       /* Fill in each buffer with an empty indication. */
        tb = &Buffers[i];
-        dirp_Zap(tb->fid);
-        tb->accesstime = 0;
+       dirp_Zap(tb->fid);
+       tb->accesstime = 0;
        tb->lockers = 0;
 #if AFS_USEBUFFERS
-       if ((i & (NPB-1)) == 0) 
+       if ((i & (NPB - 1)) == 0)
            tb->bufp = tub;
        else
            tb->bufp = 0;
-       tb->data = &BufferData[AFS_BUFFER_PAGESIZE * (i&(NPB-1))];
+       tb->data = &BufferData[AFS_BUFFER_PAGESIZE * (i & (NPB - 1))];
 #else
-        tb->data = &BufferData[AFS_BUFFER_PAGESIZE*i];
+       tb->data = &BufferData[AFS_BUFFER_PAGESIZE * i];
 #endif
        tb->hashIndex = 0;
-        tb->dirty = 0;
+       tb->dirty = 0;
        RWLOCK_INIT(&tb->lock, "buffer lock");
     }
     return;
 }
 
-char *DRead(register ino_t *fid, register int page)
+void *
+DRead(register struct fcache * fid, register int page)
 {
     /* Read a page from the disk. */
     register struct buffer *tb, *tb2;
-    void *tfile;
-    register afs_int32 code, *sizep;
+    struct osi_file *tfile;
+    int code;
 
     AFS_STATCNT(DRead);
-    MObtainWriteLock(&afs_bufferLock,256);
+    MObtainWriteLock(&afs_bufferLock, 256);
 
-/* some new code added 1/1/92 */
 #define bufmatch(tb) (tb->page == page && dirp_Eq(tb->fid, fid))
 #define buf_Front(head,parent,p) {(parent)->hashNext = (p)->hashNext; (p)->hashNext= *(head);*(head)=(p);}
 
@@ -163,47 +169,46 @@ char *DRead(register ino_t *fid, register int page)
      * of larger code size.  This could be simplified by better use of
      * macros. 
      */
-    if ((tb = phTable[pHash(fid,page)])) {
+    if ((tb = phTable[pHash(fid, page)])) {
        if (bufmatch(tb)) {
-           MObtainWriteLock(&tb->lock,257);
+           MObtainWriteLock(&tb->lock, 257);
            ReleaseWriteLock(&afs_bufferLock);
            tb->lockers++;
            tb->accesstime = timecounter++;
            AFS_STATS(afs_stats_cmperf.bufHits++);
            MReleaseWriteLock(&tb->lock);
            return tb->data;
-       }
-       else {
-         register struct buffer **bufhead;
-         bufhead = &( phTable[pHash(fid,page)] );
-         while ((tb2 = tb->hashNext)) {
-           if (bufmatch(tb2)) {
-             buf_Front(bufhead,tb,tb2);
-             MObtainWriteLock(&tb2->lock,258);
-             ReleaseWriteLock(&afs_bufferLock);
-             tb2->lockers++;
-             tb2->accesstime = timecounter++;
-             AFS_STATS(afs_stats_cmperf.bufHits++);
-             MReleaseWriteLock(&tb2->lock);
-             return tb2->data;
-           }
-           if ((tb = tb2->hashNext)) {
-             if (bufmatch(tb)) {
-               buf_Front(bufhead,tb2,tb);
-               MObtainWriteLock(&tb->lock,259);
-               ReleaseWriteLock(&afs_bufferLock);
-               tb->lockers++;
-               tb->accesstime = timecounter++;
-               AFS_STATS(afs_stats_cmperf.bufHits++);
-               MReleaseWriteLock(&tb->lock);
-               return tb->data;
-             }
+       } else {
+           register struct buffer **bufhead;
+           bufhead = &(phTable[pHash(fid, page)]);
+           while ((tb2 = tb->hashNext)) {
+               if (bufmatch(tb2)) {
+                   buf_Front(bufhead, tb, tb2);
+                   MObtainWriteLock(&tb2->lock, 258);
+                   ReleaseWriteLock(&afs_bufferLock);
+                   tb2->lockers++;
+                   tb2->accesstime = timecounter++;
+                   AFS_STATS(afs_stats_cmperf.bufHits++);
+                   MReleaseWriteLock(&tb2->lock);
+                   return tb2->data;
+               }
+               if ((tb = tb2->hashNext)) {
+                   if (bufmatch(tb)) {
+                       buf_Front(bufhead, tb2, tb);
+                       MObtainWriteLock(&tb->lock, 259);
+                       ReleaseWriteLock(&afs_bufferLock);
+                       tb->lockers++;
+                       tb->accesstime = timecounter++;
+                       AFS_STATS(afs_stats_cmperf.bufHits++);
+                       MReleaseWriteLock(&tb->lock);
+                       return tb->data;
+                   }
+               } else
+                   break;
            }
-           else break;
-         }
        }
-      }  
-    else tb2 = NULL;
+    } else
+       tb2 = NULL;
 
     AFS_STATS(afs_stats_cmperf.bufMisses++);
     /* can't find it */
@@ -213,29 +218,28 @@ char *DRead(register ino_t *fid, register int page)
      */
     tb = afs_newslot(fid, page, (tb ? tb : tb2));
     if (!tb) {
-      MReleaseWriteLock(&afs_bufferLock);
-      return 0;
+       MReleaseWriteLock(&afs_bufferLock);
+       return NULL;
     }
-    MObtainWriteLock(&tb->lock,260);
+    MObtainWriteLock(&tb->lock, 260);
     MReleaseWriteLock(&afs_bufferLock);
     tb->lockers++;
-    tfile = afs_CFileOpen(fid[0]);
-    sizep = (afs_int32 *)tfile;
-    if (page * AFS_BUFFER_PAGESIZE >= *sizep) {
+    if (page * AFS_BUFFER_PAGESIZE >= fid->chunkBytes) {
        dirp_Zap(tb->fid);
        tb->lockers--;
        MReleaseWriteLock(&tb->lock);
-       afs_CFileClose(tfile);
-       return 0;
+       return NULL;
     }
-    code = afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE,
-                        tb->data, AFS_BUFFER_PAGESIZE);
+    tfile = afs_CFileOpen(fid->inode);
+    code =
+       afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data,
+                     AFS_BUFFER_PAGESIZE);
     afs_CFileClose(tfile);
     if (code < AFS_BUFFER_PAGESIZE) {
        dirp_Zap(tb->fid);
        tb->lockers--;
        MReleaseWriteLock(&tb->lock);
-       return 0;
+       return NULL;
     }
     /* Note that findslot sets the page field in the buffer equal to
      * what it is searching for. */
@@ -243,7 +247,8 @@ char *DRead(register ino_t *fid, register int page)
     return tb->data;
 }
 
-static void FixupBucket(register struct buffer *ap)
+static void
+FixupBucket(register struct buffer *ap)
 {
     register struct buffer **lp, *tp;
     register int i;
@@ -252,7 +257,7 @@ static void FixupBucket(register struct buffer *ap)
     AFS_STATCNT(FixupBucket);
     i = ap->hashIndex;
     lp = &phTable[i];
-    for(tp = *lp; tp; tp=tp->hashNext) {
+    for (tp = *lp; tp; tp = tp->hashNext) {
        if (tp == ap) {
            *lp = tp->hashNext;
            break;
@@ -260,20 +265,21 @@ static void FixupBucket(register struct buffer *ap)
        lp = &tp->hashNext;
     }
     /* now figure the new hash bucket */
-    i = pHash(ap->fid,ap->page);
+    i = pHash(ap->fid, ap->page);
     ap->hashIndex = i;         /* remember where we are for deletion */
     ap->hashNext = phTable[i]; /* add us to the list */
-    phTable[i] = ap;            /* at the front, since it's LRU */
+    phTable[i] = ap;           /* at the front, since it's LRU */
 }
 
 /* lp is pointer to a fairly-old buffer */
-static struct buffer *afs_newslot (ino_t *afid, afs_int32 apage,register struct buffer *lp)
+static struct buffer *
+afs_newslot(struct fcache * afid, afs_int32 apage, register struct buffer *lp)
 {
     /* Find a usable buffer slot */
     register afs_int32 i;
     afs_int32 lt;
     register struct buffer *tp;
-    void *tfile;
+    struct osi_file *tfile;
 
     AFS_STATCNT(afs_newslot);
     /* we take a pointer here to a buffer which was at the end of an
@@ -283,11 +289,10 @@ static struct buffer *afs_newslot (ino_t *afid, afs_int32 apage,register struct
      * case" for loop below.
      */
     if (lp && (lp->lockers == 0)) {
-      lt = lp->accesstime;
-    }
-    else {
-      lp = 0;
-      lt = BUF_TIME_MAX;
+       lt = lp->accesstime;
+    } else {
+       lp = 0;
+       lt = BUF_TIME_MAX;
     }
 
     /* timecounter might have wrapped, if machine is very very busy
@@ -305,44 +310,43 @@ static struct buffer *afs_newslot (ino_t *afid, afs_int32 apage,register struct
      * themselves back out after just a few more DReads.
      */
     if (timecounter < 0) {
-      timecounter = 1;
-      tp = Buffers;
-      for (i=0;i<nbuffers;i++,tp++) {
-       tp->accesstime = 0;
-       if (!lp && !tp->lockers)  /* one is as good as the rest, I guess */
-         lp = tp;
-      }
-    }
-    else {
-      /* this is the typical case */
-      tp = Buffers;
-      for (i=0;i<nbuffers;i++,tp++) {
-       if (tp->lockers == 0) {
-         if (tp->accesstime < lt) {
-           lp = tp;
-           lt = tp->accesstime;
-         }
+       timecounter = 1;
+       tp = Buffers;
+       for (i = 0; i < nbuffers; i++, tp++) {
+           tp->accesstime = 0;
+           if (!lp && !tp->lockers)    /* one is as good as the rest, I guess */
+               lp = tp;
+       }
+    } else {
+       /* this is the typical case */
+       tp = Buffers;
+       for (i = 0; i < nbuffers; i++, tp++) {
+           if (tp->lockers == 0) {
+               if (tp->accesstime < lt) {
+                   lp = tp;
+                   lt = tp->accesstime;
+               }
+           }
        }
-      }
     }
 
     if (lp == 0) {
-      /* There are no unlocked buffers -- this used to panic, but that
-       * seems extreme.  To the best of my knowledge, all the callers
-       * of DRead are prepared to handle a zero return.  Some of them
-       * just panic directly, but not all of them. */
-      afs_warn ("all buffers locked");
-      return 0;
+       /* There are no unlocked buffers -- this used to panic, but that
+        * seems extreme.  To the best of my knowledge, all the callers
+        * of DRead are prepared to handle a zero return.  Some of them
+        * just panic directly, but not all of them. */
+       afs_warn("all buffers locked");
+       return 0;
     }
 
     if (lp->dirty) {
-       tfile = afs_CFileOpen(lp->fid[0]);
-       afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, 
-                      lp->data, AFS_BUFFER_PAGESIZE);  
-        lp->dirty = 0;
+       tfile = afs_CFileOpen(lp->fid->inode);
+       afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, lp->data,
+                      AFS_BUFFER_PAGESIZE);
+       lp->dirty = 0;
        afs_CFileClose(tfile);
        AFS_STATS(afs_stats_cmperf.bufFlushDirty++);
-      }
+    }
 
     /* Now fill in the header. */
     dirp_Cpy(lp->fid, afid);   /* set this */
@@ -353,7 +357,8 @@ static struct buffer *afs_newslot (ino_t *afid, afs_int32 apage,register struct
     return lp;
 }
 
-void DRelease (register struct buffer *bp, int flag)
+void
+DRelease(register struct buffer *bp, int flag)
 {
     /* Release a buffer, specifying whether or not the buffer has been
      * modified by the locker. */
@@ -363,29 +368,33 @@ void DRelease (register struct buffer *bp, int flag)
 #endif
 
     AFS_STATCNT(DRelease);
-    if (!bp) return;
+    if (!bp)
+       return;
 #if AFS_USEBUFFERS
     /* look for buffer by scanning Unix buffers for appropriate address */
     tp = Buffers;
-    for(index = 0; index < nbuffers; index += NPB, tp += NPB) {
-       if ((afs_int32)bp >= (afs_int32)tp->data 
-           && (afs_int32)bp < (afs_int32)tp->data + AFS_BUFFER_PAGESIZE*NPB) {
+    for (index = 0; index < nbuffers; index += NPB, tp += NPB) {
+       if ((afs_int32) bp >= (afs_int32) tp->data
+           && (afs_int32) bp <
+           (afs_int32) tp->data + AFS_BUFFER_PAGESIZE * NPB) {
            /* we found the right range */
-           index += ((afs_int32)bp - (afs_int32)tp->data) >> LOGPS;
+           index += ((afs_int32) bp - (afs_int32) tp->data) >> LOGPS;
            break;
        }
     }
 #else
-    index = (((char *)bp)-((char *)BufferData))>>LOGPS;
+    index = (((char *)bp) - ((char *)BufferData)) >> LOGPS;
 #endif
     bp = &(Buffers[index]);
-    MObtainWriteLock(&bp->lock,261);
+    MObtainWriteLock(&bp->lock, 261);
     bp->lockers--;
-    if (flag) bp->dirty=1;
+    if (flag)
+       bp->dirty = 1;
     MReleaseWriteLock(&bp->lock);
 }
 
-int DVOffset (register void *ap)
+int
+DVOffset(register void *ap)
 {
     /* Return the byte within a file represented by a buffer pointer. */
     register struct buffer *bp;
@@ -394,23 +403,26 @@ int DVOffset (register void *ap)
     register struct buffer *tp;
 #endif
     AFS_STATCNT(DVOffset);
-    bp=ap;
+    bp = ap;
 #if AFS_USEBUFFERS
     /* look for buffer by scanning Unix buffers for appropriate address */
     tp = Buffers;
-    for(index = 0; index < nbuffers; index += NPB, tp += NPB) {
-       if ((afs_int32)bp >= (afs_int32)tp->data && (afs_int32)bp < (afs_int32)tp->data + AFS_BUFFER_PAGESIZE*NPB) {
+    for (index = 0; index < nbuffers; index += NPB, tp += NPB) {
+       if ((afs_int32) bp >= (afs_int32) tp->data
+           && (afs_int32) bp <
+           (afs_int32) tp->data + AFS_BUFFER_PAGESIZE * NPB) {
            /* we found the right range */
-           index += ((afs_int32)bp - (afs_int32)tp->data) >> LOGPS;
+           index += ((afs_int32) bp - (afs_int32) tp->data) >> LOGPS;
            break;
        }
     }
 #else
-    index = (((char *)bp)-((char *)BufferData))>>LOGPS;
+    index = (((char *)bp) - ((char *)BufferData)) >> LOGPS;
 #endif
-    if (index<0 || index >= nbuffers) return -1;
+    if (index < 0 || index >= nbuffers)
+       return -1;
     bp = &(Buffers[index]);
-    return AFS_BUFFER_PAGESIZE*bp->page+(int)(((char *)ap)-bp->data);
+    return AFS_BUFFER_PAGESIZE * bp->page + (int)(((char *)ap) - bp->data);
 }
 
 /* 1/1/91 - I've modified the hash function to take the page as well
@@ -419,43 +431,45 @@ int DVOffset (register void *ap)
  * of the hash function.  Oh well.  This should use the list traversal 
  * method of DRead...
  */
-void DZap (ino_t *fid)
+void
+DZap(struct fcache * fid)
 {
     register int i;
     /* Destroy all buffers pertaining to a particular fid. */
     register struct buffer *tb;
-    
+
     AFS_STATCNT(DZap);
     MObtainReadLock(&afs_bufferLock);
 
-    for (i=0;i<=PHPAGEMASK;i++)
-    for(tb=phTable[pHash(fid,i)]; tb; tb=tb->hashNext)
-        if (dirp_Eq(tb->fid,fid)) {
-           MObtainWriteLock(&tb->lock,262);
-            dirp_Zap(tb->fid);
-            tb->dirty = 0;
-           MReleaseWriteLock(&tb->lock);
-       }
+    for (i = 0; i <= PHPAGEMASK; i++)
+       for (tb = phTable[pHash(fid, i)]; tb; tb = tb->hashNext)
+           if (dirp_Eq(tb->fid, fid)) {
+               MObtainWriteLock(&tb->lock, 262);
+               dirp_Zap(tb->fid);
+               tb->dirty = 0;
+               MReleaseWriteLock(&tb->lock);
+           }
     MReleaseReadLock(&afs_bufferLock);
 }
 
-void DFlush (void)
+void
+DFlush(void)
 {
     /* Flush all the modified buffers. */
     register int i;
     register struct buffer *tb;
-    void *tfile;
+    struct osi_file *tfile;
 
     AFS_STATCNT(DFlush);
     tb = Buffers;
     MObtainReadLock(&afs_bufferLock);
-    for(i=0;i<nbuffers;i++,tb++) {
-        if (tb->dirty) {
-           MObtainWriteLock(&tb->lock,263);
+    for (i = 0; i < nbuffers; i++, tb++) {
+       if (tb->dirty) {
+           MObtainWriteLock(&tb->lock, 263);
            tb->lockers++;
            MReleaseReadLock(&afs_bufferLock);
            if (tb->dirty) {
-               tfile = afs_CFileOpen(tb->fid[0]);
+               tfile = afs_CFileOpen(tb->fid->inode);
                afs_CFileWrite(tfile, tb->page * AFS_BUFFER_PAGESIZE,
                               tb->data, AFS_BUFFER_PAGESIZE);
                tb->dirty = 0;  /* Clear the dirty flag */
@@ -469,24 +483,26 @@ void DFlush (void)
     MReleaseReadLock(&afs_bufferLock);
 }
 
-char *DNew (register ino_t *fid, register int page)
+void *
+DNew(register struct fcache * fid, register int page)
 {
     /* Same as read, only do *not* even try to read the page, since it probably doesn't exist. */
     register struct buffer *tb;
     AFS_STATCNT(DNew);
-    MObtainWriteLock(&afs_bufferLock,264);
-    if ((tb = afs_newslot(fid,page,NULL)) == 0) {
+    MObtainWriteLock(&afs_bufferLock, 264);
+    if ((tb = afs_newslot(fid, page, NULL)) == 0) {
        MReleaseWriteLock(&afs_bufferLock);
        return 0;
     }
-    MObtainWriteLock(&tb->lock,265);
+    MObtainWriteLock(&tb->lock, 265);
     MReleaseWriteLock(&afs_bufferLock);
     tb->lockers++;
     MReleaseWriteLock(&tb->lock);
     return tb->data;
 }
 
-void shutdown_bufferpackage(void)
+void
+shutdown_bufferpackage(void)
 {
 #if AFS_USEBUFFERS
     register struct buffer *tp;
@@ -498,25 +514,27 @@ void shutdown_bufferpackage(void)
     /* Free all allocated Buffers and associated buffer pages */
     DFlush();
     if (afs_cold_shutdown) {
-      dinit_flag = 0;
+       dinit_flag = 0;
 #if !AFS_USEBUFFERS
-      afs_osi_Free(BufferData, nbuffers * AFS_BUFFER_PAGESIZE);
+       afs_osi_Free(BufferData, nbuffers * AFS_BUFFER_PAGESIZE);
 #else
-      tp = Buffers;
-      for (i=0; i < nbuffers; i+= NPB, tp += NPB) {
-       /* The following check shouldn't be necessary and it will be removed soon */
-       if (!tp->bufp) 
-           afs_warn("shutdown_bufferpackage: bufp == 0!! Shouldn't happen\n");
-       else {
-           brelse(tp->bufp);
-           tp->bufp = 0;
+       tp = Buffers;
+       for (i = 0; i < nbuffers; i += NPB, tp += NPB) {
+           /* The following check shouldn't be necessary and it will be removed soon */
+           if (!tp->bufp)
+               afs_warn
+                   ("shutdown_bufferpackage: bufp == 0!! Shouldn't happen\n");
+           else {
+               brelse(tp->bufp);
+               tp->bufp = 0;
+           }
        }
-      }
 #endif
-      afs_osi_Free(Buffers, nbuffers * sizeof(struct buffer));
-      nbuffers = 0;
-      timecounter = 1;
-      for(i=0;i<PHSIZE;i++) phTable[i] = 0;
-      memset((char *)&afs_bufferLock, 0, sizeof(afs_lock_t));
-  }
-}  
+       afs_osi_Free(Buffers, nbuffers * sizeof(struct buffer));
+       nbuffers = 0;
+       timecounter = 1;
+       for (i = 0; i < PHSIZE; i++)
+           phTable[i] = 0;
+       memset((char *)&afs_bufferLock, 0, sizeof(afs_lock_t));
+    }
+}