[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1389291252.24222.23.camel@joe-AO722>
Date: Thu, 09 Jan 2014 10:14:12 -0800
From: Joe Perches <joe@...ches.com>
To: Matthew Wilcox <matthew@....cx>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [RFC] Easier printing of unknown-size quantities
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists