Fix compilation warnings due to bigger ino_t/off_t

Change-Id: Ic489c2dae9a2a0a651908a6f9c43b1e311454807
This commit is contained in:
Thomas Veerman 2013-03-27 15:08:23 +00:00
parent 3ff8349d7d
commit ba556d1b6c
13 changed files with 34 additions and 33 deletions

View File

@ -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++;

View File

@ -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++;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -23,7 +23,7 @@ int do_get()
*/
register struct mproc *rmp = mp;
int r, i;
int r;
int ngroups;
switch(call_nr) {

View File

@ -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;

View File

@ -66,7 +66,7 @@ __RCSID("$NetBSD: gzip.c,v 1.105 2011/08/30 23:06:00 joerg Exp $");
#include <time.h>
#ifndef PRIdOFF
#define PRIdOFF PRId32
#define PRIdOFF PRId64
#endif
/* what type of file are we dealing with */

View File

@ -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);
}

View File

@ -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);