diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-05-12 12:16:54 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-05-12 12:16:54 +0000 |
commit | 40e5ba0182d32d492e40b3b2b4ddec869e7b6739 (patch) | |
tree | 16d75d645419e2d2c990b4b982bf3c9166ceadaf /sbin/tunefs/tunefs.c | |
parent | 607edd1d48efdf9e9cfef71322340ed466bbedfb (diff) |
No need for a dev_bsize variable that is always set to 512,
a.k.a. DEV_BSIZE. So just use DEV_BSIZE.
Confirmed to still work on 4k-byte sector disks by David Vasek.
Diffstat (limited to 'sbin/tunefs/tunefs.c')
-rw-r--r-- | sbin/tunefs/tunefs.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index 7185659cfff..89cd7b85e48 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tunefs.c,v 1.32 2013/06/11 16:42:05 deraadt Exp $ */ +/* $OpenBSD: tunefs.c,v 1.33 2014/05/12 12:16:53 krw Exp $ */ /* $NetBSD: tunefs.c,v 1.33 2005/01/19 20:46:16 xtraeme Exp $ */ /* @@ -61,7 +61,6 @@ union { char buf[MAXBSIZE]; int fi; -long dev_bsize = 512; int is_ufs2 = 0; off_t sblockloc; @@ -269,7 +268,7 @@ getsb(struct fs *fs, const char *file) for (i = 0; ; i++) { if (sblock_try[i] == -1) errx(5, "cannot find filesystem superblock"); - bread(sblock_try[i] / dev_bsize, (char *)fs, SBLOCKSIZE, file); + bread(sblock_try[i] / DEV_BSIZE, (char *)fs, SBLOCKSIZE, file); switch(fs->fs_magic) { case FS_UFS2_MAGIC: is_ufs2 = 1; @@ -287,8 +286,7 @@ getsb(struct fs *fs, const char *file) break; } - dev_bsize = fs->fs_fsize / fsbtodb(fs, 1); - sblockloc = sblock_try[i] / dev_bsize; + sblockloc = sblock_try[i] / DEV_BSIZE; } static void @@ -296,7 +294,7 @@ bwrite(daddr_t blk, char *buffer, int size, const char *file) { off_t offset; - offset = (off_t)blk * dev_bsize; + offset = (off_t)blk * DEV_BSIZE; if (lseek(fi, offset, SEEK_SET) == -1) err(6, "%s: seeking to %lld", file, (long long)offset); if (write(fi, buffer, size) != size) @@ -309,7 +307,7 @@ bread(daddr_t blk, char *buffer, int cnt, const char *file) off_t offset; int i; - offset = (off_t)blk * dev_bsize; + offset = (off_t)blk * DEV_BSIZE; if (lseek(fi, offset, SEEK_SET) == -1) err(4, "%s: seeking to %lld", file, (long long)offset); if ((i = read(fi, buffer, cnt)) != cnt) |