linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Colin Cross <ccross@android.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>,
	"open list:FUSE: FILESYSTEM..."
	<fuse-devel@lists.sourceforge.net>,
	"Arve Hjønnevåg" <arve@android.com>
Subject: Re: [PATCH] fuse: use kernel headers when __KERNEL__ is set
Date: Wed, 17 Apr 2013 12:45:06 -0700	[thread overview]
Message-ID: <CAMbhsRTwRSW_c5xSMC4Xk3aQFDoqXpcfspxoqOPiUmfPwNa1EQ@mail.gmail.com> (raw)
In-Reply-To: <20130417095728.GA20829@tucsk.piliscsaba.szeredi.hu>

On Wed, Apr 17, 2013 at 2:57 AM, Miklos Szeredi <miklos@szeredi.hu> wrote:
> On Tue, Apr 16, 2013 at 01:00:37PM -0700, Colin Cross wrote:
>
>> Every other uapi header includes linux/types.h to get its type
>> definitions, and fuse.h should do the same when compiling for
>> userspace targeting linux
>
> Not necessarily.
>
> Here's a patch (largish but only search&replace) that should fix all the issues
> and actually removes a hack instead of adding more.
>
> Thanks,
> Miklos
> ----
>
> From: Miklos Szeredi <mszeredi@suse.cz>
> Subject: fuse: fix type definitions in uapi header
>
> Commit 7e98d53086d18c877cb44e9065219335184024de (Synchronize fuse
> header with one used in library) added #ifdef __linux__ around
> defines if it is not set.  The kernel build is self-contained and
> can be built on non-Linux toolchains.  After the mentioned commit
> builds on non-Linux toolchains will try to include stdint.h and
> fail due to -nostdinc, and then fail with a bunch of undefined
> type errors.
>
> Fix by checking for __KERNEL__ instead of __linux__ and using the standard int
> types instead of the linux specific ones.
>
> Reported-by: Arve Hjønnevåg <arve@android.com>
> Reported-by: Colin Cross <ccross@android.com>
> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>

This fixes my build issue, and doesn't introduce a new make
headers_check warning so you can add my Tested-by: Colin Cross
<ccross@android.com>

I still like my patch better though.  This patch results in different
typedefs being used when compiling in userspace vs. kernel, so you're
trusting that the host stdint.h matches the kernel's definitions.  In
practice I don't see how they would differ, so I guess its up to you.
If it were up to me, I would use linux/types.h for kernel and linux
userspace, and maybe replace the #defines with typedefs for non-linux
userspace builds.

  reply	other threads:[~2013-04-17 19:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 20:41 [PATCH] fuse: use kernel headers when __KERNEL__ is set Colin Cross
2013-04-15 21:47 ` Colin Cross
2013-04-16 14:21   ` Miklos Szeredi
2013-04-16 15:59     ` Linus Torvalds
2013-04-16 17:24       ` Miklos Szeredi
2013-04-16 18:21         ` Linus Torvalds
2013-04-16 18:29           ` Colin Cross
2013-04-16 19:11             ` Miklos Szeredi
2013-04-16 20:00               ` Colin Cross
2013-04-17  9:57                 ` Miklos Szeredi
2013-04-17 19:45                   ` Colin Cross [this message]
2013-04-17 20:59                     ` Miklos Szeredi

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=CAMbhsRTwRSW_c5xSMC4Xk3aQFDoqXpcfspxoqOPiUmfPwNa1EQ@mail.gmail.com \
    --to=ccross@android.com \
    --cc=arve@android.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=torvalds@linux-foundation.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 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).