diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-06-22 19:04:14 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-06-22 19:04:14 +0000 |
commit | fa7cd21bab5193c1e843bfc263c09552740b5b51 (patch) | |
tree | 925d252538f6b9bd1f162328924de92b5591b47a /sbin/scan_ffs/scan_ffs.c | |
parent | df2c68b921e02bde5e74b47112b329a5c75224fa (diff) |
daddr_t -> daddr64_t; ok pedro@ thib@
Diffstat (limited to 'sbin/scan_ffs/scan_ffs.c')
-rw-r--r-- | sbin/scan_ffs/scan_ffs.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sbin/scan_ffs/scan_ffs.c b/sbin/scan_ffs/scan_ffs.c index c6645d6867d..fa96acfe3e9 100644 --- a/sbin/scan_ffs/scan_ffs.c +++ b/sbin/scan_ffs/scan_ffs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scan_ffs.c,v 1.13 2007/03/19 13:27:47 pedro Exp $ */ +/* $OpenBSD: scan_ffs.c,v 1.14 2007/06/22 19:04:13 otto Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist, Tobias Weingartner @@ -47,12 +47,12 @@ static void usage(void); static int -ufsscan(int fd, daddr_t beg, daddr_t end, int flags) +ufsscan(int fd, daddr64_t beg, daddr64_t end, int flags) { static char lastmount[MAXMNTLEN]; static u_int8_t buf[SBSIZE * SBCOUNT]; struct fs *sb; - daddr_t blk, lastblk; + daddr64_t blk, lastblk; int n; lastblk = -1; @@ -69,20 +69,20 @@ ufsscan(int fd, daddr_t beg, daddr_t end, int flags) sb = (struct fs*)(&buf[n]); if (sb->fs_magic == FS_MAGIC) { if (flags & FLAG_VERBOSE) - printf("block %d id %x,%x size %d\n", + printf("block %lld id %x,%x size %d\n", blk + (n/512), sb->fs_id[0], sb->fs_id[1], sb->fs_ffs1_size); if (((blk+(n/512)) - lastblk) == (SBSIZE/512)) { if (flags & FLAG_LABELS ) { - printf("X: %d %d 4.2BSD %d %d %d # %s\n", - (daddr_t)((off_t)sb->fs_ffs1_size * + printf("X: %lld %lld 4.2BSD %d %d %d # %s\n", + ((off_t)sb->fs_ffs1_size * sb->fs_fsize / 512), blk+(n/512)-(2*SBSIZE/512), sb->fs_fsize, sb->fs_bsize, sb->fs_cpg, lastmount); } else { - printf("ffs at %d size %lld " + printf("ffs at %lld size %lld " "mount %s time %s", blk+(n/512)-(2*SBSIZE/512), (long long)(off_t)sb->fs_ffs1_size * @@ -129,15 +129,20 @@ int main(int argc, char *argv[]) { int ch, fd, flags = 0; - daddr_t beg = 0, end = -1; + daddr64_t beg = 0, end = -1; + const char *errstr; while ((ch = getopt(argc, argv, "lsvb:e:")) != -1) switch(ch) { case 'b': - beg = atoi(optarg); + beg = strtonum(optarg, 0, LLONG_MAX, &errstr); + if (errstr) + errx(1, "%s: %s", optarg, errstr); break; case 'e': - end = atoi(optarg); + end = strtonum(optarg, 0, LLONG_MAX, &errstr); + if (errstr) + errx(1, "%s: %s", optarg, errstr); break; case 'v': flags |= FLAG_VERBOSE; |