From: Joe Perches <joe@perches.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Easier printing of unknown-size quantities
Date: Thu, 09 Jan 2014 10:14:12 -0800 [thread overview]
Message-ID: <1389291252.24222.23.camel@joe-AO722> (raw)
In-Reply-To: <20140109134210.GC29910@parisc-linux.org>
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);
prev parent reply other threads:[~2014-01-09 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 13:42 Matthew Wilcox
2014-01-09 18:14 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389291252.24222.23.camel@joe-AO722 \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®