[PATCH] jffs2: Fix size_t on 64bit architectures

From: Takashi Iwai
Date: Tue Feb 14 2006 - 14:53:19 EST


Fix the handling of size_t and printf formats.
size_t isn't unsigned int on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>

---
nodelist.c | 7 ++++---
readinode.c | 8 ++++----
summary.c | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index b635e16..fd6ca42 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -406,7 +406,8 @@ static int check_node_data(struct jffs2_
int err = 0, pointed = 0;
struct jffs2_eraseblock *jeb;
unsigned char *buffer;
- uint32_t crc, ofs, retlen, len;
+ uint32_t crc, ofs, len;
+ size_t retlen;

BUG_ON(tn->csize == 0);

@@ -437,7 +438,7 @@ static int check_node_data(struct jffs2_
if (c->mtd->point) {
err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer);
if (!err && retlen < tn->csize) {
- JFFS2_WARNING("MTD point returned len too short: %u instead of %u.\n", retlen, tn->csize);
+ JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize);
c->mtd->unpoint(c->mtd, buffer, ofs, len);
} else if (err)
JFFS2_WARNING("MTD point failed: error code %d.\n", err);
@@ -460,7 +461,7 @@ static int check_node_data(struct jffs2_
}

if (retlen != len) {
- JFFS2_ERROR("short read at %#08x: %d instead of %d.\n", ofs, retlen, len);
+ JFFS2_ERROR("short read at %#08x: %zd instead of %d.\n", ofs, retlen, len);
err = -EIO;
goto free_out;
}
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 5f0652d..c43acf3 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -112,7 +112,7 @@ static struct jffs2_raw_node_ref *jffs2_
* negative error code on failure.
*/
static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref,
- struct jffs2_raw_dirent *rd, uint32_t read, struct jffs2_full_dirent **fdp,
+ struct jffs2_raw_dirent *rd, size_t read, struct jffs2_full_dirent **fdp,
uint32_t *latest_mctime, uint32_t *mctime_ver)
{
struct jffs2_full_dirent *fd;
@@ -204,7 +204,7 @@ static inline int read_dnode(struct jffs

tn = jffs2_alloc_tmp_dnode_info();
if (!tn) {
- JFFS2_ERROR("failed to allocate tn (%d bytes).\n", sizeof(*tn));
+ JFFS2_ERROR("failed to allocate tn (%zd bytes).\n", sizeof(*tn));
return -ENOMEM;
}

@@ -434,7 +434,7 @@ static int read_more(struct jffs2_sb_inf
}

if (retlen < len) {
- JFFS2_ERROR("short read at %#08x: %d instead of %d.\n",
+ JFFS2_ERROR("short read at %#08x: %Zd instead of %d.\n",
offs, retlen, len);
return -EIO;
}
@@ -542,7 +542,7 @@ static int jffs2_get_inode_nodes(struct
}

if (retlen < len) {
- JFFS2_ERROR("short read at %#08x: %d instead of %d.\n", ref_offset(ref), retlen, len);
+ JFFS2_ERROR("short read at %#08x: %zd instead of %d.\n", ref_offset(ref), retlen, len);
err = -EIO;
goto free_out;
}
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index fb9cec6..793fbb8 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -655,7 +655,7 @@ static int jffs2_sum_write_data(struct j


if (ret || (retlen != infosize)) {
- JFFS2_WARNING("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
+ JFFS2_WARNING("Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n",
infosize, jeb->offset + c->sector_size - jeb->free_size, ret, retlen);

c->summary->sum_size = JFFS2_SUMMARY_NOSUM_SIZE;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/