Skip to contentSkip to conversation

bcache: Use %zi to format size_t

PATCH RESEND In review Geert Uytterhoeven 2 participants 4 messages Feb 3, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 bcache: Use %zi to format size_t

drivers/md/bcache/extents.c: In function ‘btree_ptr_bad_expensive’:
drivers/md/bcache/extents.c:196: warning: format ‘%li’ expects type ‘long int’, but argument 4 has type ‘size_t’

---
Issue has migrated from linux-next to Linus' tree

 drivers/md/bcache/extents.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/extents.c +1 -1
index c3ead586dc27..416d1a3e028e 100644
@@ -194,7 +194,7 @@ err:
 	mutex_unlock(&b->c->bucket_lock);
 	bch_extent_to_text(buf, sizeof(buf), k);
 	btree_bug(b,
-"inconsistent btree pointer %s: bucket %li pin %i prio %i gen %i last_gc %i mark %llu gc_gen %i",
+"inconsistent btree pointer %s: bucket %zi pin %i prio %i gen %i last_gc %i mark %llu gc_gen %i",
 		  buf, PTR_BUCKET_NR(b->c, k, i), atomic_read(&g->pin),
 		  g->prio, g->gen, g->last_gc, GC_MARK(g), g->gc_gen);
 	return true;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 2/2 bcache: Drop L-suffix when comparing ssize_t with 0

drivers/md/bcache/btree.c: In function ‘insert_u64s_remaining’:
drivers/md/bcache/btree.c:1816: warning: comparison of distinct pointer types lacks a cast

---
Issue has migrated from linux-next to Linus' tree

v2: Drop L-suffix instead of using max_t(ssize_t, ...), as suggested by Joe
Perches

 drivers/md/bcache/btree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/btree.c +1 -1
index 98cc0a810a36..f08e48f12291 100644
@@ -1813,7 +1813,7 @@ static size_t insert_u64s_remaining(struct btree *b)
 	if (b->keys.ops->is_extents)
 		ret -= KEY_MAX_U64S;
 
-	return max(ret, 0L);
+	return max(ret, 0);
 }
 
 static bool bch_btree_insert_keys(struct btree *b, struct btree_op *op,
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Geert Uytterhoeven

Shouldn't size_t use %zu?

Signature · 4 lines
========================================================================
Ian Pilcher                                         [email protected]
           Sent from the cloud -- where it's already tomorrow
========================================================================
#3 lore raw
Quoted 1 line · Ian Pilcher

Shouldn't size_t use %zu?

Technically yes. %zi/%zd prints signed numbers (ssize_t), while %zu prints unsigned (size_t).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds