On Thu, 2014-01-09 at 06:42 -0700, Matthew Wilcox wrote:
> We have a number of types whose sizes are architecture- or
> config-dependent such as pgoff_t or sector_t.  The recommendation for
> printing them is to cast them to (unsigned long long) and print them with
> %Lu/%llx/...  That's entirely reasonable except that it's so verbose.
[]
> diff --git a/fs/buffer.c b/fs/buffer.c
[]
> @@ -148,7 +148,7 @@ static void buffer_io_error(struct buffer_head *bh)
>  {
>       char b[BDEVNAME_SIZE];
>       printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
> -                     bdevname(bh->b_bdev, b),
> -                     (unsigned long long)bh->b_blocknr);
> +                     bdevname(bh->b_bdev, b), ULL(bh->b_blocknr));
>  }
 
casting to u64 works and is also simpler

        printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
                        bdevname(bh->b_bdev, b), (u64)bh->b_blocknr);


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

Reply via email to