[Tux3] [PATCH] Clean up format string warnings on x86_64
Shapor Naghibzadeh
shapor at gmail.com
Sat Aug 16 22:06:58 PDT 2008
# HG changeset patch
# User shapor at yzf.shapor.com
# Date 1218949608 25200
# Node ID 11dad0a445651149c2abf7b7947b348cfebed190
# Parent 7bea1a5fad21582a81ec2ccf4cd07fd527abc6db
Clean up format string warnings on x86_64
diff -r 7bea1a5fad21 -r 11dad0a44565 user/test/dir.c
--- a/user/test/dir.c Sat Aug 16 21:35:01 2008 -0700
+++ b/user/test/dir.c Sat Aug 16 22:06:48 2008 -0700
@@ -125,7 +125,7 @@ static unsigned char ext2_type_by_mode[S
void ext2_dump_entries(struct buffer *buffer, unsigned blocksize)
{
- printf("dirents <%Lx:%Lx>: ", buffer->map->inode->inum, buffer->index);
+ printf("dirents <%Lx:%Lx>: ", (llui_t)buffer->map->inode->inum, buffer->index);
ext2_dirent *dirent = (ext2_dirent *)buffer->data;
ext2_dirent *limit = buffer->data + blocksize;
while (dirent < limit) {
@@ -204,7 +204,7 @@ ext2_dirent *ext2_find_entry(struct inod
while (dirent <= limit) {
if (dirent->rec_len == 0) {
brelse(buffer);
- warn("zero length dirent at <%Lx:%x>", inode->inum, block);
+ warn("zero length dirent at <%Lx:%x>", (llui_t)inode->inum, block);
return NULL;
}
if (ext2_match(len, name, dirent)) {
@@ -266,7 +266,7 @@ static int ext2_readdir(struct file *fil
for (ext2_dirent *entry = base + offset; entry <= limit; entry = next_entry(entry)) {
if (entry->rec_len == 0) {
brelse(buffer);
- warn("zero length entry at <%Lx:%x>", inode->inum, block);
+ warn("zero length entry at <%Lx:%x>", (llui_t)inode->inum, block);
return -EIO;
}
if (entry->inode) {
diff -r 7bea1a5fad21 -r 11dad0a44565 user/test/dleaf.c
--- a/user/test/dleaf.c Sat Aug 16 21:35:01 2008 -0700
+++ b/user/test/dleaf.c Sat Aug 16 22:06:48 2008 -0700
@@ -130,18 +130,18 @@ void leaf_dump(SB, struct dleaf *leaf)
printf("%i entry groups:\n", leaf->groups);
for (struct group *group = groups; group > grbase; group--) {
- printf(" %u/%i:", groups - group, group->count);
+ printf(" %u/%i:", (unsigned int)(groups - group), group->count);
//printf(" [%i]", extents - leaf->table);
struct entry *enbase = entry - group->count;
while (entry > enbase) {
--entry;
unsigned offset = entry == entries - 1 ? 0 : (entry + 1)->limit;
int count = entry->limit - offset;
- printf(" %Lx ->", ((u64)group->loghi << 24) + entry->loglo);
+ printf(" %Lx ->", ((llui_t)group->loghi << 24) + entry->loglo);
if (count < 0)
printf(" <corrupt>");
else for (int i = 0; i < count; i++)
- printf(" %Lx", (u64)(extents + offset + i)->block);
+ printf(" %Lx", (llui_t)(extents + offset + i)->block);
//printf(" {%u}", entry->limit);
printf(";");
}
@@ -242,7 +242,7 @@ target = target & 0xffffffffffffLL;
/* insert new group if no match */
if (group == grbase || loghi < group->loghi || (entries - group->count)->limit == grouplim) {
int split = group != grbase && loghi == group->loghi;
- printf("new group at %u\n", group - grbase);
+ printf("new group at %u\n", (unsigned int)(group - grbase));
memmove(used - sizeof(*group), used, (void *)(group + 1) - used);
*group = (struct group){ .loghi = loghi, .count = 0 };
used -= sizeof(*group);
@@ -273,7 +273,7 @@ target = target & 0xffffffffffffLL;
/* insert new entry if no match */
if (entry == enbase || loglo < entry->loglo) {
- printf("insert 0x%Lx at %u in group %u\n", target, entries - entry, groups - group);
+ printf("insert 0x%Lx at %u in group %u\n", (llui_t)target, (unsigned int)(entries - entry), (unsigned int)(groups - group));
memmove(used - sizeof(*entry), used, (void *)(entry + 1) - used);
unsigned limit = !group->count || entry == entries ? 0 : (entry + 1)->limit;
*entry = (struct entry){ .loglo = loglo, .limit = limit };
@@ -300,7 +300,7 @@ target = target & 0xffffffffffffLL;
void leaf_insert(SB, struct dleaf *leaf, block_t target, struct extent extent)
{
- printf("insert 0x%Lx -> 0x%Lx\n", target, (block_t)extent.block);
+ printf("insert 0x%Lx -> 0x%Lx\n", (llui_t)target, (llui_t)extent.block);
struct extent *store = leaf_expand(sb, leaf, target, sizeof(extent));
*store = extent;
}
@@ -458,7 +458,7 @@ void dleaf_test(SB)
struct dleaf *dest = leaf_create(sb);
tuxkey_t key = leaf_split(sb, leaf, dest, 0);
- printf("split key 0x%Lx\n", key);
+ printf("split key 0x%Lx\n", (llui_t)key);
leaf_dump(sb, leaf);
leaf_dump(sb, dest);
leaf_check(sb, leaf);
diff -r 7bea1a5fad21 -r 11dad0a44565 user/test/ileaf.c
--- a/user/test/ileaf.c Sat Aug 16 21:35:01 2008 -0700
+++ b/user/test/ileaf.c Sat Aug 16 22:06:48 2008 -0700
@@ -86,7 +86,7 @@ void *ileaf_lookup(SB, struct ileaf *lea
assert(inum >= leaf->inum);
inum_t at = inum - leaf->inum;
assert(at < 999); // !!! calculate this properly: max inode possible with max dict
- printf("lookup inode %Lx, %Lx + %Lx\n", inum, leaf->inum, at);
+ printf("lookup inode %Lx, %Lx + %Lx\n", (llui_t)inum, (llui_t)leaf->inum, (llui_t)at);
unsigned size = 0;
void *inode = NULL;
if (at < leaf->count) {
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
char *inode = ileaf_lookup(sb, leaf, 3, &size);
hexdump(inode, size);
for (int i = 0; i <= 10; i++)
- printf("goal %i, free: %Lu\n", i, find_empty_inode(sb, leaf, i));
+ printf("goal %i, free: %Lu\n", i, (llui_t)find_empty_inode(sb, leaf, i));
ileaf_destroy(sb, leaf);
ileaf_destroy(sb, dest);
return 0;
diff -r 7bea1a5fad21 -r 11dad0a44565 user/test/tux3.h
--- a/user/test/tux3.h Sat Aug 16 21:35:01 2008 -0700
+++ b/user/test/tux3.h Sat Aug 16 22:06:48 2008 -0700
@@ -11,6 +11,7 @@ typedef uint16_t le_u16;
typedef uint16_t le_u16;
typedef uint32_t le_u32;
typedef uint64_t le_u64;
+typedef long long unsigned int llui_t;
#define fieldtype(structure, field) typeof(((struct structure *)NULL)->field)
#define vecset(d, v, n) memset((d), (v), (n) * sizeof(*(d)))
_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3
More information about the Tux3
mailing list