-/* $OpenBSD: fsck.h,v 1.10 2011/03/12 17:50:47 deraadt Exp $ */
+/* $OpenBSD: fsck.h,v 1.11 2014/05/22 14:04:41 krw Exp $ */
/* $NetBSD: fsck.h,v 1.1 1997/06/11 11:21:47 bouyer Exp $ */
/*
} **inphead, **inpsort;
long numdirs, listmax, inplast;
-long dev_bsize; /* computed value of DEV_BSIZE */
long secsize; /* actual disk sector size */
char nflag; /* assume a no response */
char yflag; /* assume a yes response */
-/* $OpenBSD: setup.c,v 1.19 2013/11/22 04:38:02 guenther Exp $ */
+/* $OpenBSD: setup.c,v 1.20 2014/05/22 14:04:41 krw Exp $ */
/* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */
/*
if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL)
errexit("cannot allocate space for superblock\n");
if ((lp = getdisklabel((char *)NULL, fsreadfd)) != NULL)
- dev_bsize = secsize = lp->d_secsize;
+ secsize = lp->d_secsize;
else
- dev_bsize = secsize = DEV_BSIZE;
+ secsize = DEV_BSIZE;
/*
* Read in the superblock, looking for alternates if necessary
*/
static int
readsb(int listerr)
{
- daddr32_t super = bflag ? bflag : SBOFF / dev_bsize;
+ daddr32_t super = bflag ? bflag : SBOFF / DEV_BSIZE;
if (bread(fsreadfd, (char *)sblk.b_un.b_fs, super, (long)SBSIZE) != 0)
return (0);
* according to fsbtodb, and adjust superblock block number
* so we can tell if this is an alternate later.
*/
- super *= dev_bsize;
- dev_bsize = sblock.e2fs_bsize / fsbtodb(&sblock, 1);
- sblk.b_bno = super / dev_bsize;
+ sblk.b_bno = super / DEV_BSIZE;
if (sblock.e2fs_ncg == 1) {
/* no alternate superblock; assume it's okey */
-/* $OpenBSD: utilities.c,v 1.20 2014/05/20 21:11:16 krw Exp $ */
+/* $OpenBSD: utilities.c,v 1.21 2014/05/22 14:04:41 krw Exp $ */
/* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */
/*
return;
if (bp->b_errs != 0)
pfatal("WRITING %sZERO'ED BLOCK %d TO DISK\n",
- (bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ",
+ (bp->b_errs == bp->b_size / DEV_BSIZE) ? "" : "PARTIALLY ",
bp->b_bno);
bp->b_dirty = 0;
bp->b_errs = 0;
return;
}
flush(fswritefd, &sblk);
- if (havesb && sblk.b_bno != SBOFF / dev_bsize &&
+ if (havesb && sblk.b_bno != SBOFF / DEV_BSIZE &&
!preen && reply("UPDATE STANDARD SUPERBLOCKS")) {
- sblk.b_bno = SBOFF / dev_bsize;
+ sblk.b_bno = SBOFF / DEV_BSIZE;
sbdirty();
flush(fswritefd, &sblk);
copyback_sb(&asblk);
off_t offset;
offset = blk;
- offset *= dev_bsize;
+ offset *= DEV_BSIZE;
if (pread(fd, buf, size, offset) == size)
return (0);
rwerror("READ", blk);
printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:");
for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) {
if (pread(fd, cp, secsize, offset + i) != secsize) {
- if (secsize != dev_bsize && dev_bsize != 1)
+ if (secsize != DEV_BSIZE)
printf(" %ld (%ld),",
- (blk * dev_bsize + i) / secsize,
- blk + i / dev_bsize);
+ (blk * DEV_BSIZE + i) / secsize,
+ blk + i / DEV_BSIZE);
else
- printf(" %ld,", blk + i / dev_bsize);
+ printf(" %ld,", blk + i / DEV_BSIZE);
errs++;
}
}
if (fd < 0)
return;
offset = blk;
- offset *= dev_bsize;
+ offset *= DEV_BSIZE;
if (pwrite(fd, buf, size, offset) == size) {
fsmodified = 1;
return;
}
rwerror("WRITE", blk);
printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
- for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
- if (pwrite(fd, cp, dev_bsize, offset + i) != dev_bsize) {
- printf(" %ld,", blk + i / dev_bsize);
+ for (cp = buf, i = 0; i < size; i += secsize, cp += secsize)
+ if (pwrite(fd, cp, secsize, offset + i) != secsize) {
+ printf(" %ld,", blk + i / DEV_BSIZE);
}
printf("\n");
return;