mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Giarrusso <blaisorblade_personal@yahoo.it>
To: Andrew Morton <akpm@osdl.org>
Cc: Alasdair G Kergon <agk@redhat.com>,
	linux-kernel@vger.kernel.org, neilb@cse.unsw.edu.au
Subject: Re: [patch 1/1] dm: fix printk warnings about whether %lu/%Lu is right for sector_t
Date: Thu, 21 Oct 2004 17:27:04 +0200	[thread overview]
Message-ID: <200410211727.04286.blaisorblade_personal@yahoo.it> (raw)
In-Reply-To: <20041019155258.75f35416.akpm@osdl.org>

On Wednesday 20 October 2004 00:52, Andrew Morton wrote:
> Alasdair G Kergon <agk@redhat.com> wrote:
> > On Fri, Oct 08, 2004 at 12:12:39PM -0700, Andrew Morton wrote:
> >  > I would prefer that SECTOR_FORMAT be removed altogether.
> >  >
> >  > The industry-standard way of printing a sector_t is:
> >  > 	printk("%llu", (unsigned long long)sector);
> >
> >  What about reading a sector_t with sscanf, which looks like the
> >  reason for the existence of SECTOR_FORMAT?
>
> I'm not sure that it has arisen.  I'd do:

> 	unsigned long long temp;
> 	sector_t sector;
>
> 	sscanf(buf, "%llu", &temp);
> 	sector = temp;

It is already meaningless, IMHO, in this short example. But when you have such 
code:

        if (sscanf(argv[2], SECTOR_FORMAT, &cc->iv_offset) != 1) {
                ti->error = PFX "Invalid iv_offset sector";
                goto bad4;
        }

        if (sscanf(argv[4], SECTOR_FORMAT, &cc->start) != 1) {
                ti->error = PFX "Invalid device sector";
                goto bad4;
        }

it becomes even uglier.

Why cannot we simply define the macro in linux/types.h and go along? There is 
no reason at all for arch-dependent definition of this macro; we can handle 
CONFIG_LBD in arch-independent code. In fact, it's what I'm doing.

I'm resending the patch, removing altogether HAVE_SECTOR_T and anything in 
arch-code referring to that. For h8300, I'm unconditionally defining 
CONFIG_LBD in Kconfig.

An even better road would would be to use always a "unsigned long long" for 
64-bit sector_t even on 64-bit archs.

Is there any reason for having u/s64 being "(unsigned) long" instead of 
"(unsigned) long long"? I.e., must we cope with braindead gcc? If not, this 
should be fixed, to avoid even other such problems.

Bye
-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729

      reply	other threads:[~2004-10-21 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-08 14:40 blaisorblade_spam
2004-10-08 19:12 ` Andrew Morton
2004-10-08 20:11   ` Anton Altaparmakov
2004-10-08 20:45     ` Paolo Giarrusso
2004-10-08 21:57       ` Anton Altaparmakov
2004-10-09  0:04         ` BlaisorBlade
2004-10-09  6:38           ` Anton Altaparmakov
2004-10-19 17:41   ` Alasdair G Kergon
2004-10-19 22:52     ` Andrew Morton
2004-10-21 15:27       ` Paolo Giarrusso [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=200410211727.04286.blaisorblade_personal@yahoo.it \
    --to=blaisorblade_personal@yahoo.it \
    --cc=agk@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    /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®