Geert Uytterhoeven
2014-02-17 21:00:22 UTC
On Fri, Feb 14, 2014 at 8:04 PM, Linux Kernel Mailing List
drivers/md/bcache/bset.c: In function =E2=80=98bch_dump_bset=E2=80=99:
drivers/md/bcache/bset.c:27: warning: format =E2=80=98%li=E2=80=99 expe=
cts type =E2=80=98long
int=E2=80=99, but argument 3 has type =E2=80=98int=E2=80=99
What are you trying to print here? It looks a bit strange to me.
Technically, the difference between two pointers is of type ptrdiff_.
The kernel had
typedef __kernel_ptrdiff_t ptrdiff_t;
and
#if __BITS_PER_LONG !=3D 64
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
#else
typedef __kernel_ulong_t __kernel_size_t;
typedef __kernel_long_t __kernel_ssize_t;
typedef __kernel_long_t __kernel_ptrdiff_t;
#endif
So I'd expect "%zi" to be the right way, and a quick test compile on
32-bit (m68k)
and 64-bit (amd64) comfirms that. What was wrong with it?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ***@linux-=
m68k.org
In personal conversations with technical people, I call myself a hacker=
=2E But
when I'm talking to journalists I just say "programmer" or something li=
ke that.
-- Linus Torvalds
bcache: Minor fixes from kbuild robot
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
index 4f6b594..3f74b4b 100644
--- a/drivers/md/bcache/bset.c
+++ b/drivers/md/bcache/bset.c
@@ -23,7 +23,7 @@ void bch_dump_bset(struct btree_keys *b, struct bse=
t *i, unsigned set)diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
index 4f6b594..3f74b4b 100644
--- a/drivers/md/bcache/bset.c
+++ b/drivers/md/bcache/bset.c
@@ -23,7 +23,7 @@ void bch_dump_bset(struct btree_keys *b, struct bse=
for (k =3D i->start; k < bset_bkey_last(i); k =3D next) {
next =3D bkey_next(k);
- printk(KERN_ERR "block %u key %zi/%u: ", set,
+ printk(KERN_ERR "block %u key %li/%u: ", set,
(uint64_t *) k - i->d, i->keys);
if (b->ops->key_dump)
On 32-bit (m68k):next =3D bkey_next(k);
- printk(KERN_ERR "block %u key %zi/%u: ", set,
+ printk(KERN_ERR "block %u key %li/%u: ", set,
(uint64_t *) k - i->d, i->keys);
if (b->ops->key_dump)
drivers/md/bcache/bset.c: In function =E2=80=98bch_dump_bset=E2=80=99:
drivers/md/bcache/bset.c:27: warning: format =E2=80=98%li=E2=80=99 expe=
cts type =E2=80=98long
int=E2=80=99, but argument 3 has type =E2=80=98int=E2=80=99
What are you trying to print here? It looks a bit strange to me.
Technically, the difference between two pointers is of type ptrdiff_.
The kernel had
typedef __kernel_ptrdiff_t ptrdiff_t;
and
#if __BITS_PER_LONG !=3D 64
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
#else
typedef __kernel_ulong_t __kernel_size_t;
typedef __kernel_long_t __kernel_ssize_t;
typedef __kernel_long_t __kernel_ptrdiff_t;
#endif
So I'd expect "%zi" to be the right way, and a quick test compile on
32-bit (m68k)
and 64-bit (amd64) comfirms that. What was wrong with it?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ***@linux-=
m68k.org
In personal conversations with technical people, I call myself a hacker=
=2E But
when I'm talking to journalists I just say "programmer" or something li=
ke that.
-- Linus Torvalds