eliminate dbtob macro (which uses DEV_BSIZE)
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 24 Feb 1987 07:54:08 +0000 (23:54 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 24 Feb 1987 07:54:08 +0000 (23:54 -0800)
SCCS-vsn: sbin/fsck/utilities.c 5.8

usr/src/sbin/fsck/utilities.c

index 3f6d9b0..6f96573 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)utilities.c        5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)utilities.c        5.8 (Berkeley) %G%";
 #endif not lint
 
 #include <stdio.h>
 #endif not lint
 
 #include <stdio.h>
@@ -163,19 +163,19 @@ bread(fcp, buf, blk, size)
        char *cp;
        int i, errs;
 
        char *cp;
        int i, errs;
 
-       if (lseek(fcp->rfdes, (long)dbtob(blk), 0) < 0)
+       if (lseek(fcp->rfdes, blk * dev_bsize, 0) < 0)
                rwerr("SEEK", blk);
        else if (read(fcp->rfdes, buf, (int)size) == size)
                return (0);
        rwerr("READ", blk);
                rwerr("SEEK", blk);
        else if (read(fcp->rfdes, buf, (int)size) == size)
                return (0);
        rwerr("READ", blk);
-       if (lseek(fcp->rfdes, (long)dbtob(blk), 0) < 0)
+       if (lseek(fcp->rfdes, blk * dev_bsize, 0) < 0)
                rwerr("SEEK", blk);
        errs = 0;
        bzero(buf, size);
        pfatal("THE FOLLOWING SECTORS COULD NOT BE READ:");
        for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize) {
                if (read(fcp->rfdes, cp, dev_bsize) < 0) {
                rwerr("SEEK", blk);
        errs = 0;
        bzero(buf, size);
        pfatal("THE FOLLOWING SECTORS COULD NOT BE READ:");
        for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize) {
                if (read(fcp->rfdes, cp, dev_bsize) < 0) {
-                       lseek(fcp->rfdes, (long)dbtob(blk) + i + dev_bsize, 0);
+                       lseek(fcp->rfdes, blk * dev_bsize + i + dev_bsize, 0);
                        printf(" %d,", blk + i / dev_bsize);
                        errs++;
                }
                        printf(" %d,", blk + i / dev_bsize);
                        errs++;
                }
@@ -195,19 +195,19 @@ bwrite(fcp, buf, blk, size)
 
        if (fcp->wfdes < 0)
                return;
 
        if (fcp->wfdes < 0)
                return;
-       if (lseek(fcp->wfdes, (long)dbtob(blk), 0) < 0)
+       if (lseek(fcp->wfdes, blk * dev_bsize, 0) < 0)
                rwerr("SEEK", blk);
        else if (write(fcp->wfdes, buf, (int)size) == size) {
                fcp->mod = 1;
                return;
        }
        rwerr("WRITE", blk);
                rwerr("SEEK", blk);
        else if (write(fcp->wfdes, buf, (int)size) == size) {
                fcp->mod = 1;
                return;
        }
        rwerr("WRITE", blk);
-       if (lseek(fcp->wfdes, (long)dbtob(blk), 0) < 0)
+       if (lseek(fcp->wfdes, blk * dev_bsize, 0) < 0)
                rwerr("SEEK", blk);
        pfatal("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
        for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
                if (write(fcp->wfdes, cp, dev_bsize) < 0) {
                rwerr("SEEK", blk);
        pfatal("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
        for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
                if (write(fcp->wfdes, cp, dev_bsize) < 0) {
-                       lseek(fcp->rfdes, (long)dbtob(blk) + i + dev_bsize, 0);
+                       lseek(fcp->rfdes, blk * dev_bsize + i + dev_bsize, 0);
                        printf(" %d,", blk + i / dev_bsize);
                }
        printf("\n");
                        printf(" %d,", blk + i / dev_bsize);
                }
        printf("\n");