public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: david.vrabel@citrix•com (David Vrabel)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v4 75/79] include/uapi/xen/privcmd.h: fix compilation in userspace
Date: Thu, 15 Oct 2015 12:24:39 +0100	[thread overview]
Message-ID: <561F8CF7.9070102@citrix.com> (raw)
In-Reply-To: <20151015111801.GW6104@lakka.kapsi.fi>

On 15/10/15 12:18, Mikko Rapeli wrote:
> On Thu, Oct 15, 2015 at 11:29:12AM +0100, David Vrabel wrote:
>> On 15/10/15 06:56, Mikko Rapeli wrote:
>>> xen/interface/xen.h is not exported from kernel headers so remove the
>>> dependency and provide needed defines for domid_t and xen_pfn_t if they
>>> are not already defined by some other e.g. Xen specific headers.
>>>
>>> Suggested by Andrew Cooper <andrew.cooper3@citrix•com> on lkml message
>>> <5569F9C9.8000607@citrix•com>.
>>>
>>> The ifdef for ARM is ugly but did not find better solutions for it.
>>>
>>> Fixes userspace compilation error:
>>>
>>> xen/privcmd.h:38:31: fatal error: xen/interface/xen.h: No such file or directory
>> [...]
>>> --- a/include/uapi/xen/privcmd.h
>>> +++ b/include/uapi/xen/privcmd.h
>>> @@ -35,7 +35,19 @@
>>>  
>>>  #include <linux/types.h>
>>>  #include <linux/compiler.h>
>>> -#include <xen/interface/xen.h>
>>> +
>>> +/* Might be defined by Xen specific headers, but if not */
>>> +#ifndef domid_t
>>> +typedef __u16 domid_t;
>>> +#endif /* domid_t */
>>
>> As the kbuild bot points out, this does not work since the existence of
>> a typedef cannot be checked with #ifdef.
> 
> Yeah, this hack doesn't cut it. Sorry. Tried to implement these changes:
> http://www.spinics.net/lists/linux-api/msg11048.html
> 
>> I'm not really sure what problem you're trying to solve.  A user space
>> program making use of this interface gets the domid_t and xen_pfn_t etc
>> typedefs from the headers provided as part of the libxenctrl library.
> 
> I'm trying to make sure that kernel headers in userspace compile with minimal
> dependencies which are gcc and libc.
> 
> For me it is clear by now that many Linux API's and ABI's like Xen parts do
> not live in the uapi header files and instead there's a separate userspace
> library with needed headers and defines which have embedded copies of
> the needed API and ABI definitions, like header files.
> 
> So how could this file be changed so that it compiles in userspace without
> definitions from libxenctrl?

I don't think anything needs to be changed.

Instead I would make your compilation check of this header dependent on
the existence of the xen/interface/xen.h header. Or you may exclude the
check of this header entirely.

> I guess I could copy the needed definitions for domid_t and xen_pfn_t from
> xen/interface/xen.h of libxenctrl. That I should have done to begin with
> instead of trying to hack something on my own.

I do not want definitions duplicated/copied from the hypervisor ABI
headers.  This causes problems when support for new architectures is
added (for example).

David

  reply	other threads:[~2015-10-15 11:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1444888618-4506-1-git-send-email-mikko.rapeli@iki.fi>
2015-10-15  5:55 ` [PATCH v4 05/79] exynos_drm.h: use __u64 from linux/types.h Mikko Rapeli
2015-10-15 16:17   ` Gustavo Padovan
2015-10-15  5:56 ` [PATCH v4 75/79] include/uapi/xen/privcmd.h: fix compilation in userspace Mikko Rapeli
2015-10-15 10:07   ` kbuild test robot
2015-10-15 10:29   ` David Vrabel
2015-10-15 11:18     ` Mikko Rapeli
2015-10-15 11:24       ` David Vrabel [this message]
2015-10-15 11:35         ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 79/79] arch/arm/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli

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=561F8CF7.9070102@citrix.com \
    --to=david.vrabel@citrix$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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