From ba556d1b6c77eadbc048f04b0724ead855a500b8 Mon Sep 17 00:00:00 2001 From: Thomas Veerman Date: Wed, 27 Mar 2013 15:08:23 +0000 Subject: [PATCH] Fix compilation warnings due to bigger ino_t/off_t Change-Id: Ic489c2dae9a2a0a651908a6f9c43b1e311454807 --- commands/cmp/cmp.c | 4 ++-- commands/format/format.c | 8 ++++---- commands/fsck.mfs/fsck.c | 20 ++++++++++---------- commands/ftp101/file.c | 6 +++--- commands/rawspeed/rawspeed.c | 10 +++++----- commands/writeisofs/writeisofs.c | 2 +- lib/libc/sys-minix/_ucontext.c | 2 +- lib/libmthread/misc.c | 2 +- servers/pm/getset.c | 2 +- servers/rs/exec.c | 3 ++- usr.bin/gzip/gzip.c | 2 +- usr.bin/sort/fields.c | 2 +- usr.sbin/mkfs.mfs/mkfs.c | 4 ++-- 13 files changed, 34 insertions(+), 33 deletions(-) diff --git a/commands/cmp/cmp.c b/commands/cmp/cmp.c index 3492f2e42..03d2f0279 100644 --- a/commands/cmp/cmp.c +++ b/commands/cmp/cmp.c @@ -100,12 +100,12 @@ int fd1, fd2; if (c1 != c2) { if (!loud) { if (!silent) { - printf("%s %s differ: char %d, line %d\n", + printf("%s %s differ: char %lld, line %lld\n", name1, name2, pos + i1, line); } return(1); } - printf("%10d %3o %3o\n", pos + i1, c1 & 0xFF, c2 & 0xFF); + printf("%10lld %3o %3o\n", pos + i1, c1 & 0xFF, c2 & 0xFF); differ = 1; } if (c1 == '\n') line++; diff --git a/commands/format/format.c b/commands/format/format.c index 8cb8a4c93..c11025c26 100644 --- a/commands/format/format.c +++ b/commands/format/format.c @@ -122,7 +122,7 @@ void format_track(int ffd, unsigned type, unsigned cyl, unsigned head) track_pos= (off_t) (cyl * NR_HEADS + head) * nr_sectors * SECTOR_SIZE; if (lseek(ffd, track_pos, SEEK_SET) == -1) { fprintf(stderr, - "format: seeking to cyl %u, head %u (pos %d) failed: %s\n", + "format: seeking to cyl %u, head %u (pos %lld) failed: %s\n", cyl, head, track_pos, strerror(errno)); exit(1); } @@ -154,7 +154,7 @@ void verify_track(int vfd, unsigned type, unsigned cyl, unsigned head) track_pos= (off_t) (cyl * NR_HEADS + head) * nr_sectors * SECTOR_SIZE; if (lseek(vfd, track_pos, SEEK_SET) == -1) { fprintf(stderr, - "format: seeking to cyl %u, head %u (pos %d) failed: %s\n", + "format: seeking to cyl %u, head %u (pos %lld) failed: %s\n", cyl, head, track_pos, strerror(errno)); exit(1); } @@ -167,7 +167,7 @@ void verify_track(int vfd, unsigned type, unsigned cyl, unsigned head) for (sector= 0; sector < nr_sectors; sector++) { if (lseek(vfd, track_pos, SEEK_SET) == -1) { fprintf(stderr, - "format: seeking to cyl %u, head %u, sector %u (pos %d) failed: %s\n", + "format: seeking to cyl %u, head %u, sector %u (pos %lld) failed: %s\n", cyl, head, sector, track_pos, strerror(errno)); exit(1); } @@ -183,7 +183,7 @@ void verify_track(int vfd, unsigned type, unsigned cyl, unsigned head) /* Fine. */ break; default: - fprintf(stderr, "format: short read at pos %d\n", + fprintf(stderr, "format: short read at pos %lld\n", track_pos); bad_count++; } diff --git a/commands/fsck.mfs/fsck.c b/commands/fsck.mfs/fsck.c index e42af03a2..6744dbde5 100644 --- a/commands/fsck.mfs/fsck.c +++ b/commands/fsck.mfs/fsck.c @@ -646,7 +646,7 @@ void chksuper() if(maxsize <= 0) maxsize = LONG_MAX; if (sb.s_max_size != maxsize) { - printf("warning: expected max size to be %d ", maxsize); + printf("warning: expected max size to be %lld ", maxsize); printf("instead of %d\n", sb.s_max_size); } @@ -682,7 +682,7 @@ char **clist; ino = bit; do { devread(inoblock(ino), inooff(ino), (char *) ip, INODE_SIZE); - printf("inode %u:\n", ino); + printf("inode %llu:\n", ino); printf(" mode = %6o", ip->i_mode); if (input(buf, 80)) ip->i_mode = atoo(buf); printf(" nlinks = %6u", ip->i_nlinks); @@ -854,7 +854,7 @@ void chkilist() devread(inoblock(ino), inooff(ino), (char *) &mode, sizeof(mode)); if (mode != I_NOT_ALLOC) { - printf("mode inode %u not cleared", ino); + printf("mode inode %lld not cleared", ino); if (yes(". clear")) devwrite(inoblock(ino), inooff(ino), nullbuf, INODE_SIZE); } @@ -880,7 +880,7 @@ void counterror(ino_t ino) } devread(inoblock(ino), inooff(ino), (char *) &inode, INODE_SIZE); count[ino] += inode.i_nlinks; /* it was already subtracted; add it back */ - printf("%5u %5u %5u", ino, (unsigned) inode.i_nlinks, count[ino]); + printf("%5llu %5u %5u", ino, (unsigned) inode.i_nlinks, count[ino]); if (yes(" adjust")) { if ((inode.i_nlinks = count[ino]) == 0) { fatal("internal error (counterror)"); @@ -940,7 +940,7 @@ void list(ino_t ino, d_inode *ip) firstlist = 0; printf(" inode permission link size name\n"); } - printf("%6u ", ino); + printf("%6llu ", ino); switch (ip->i_mode & I_TYPE) { case I_REGULAR: putchar('-'); break; case I_DIRECTORY: putchar('d'); break; @@ -1028,7 +1028,7 @@ int chkdots(ino_t ino, off_t pos, dir_struct *dp, ino_t exp) printf("bad %s in ", printable_name); printpath(1, 0); printf("%s is linked to %u ", printable_name, dp->d_inum); - printf("instead of %u)", exp); + printf("instead of %llu)", exp); setbit(spec_imap, (bit_nr) ino); setbit(spec_imap, (bit_nr) dp->d_inum); setbit(spec_imap, (bit_nr) exp); @@ -1040,7 +1040,7 @@ int chkdots(ino_t ino, off_t pos, dir_struct *dp, ino_t exp) } } else if (pos != (dp->mfs_d_name[1] ? DIR_ENTRY_SIZE : 0)) { make_printable_name(printable_name, dp->mfs_d_name, sizeof(dp->mfs_d_name)); - printf("warning: %s has offset %d in ", printable_name, pos); + printf("warning: %s has offset %lld in ", printable_name, pos); printpath(1, 0); printf("%s is linked to %u)\n", printable_name, dp->d_inum); setbit(spec_imap, (bit_nr) ino); @@ -1207,7 +1207,7 @@ off_t pos; case 2: printf("DOUBLE INDIRECT"); break; default: printf("VERY INDIRECT"); } - printf(", pos = %d)\n", pos); + printf(", pos = %lld)\n", pos); } /* Found the given zone in the given inode. Check it, and if ok, mark it @@ -1426,7 +1426,7 @@ int chkinode(ino_t ino, d_inode *ip) { if (ino == ROOT_INODE && (ip->i_mode & I_TYPE) != I_DIRECTORY) { printf("root inode is not a directory "); - printf("(ino = %u, mode = %o)\n", ino, ip->i_mode); + printf("(ino = %llu, mode = %o)\n", ino, ip->i_mode); fatal(""); } if (ip->i_nlinks == 0) { @@ -1461,7 +1461,7 @@ dir_struct *dp; stk.st_next = ftop; ftop = &stk; if (bitset(spec_imap, (bit_nr) ino)) { - printf("found inode %u: ", ino); + printf("found inode %llu: ", ino); printpath(0, 1); } visited = bitset(imap, (bit_nr) ino); diff --git a/commands/ftp101/file.c b/commands/ftp101/file.c index 3c53e9331..400781954 100644 --- a/commands/ftp101/file.c +++ b/commands/ftp101/file.c @@ -435,7 +435,7 @@ char restart[16]; } else filesize = lseek(fd, 0, SEEK_END); - sprintf(restart, "%u", filesize); + sprintf(restart, "%lld", filesize); s = DOcommand("REST", restart); @@ -510,7 +510,7 @@ unsigned short crc(char *fname); if((s / 100) != 2) return(-1); - sscanf(reply, "%*hu %*s%u%lu", &ccrc, &csize); + sscanf(reply, "%*hu %*s%hu%lu", &ccrc, &csize); if(ss < 0) return(-1); lcrc = crc(file); if(size != csize || size != st.st_size || ccrc != lcrc) @@ -728,7 +728,7 @@ char restart[16]; return(0); } - sprintf(restart, "%u", rmtsize); + sprintf(restart, "%lld", rmtsize); s = DOcommand("REST", restart); diff --git a/commands/rawspeed/rawspeed.c b/commands/rawspeed/rawspeed.c index 256f536fa..40302287f 100644 --- a/commands/rawspeed/rawspeed.c +++ b/commands/rawspeed/rawspeed.c @@ -220,7 +220,7 @@ int main(int argc, char **argv) if (nbytes > 0) { off_t kBpts; - fprintf(stderr, "%d kB / %ld.%ld s = ", + fprintf(stderr, "%lld kB / %ld.%ld s = ", (nbytes + 512) / 1024, tenthsec / 10, tenthsec % 10); if (tenthsec < 5) @@ -230,11 +230,11 @@ int main(int argc, char **argv) seconds = (tenthsec + 5) / 10; kBpts= (nbytes + 512L * seconds) / (1024L * seconds); - fprintf(stderr, "%d kB/s\n", kBpts); + fprintf(stderr, "%lld kB/s\n", kBpts); } else { kBpts= (100 * nbytes + 512L * tenthsec) / (1024L * tenthsec); - fprintf(stderr, "%d.%d kB/s\n", + fprintf(stderr, "%lld.%lld kB/s\n", kBpts/10, kBpts%10); } } @@ -246,7 +246,7 @@ int main(int argc, char **argv) tenthms= (tenthsec * 1000 + nseeks/2) / nseeks; fprintf(stderr, - "%d seeks / %ld.%ld s = %ld seeks/s = %d.%d ms/seek\n", + "%lld seeks / %ld.%ld s = %lld seeks/s = %lld.%lld ms/seek\n", nseeks, tenthsec / 10, tenthsec % 10, (nseeks * 10 + tenthsec/2) / tenthsec, tenthms / 10, tenthms % 10); @@ -263,7 +263,7 @@ int main(int argc, char **argv) } else { fprintf(stderr, ", "); } - fprintf(stderr, "%d.%d ms (%d rpm)", + fprintf(stderr, "%lld.%lld ms (%d rpm)", (tenthms - rotms) / 10, (tenthms - rotms) % 10, rpm); } diff --git a/commands/writeisofs/writeisofs.c b/commands/writeisofs/writeisofs.c index 4b0ae0ea4..a978a1b90 100644 --- a/commands/writeisofs/writeisofs.c +++ b/commands/writeisofs/writeisofs.c @@ -851,7 +851,7 @@ writebootimage(char *bootimage, int bootfd, int fd, int *currentsector, exit(1); } - fprintf(stderr, " * appended sector info: 0x%x len 0x%x\n", + fprintf(stderr, " * appended sector info: 0x%llx len 0x%x\n", bap[0].sector, bap[0].length); addr = buf; diff --git a/lib/libc/sys-minix/_ucontext.c b/lib/libc/sys-minix/_ucontext.c index 7d9d11d37..cb63dc1d8 100644 --- a/lib/libc/sys-minix/_ucontext.c +++ b/lib/libc/sys-minix/_ucontext.c @@ -245,7 +245,7 @@ int swapcontext(ucontext_t *oucp, const ucontext_t *ucp) /*===========================================================================* * resumecontext * *===========================================================================*/ -void resumecontext(ucontext_t *ucp) +__dead void resumecontext(ucontext_t *ucp) { if (ucp->uc_link == NULL) exit(0); diff --git a/lib/libmthread/misc.c b/lib/libmthread/misc.c index c9c9f1775..7ce0b8fb0 100644 --- a/lib/libmthread/misc.c +++ b/lib/libmthread/misc.c @@ -33,7 +33,7 @@ void mthread_panic_f(const char *file, int line, const char *msg) exit(1); } #else -void mthread_panic_s(void) +__dead void mthread_panic_s(void) { /* Silent panic */ volatile int *sf; diff --git a/servers/pm/getset.c b/servers/pm/getset.c index 407a5a63a..5303841dd 100644 --- a/servers/pm/getset.c +++ b/servers/pm/getset.c @@ -23,7 +23,7 @@ int do_get() */ register struct mproc *rmp = mp; - int r, i; + int r; int ngroups; switch(call_nr) { diff --git a/servers/rs/exec.c b/servers/rs/exec.c index d0c950f67..605b77725 100644 --- a/servers/rs/exec.c +++ b/servers/rs/exec.c @@ -206,7 +206,8 @@ size_t seg_bytes /* how much is to be transferred? */ if (off+seg_bytes > execi->hdr_len) return ENOEXEC; if((r= sys_vircopy(SELF, ((vir_bytes)execi->hdr)+off, execi->proc_e, seg_addr, seg_bytes)) != OK) { - printf("RS: exec read_seg: copy 0x%x bytes into %i at 0x%08x failed: %i\n", + printf( "RS: exec read_seg: copy 0x%x bytes into %i at " + "0x%08llx failed: %i\n", seg_bytes, execi->proc_e, seg_addr, r); } return r; diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index 0bd9a0005..886ff5b27 100644 --- a/usr.bin/gzip/gzip.c +++ b/usr.bin/gzip/gzip.c @@ -66,7 +66,7 @@ __RCSID("$NetBSD: gzip.c,v 1.105 2011/08/30 23:06:00 joerg Exp $"); #include #ifndef PRIdOFF -#define PRIdOFF PRId32 +#define PRIdOFF PRId64 #endif /* what type of file are we dealing with */ diff --git a/usr.bin/sort/fields.c b/usr.bin/sort/fields.c index 94cb23ca5..d3071dffa 100644 --- a/usr.bin/sort/fields.c +++ b/usr.bin/sort/fields.c @@ -393,7 +393,7 @@ numhex(u_char *pos, const u_char *bufend, u_char *line, u_char *lineend, int64_t n = 0; int l; SKIP_BLANKS(line); - sscanf((const char *) pos, "%lx", &n); + sscanf((const char *) pos, "%llx", &n); l = snprintf((char *)buf, sizeof(buf), "%lld", n); return number(pos, bufend, buf, buf + l, flag); } diff --git a/usr.sbin/mkfs.mfs/mkfs.c b/usr.sbin/mkfs.mfs/mkfs.c index b76f3c7ce..24f267749 100644 --- a/usr.sbin/mkfs.mfs/mkfs.c +++ b/usr.sbin/mkfs.mfs/mkfs.c @@ -840,7 +840,7 @@ void enter_dir(ino_t parent, char const *name, ino_t child) } } - printf("Directory-inode %u beyond direct blocks. Could not enter %s\n", + printf("Directory-inode %llu beyond direct blocks. Could not enter %s\n", parent, name); pexit("Halt"); } @@ -1338,7 +1338,7 @@ void print_fs() if (k > nrinodes) break; { if (inode2[i].d2_mode != 0) { - printf("Inode %2u: mode=", k); + printf("Inode %2llu: mode=", k); printf("%06o", inode2[i].d2_mode); printf(" uid=%2d gid=%2d size=", inode2[i].d2_uid, inode2[i].d2_gid);