linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Peter Chubb <peter@chubb.wattle.id.au>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: Large block device patch, part 1 of 9
Date: Fri, 23 Aug 2002 01:07:59 -0600	[thread overview]
Message-ID: <20020823070759.GS19435@clusterfs.com> (raw)
In-Reply-To: <15717.52317.654149.636236@wombat.chubb.wattle.id.au>

On Aug 23, 2002  15:47 +1000, Peter Chubb wrote:
> This part just fixes printk() formats to allow sector_t to be either
> 32 or 64 bit.

> @@ -175,8 +175,8 @@
>                  drv = &h->drv[i];
>  		if (drv->block_size == 0)
>  			continue;
> -                size = sprintf(buffer+len, "cciss/c%dd%d: blksz=%d nr_blocks=%d\n",
> -                                ctlr, i, drv->block_size, drv->nr_blocks);
> +                size = sprintf(buffer+len, "cciss/c%dd%d: blksz=%d nr_blocks=%llu\n",
> +                                ctlr, i, drv->block_size, (unsigned long long)drv->nr_blocks);

Ugh.  My personal preference would be to have two things:

1) A kernel-wide definition like the following, maybe in asm/types where
   the __u64 types are defined in the first place, to fix printing of __u64
   (granted, this isn't exactly your problem, but it is related):

#if BITS_PER_LONG > 32
#define PFU64 "%lu"
#define PFD64 "%ld"
#define PFX64 "%lx"
#else
#define PFU64 "%Lu"
#define PFD64 "%Ld"
#define PFX64 "%Lx"
#endif

Then the following works properly without ugly casts or warnings:

	__u64 val = 1;

	printk("at least "PFU64" of your u64s are belong to us\n", val);

2) Define the sector_t printing similarly so it works without casting:

#if SECTOR_T_BITS == 64 // or whatever
#define PFST "%lu"
#else
#define PFST "%Lu"
#endif

	size = sprintf(buffer+len, "cciss/c%dd%d: blksz=%d nr_blocks="PFST"\n",
		ctlr, i, drv->block_size, drv->nr_blocks);

Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/


  reply	other threads:[~2002-08-23  7:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-23  5:47 Large block device patch, part 1 of 9 Peter Chubb
2002-08-23  7:07 ` Andreas Dilger [this message]
2002-08-27 15:23   ` Pavel Machek
2002-08-27 22:58     ` Benjamin LaHaise
2002-08-27 23:40       ` Peter Chubb
2002-09-03 10:01       ` Neil Brown
2002-09-03 16:04         ` Linus Torvalds
2002-09-03 16:21           ` Thunder from the hill
2002-09-03 23:06           ` Neil Brown
2002-12-03  0:03           ` H. Peter Anvin
2002-09-03 19:42         ` Daniel Phillips
2002-09-03 19:50           ` Benjamin LaHaise
2002-09-03 20:02             ` Daniel Phillips
2002-09-03 20:04               ` Benjamin LaHaise
2002-09-03 20:19                 ` Daniel Phillips
2002-09-03 20:25                 ` Daniel Phillips
2002-09-03 20:05               ` Thunder from the hill
2002-09-03 20:19                 ` Daniel Phillips
2002-12-03  0:05           ` H. Peter Anvin
     [not found] <15732.34929.657481.777572@notabene.cse.unsw.edu.au.suse.lists.linux.kernel>
     [not found] ` <Pine.LNX.4.44.0209030900410.1997-100000@home.transmeta.com.suse.lists.linux.kernel>
2002-09-03 16:23   ` Andi Kleen
2002-09-03  8:19     ` Linus Torvalds
2002-09-03 16:43       ` Nikita Danilov
2002-09-03  8:45         ` Linus Torvalds
2002-12-03  0:06       ` H. Peter Anvin
2002-12-05 10:58         ` Pavel Machek
2002-12-05 21:15           ` H. Peter Anvin
     [not found] <825516963@toto.iv>
     [not found] ` <15734.37217.686498.162782@wombat.chubb.wattle.id.au>
2002-09-05  0:04   ` Benjamin LaHaise
2002-09-05  0:38     ` Daniel Phillips
2002-09-05  1:31       ` Benjamin LaHaise
2002-09-05  4:05         ` Daniel Phillips
     [not found] <fa.l4d1mqv.1ghm1h2@ifi.uio.no>
     [not found] ` <fa.j8nq6dv.14lihor@ifi.uio.no>
2002-12-03  8:45   ` Giacomo Catenazzi
2002-12-03 17:40     ` H. Peter Anvin
2002-12-03 17:48       ` Giacomo Catenazzi

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=20020823070759.GS19435@clusterfs.com \
    --to=adilger@clusterfs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@chubb.wattle.id.au \
    --cc=torvalds@transmeta.com \
    /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;
as well as URLs for NNTP newsgroup(s).