diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-11-01 17:36:20 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-11-01 17:36:20 +0000 |
commit | b8183a0dbd4877f3cb0a20e0e6125c02674f08d2 (patch) | |
tree | d8807435b56011aa01dbd9ae817d091c18d254de /sbin | |
parent | 0b88d158f37a4188b2c37633639614eba0110aa5 (diff) |
Sprinkle (long long) casts where %lld is being used to print daddr_t
variables. Some random whitespace/knf repairs encountered on the way.
ok miod@ on inspection, feedback & more suggestions from millert@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/badsect/badsect.c | 16 | ||||
-rw-r--r-- | sbin/fsck_ffs/inode.c | 14 | ||||
-rw-r--r-- | sbin/fsck_ffs/main.c | 15 | ||||
-rw-r--r-- | sbin/fsck_ffs/utilities.c | 16 | ||||
-rw-r--r-- | sbin/ncheck_ffs/ncheck_ffs.c | 18 | ||||
-rw-r--r-- | sbin/newfs/mkfs.c | 13 | ||||
-rw-r--r-- | sbin/scan_ffs/scan_ffs.c | 13 |
7 files changed, 60 insertions, 45 deletions
diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c index 4c9f54b87bd..4deed201175 100644 --- a/sbin/badsect/badsect.c +++ b/sbin/badsect/badsect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: badsect.c,v 1.21 2013/06/11 16:42:02 deraadt Exp $ */ +/* $OpenBSD: badsect.c,v 1.22 2013/11/01 17:36:18 krw Exp $ */ /* $NetBSD: badsect.c,v 1.10 1995/03/18 14:54:28 cgd Exp $ */ /* @@ -147,20 +147,21 @@ chkuse(daddr_t blkno, int cnt) fsbn = dbtofsb(fs, blkno); if (fsbn+cnt > fs->fs_ffs1_size) { - fprintf(stderr, "block %lld out of range of file system\n", blkno); + fprintf(stderr, "block %lld out of range of file system\n", + (long long)blkno); return (1); } cg = dtog(fs, fsbn); if (fsbn < cgdmin(fs, cg)) { if (cg == 0 || (fsbn+cnt) > cgsblock(fs, cg)) { - fprintf(stderr, "block %lld in non-data area: cannot attach\n", - blkno); + fprintf(stderr, "block %lld in non-data area: cannot " + "attach\n", (long long)blkno); return (1); } } else { if ((fsbn+cnt) > cgbase(fs, cg+1)) { - fprintf(stderr, "block %lld in non-data area: cannot attach\n", - blkno); + fprintf(stderr, "block %lld in non-data area: cannot " + "attach\n", (long long)blkno); return (1); } } @@ -173,7 +174,8 @@ chkuse(daddr_t blkno, int cnt) } bn = dtogd(fs, fsbn); if (isclr(cg_blksfree(&acg), bn)) - fprintf(stderr, "Warning: sector %lld is in use\n", blkno); + fprintf(stderr, "Warning: sector %lld is in use\n", + (long long)blkno); return (0); } diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 87b262aa362..084acaa7f05 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inode.c,v 1.38 2013/06/11 16:42:04 deraadt Exp $ */ +/* $OpenBSD: inode.c,v 1.39 2013/11/01 17:36:18 krw Exp $ */ /* $NetBSD: inode.c,v 1.23 1996/10/11 20:15:47 thorpej Exp $ */ /* @@ -240,7 +240,8 @@ chkrange(daddr_t blk, int cnt) fragnum(&sblock, blk) + cnt > sblock.fs_frag) { if (debug) printf("bad size: blk %lld, offset %lld, size %d\n", - blk, fragnum(&sblock, blk), cnt); + (long long)blk, fragnum(&sblock, blk), + cnt); return (1); } c = dtog(&sblock, blk); @@ -248,9 +249,10 @@ chkrange(daddr_t blk, int cnt) if ((blk + cnt) > cgsblock(&sblock, c)) { if (debug) { printf("blk %lld < cgdmin %lld;", - blk, cgdmin(&sblock, c)); + (long long)blk, cgdmin(&sblock, c)); printf(" blk + cnt %lld > cgsbase %lld\n", - blk + cnt, cgsblock(&sblock, c)); + (long long)(blk + cnt), + cgsblock(&sblock, c)); } return (1); } @@ -258,9 +260,9 @@ chkrange(daddr_t blk, int cnt) if ((blk + cnt) > cgbase(&sblock, c+1)) { if (debug) { printf("blk %lld >= cgdmin %lld;", - blk, cgdmin(&sblock, c)); + (long long)blk, cgdmin(&sblock, c)); printf(" blk + cnt %lld > sblock.fs_fpg %d\n", - blk+cnt, sblock.fs_fpg); + (long long)(blk+cnt), sblock.fs_fpg); } return (1); } diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 6621984b90f..1fec03cff23 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.40 2013/06/11 16:42:04 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.41 2013/11/01 17:36:18 krw Exp $ */ /* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */ /* @@ -239,10 +239,13 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child) n_ffree = sblock.fs_cstotal.cs_nffree; n_bfree = sblock.fs_cstotal.cs_nbfree; pwarn("%lld files, %lld used, %lld free ", - n_files, n_blks, n_ffree + sblock.fs_frag * n_bfree); + n_files, (long long)n_blks, + (long long)(n_ffree + sblock.fs_frag * n_bfree)); printf("(%lld frags, %lld blocks, %lld.%lld%% fragmentation)\n", - n_ffree, n_bfree, (n_ffree * 100) / sblock.fs_dsize, - ((n_ffree * 1000 + sblock.fs_dsize / 2) / sblock.fs_dsize) % 10); + (long long)n_ffree, (long long)n_bfree, + (long long)((n_ffree * 100) / sblock.fs_dsize), + (long long)(((n_ffree * 1000 + sblock.fs_dsize / 2) / + sblock.fs_dsize) % 10)); if (debug && (n_files -= maxino - ROOTINO - sblock.fs_cstotal.cs_nifree)) printf("%lld files missing\n", n_files); @@ -252,11 +255,11 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child) n_blks += cgsblock(&sblock, 0) - cgbase(&sblock, 0); n_blks += howmany(sblock.fs_cssize, sblock.fs_fsize); if (n_blks -= maxfsblock - (n_ffree + sblock.fs_frag * n_bfree)) - printf("%lld blocks missing\n", n_blks); + printf("%lld blocks missing\n", (long long)n_blks); if (duplist != NULL) { printf("The following duplicate blocks remain:"); for (dp = duplist; dp; dp = dp->next) - printf(" %lld,", dp->dup); + printf(" %lld,", (long long)dp->dup); printf("\n"); } if (zlnhead != NULL) { diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index ca5d4a857cb..44ef7afc2d1 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.41 2013/06/11 16:42:04 deraadt Exp $ */ +/* $OpenBSD: utilities.c,v 1.42 2013/11/01 17:36:18 krw Exp $ */ /* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */ /* @@ -230,7 +230,7 @@ flush(int fd, struct bufarea *bp) if (bp->b_errs != 0) pfatal("WRITING %sZERO'ED BLOCK %lld TO DISK\n", (bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ", - bp->b_bno); + (long long)bp->b_bno); bp->b_dirty = 0; bp->b_errs = 0; bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size); @@ -250,7 +250,7 @@ rwerror(char *mesg, daddr_t blk) if (preen == 0) printf("\n"); - pfatal("CANNOT %s: BLK %lld", mesg, blk); + pfatal("CANNOT %s: BLK %lld", mesg, (long long)blk); if (reply("CONTINUE") == 0) errexit("Program terminated\n"); } @@ -354,10 +354,12 @@ bread(int fd, char *buf, daddr_t blk, long size) (void)lseek(fd, offset + i + secsize, SEEK_SET); if (secsize != dev_bsize && dev_bsize != 1) printf(" %lld (%lld),", - (blk * dev_bsize + i) / secsize, - blk + i / dev_bsize); + (long long)((blk * dev_bsize + i) / + secsize), + (long long)(blk + i / dev_bsize)); else - printf(" %lld,", blk + i / dev_bsize); + printf(" %lld,", + (long long)(blk + i / dev_bsize)); errs++; } } @@ -389,7 +391,7 @@ bwrite(int fd, char *buf, daddr_t blk, long size) for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize) if (write(fd, cp, (int)dev_bsize) != dev_bsize) { (void)lseek(fd, offset + i + dev_bsize, SEEK_SET); - printf(" %lld,", blk + i / dev_bsize); + printf(" %lld,", (long long)(blk + i / dev_bsize)); } printf("\n"); return; diff --git a/sbin/ncheck_ffs/ncheck_ffs.c b/sbin/ncheck_ffs/ncheck_ffs.c index c0b7e08aafb..8875f871753 100644 --- a/sbin/ncheck_ffs/ncheck_ffs.c +++ b/sbin/ncheck_ffs/ncheck_ffs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncheck_ffs.c,v 1.37 2013/06/11 16:42:05 deraadt Exp $ */ +/* $OpenBSD: ncheck_ffs.c,v 1.38 2013/11/01 17:36:18 krw Exp $ */ /*- * Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> @@ -288,10 +288,11 @@ loop: warnx("read error from %s: %s: [block %lld]: count=%d", disk, strerror(errno), (long long)blkno, size); else - warnx("short read error from %s: [block %lld]: count=%d, got=%d", - disk, (long long)blkno, size, cnt); + warnx("short read error from %s: [block %lld]: count=%d, " + "got=%d", disk, (long long)blkno, size, cnt); if (++breaderrors > BREADEMAX) - errx(1, "More than %d block read errors from %s", BREADEMAX, disk); + errx(1, "More than %d block read errors from %s", BREADEMAX, + disk); /* * Zero buffer, then try to read each sector of buffer separately. */ @@ -302,12 +303,13 @@ loop: if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize) continue; if (cnt == -1) { - warnx("read error from %s: %s: [sector %lld]: count=%ld", - disk, strerror(errno), (long long)blkno, dev_bsize); + warnx("read error from %s: %s: [sector %lld]: " + "count=%ld", disk, strerror(errno), + (long long)blkno, dev_bsize); continue; } - warnx("short read error from %s: [sector %lld]: count=%ld, got=%d", - disk, (long long)blkno, dev_bsize, cnt); + warnx("short read error from %s: [sector %lld]: count=%ld, " + "got=%d", disk, (long long)blkno, dev_bsize, cnt); } } diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 4c08d5023ce..20b515dcac3 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.81 2013/10/07 21:00:45 krw Exp $ */ +/* $OpenBSD: mkfs.c,v 1.82 2013/11/01 17:36:19 krw Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -195,10 +195,11 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo, mode_t mfsmode, * Verify that its last block can actually be accessed. */ if (Oflag <= 1 && fssize > INT_MAX) - errx(13, "preposterous size %lld, max is %d", fssize, INT_MAX); + errx(13, "preposterous size %lld, max is %d", (long long)fssize, + INT_MAX); if (Oflag == 2 && fssize > MAXDISKSIZE) - errx(13, "preposterous size %lld, max is %lld", fssize, - MAXDISKSIZE); + errx(13, "preposterous size %lld, max is %lld", + (long long)fssize, MAXDISKSIZE); wtfs(fssize - (sectorsize / DEV_BSIZE), sectorsize, (char *)&sblock); @@ -1015,7 +1016,7 @@ rdfs(daddr_t bno, int size, void *bf) } n = pread(fsi, bf, size, (off_t)bno * DEV_BSIZE); if (n != size) { - err(34, "rdfs: read error on block %lld", bno); + err(34, "rdfs: read error on block %lld", (long long)bno); } } @@ -1035,7 +1036,7 @@ wtfs(daddr_t bno, int size, void *bf) return; n = pwrite(fso, bf, size, (off_t)bno * DEV_BSIZE); if (n != size) { - err(36, "wtfs: write error on block %lld", bno); + err(36, "wtfs: write error on block %lld", (long long)bno); } } diff --git a/sbin/scan_ffs/scan_ffs.c b/sbin/scan_ffs/scan_ffs.c index f490ed0c3e2..b2e36f84a67 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.16 2013/06/11 16:42:05 deraadt Exp $ */ +/* $OpenBSD: scan_ffs.c,v 1.17 2013/11/01 17:36:19 krw Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist, Tobias Weingartner @@ -70,15 +70,17 @@ ufsscan(int fd, daddr_t beg, daddr_t end, int flags) if (sb->fs_magic == FS_MAGIC) { if (flags & FLAG_VERBOSE) printf("block %lld id %x,%x size %d\n", - blk + (n/512), sb->fs_id[0], - sb->fs_id[1], sb->fs_ffs1_size); + (long long)(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: %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), + (long long)(blk + (n/512) - + (2*SBSIZE/512)), sb->fs_fsize, sb->fs_bsize, sb->fs_cpg, lastmount); } else { @@ -87,7 +89,8 @@ ufsscan(int fd, daddr_t beg, daddr_t end, int flags) printf("ffs at %lld size %lld " "mount %s time %s", - blk+(n/512)-(2*SBSIZE/512), + (long long)(blk+(n/512) - + (2*SBSIZE/512)), (long long)(off_t)sb->fs_ffs1_size * sb->fs_fsize, lastmount, ctime(&t)); |