some disks put bad sector replacements at the end of each cylinder,
[unix-history] / usr / src / sys / ufs / ffs / ffs_inode.c
index 4af43fb..238034b 100644 (file)
@@ -1,4 +1,10 @@
-/*     ffs_inode.c     6.15    85/03/20        */
+/*
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)ffs_inode.c 6.19 (Berkeley) %G%
+ */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -8,6 +14,7 @@
 #include "inode.h"
 #include "fs.h"
 #include "buf.h"
 #include "inode.h"
 #include "fs.h"
 #include "buf.h"
+#include "cmap.h"
 #ifdef QUOTA
 #include "quota.h"
 #endif
 #ifdef QUOTA
 #include "quota.h"
 #endif
@@ -107,7 +114,6 @@ iget(dev, fs, ino)
        register struct dinode *dp;
        register struct inode *iq;
 
        register struct dinode *dp;
        register struct inode *iq;
 
-
 loop:
        ih = &ihead[INOHASH(dev, ino)];
        for (ip = ih->ih_chain[0]; ip != (struct inode *)ih; ip = ip->i_forw)
 loop:
        ih = &ihead[INOHASH(dev, ino)];
        for (ip = ih->ih_chain[0]; ip != (struct inode *)ih; ip = ip->i_forw)
@@ -372,11 +378,11 @@ itrunc(oip, length)
        u_long length;
 {
        register daddr_t lastblock;
        u_long length;
 {
        register daddr_t lastblock;
-       daddr_t bn, lastiblock[NIADDR];
+       daddr_t bn, lbn, lastiblock[NIADDR];
        register struct fs *fs;
        register struct inode *ip;
        struct buf *bp;
        register struct fs *fs;
        register struct inode *ip;
        struct buf *bp;
-       int offset, lbn, osize, size, error, count, level, s;
+       int offset, osize, size, count, level, s;
        long nblocks, blocksreleased = 0;
        register int i;
        dev_t dev;
        long nblocks, blocksreleased = 0;
        register int i;
        dev_t dev;
@@ -433,7 +439,7 @@ itrunc(oip, length)
                        brelse(bp);
                        return;
                }
                        brelse(bp);
                        return;
                }
-               bzero(bp->b_un.b_addr + offset, size - offset);
+               bzero(bp->b_un.b_addr + offset, (unsigned)(size - offset));
                bdwrite(bp);
        }
        /*
                bdwrite(bp);
        }
        /*
@@ -479,15 +485,15 @@ itrunc(oip, length)
         * All whole direct blocks or frags.
         */
        for (i = NDADDR - 1; i > lastblock; i--) {
         * All whole direct blocks or frags.
         */
        for (i = NDADDR - 1; i > lastblock; i--) {
-               register int size;
+               register off_t bsize;
 
                bn = ip->i_db[i];
                if (bn == 0)
                        continue;
                ip->i_db[i] = 0;
 
                bn = ip->i_db[i];
                if (bn == 0)
                        continue;
                ip->i_db[i] = 0;
-               size = (off_t)blksize(fs, ip, i);
-               free(ip, bn, size);
-               blocksreleased += btodb(size);
+               bsize = (off_t)blksize(fs, ip, i);
+               free(ip, bn, bsize);
+               blocksreleased += btodb(bsize);
        }
        if (lastblock < 0)
                goto done;
        }
        if (lastblock < 0)
                goto done;
@@ -498,7 +504,7 @@ itrunc(oip, length)
         */
        bn = ip->i_db[lastblock];
        if (bn != 0) {
         */
        bn = ip->i_db[lastblock];
        if (bn != 0) {
-               int oldspace, newspace;
+               off_t oldspace, newspace;
 
                /*
                 * Calculate amount of space we're giving
 
                /*
                 * Calculate amount of space we're giving
@@ -603,7 +609,7 @@ indirtrunc(ip, bn, lastbn, level)
                if (level > SINGLE)
                        blocksreleased +=
                            indirtrunc(ip, nb, (daddr_t)-1, level - 1);
                if (level > SINGLE)
                        blocksreleased +=
                            indirtrunc(ip, nb, (daddr_t)-1, level - 1);
-               free(ip, nb, (int)fs->fs_bsize);
+               free(ip, nb, (off_t)fs->fs_bsize);
                blocksreleased += nblocks;
        }
 
                blocksreleased += nblocks;
        }