libsys: 64-bit numbers support for printf()

Change some drivers accordingly.
This commit is contained in:
David van Moolenbroek
2012-07-24 16:14:48 +00:00
parent 86344bb535
commit 8caec1b57b
6 changed files with 31 additions and 36 deletions

View File

@@ -426,9 +426,8 @@ static int fbd_transfer(dev_t UNUSED(minor), int do_write, u64_t position,
do_write ? FBD_FLAG_WRITE : FBD_FLAG_READ);
#if DEBUG
printf("FBD: %s operation for pos %lx:%08lx size %u -> hooks %x\n",
do_write ? "write" : "read", ex64hi(position),
ex64lo(position), size, hooks);
printf("FBD: %s operation for pos %"PRIx64" size %u -> hooks %x\n",
do_write ? "write" : "read", position, size, hooks);
#endif
if (hooks & PRE_HOOK)

View File

@@ -84,13 +84,14 @@ static int driver_open(int which)
return RET_REDO;
}
#if DEBUG
printf("Filter: partition size: 0x%s / %lu sectors\n",
print64(disk_size), sectors);
printf("Filter: partition size: 0x%"PRIx64" / %lu sectors\n",
disk_size, sectors);
#endif
} else {
if(cmp64(disk_size, part.size)) {
printf("Filter: partition size mismatch (%s != %s)\n",
print64(part.size), print64(disk_size));
printf("Filter: partition size mismatch "
"(0x%"PRIx64" != 0x%"PRIx64")\n",
part.size, disk_size);
return RET_REDO;
}
@@ -768,7 +769,7 @@ static int paired_sendrec(message *m1, message *m2, int both)
int r;
#if DEBUG2
printf("paired_sendrec(%d) - <%d,%x:%x,%d> - %x,%x\n",
printf("paired_sendrec(%d) - <%d,%lx:%lx,%d> - %x,%x\n",
both, m1->m_type, m1->BDEV_POS_HI, m1->BDEV_POS_LO,
m1->BDEV_COUNT, m1->BDEV_GRANT, m2->BDEV_GRANT);
#endif

View File

@@ -118,6 +118,5 @@ extern void ds_event(void);
/* util.c */
extern char *flt_malloc(size_t size, char *sbuf, size_t ssize);
extern void flt_free(char *buf, size_t size, const char *sbuf);
extern char *print64(u64_t p);
extern clock_t flt_alarm(clock_t dt);

View File

@@ -568,9 +568,8 @@ int transfer(u64_t pos, char *buffer, size_t *sizep, int flag_rw)
r = read_write(phys_pos, ext_buffer, ext_buffer, &res_size, flag_rw);
#if DEBUG2
printf("Filter: transfer: read_write(%x:%x, %u, %d) = %d, %u\n",
ex64hi(phys_pos), ex64lo(phys_pos), ext_size, flag_rw, r,
res_size);
printf("Filter: transfer: read_write(%"PRIx64", %u, %d) = %d, %u\n",
phys_pos, ext_size, flag_rw, r, res_size);
#endif
if (r != OK) {

View File

@@ -38,21 +38,6 @@ void flt_free(char *buf, size_t size, const char *sbuf)
free_contig(buf, size);
}
/*===========================================================================*
* print64 *
*===========================================================================*/
char *print64(u64_t p)
{
#define NB 10
static int n = 0;
static char buf[NB][100];
u32_t lo = ex64lo(p), hi = ex64hi(p);
n = (n+1) % NB;
if(!hi) sprintf(buf[n], "%x", lo);
else sprintf(buf[n], "%x%08x", hi, lo);
return buf[n];
}
/*===========================================================================*
* flt_alarm *
*===========================================================================*/