Messages in this thread | | | Subject | Re: [RFC] Easier printing of unknown-size quantities | From | Joe Perches <> | Date | Thu, 09 Jan 2014 10:14:12 -0800 |
| |
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);
| |