All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Jes.Sorensen@redhat.com
Cc: neilb@suse.de, linux-raid@vger.kernel.org, ralf@linux-mips.org
Subject: Re: [PATCH 1/1] Work around architectures having statfs.f_type defined as long
Date: Wed, 19 Mar 2014 21:43:37 +0100	[thread overview]
Message-ID: <201403192143.37675.arnd@arndb.de> (raw)
In-Reply-To: <1395235562-24672-2-git-send-email-Jes.Sorensen@redhat.com>

On Wednesday 19 March 2014, Jes.Sorensen@redhat.com wrote:
> @@ -1946,9 +1946,13 @@ int in_initrd(void)
>  {
>         /* This is based on similar function in systemd. */
>         struct statfs s;
> +       /* statfs.f_type is signed long on s390x and MIPS, causing all
> +          sorts of sign extension problems with RAMFS_MAGIC being
> +          defined as 0x858458f6 */
>         return  statfs("/", &s) >= 0 &&
>                 ((unsigned long)s.f_type == TMPFS_MAGIC ||
> -                (unsigned long)s.f_type == RAMFS_MAGIC);
> +                ((unsigned long)s.f_type & 0xFFFFFFFFUL) ==
> +                ((unsigned long)RAMFS_MAGIC & 0xFFFFFFFFUL));

The comment is wrong: on s390x the type is actually 'unsigned int'.
The fix however works on all variants as far as I can tell.

Thinking about it a bit more, I guess we can also cast both
sides to 'unsigned int' for the same effect and get rid of
the mask.

	Arnd

  reply	other threads:[~2014-03-19 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 13:26 [PATCH 0/1] Work around systems defining statfs.f_type as long Jes.Sorensen
2014-03-19 13:26 ` [PATCH 1/1] Work around architectures having statfs.f_type defined " Jes.Sorensen
2014-03-19 20:43   ` Arnd Bergmann [this message]
2014-03-19 22:24   ` NeilBrown

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=201403192143.37675.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Jes.Sorensen@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=ralf@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.