Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1467924 > unrolled thread

[PATCH v05 00/72] Userspace compile test and fixes for exported uapi header files

Started byMikko Rapeli <mikko.rapeli@iki.fi>
First post2016-08-22 20:50 +0200
Last post2016-08-22 21:50 +0200
Articles 20 on this page of 87 — 11 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v05 00/72] Userspace compile test and fixes for exported uapi header files Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 31/72] include/uapi/linux/mroute.h: include linux/in.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 31/72] include/uapi/linux/mroute.h: include  linux/in.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 18/72] include/uapi/asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ definition to hdlc/ioctl.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ  definition to hdlc/ioctl.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
        Re: [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ  definition to hdlc/ioctl.h David Miller <davem@davemloft.net> - 2016-08-23 09:10 +0200
          Re: [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ  definition to hdlc/ioctl.h Frans Klaver <fransklaver@gmail.com> - 2016-08-23 10:10 +0200
            Re: [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ  definition to hdlc/ioctl.h Frans Klaver <fransklaver@gmail.com> - 2016-08-24 09:00 +0200
        Re: [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ  definition to hdlc/ioctl.h Frans Klaver <fransklaver@gmail.com> - 2016-08-23 09:20 +0200
    [PATCH v05 26/72] include/uapi/linux/if_pppox.h: include linux/in.h and linux/in6.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 26/72] include/uapi/linux/if_pppox.h: include  linux/in.h and linux/in6.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 17/72] asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 41/72] include/uapi/linux/atm_zatm.h: include linux/time.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 41/72] include/uapi/linux/atm_zatm.h: include  linux/time.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 37/72] include/uapi/linux/auto_fs.h: include linux/limits.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 37/72] include/uapi/linux/auto_fs.h: include  linux/limits.h Ian Kent <raven@themaw.net> - 2016-08-23 02:50 +0200
    [PATCH v05 30/72] include/uapi/linux/mqueue.h: include linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 05/72] hsi_char.h: use __u32 from linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 05/72] hsi_char.h: use __u32 from linux/types.h Sebastian Reichel <sre@kernel.org> - 2016-08-22 23:00 +0200
    [PATCH v05 13/72] include/uapi/linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 39/72] include/uapi/linux/target_core_user.h: use __u8, __u16, __u32 and __u64 from linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 32/72] include/uapi/linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 33/72] include/uapi/linux/ip6_tunnel.h: include linux/if.h and linux/in6.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 28/72] include/uapi/linux/packet_diag.h: include linux/netdevice.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 36/72] arch/x86/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32  from linux/types.h Stephen Hemminger <stephen@networkplumber.org> - 2016-08-22 21:40 +0200
        Re: [PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32  from linux/types.h David Miller <davem@davemloft.net> - 2016-08-23 01:30 +0200
        Re: [PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32  from linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-23 09:00 +0200
      Re: [PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32  from linux/types.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 43/72] include/uapi/linux/btrfs.h: define NULL Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 06/72] include/uapi/linux/hsi/cs-protocol.h: include linux/time.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
      Re: [PATCH v05 06/72] include/uapi/linux/hsi/cs-protocol.h: include  linux/time.h Sebastian Reichel <sre@kernel.org> - 2016-08-22 23:00 +0200
        Re: [PATCH v05 06/72] include/uapi/linux/hsi/cs-protocol.h: include  linux/time.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-23 09:00 +0200
    [PATCH v05 02/72] scripts/headers_compile_test.sh: compile test script for exported headers Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:50 +0200
    [PATCH v05 62/72] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:00 +0200
      Re: [PATCH v05 62/72] include/uapi/linux/openvswitch.h: use __u32  from linux/types.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 72/72] uapi route.h: glibc net/route.h compat fix Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:00 +0200
      Re: [PATCH v05 72/72] uapi route.h: glibc net/route.h compat fix David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
        Re: [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header  file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-23 23:30 +0200
          Re: [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header  file compatibility fixes David Miller <davem@davemloft.net> - 2016-08-24 01:50 +0200
    [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:00 +0200
      Re: [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header  file compatibility fixes David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
      Re: [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header  file compatibility fixes David Miller <davem@davemloft.net> - 2016-08-24 01:50 +0200
    [PATCH v05 55/72] include/uapi/xen/gntdev.h: include xen/privcmd.h and define grant_ref_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:00 +0200
    [PATCH v05 21/72] include/uapi/linux/if_pppox.h: include linux/if.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:10 +0200
      Re: [PATCH v05 21/72] include/uapi/linux/if_pppox.h: include  linux/if.h Stephen Hemminger <stephen@networkplumber.org> - 2016-08-22 21:40 +0200
        Re: [PATCH v05 21/72] include/uapi/linux/if_pppox.h: include  linux/if.h David Miller <davem@davemloft.net> - 2016-08-23 01:30 +0200
        Re: [PATCH v05 21/72] include/uapi/linux/if_pppox.h: include  linux/if.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-23 08:50 +0200
      Re: [PATCH v05 21/72] include/uapi/linux/if_pppox.h: include  linux/if.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 57/72] coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:10 +0200
    [PATCH v05 65/72] uapi fcntl.h: glibc fcntl.h header file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:10 +0200
    [PATCH v05 23/72] include/uapi/linux/ipv6_route.h: include linux/in6.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:20 +0200
      Re: [PATCH v05 23/72] include/uapi/linux/ipv6_route.h: include  linux/in6.h David Miller <davem@davemloft.net> - 2016-08-23 01:30 +0200
    [PATCH v05 19/72] include/uapi/linux/socket.h: include sys/socket.h in userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:20 +0200
    [PATCH v05 60/72] arch/arm/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:20 +0200
      Re: [PATCH v05 60/72] arch/arm/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Arnd Bergmann <arnd@arndb.de> - 2016-08-24 17:10 +0200
    [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:20 +0200
    [PATCH v05 52/72] include/linux/sdb.h: use linux/types.h types instead of stdint.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:20 +0200
    [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:20 +0200
      Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in  userspace Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-08-23 12:10 +0200
        Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation  in userspace Stefano Stabellini <sstabellini@kernel.org> - 2016-08-23 20:20 +0200
          Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in  userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-23 22:40 +0200
            Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation  in userspace Stefano Stabellini <sstabellini@kernel.org> - 2016-08-23 23:20 +0200
    [PATCH v05 24/72] include/uapi/linux/ipv6_route.h: include linux/in6.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
    [PATCH v05 56/72] include/uapi/xen/evtchn.h: include xen/privcmd.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
    [PATCH v05 63/72] include/uapi/sound/Kbuild: remove sound/asoc.h from userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
    [PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
      Re: [PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting  defitions with glibc netipx/ipx.h David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 20/72] include/uapi/linux/rds.h: include linux/socket.h and linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
    [PATCH v05 58/72] include/uapi/linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
    [PATCH v05 70/72] uapi time.h: glibc time.h header file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
    [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
      Re: [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header  file compatibility fixes David Miller <davem@davemloft.net> - 2016-08-23 01:40 +0200
    [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
      Re: [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h  also in userspace Miklos Szeredi <miklos@szeredi.hu> - 2016-08-23 09:20 +0200
        Re: [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h  also in userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-23 09:50 +0200
    [PATCH v05 67/72] uapi uio.h: glibc sys/uio.h header file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:30 +0200
    [PATCH v05 59/72] include/uapi/linux/errqueue.h: include time.h in userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:40 +0200
    [PATCH v05 53/72] include/linux/xz.h: use linux/types.h types instead of stdint.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:40 +0200
    [PATCH v05 61/72] include/uapi/rdma/rdma_user_rxe.h: include in.h and in6.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:40 +0200
      Re: [PATCH v05 61/72] include/uapi/rdma/rdma_user_rxe.h: include in.h  and in6.h Doug Ledford <dledford@redhat.com> - 2016-08-23 17:10 +0200
    [PATCH v05 71/72] uapi term*.h: glibc termios.h header file compatibility fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:50 +0200
    [PATCH v05 22/72] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:50 +0200
      Re: [PATCH v05 22/72] include/uapi/linux/if_tunnel.h: include  linux/if.h, linux/ip.h and linux/in6.h David Miller <davem@davemloft.net> - 2016-08-23 01:30 +0200
    [PATCH v05 51/72] include/linux/ipmi-fru.h: use linux/types.h instead of stdint.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 21:50 +0200

Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →


#1467978 — [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:20 +0200
Subject[PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace
Message-ID<s92Vk-1VN-41@gated-at.bofh.it>
In reply to#1467924
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

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: David Vrabel <david.vrabel@citrix.com>
---
 arch/arm/include/asm/xen/interface.h |  2 +-
 include/uapi/xen/privcmd.h           | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
index 75d5968..6898ee1 100644
--- a/arch/arm/include/asm/xen/interface.h
+++ b/arch/arm/include/asm/xen/interface.h
@@ -38,7 +38,7 @@
  * fine since it simply wouldn't be able to create any sure pfns in
  * the first place.
  */
-typedef uint64_t xen_pfn_t;
+typedef __u64 xen_pfn_t;
 #define PRI_xen_pfn "llx"
 typedef uint64_t xen_ulong_t;
 #define PRI_xen_ulong "llx"
diff --git a/include/uapi/xen/privcmd.h b/include/uapi/xen/privcmd.h
index 7ddeeda..16c11f9 100644
--- a/include/uapi/xen/privcmd.h
+++ b/include/uapi/xen/privcmd.h
@@ -35,7 +35,17 @@
 
 #include <linux/types.h>
 #include <linux/compiler.h>
-#include <xen/interface/xen.h>
+
+/* Defined by include/xen/interface/xen.h, but it is not part of Linux uapi */
+#ifndef __XEN_PUBLIC_XEN_H__
+typedef __u16 domid_t;
+
+#if (defined __ARMEL__ || defined __ARMEB__)
+typedef __u64 xen_pfn_t;
+#else
+typedef unsigned long xen_pfn_t;
+#endif /* (defined __ARMEL__ || defined __ARMEB__) */
+#endif /* __XEN_PUBLIC_XEN_H__ */
 
 struct privcmd_hypercall {
 	__u64 op;
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1468457 — Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace

FromRussell King - ARM Linux <linux@armlinux.org.uk>
Date2016-08-23 12:10 +0200
SubjectRe: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace
Message-ID<s9gOB-2tc-13@gated-at.bofh.it>
In reply to#1467978
On Mon, Aug 22, 2016 at 08:33:11PM +0200, 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.

I'm confused.  How did we end up with a 64-bit PFN number on ARM?  It's
insane - especially as the kernel uses "unsigned long" almost everywhere
for PFNs - we can't have physical addresses more than 44 bits (32 bit
pfn + 4k page size).

> 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.

#ifdef __arm__

maybe?  Even if not, the unsightly parens are not necessary.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

[toc] | [prev] | [next] | [standalone]


#1468761 — Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-08-23 20:20 +0200
SubjectRe: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace
Message-ID<s9osN-7zz-13@gated-at.bofh.it>
In reply to#1468457
On Tue, 23 Aug 2016, Russell King - ARM Linux wrote:
> On Mon, Aug 22, 2016 at 08:33:11PM +0200, 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.
> 
> I'm confused.  How did we end up with a 64-bit PFN number on ARM?  It's
> insane - especially as the kernel uses "unsigned long" almost everywhere
> for PFNs - we can't have physical addresses more than 44 bits (32 bit
> pfn + 4k page size).

That's because xen_pfn_t is the type used to store pfns in structures
passed to Xen via hypercalls. The Xen hypercall ABI is shared between
ARM and ARM64. On x86_32 and x86_64 we have different sizes for pfn
types in the hypercall ABI and it caused quite a bit of trouble in the
past as it is possible to run 32bit domains on a 64bit hypervisor.
Having a common type for pfns on ARM and ARM64 helped a lot in that
respect.


> > 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.
> 
> #ifdef __arm__
> 
> maybe?  Even if not, the unsightly parens are not necessary.

Yes, I think it should be:

#if defined(__arm__) || defined(__aarch64__)


> diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
> index 75d5968..6898ee1 100644
> --- a/arch/arm/include/asm/xen/interface.h
> +++ b/arch/arm/include/asm/xen/interface.h
> @@ -38,7 +38,7 @@
>   * fine since it simply wouldn't be able to create any sure pfns in
>   * the first place.
>   */
> -typedef uint64_t xen_pfn_t;
> +typedef __u64 xen_pfn_t;
>  #define PRI_xen_pfn "llx"
>  typedef uint64_t xen_ulong_t;
>  #define PRI_xen_ulong "llx"

Why this change?

[toc] | [prev] | [next] | [standalone]


#1468827 — Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-23 22:40 +0200
SubjectRe: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace
Message-ID<s9qEh-zs-17@gated-at.bofh.it>
In reply to#1468761
On Tue, Aug 23, 2016 at 11:13:52AM -0700, Stefano Stabellini wrote:
> On Tue, 23 Aug 2016, Russell King - ARM Linux wrote:
> > On Mon, Aug 22, 2016 at 08:33:11PM +0200, 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.
> > 
> > I'm confused.  How did we end up with a 64-bit PFN number on ARM?  It's
> > insane - especially as the kernel uses "unsigned long" almost everywhere
> > for PFNs - we can't have physical addresses more than 44 bits (32 bit
> > pfn + 4k page size).
> 
> That's because xen_pfn_t is the type used to store pfns in structures
> passed to Xen via hypercalls. The Xen hypercall ABI is shared between
> ARM and ARM64. On x86_32 and x86_64 we have different sizes for pfn
> types in the hypercall ABI and it caused quite a bit of trouble in the
> past as it is possible to run 32bit domains on a 64bit hypervisor.
> Having a common type for pfns on ARM and ARM64 helped a lot in that
> respect.
> 
> 
> > > 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.
> > 
> > #ifdef __arm__
> > 
> > maybe?  Even if not, the unsightly parens are not necessary.
> 
> Yes, I think it should be:
> 
> #if defined(__arm__) || defined(__aarch64__)

Thanks, I will send a new version with this change.
 
> > diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
> > index 75d5968..6898ee1 100644
> > --- a/arch/arm/include/asm/xen/interface.h
> > +++ b/arch/arm/include/asm/xen/interface.h
> > @@ -38,7 +38,7 @@
> >   * fine since it simply wouldn't be able to create any sure pfns in
> >   * the first place.
> >   */
> > -typedef uint64_t xen_pfn_t;
> > +typedef __u64 xen_pfn_t;
> >  #define PRI_xen_pfn "llx"
> >  typedef uint64_t xen_ulong_t;
> >  #define PRI_xen_ulong "llx"
> 
> Why this change?

I will double check but I think the other fix exposed then the common
"<stdint.h> definitions not available in userspace <linux/types.h>" and this
was needed to please the compiler. If so, I'll add this to commit message.

If you would prefer to include libc's <stdint.h> in userspace, well, join the
club. drm and fuse maintainers want the same but my patches with those fixes got
rejected in the past. Example: https://lkml.org/lkml/2015/6/1/160

-Mikko

[toc] | [prev] | [next] | [standalone]


#1468872 — Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-08-23 23:20 +0200
SubjectRe: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace
Message-ID<s9rh0-140-25@gated-at.bofh.it>
In reply to#1468827
On Tue, 23 Aug 2016, Mikko Rapeli wrote:
> On Tue, Aug 23, 2016 at 11:13:52AM -0700, Stefano Stabellini wrote:
> > On Tue, 23 Aug 2016, Russell King - ARM Linux wrote:
> > > On Mon, Aug 22, 2016 at 08:33:11PM +0200, 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.
> > > 
> > > I'm confused.  How did we end up with a 64-bit PFN number on ARM?  It's
> > > insane - especially as the kernel uses "unsigned long" almost everywhere
> > > for PFNs - we can't have physical addresses more than 44 bits (32 bit
> > > pfn + 4k page size).
> > 
> > That's because xen_pfn_t is the type used to store pfns in structures
> > passed to Xen via hypercalls. The Xen hypercall ABI is shared between
> > ARM and ARM64. On x86_32 and x86_64 we have different sizes for pfn
> > types in the hypercall ABI and it caused quite a bit of trouble in the
> > past as it is possible to run 32bit domains on a 64bit hypervisor.
> > Having a common type for pfns on ARM and ARM64 helped a lot in that
> > respect.
> > 
> > 
> > > > 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.
> > > 
> > > #ifdef __arm__
> > > 
> > > maybe?  Even if not, the unsightly parens are not necessary.
> > 
> > Yes, I think it should be:
> > 
> > #if defined(__arm__) || defined(__aarch64__)
> 
> Thanks, I will send a new version with this change.
>  
> > > diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
> > > index 75d5968..6898ee1 100644
> > > --- a/arch/arm/include/asm/xen/interface.h
> > > +++ b/arch/arm/include/asm/xen/interface.h
> > > @@ -38,7 +38,7 @@
> > >   * fine since it simply wouldn't be able to create any sure pfns in
> > >   * the first place.
> > >   */
> > > -typedef uint64_t xen_pfn_t;
> > > +typedef __u64 xen_pfn_t;
> > >  #define PRI_xen_pfn "llx"
> > >  typedef uint64_t xen_ulong_t;
> > >  #define PRI_xen_ulong "llx"
> > 
> > Why this change?
> 
> I will double check but I think the other fix exposed then the common
> "<stdint.h> definitions not available in userspace <linux/types.h>" and this
> was needed to please the compiler. If so, I'll add this to commit message.

That would be strange, because I don't think
arch/arm/include/asm/xen/interface.h is exposed to userspace. If it
was, we would need to replace the other definitions there too.

[toc] | [prev] | [next] | [standalone]


#1467979 — [PATCH v05 24/72] include/uapi/linux/ipv6_route.h: include linux/in6.h

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 24/72] include/uapi/linux/ipv6_route.h: include linux/in6.h
Message-ID<s934Z-22o-1@gated-at.bofh.it>
In reply to#1467924
Fixes userspace compile errors like:

error: field ‘rtmsg_dst’ has incomplete type
  struct in6_addr  rtmsg_dst;

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/ipv6_route.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/ipv6_route.h b/include/uapi/linux/ipv6_route.h
index f6598d1..25ab362 100644
--- a/include/uapi/linux/ipv6_route.h
+++ b/include/uapi/linux/ipv6_route.h
@@ -14,6 +14,7 @@
 #define _UAPI_LINUX_IPV6_ROUTE_H
 
 #include <linux/types.h>
+#include <linux/in6.h>
 
 #define RTF_DEFAULT	0x00010000	/* default - learned via ND	*/
 #define RTF_ALLONLINK	0x00020000	/* (deprecated and will be removed)
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1467980 — [PATCH v05 56/72] include/uapi/xen/evtchn.h: include xen/privcmd.h

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 56/72] include/uapi/xen/evtchn.h: include xen/privcmd.h
Message-ID<s934Z-22o-7@gated-at.bofh.it>
In reply to#1467924
It has definition of domid_t. Fixes userspace compiler error when
xen/privcmd.h is compiled alone:

xen/evtchn.h:100:2: error: unknown type name ‘domid_t’
  domid_t domid;
  ^~~~~~~

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/xen/evtchn.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/xen/evtchn.h b/include/uapi/xen/evtchn.h
index cb4aa4b..81df4b3 100644
--- a/include/uapi/xen/evtchn.h
+++ b/include/uapi/xen/evtchn.h
@@ -33,6 +33,8 @@
 #ifndef __LINUX_PUBLIC_EVTCHN_H__
 #define __LINUX_PUBLIC_EVTCHN_H__
 
+#include <xen/privcmd.h>
+
 /*
  * Bind a fresh port to VIRQ @virq.
  * Return allocated port.
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1467982 — [PATCH v05 63/72] include/uapi/sound/Kbuild: remove sound/asoc.h from userspace

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 63/72] include/uapi/sound/Kbuild: remove sound/asoc.h from userspace
Message-ID<s934Z-22o-9@gated-at.bofh.it>
In reply to#1467924
Based on git commit messages and the #error macro messages it should not be
used in userspace. Fixes userspace compile errors:

sound/asoc.h:21:2: error: #error This API is an early revision and not enabled
 in the current
 #error This API is an early revision and not enabled in the current
  ^~~~~
sound/asoc.h:22:2: error: #error kernel release, it will be enabled in a futur
e kernel version
 #error kernel release, it will be enabled in a future kernel version
  ^~~~~
sound/asoc.h:23:2: error: #error with incompatible changes to what is here.
 #error with incompatible changes to what is here.
  ^~~~~

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/sound/Kbuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/uapi/sound/Kbuild b/include/uapi/sound/Kbuild
index 691984c..6d8b203 100644
--- a/include/uapi/sound/Kbuild
+++ b/include/uapi/sound/Kbuild
@@ -1,6 +1,5 @@
 # UAPI Header export list
 header-y += asequencer.h
-header-y += asoc.h
 header-y += asound.h
 header-y += asound_fm.h
 header-y += compress_offload.h
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1467984 — [PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h
Message-ID<s9350-22o-17@gated-at.bofh.it>
In reply to#1467924
Fixes these compiler warnings via libc-compat.h when glibc netipx/ipx.h is
included before linux/ipx.h:

./linux/ipx.h:9:8: error: redefinition of ‘struct sockaddr_ipx’
./linux/ipx.h:26:8: error: redefinition of ‘struct ipx_route_definition’
./linux/ipx.h:32:8: error: redefinition of ‘struct ipx_interface_definition’
./linux/ipx.h:49:8: error: redefinition of ‘struct ipx_config_data’
./linux/ipx.h:58:8: error: redefinition of ‘struct ipx_route_def’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/ipx.h         | 13 ++++++++++++-
 include/uapi/linux/libc-compat.h | 26 ++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/ipx.h b/include/uapi/linux/ipx.h
index 3d48014..30f031d 100644
--- a/include/uapi/linux/ipx.h
+++ b/include/uapi/linux/ipx.h
@@ -1,11 +1,13 @@
 #ifndef _IPX_H_
 #define _IPX_H_
+#include <linux/libc-compat.h>	/* for compatibility with glibc netipx/ipx.h */
 #include <linux/types.h>
 #include <linux/sockios.h>
 #include <linux/socket.h>
 #define IPX_NODE_LEN	6
 #define IPX_MTU		576
 
+#if __UAPI_DEF_SOCKADDR_IPX
 struct sockaddr_ipx {
 	__kernel_sa_family_t sipx_family;
 	__be16		sipx_port;
@@ -14,6 +16,7 @@ struct sockaddr_ipx {
 	__u8		sipx_type;
 	unsigned char	sipx_zero;	/* 16 byte fill */
 };
+#endif /* __UAPI_DEF_SOCKADDR_IPX */
 
 /*
  * So we can fit the extra info for SIOCSIFADDR into the address nicely
@@ -23,12 +26,15 @@ struct sockaddr_ipx {
 #define IPX_DLTITF	0
 #define IPX_CRTITF	1
 
+#if __UAPI_DEF_IPX_ROUTE_DEFINITION
 struct ipx_route_definition {
 	__be32        ipx_network;
 	__be32        ipx_router_network;
 	unsigned char ipx_router_node[IPX_NODE_LEN];
 };
+#endif /* __UAPI_DEF_IPX_ROUTE_DEFINITION */
 
+#if __UAPI_DEF_IPX_INTERFACE_DEFINITION
 struct ipx_interface_definition {
 	__be32        ipx_network;
 	unsigned char ipx_device[16];
@@ -45,16 +51,20 @@ struct ipx_interface_definition {
 #define IPX_INTERNAL		2
 	unsigned char ipx_node[IPX_NODE_LEN];
 };
-	
+#endif /* __UAPI_DEF_IPX_INTERFACE_DEFINITION */
+
+#if __UAPI_DEF_IPX_CONFIG_DATA
 struct ipx_config_data {
 	unsigned char	ipxcfg_auto_select_primary;
 	unsigned char	ipxcfg_auto_create_interfaces;
 };
+#endif /* __UAPI_DEF_IPX_CONFIG_DATA */
 
 /*
  * OLD Route Definition for backward compatibility.
  */
 
+#if __UAPI_DEF_IPX_ROUTE_DEF
 struct ipx_route_def {
 	__be32		ipx_network;
 	__be32		ipx_router_network;
@@ -67,6 +77,7 @@ struct ipx_route_def {
 #define IPX_RT_BLUEBOOK		2
 #define IPX_RT_ROUTED		1
 };
+#endif /* __UAPI_DEF_IPX_ROUTE_DEF */
 
 #define SIOCAIPXITFCRT		(SIOCPROTOPRIVATE)
 #define SIOCAIPXPRISLT		(SIOCPROTOPRIVATE + 1)
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index e4f048e..44b8a6b 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -139,6 +139,25 @@
 
 #endif /* _NETINET_IN_H */
 
+/* Coordinate with glibc netipx/ipx.h header. */
+#if defined(__NETIPX_IPX_H)
+
+#define __UAPI_DEF_SOCKADDR_IPX			0
+#define __UAPI_DEF_IPX_ROUTE_DEFINITION		0
+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION	0
+#define __UAPI_DEF_IPX_CONFIG_DATA		0
+#define __UAPI_DEF_IPX_ROUTE_DEF		0
+
+#else /* defined(__NETIPX_IPX_H) */
+
+#define __UAPI_DEF_SOCKADDR_IPX			1
+#define __UAPI_DEF_IPX_ROUTE_DEFINITION		1
+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION	1
+#define __UAPI_DEF_IPX_CONFIG_DATA		1
+#define __UAPI_DEF_IPX_ROUTE_DEF		1
+
+#endif /* defined(__NETIPX_IPX_H) */
+
 /* Definitions for xattr.h */
 #if defined(_SYS_XATTR_H)
 #define __UAPI_DEF_XATTR		0
@@ -179,6 +198,13 @@
 #define __UAPI_DEF_IN6_PKTINFO		1
 #define __UAPI_DEF_IP6_MTUINFO		1
 
+/* Definitions for ipx.h */
+#define __UAPI_DEF_SOCKADDR_IPX			1
+#define __UAPI_DEF_IPX_ROUTE_DEFINITION		1
+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION	1
+#define __UAPI_DEF_IPX_CONFIG_DATA		1
+#define __UAPI_DEF_IPX_ROUTE_DEF		1
+
 /* Definitions for xattr.h */
 #define __UAPI_DEF_XATTR		1
 
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1468184 — Re: [PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h

FromDavid Miller <davem@davemloft.net>
Date2016-08-23 01:40 +0200
SubjectRe: [PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h
Message-ID<s96YX-4v1-65@gated-at.bofh.it>
In reply to#1467984
From: Mikko Rapeli <mikko.rapeli@iki.fi>
Date: Mon, 22 Aug 2016 20:33:21 +0200

> Fixes these compiler warnings via libc-compat.h when glibc netipx/ipx.h is
> included before linux/ipx.h:
> 
> ./linux/ipx.h:9:8: error: redefinition of ‘struct sockaddr_ipx’
> ./linux/ipx.h:26:8: error: redefinition of ‘struct ipx_route_definition’
> ./linux/ipx.h:32:8: error: redefinition of ‘struct ipx_interface_definition’
> ./linux/ipx.h:49:8: error: redefinition of ‘struct ipx_config_data’
> ./linux/ipx.h:58:8: error: redefinition of ‘struct ipx_route_def’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>

Applied.

[toc] | [prev] | [next] | [standalone]


#1467986 — [PATCH v05 20/72] include/uapi/linux/rds.h: include linux/socket.h and linux/types.h

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 20/72] include/uapi/linux/rds.h: include linux/socket.h and linux/types.h
Message-ID<s9350-22o-37@gated-at.bofh.it>
In reply to#1467924
Fixes userspace compilation errors like:

error: unknown type name ‘__be32’
error: field ‘dest_addr’ has incomplete type
   struct sockaddr_storage dest_addr;

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
 include/uapi/linux/rds.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h
index 5bf0368..441adf7 100644
--- a/include/uapi/linux/rds.h
+++ b/include/uapi/linux/rds.h
@@ -35,6 +35,7 @@
 #define _LINUX_RDS_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
 
 #define RDS_IB_ABI_VERSION		0x301
 
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1467988 — [PATCH v05 58/72] include/uapi/linux/elfcore.h: remove non-compiling userspace parts

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 58/72] include/uapi/linux/elfcore.h: remove non-compiling userspace parts
Message-ID<s9350-22o-31@gated-at.bofh.it>
In reply to#1467924
Remove typedef elf_greg_t greg_t and friends from userspace.
Remove struct elf_prstatus completely from userspace.

elfcore.h as such does not compile in userspace. All userspace users
of <linux/elfcore.h> like gcc/gdb and linux-tools contain their own modified
versions of the file. With these changes the file compiles but is generally
not usable for things like core dump parsing but luckily userspace users
already know this and have their own modified version of the needed
definitions and headers. But at least this compiles now.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/elfcore.h | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/include/uapi/linux/elfcore.h b/include/uapi/linux/elfcore.h
index 569737c..6c23066 100644
--- a/include/uapi/linux/elfcore.h
+++ b/include/uapi/linux/elfcore.h
@@ -15,15 +15,7 @@ struct elf_siginfo
 	int	si_errno;			/* errno */
 };
 
-
-#ifndef __KERNEL__
-typedef elf_greg_t greg_t;
-typedef elf_gregset_t gregset_t;
-typedef elf_fpregset_t fpregset_t;
-typedef elf_fpxregset_t fpxregset_t;
-#define NGREG ELF_NGREG
-#endif
-
+#ifdef __KERNEL__
 /*
  * Definitions to generate Intel SVR4-like core files.
  * These mostly have the same names as the SVR4 types with "elf_"
@@ -48,10 +40,10 @@ struct elf_prstatus
 	struct sigaltstack pr_altstack;	/* Alternate stack info */
 	struct sigaction pr_action;	/* Signal action for current sig */
 #endif
-	pid_t	pr_pid;
-	pid_t	pr_ppid;
-	pid_t	pr_pgrp;
-	pid_t	pr_sid;
+	__kernel_pid_t	pr_pid;
+	__kernel_pid_t	pr_ppid;
+	__kernel_pid_t	pr_pgrp;
+	__kernel_pid_t	pr_sid;
 	struct timeval pr_utime;	/* User time */
 	struct timeval pr_stime;	/* System time */
 	struct timeval pr_cutime;	/* Cumulative user time */
@@ -72,6 +64,7 @@ struct elf_prstatus
 #endif
 	int pr_fpvalid;		/* True if math co-processor being used.  */
 };
+#endif /* __KERNEL__ */
 
 #define ELF_PRARGSZ	(80)	/* Number of chars for args */
 
@@ -84,7 +77,7 @@ struct elf_prpsinfo
 	unsigned long pr_flag;	/* flags */
 	__kernel_uid_t	pr_uid;
 	__kernel_gid_t	pr_gid;
-	pid_t	pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	__kernel_pid_t	pr_pid, pr_ppid, pr_pgrp, pr_sid;
 	/* Lots missing */
 	char	pr_fname[16];	/* filename of executable */
 	char	pr_psargs[ELF_PRARGSZ];	/* initial part of arg list */
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1467989 — [PATCH v05 70/72] uapi time.h: glibc time.h header file compatibility fixes

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 70/72] uapi time.h: glibc time.h header file compatibility fixes
Message-ID<s9350-22o-33@gated-at.bofh.it>
In reply to#1467924
Fixes these userspace compile errors and warnings when glibc time.h
is included before linux/time.h:

linux/time.h:9:8: error: redefinition of ‘struct timespec’
linux/time.h:15:8: error: redefinition of ‘struct timeval’
linux/time.h:20:8: error: redefinition of ‘struct timezone’
linux/time.h:30:0: warning: "ITIMER_REAL" redefined
linux/time.h:31:0: warning: "ITIMER_VIRTUAL" redefined
linux/time.h:32:0: warning: "ITIMER_PROF" redefined
linux/time.h:34:8: error: redefinition of ‘struct itimerspec’
linux/time.h:39:8: error: redefinition of ‘struct itimerval’
linux/time.h:67:0: warning: "TIMER_ABSTIME" redefined

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/libc-compat.h | 37 +++++++++++++++++++++++++++++++++++++
 include/uapi/linux/time.h        | 18 ++++++++++++++++--
 2 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index acc2e75..cb25f16 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -230,6 +230,21 @@
 
 #endif /* defined(_NETROSE_ROSE_H) */
 
+/* Coordinate with glibc time.h */
+#if defined(_TIME_H)
+#define __UAPI_DEF_TIMESPEC		0
+#define __UAPI_DEF_TIMEVAL		0
+#define __UAPI_DEF_ITIMERSPEC		0
+#define __UAPI_DEF_TIMER_ABSTIME	0
+
+#else /* defined(_TIME_H) */
+#define __UAPI_DEF_TIMESPEC		1
+#define __UAPI_DEF_TIMEVAL		1
+#define __UAPI_DEF_ITIMERSPEC		1
+#define __UAPI_DEF_TIMER_ABSTIME	1
+
+#endif /* defined(_TIME_H) */
+
 /* Definitions for sys/uio.h */
 #if defined(_SYS_UIO_H)
 #define __UAPI_DEF_IOVEC		0
@@ -237,6 +252,19 @@
 #define __UAPI_DEF_IOVEC		1
 #endif /* defined(_SYS_UIO_H) */
 
+/* Definitions for sys/time.h */
+#if defined(_SYS_TIME_H)
+#define __UAPI_DEF_TIMEZONE			0
+#define __UAPI_DEF_ITIMER_REAL_VIRTUAL_PROF	0
+#define __UAPI_DEF_ITIMERVAL			0
+
+#else /* defined(_SYS_TIME_H) */
+#define __UAPI_DEF_TIMEZONE			1
+#define __UAPI_DEF_ITIMER_REAL_VIRTUAL_PROF	1
+#define __UAPI_DEF_ITIMERVAL			1
+
+#endif /* defined(_SYS_TIME_H) */
+
 /* Definitions for xattr.h */
 #if defined(_SYS_XATTR_H)
 #define __UAPI_DEF_XATTR		0
@@ -313,6 +341,15 @@
 #define __UAPI_DEF_ROSE_CAUSE_STRUCT			1
 #define __UAPI_DEF_ROSE_FACILITIES_STRUCT		1
 
+/* Definitions for time.h */
+#define __UAPI_DEF_TIMESPEC			1
+#define __UAPI_DEF_TIMEVAL			1
+#define __UAPI_DEF_TIMEZONE			1
+#define __UAPI_DEF_ITIMER_REAL_VIRTUAL_PROF	1
+#define __UAPI_DEF_ITIMERSPEC			1
+#define __UAPI_DEF_ITIMERVAL			1
+#define __UAPI_DEF_TIMER_ABSTIME		1
+
 /* Definitions for uio.h */
 #define __UAPI_DEF_IOVEC		1
 
diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h
index e75e1b6..66fb19c 100644
--- a/include/uapi/linux/time.h
+++ b/include/uapi/linux/time.h
@@ -1,45 +1,57 @@
 #ifndef _UAPI_LINUX_TIME_H
 #define _UAPI_LINUX_TIME_H
 
+#include <linux/libc-compat.h>
 #include <linux/types.h>
 
 
 #ifndef _STRUCT_TIMESPEC
 #define _STRUCT_TIMESPEC
+#if __UAPI_DEF_TIMESPEC
 struct timespec {
 	__kernel_time_t	tv_sec;			/* seconds */
 	long		tv_nsec;		/* nanoseconds */
 };
-#endif
+#endif /* __UAPI_DEF_TIMESPEC */
+#endif /* _STRUCT_TIMESPEC */
 
+#if __UAPI_DEF_TIMEVAL
 struct timeval {
 	__kernel_time_t		tv_sec;		/* seconds */
 	__kernel_suseconds_t	tv_usec;	/* microseconds */
 };
+#endif /* __UAPI_DEF_TIMEVAL */
 
+#if __UAPI_DEF_TIMEZONE
 struct timezone {
 	int	tz_minuteswest;	/* minutes west of Greenwich */
 	int	tz_dsttime;	/* type of dst correction */
 };
-
+#endif /* __UAPI_DEF_TIMEZONE */
 
 /*
  * Names of the interval timers, and structure
  * defining a timer setting:
  */
+#if __UAPI_DEF_ITIMER_REAL_VIRTUAL_PROF
 #define	ITIMER_REAL		0
 #define	ITIMER_VIRTUAL		1
 #define	ITIMER_PROF		2
+#endif /* __UAPI_DEF_ITIMER_REAL_VIRTUAL_PROF */
 
+#if __UAPI_DEF_ITIMERSPEC
 struct itimerspec {
 	struct timespec it_interval;	/* timer period */
 	struct timespec it_value;	/* timer expiration */
 };
+#endif /* __UAPI_DEF_ITIMERSPEC */
 
+#if __UAPI_DEF_ITIMERVAL
 struct itimerval {
 	struct timeval it_interval;	/* timer interval */
 	struct timeval it_value;	/* current value */
 };
+#endif /* __UAPI_DEF_ITIMERVAL */
 
 /*
  * The IDs of the various system clocks (for POSIX.1b interval timers):
@@ -64,6 +76,8 @@ struct itimerval {
 /*
  * The various flags for setting POSIX.1b interval timers:
  */
+#if __UAPI_DEF_TIMER_ABSTIME
 #define TIMER_ABSTIME			0x01
+#endif /* __UAPI_DEF_TIMER_ABSTIME */
 
 #endif /* _UAPI_LINUX_TIME_H */
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1467990 — [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes
Message-ID<s934Z-22o-11@gated-at.bofh.it>
In reply to#1467924
Fixes these userspace compile error when glibc netax25/ax25.h is included
before linux/ax25.h:

linux/ax25.h:28:0: warning: "SIOCAX25GETUID" redefined
linux/ax25.h:38:0: warning: "SIOCAX25GETINFO" redefined
linux/ax25.h:47:3: error: conflicting types for ‘ax25_address’
linux/ax25.h:49:8: error: redefinition of ‘struct sockaddr_ax25’
linux/ax25.h:58:8: error: redefinition of ‘struct full_sockaddr_ax25’
linux/ax25.h:63:8: error: redefinition of ‘struct ax25_routes_struct’
linux/ax25.h:70:8: error: redefinition of ‘struct ax25_route_opt_struct’
linux/ax25.h:77:8: error: redefinition of ‘struct ax25_ctl_struct’
linux/ax25.h:98:8: error: redefinition of ‘struct ax25_info_struct’
linux/ax25.h:111:8: error: redefinition of ‘struct ax25_fwd_struct’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/ax25.h        | 22 +++++++++++++++++++++
 include/uapi/linux/libc-compat.h | 41 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)

diff --git a/include/uapi/linux/ax25.h b/include/uapi/linux/ax25.h
index 74c89a4..e296c8a 100644
--- a/include/uapi/linux/ax25.h
+++ b/include/uapi/linux/ax25.h
@@ -6,6 +6,7 @@
 #ifndef	AX25_KERNEL_H
 #define	AX25_KERNEL_H
 
+#include <linux/libc-compat.h>
 #include <linux/socket.h>
 
 #define AX25_MTU	256
@@ -25,6 +26,7 @@
 
 #define AX25_KILL	99
 
+#if __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD
 #define SIOCAX25GETUID		(SIOCPROTOPRIVATE+0)
 #define SIOCAX25ADDUID		(SIOCPROTOPRIVATE+1)
 #define SIOCAX25DELUID		(SIOCPROTOPRIVATE+2)
@@ -34,46 +36,61 @@
 #define SIOCAX25GETINFOOLD	(SIOCPROTOPRIVATE+9)
 #define SIOCAX25ADDFWD		(SIOCPROTOPRIVATE+10)
 #define SIOCAX25DELFWD		(SIOCPROTOPRIVATE+11)
+#endif /* __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD */
 #define SIOCAX25DEVCTL          (SIOCPROTOPRIVATE+12)
+/* glibc uses SIOCPROTOPRIVATE+9 for SIOCAX25GETINFO */
+#if __UAPI_DEF_SIOCAX25GETINFO
 #define SIOCAX25GETINFO         (SIOCPROTOPRIVATE+13)
+#endif /* __UAPI_DEF_SIOCAX25GETINFO */
 
 #define AX25_SET_RT_IPMODE	2
 
 #define AX25_NOUID_DEFAULT	0
 #define AX25_NOUID_BLOCK	1
 
+#if __UAPI_DEF_AX25_ADDRESS
 typedef struct {
 	char		ax25_call[7];	/* 6 call + SSID (shifted ascii!) */
 } ax25_address;
+#endif /* __UAPI_DEF_AX25_ADDRESS */
 
+#if __UAPI_DEF_SOCKADDR_AX25
 struct sockaddr_ax25 {
 	__kernel_sa_family_t sax25_family;
 	ax25_address	sax25_call;
 	int		sax25_ndigis;
 	/* Digipeater ax25_address sets follow */
 };
+#endif /* __UAPI_DEF_SOCKADDR_AX25 */
 
 #define sax25_uid	sax25_ndigis
 
+#if __UAPI_DEF_FULL_SOCKADDR_AX25
 struct full_sockaddr_ax25 {
 	struct sockaddr_ax25 fsa_ax25;
 	ax25_address	fsa_digipeater[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_FULL_SOCKADDR_AX25 */
 
+#if __UAPI_DEF_AX25_ROUTES_STRUCT
 struct ax25_routes_struct {
 	ax25_address	port_addr;
 	ax25_address	dest_addr;
 	unsigned char	digi_count;
 	ax25_address	digi_addr[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_AX25_ROUTES_STRUCT */
 
+#if __UAPI_DEF_AX25_ROUTES_OPT_STRUCT
 struct ax25_route_opt_struct {
 	ax25_address	port_addr;
 	ax25_address	dest_addr;
 	int		cmd;
 	int		arg;
 };
+#endif /* __UAPI_DEF_AX25_ROUTES_OPT_STRUCT */
 
+#if __UAPI_DEF_AX25_CTL_STRUCT
 struct ax25_ctl_struct {
         ax25_address            port_addr;
         ax25_address            source_addr;
@@ -83,6 +100,7 @@ struct ax25_ctl_struct {
         unsigned char           digi_count;
         ax25_address            digi_addr[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_AX25_CTL_STRUCT */
 
 /* this will go away. Please do not export to user land */
 struct ax25_info_struct_deprecated {
@@ -95,6 +113,7 @@ struct ax25_info_struct_deprecated {
 	unsigned int	rcv_q, snd_q;
 };
 
+#if __UAPI_DEF_AX25_INFO_STRUCT
 struct ax25_info_struct {
 	unsigned int	n2, n2count;
 	unsigned int	t1, t1timer;
@@ -107,10 +126,13 @@ struct ax25_info_struct {
 	unsigned int	paclen;
 	unsigned int	window;
 };
+#endif /* __UAPI_DEF_AX25_INFO_STRUCT */
 
+#if __UAPI_DEF_AX25_FWD_STRUCT
 struct ax25_fwd_struct {
 	ax25_address	port_from;
 	ax25_address	port_to;
 };
+#endif /* __UAPI_DEF_AX25_FWD_STRUCT */
 
 #endif
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index f793b09..01bb521 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -100,6 +100,35 @@
 
 #endif /* _NET_IF_H */
 
+/* Coordinate with glibc netax25/ax25.h header. */
+#if defined(_NETAX25_AX25_H)
+
+#define __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD	0
+#define __UAPI_DEF_SIOCAX25GETINFO			0
+#define __UAPI_DEF_AX25_ADDRESS				0
+#define __UAPI_DEF_SOCKADDR_AX25			0
+#define __UAPI_DEF_FULL_SOCKADDR_AX25			0
+#define __UAPI_DEF_AX25_ROUTES_STRUCT			0
+#define __UAPI_DEF_AX25_ROUTES_OPT_STRUCT		0
+#define __UAPI_DEF_AX25_CTL_STRUCT			0
+#define __UAPI_DEF_AX25_INFO_STRUCT			0
+#define __UAPI_DEF_AX25_FWD_STRUCT			0
+
+#else /* defined(_NETAX25_AX25_H) */
+
+#define __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD	1
+#define __UAPI_DEF_SIOCAX25GETINFO			1
+#define __UAPI_DEF_AX25_ADDRESS				1
+#define __UAPI_DEF_SOCKADDR_AX25			1
+#define __UAPI_DEF_FULL_SOCKADDR_AX25			1
+#define __UAPI_DEF_AX25_ROUTES_STRUCT			1
+#define __UAPI_DEF_AX25_ROUTES_OPT_STRUCT		1
+#define __UAPI_DEF_AX25_CTL_STRUCT			1
+#define __UAPI_DEF_AX25_INFO_STRUCT			1
+#define __UAPI_DEF_AX25_FWD_STRUCT			1
+
+#endif /* defined(_NETAX25_AX25_H) */
+
 /* Coordinate with glibc netinet/in.h header. */
 #if defined(_NETINET_IN_H)
 
@@ -204,6 +233,18 @@
 #define __UAPI_DEF_F_DUPFD_CLOEXEC		1
 #define __UAPI_DEF_O_ACCMODE_RDONLY_WRONLY_RDWR	1
 
+/* Definitions for ax25.h */
+#define __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD	1
+#define __UAPI_DEF_SIOCAX25GETINFO			1
+#define __UAPI_DEF_AX25_ADDRESS				1
+#define __UAPI_DEF_SOCKADDR_AX25			1
+#define __UAPI_DEF_FULL_SOCKADDR_AX25			1
+#define __UAPI_DEF_AX25_ROUTES_STRUCT			1
+#define __UAPI_DEF_AX25_ROUTES_OPT_STRUCT		1
+#define __UAPI_DEF_AX25_CTL_STRUCT			1
+#define __UAPI_DEF_AX25_INFO_STRUCT			1
+#define __UAPI_DEF_AX25_FWD_STRUCT			1
+
 /* Definitions for if.h */
 #define __UAPI_DEF_IF_IFCONF 1
 #define __UAPI_DEF_IF_IFMAP 1
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1468160 — Re: [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes

FromDavid Miller <davem@davemloft.net>
Date2016-08-23 01:40 +0200
SubjectRe: [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes
Message-ID<s96YW-4v1-13@gated-at.bofh.it>
In reply to#1467990
Must be CC:'d to netdev.

[toc] | [prev] | [next] | [standalone]


#1467991 — [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace
Message-ID<s9350-22o-27@gated-at.bofh.it>
In reply to#1467924
Kernel headers should not use stdint.h.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Miklos Szeredi <miklos@szeredi.hu>
---
 include/uapi/linux/fuse.h | 452 +++++++++++++++++++++++-----------------------
 1 file changed, 224 insertions(+), 228 deletions(-)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 27e1736..f9eadc7 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -113,11 +113,7 @@
 #ifndef _LINUX_FUSE_H
 #define _LINUX_FUSE_H
 
-#ifdef __KERNEL__
 #include <linux/types.h>
-#else
-#include <stdint.h>
-#endif
 
 /*
  * Version negotiation:
@@ -152,42 +148,42 @@
    userspace works under 64bit kernels */
 
 struct fuse_attr {
-	uint64_t	ino;
-	uint64_t	size;
-	uint64_t	blocks;
-	uint64_t	atime;
-	uint64_t	mtime;
-	uint64_t	ctime;
-	uint32_t	atimensec;
-	uint32_t	mtimensec;
-	uint32_t	ctimensec;
-	uint32_t	mode;
-	uint32_t	nlink;
-	uint32_t	uid;
-	uint32_t	gid;
-	uint32_t	rdev;
-	uint32_t	blksize;
-	uint32_t	padding;
+	__u64	ino;
+	__u64	size;
+	__u64	blocks;
+	__u64	atime;
+	__u64	mtime;
+	__u64	ctime;
+	__u32	atimensec;
+	__u32	mtimensec;
+	__u32	ctimensec;
+	__u32	mode;
+	__u32	nlink;
+	__u32	uid;
+	__u32	gid;
+	__u32	rdev;
+	__u32	blksize;
+	__u32	padding;
 };
 
 struct fuse_kstatfs {
-	uint64_t	blocks;
-	uint64_t	bfree;
-	uint64_t	bavail;
-	uint64_t	files;
-	uint64_t	ffree;
-	uint32_t	bsize;
-	uint32_t	namelen;
-	uint32_t	frsize;
-	uint32_t	padding;
-	uint32_t	spare[6];
+	__u64	blocks;
+	__u64	bfree;
+	__u64	bavail;
+	__u64	files;
+	__u64	ffree;
+	__u32	bsize;
+	__u32	namelen;
+	__u32	frsize;
+	__u32	padding;
+	__u32	spare[6];
 };
 
 struct fuse_file_lock {
-	uint64_t	start;
-	uint64_t	end;
-	uint32_t	type;
-	uint32_t	pid; /* tgid */
+	__u64	start;
+	__u64	end;
+	__u32	type;
+	__u32	pid; /* tgid */
 };
 
 /**
@@ -388,149 +384,149 @@ enum fuse_notify_code {
 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
 
 struct fuse_entry_out {
-	uint64_t	nodeid;		/* Inode ID */
-	uint64_t	generation;	/* Inode generation: nodeid:gen must
+	__u64	nodeid;		/* Inode ID */
+	__u64	generation;	/* Inode generation: nodeid:gen must
 					   be unique for the fs's lifetime */
-	uint64_t	entry_valid;	/* Cache timeout for the name */
-	uint64_t	attr_valid;	/* Cache timeout for the attributes */
-	uint32_t	entry_valid_nsec;
-	uint32_t	attr_valid_nsec;
+	__u64	entry_valid;	/* Cache timeout for the name */
+	__u64	attr_valid;	/* Cache timeout for the attributes */
+	__u32	entry_valid_nsec;
+	__u32	attr_valid_nsec;
 	struct fuse_attr attr;
 };
 
 struct fuse_forget_in {
-	uint64_t	nlookup;
+	__u64	nlookup;
 };
 
 struct fuse_forget_one {
-	uint64_t	nodeid;
-	uint64_t	nlookup;
+	__u64	nodeid;
+	__u64	nlookup;
 };
 
 struct fuse_batch_forget_in {
-	uint32_t	count;
-	uint32_t	dummy;
+	__u32	count;
+	__u32	dummy;
 };
 
 struct fuse_getattr_in {
-	uint32_t	getattr_flags;
-	uint32_t	dummy;
-	uint64_t	fh;
+	__u32	getattr_flags;
+	__u32	dummy;
+	__u64	fh;
 };
 
 #define FUSE_COMPAT_ATTR_OUT_SIZE 96
 
 struct fuse_attr_out {
-	uint64_t	attr_valid;	/* Cache timeout for the attributes */
-	uint32_t	attr_valid_nsec;
-	uint32_t	dummy;
+	__u64	attr_valid;	/* Cache timeout for the attributes */
+	__u32	attr_valid_nsec;
+	__u32	dummy;
 	struct fuse_attr attr;
 };
 
 #define FUSE_COMPAT_MKNOD_IN_SIZE 8
 
 struct fuse_mknod_in {
-	uint32_t	mode;
-	uint32_t	rdev;
-	uint32_t	umask;
-	uint32_t	padding;
+	__u32	mode;
+	__u32	rdev;
+	__u32	umask;
+	__u32	padding;
 };
 
 struct fuse_mkdir_in {
-	uint32_t	mode;
-	uint32_t	umask;
+	__u32	mode;
+	__u32	umask;
 };
 
 struct fuse_rename_in {
-	uint64_t	newdir;
+	__u64	newdir;
 };
 
 struct fuse_rename2_in {
-	uint64_t	newdir;
-	uint32_t	flags;
-	uint32_t	padding;
+	__u64	newdir;
+	__u32	flags;
+	__u32	padding;
 };
 
 struct fuse_link_in {
-	uint64_t	oldnodeid;
+	__u64	oldnodeid;
 };
 
 struct fuse_setattr_in {
-	uint32_t	valid;
-	uint32_t	padding;
-	uint64_t	fh;
-	uint64_t	size;
-	uint64_t	lock_owner;
-	uint64_t	atime;
-	uint64_t	mtime;
-	uint64_t	ctime;
-	uint32_t	atimensec;
-	uint32_t	mtimensec;
-	uint32_t	ctimensec;
-	uint32_t	mode;
-	uint32_t	unused4;
-	uint32_t	uid;
-	uint32_t	gid;
-	uint32_t	unused5;
+	__u32	valid;
+	__u32	padding;
+	__u64	fh;
+	__u64	size;
+	__u64	lock_owner;
+	__u64	atime;
+	__u64	mtime;
+	__u64	ctime;
+	__u32	atimensec;
+	__u32	mtimensec;
+	__u32	ctimensec;
+	__u32	mode;
+	__u32	unused4;
+	__u32	uid;
+	__u32	gid;
+	__u32	unused5;
 };
 
 struct fuse_open_in {
-	uint32_t	flags;
-	uint32_t	unused;
+	__u32	flags;
+	__u32	unused;
 };
 
 struct fuse_create_in {
-	uint32_t	flags;
-	uint32_t	mode;
-	uint32_t	umask;
-	uint32_t	padding;
+	__u32	flags;
+	__u32	mode;
+	__u32	umask;
+	__u32	padding;
 };
 
 struct fuse_open_out {
-	uint64_t	fh;
-	uint32_t	open_flags;
-	uint32_t	padding;
+	__u64	fh;
+	__u32	open_flags;
+	__u32	padding;
 };
 
 struct fuse_release_in {
-	uint64_t	fh;
-	uint32_t	flags;
-	uint32_t	release_flags;
-	uint64_t	lock_owner;
+	__u64	fh;
+	__u32	flags;
+	__u32	release_flags;
+	__u64	lock_owner;
 };
 
 struct fuse_flush_in {
-	uint64_t	fh;
-	uint32_t	unused;
-	uint32_t	padding;
-	uint64_t	lock_owner;
+	__u64	fh;
+	__u32	unused;
+	__u32	padding;
+	__u64	lock_owner;
 };
 
 struct fuse_read_in {
-	uint64_t	fh;
-	uint64_t	offset;
-	uint32_t	size;
-	uint32_t	read_flags;
-	uint64_t	lock_owner;
-	uint32_t	flags;
-	uint32_t	padding;
+	__u64	fh;
+	__u64	offset;
+	__u32	size;
+	__u32	read_flags;
+	__u64	lock_owner;
+	__u32	flags;
+	__u32	padding;
 };
 
 #define FUSE_COMPAT_WRITE_IN_SIZE 24
 
 struct fuse_write_in {
-	uint64_t	fh;
-	uint64_t	offset;
-	uint32_t	size;
-	uint32_t	write_flags;
-	uint64_t	lock_owner;
-	uint32_t	flags;
-	uint32_t	padding;
+	__u64	fh;
+	__u64	offset;
+	__u32	size;
+	__u32	write_flags;
+	__u64	lock_owner;
+	__u32	flags;
+	__u32	padding;
 };
 
 struct fuse_write_out {
-	uint32_t	size;
-	uint32_t	padding;
+	__u32	size;
+	__u32	padding;
 };
 
 #define FUSE_COMPAT_STATFS_SIZE 48
@@ -540,32 +536,32 @@ struct fuse_statfs_out {
 };
 
 struct fuse_fsync_in {
-	uint64_t	fh;
-	uint32_t	fsync_flags;
-	uint32_t	padding;
+	__u64	fh;
+	__u32	fsync_flags;
+	__u32	padding;
 };
 
 struct fuse_setxattr_in {
-	uint32_t	size;
-	uint32_t	flags;
+	__u32	size;
+	__u32	flags;
 };
 
 struct fuse_getxattr_in {
-	uint32_t	size;
-	uint32_t	padding;
+	__u32	size;
+	__u32	padding;
 };
 
 struct fuse_getxattr_out {
-	uint32_t	size;
-	uint32_t	padding;
+	__u32	size;
+	__u32	padding;
 };
 
 struct fuse_lk_in {
-	uint64_t	fh;
-	uint64_t	owner;
+	__u64	fh;
+	__u64	owner;
 	struct fuse_file_lock lk;
-	uint32_t	lk_flags;
-	uint32_t	padding;
+	__u32	lk_flags;
+	__u32	padding;
 };
 
 struct fuse_lk_out {
@@ -573,140 +569,140 @@ struct fuse_lk_out {
 };
 
 struct fuse_access_in {
-	uint32_t	mask;
-	uint32_t	padding;
+	__u32	mask;
+	__u32	padding;
 };
 
 struct fuse_init_in {
-	uint32_t	major;
-	uint32_t	minor;
-	uint32_t	max_readahead;
-	uint32_t	flags;
+	__u32	major;
+	__u32	minor;
+	__u32	max_readahead;
+	__u32	flags;
 };
 
 #define FUSE_COMPAT_INIT_OUT_SIZE 8
 #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
 
 struct fuse_init_out {
-	uint32_t	major;
-	uint32_t	minor;
-	uint32_t	max_readahead;
-	uint32_t	flags;
-	uint16_t	max_background;
-	uint16_t	congestion_threshold;
-	uint32_t	max_write;
-	uint32_t	time_gran;
-	uint32_t	unused[9];
+	__u32	major;
+	__u32	minor;
+	__u32	max_readahead;
+	__u32	flags;
+	__u16	max_background;
+	__u16	congestion_threshold;
+	__u32	max_write;
+	__u32	time_gran;
+	__u32	unused[9];
 };
 
 #define CUSE_INIT_INFO_MAX 4096
 
 struct cuse_init_in {
-	uint32_t	major;
-	uint32_t	minor;
-	uint32_t	unused;
-	uint32_t	flags;
+	__u32	major;
+	__u32	minor;
+	__u32	unused;
+	__u32	flags;
 };
 
 struct cuse_init_out {
-	uint32_t	major;
-	uint32_t	minor;
-	uint32_t	unused;
-	uint32_t	flags;
-	uint32_t	max_read;
-	uint32_t	max_write;
-	uint32_t	dev_major;		/* chardev major */
-	uint32_t	dev_minor;		/* chardev minor */
-	uint32_t	spare[10];
+	__u32	major;
+	__u32	minor;
+	__u32	unused;
+	__u32	flags;
+	__u32	max_read;
+	__u32	max_write;
+	__u32	dev_major;		/* chardev major */
+	__u32	dev_minor;		/* chardev minor */
+	__u32	spare[10];
 };
 
 struct fuse_interrupt_in {
-	uint64_t	unique;
+	__u64	unique;
 };
 
 struct fuse_bmap_in {
-	uint64_t	block;
-	uint32_t	blocksize;
-	uint32_t	padding;
+	__u64	block;
+	__u32	blocksize;
+	__u32	padding;
 };
 
 struct fuse_bmap_out {
-	uint64_t	block;
+	__u64	block;
 };
 
 struct fuse_ioctl_in {
-	uint64_t	fh;
-	uint32_t	flags;
-	uint32_t	cmd;
-	uint64_t	arg;
-	uint32_t	in_size;
-	uint32_t	out_size;
+	__u64	fh;
+	__u32	flags;
+	__u32	cmd;
+	__u64	arg;
+	__u32	in_size;
+	__u32	out_size;
 };
 
 struct fuse_ioctl_iovec {
-	uint64_t	base;
-	uint64_t	len;
+	__u64	base;
+	__u64	len;
 };
 
 struct fuse_ioctl_out {
-	int32_t		result;
-	uint32_t	flags;
-	uint32_t	in_iovs;
-	uint32_t	out_iovs;
+	__s32		result;
+	__u32	flags;
+	__u32	in_iovs;
+	__u32	out_iovs;
 };
 
 struct fuse_poll_in {
-	uint64_t	fh;
-	uint64_t	kh;
-	uint32_t	flags;
-	uint32_t	events;
+	__u64	fh;
+	__u64	kh;
+	__u32	flags;
+	__u32	events;
 };
 
 struct fuse_poll_out {
-	uint32_t	revents;
-	uint32_t	padding;
+	__u32	revents;
+	__u32	padding;
 };
 
 struct fuse_notify_poll_wakeup_out {
-	uint64_t	kh;
+	__u64	kh;
 };
 
 struct fuse_fallocate_in {
-	uint64_t	fh;
-	uint64_t	offset;
-	uint64_t	length;
-	uint32_t	mode;
-	uint32_t	padding;
+	__u64	fh;
+	__u64	offset;
+	__u64	length;
+	__u32	mode;
+	__u32	padding;
 };
 
 struct fuse_in_header {
-	uint32_t	len;
-	uint32_t	opcode;
-	uint64_t	unique;
-	uint64_t	nodeid;
-	uint32_t	uid;
-	uint32_t	gid;
-	uint32_t	pid;
-	uint32_t	padding;
+	__u32	len;
+	__u32	opcode;
+	__u64	unique;
+	__u64	nodeid;
+	__u32	uid;
+	__u32	gid;
+	__u32	pid;
+	__u32	padding;
 };
 
 struct fuse_out_header {
-	uint32_t	len;
-	int32_t		error;
-	uint64_t	unique;
+	__u32	len;
+	__s32		error;
+	__u64	unique;
 };
 
 struct fuse_dirent {
-	uint64_t	ino;
-	uint64_t	off;
-	uint32_t	namelen;
-	uint32_t	type;
+	__u64	ino;
+	__u64	off;
+	__u32	namelen;
+	__u32	type;
 	char name[];
 };
 
 #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
 #define FUSE_DIRENT_ALIGN(x) \
-	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
+	(((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
 #define FUSE_DIRENT_SIZE(d) \
 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
 
@@ -721,61 +717,61 @@ struct fuse_direntplus {
 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
 
 struct fuse_notify_inval_inode_out {
-	uint64_t	ino;
-	int64_t		off;
-	int64_t		len;
+	__u64	ino;
+	__s64		off;
+	__s64		len;
 };
 
 struct fuse_notify_inval_entry_out {
-	uint64_t	parent;
-	uint32_t	namelen;
-	uint32_t	padding;
+	__u64	parent;
+	__u32	namelen;
+	__u32	padding;
 };
 
 struct fuse_notify_delete_out {
-	uint64_t	parent;
-	uint64_t	child;
-	uint32_t	namelen;
-	uint32_t	padding;
+	__u64	parent;
+	__u64	child;
+	__u32	namelen;
+	__u32	padding;
 };
 
 struct fuse_notify_store_out {
-	uint64_t	nodeid;
-	uint64_t	offset;
-	uint32_t	size;
-	uint32_t	padding;
+	__u64	nodeid;
+	__u64	offset;
+	__u32	size;
+	__u32	padding;
 };
 
 struct fuse_notify_retrieve_out {
-	uint64_t	notify_unique;
-	uint64_t	nodeid;
-	uint64_t	offset;
-	uint32_t	size;
-	uint32_t	padding;
+	__u64	notify_unique;
+	__u64	nodeid;
+	__u64	offset;
+	__u32	size;
+	__u32	padding;
 };
 
 /* Matches the size of fuse_write_in */
 struct fuse_notify_retrieve_in {
-	uint64_t	dummy1;
-	uint64_t	offset;
-	uint32_t	size;
-	uint32_t	dummy2;
-	uint64_t	dummy3;
-	uint64_t	dummy4;
+	__u64	dummy1;
+	__u64	offset;
+	__u32	size;
+	__u32	dummy2;
+	__u64	dummy3;
+	__u64	dummy4;
 };
 
 /* Device ioctls: */
-#define FUSE_DEV_IOC_CLONE	_IOR(229, 0, uint32_t)
+#define FUSE_DEV_IOC_CLONE	_IOR(229, 0, __u32)
 
 struct fuse_lseek_in {
-	uint64_t	fh;
-	uint64_t	offset;
-	uint32_t	whence;
-	uint32_t	padding;
+	__u64	fh;
+	__u64	offset;
+	__u32	whence;
+	__u32	padding;
 };
 
 struct fuse_lseek_out {
-	uint64_t	offset;
+	__u64	offset;
 };
 
 #endif /* _LINUX_FUSE_H */
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1468336 — Re: [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace

FromMiklos Szeredi <miklos@szeredi.hu>
Date2016-08-23 09:20 +0200
SubjectRe: [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace
Message-ID<s9ea6-KG-15@gated-at.bofh.it>
In reply to#1467991
On Mon, Aug 22, 2016 at 8:33 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> Kernel headers should not use stdint.h.
>

NACK.

This header is used by more than one OS.   Having a different version
for different OS's makes no sense, hence the choice of stdint.  We've
been over this many times.  I'll do a patch with a big fat warning at
the top of this header so that people don't spend time doing this
useless conversion over and over again.

Thanks,
Miklos


> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Miklos Szeredi <miklos@szeredi.hu>
> ---
>  include/uapi/linux/fuse.h | 452 +++++++++++++++++++++++-----------------------
>  1 file changed, 224 insertions(+), 228 deletions(-)
>
> diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
> index 27e1736..f9eadc7 100644
> --- a/include/uapi/linux/fuse.h
> +++ b/include/uapi/linux/fuse.h
> @@ -113,11 +113,7 @@
>  #ifndef _LINUX_FUSE_H
>  #define _LINUX_FUSE_H
>
> -#ifdef __KERNEL__
>  #include <linux/types.h>
> -#else
> -#include <stdint.h>
> -#endif
>
>  /*
>   * Version negotiation:
> @@ -152,42 +148,42 @@
>     userspace works under 64bit kernels */
>
>  struct fuse_attr {
> -       uint64_t        ino;
> -       uint64_t        size;
> -       uint64_t        blocks;
> -       uint64_t        atime;
> -       uint64_t        mtime;
> -       uint64_t        ctime;
> -       uint32_t        atimensec;
> -       uint32_t        mtimensec;
> -       uint32_t        ctimensec;
> -       uint32_t        mode;
> -       uint32_t        nlink;
> -       uint32_t        uid;
> -       uint32_t        gid;
> -       uint32_t        rdev;
> -       uint32_t        blksize;
> -       uint32_t        padding;
> +       __u64   ino;
> +       __u64   size;
> +       __u64   blocks;
> +       __u64   atime;
> +       __u64   mtime;
> +       __u64   ctime;
> +       __u32   atimensec;
> +       __u32   mtimensec;
> +       __u32   ctimensec;
> +       __u32   mode;
> +       __u32   nlink;
> +       __u32   uid;
> +       __u32   gid;
> +       __u32   rdev;
> +       __u32   blksize;
> +       __u32   padding;
>  };
>
>  struct fuse_kstatfs {
> -       uint64_t        blocks;
> -       uint64_t        bfree;
> -       uint64_t        bavail;
> -       uint64_t        files;
> -       uint64_t        ffree;
> -       uint32_t        bsize;
> -       uint32_t        namelen;
> -       uint32_t        frsize;
> -       uint32_t        padding;
> -       uint32_t        spare[6];
> +       __u64   blocks;
> +       __u64   bfree;
> +       __u64   bavail;
> +       __u64   files;
> +       __u64   ffree;
> +       __u32   bsize;
> +       __u32   namelen;
> +       __u32   frsize;
> +       __u32   padding;
> +       __u32   spare[6];
>  };
>
>  struct fuse_file_lock {
> -       uint64_t        start;
> -       uint64_t        end;
> -       uint32_t        type;
> -       uint32_t        pid; /* tgid */
> +       __u64   start;
> +       __u64   end;
> +       __u32   type;
> +       __u32   pid; /* tgid */
>  };
>
>  /**
> @@ -388,149 +384,149 @@ enum fuse_notify_code {
>  #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
>
>  struct fuse_entry_out {
> -       uint64_t        nodeid;         /* Inode ID */
> -       uint64_t        generation;     /* Inode generation: nodeid:gen must
> +       __u64   nodeid;         /* Inode ID */
> +       __u64   generation;     /* Inode generation: nodeid:gen must
>                                            be unique for the fs's lifetime */
> -       uint64_t        entry_valid;    /* Cache timeout for the name */
> -       uint64_t        attr_valid;     /* Cache timeout for the attributes */
> -       uint32_t        entry_valid_nsec;
> -       uint32_t        attr_valid_nsec;
> +       __u64   entry_valid;    /* Cache timeout for the name */
> +       __u64   attr_valid;     /* Cache timeout for the attributes */
> +       __u32   entry_valid_nsec;
> +       __u32   attr_valid_nsec;
>         struct fuse_attr attr;
>  };
>
>  struct fuse_forget_in {
> -       uint64_t        nlookup;
> +       __u64   nlookup;
>  };
>
>  struct fuse_forget_one {
> -       uint64_t        nodeid;
> -       uint64_t        nlookup;
> +       __u64   nodeid;
> +       __u64   nlookup;
>  };
>
>  struct fuse_batch_forget_in {
> -       uint32_t        count;
> -       uint32_t        dummy;
> +       __u32   count;
> +       __u32   dummy;
>  };
>
>  struct fuse_getattr_in {
> -       uint32_t        getattr_flags;
> -       uint32_t        dummy;
> -       uint64_t        fh;
> +       __u32   getattr_flags;
> +       __u32   dummy;
> +       __u64   fh;
>  };
>
>  #define FUSE_COMPAT_ATTR_OUT_SIZE 96
>
>  struct fuse_attr_out {
> -       uint64_t        attr_valid;     /* Cache timeout for the attributes */
> -       uint32_t        attr_valid_nsec;
> -       uint32_t        dummy;
> +       __u64   attr_valid;     /* Cache timeout for the attributes */
> +       __u32   attr_valid_nsec;
> +       __u32   dummy;
>         struct fuse_attr attr;
>  };
>
>  #define FUSE_COMPAT_MKNOD_IN_SIZE 8
>
>  struct fuse_mknod_in {
> -       uint32_t        mode;
> -       uint32_t        rdev;
> -       uint32_t        umask;
> -       uint32_t        padding;
> +       __u32   mode;
> +       __u32   rdev;
> +       __u32   umask;
> +       __u32   padding;
>  };
>
>  struct fuse_mkdir_in {
> -       uint32_t        mode;
> -       uint32_t        umask;
> +       __u32   mode;
> +       __u32   umask;
>  };
>
>  struct fuse_rename_in {
> -       uint64_t        newdir;
> +       __u64   newdir;
>  };
>
>  struct fuse_rename2_in {
> -       uint64_t        newdir;
> -       uint32_t        flags;
> -       uint32_t        padding;
> +       __u64   newdir;
> +       __u32   flags;
> +       __u32   padding;
>  };
>
>  struct fuse_link_in {
> -       uint64_t        oldnodeid;
> +       __u64   oldnodeid;
>  };
>
>  struct fuse_setattr_in {
> -       uint32_t        valid;
> -       uint32_t        padding;
> -       uint64_t        fh;
> -       uint64_t        size;
> -       uint64_t        lock_owner;
> -       uint64_t        atime;
> -       uint64_t        mtime;
> -       uint64_t        ctime;
> -       uint32_t        atimensec;
> -       uint32_t        mtimensec;
> -       uint32_t        ctimensec;
> -       uint32_t        mode;
> -       uint32_t        unused4;
> -       uint32_t        uid;
> -       uint32_t        gid;
> -       uint32_t        unused5;
> +       __u32   valid;
> +       __u32   padding;
> +       __u64   fh;
> +       __u64   size;
> +       __u64   lock_owner;
> +       __u64   atime;
> +       __u64   mtime;
> +       __u64   ctime;
> +       __u32   atimensec;
> +       __u32   mtimensec;
> +       __u32   ctimensec;
> +       __u32   mode;
> +       __u32   unused4;
> +       __u32   uid;
> +       __u32   gid;
> +       __u32   unused5;
>  };
>
>  struct fuse_open_in {
> -       uint32_t        flags;
> -       uint32_t        unused;
> +       __u32   flags;
> +       __u32   unused;
>  };
>
>  struct fuse_create_in {
> -       uint32_t        flags;
> -       uint32_t        mode;
> -       uint32_t        umask;
> -       uint32_t        padding;
> +       __u32   flags;
> +       __u32   mode;
> +       __u32   umask;
> +       __u32   padding;
>  };
>
>  struct fuse_open_out {
> -       uint64_t        fh;
> -       uint32_t        open_flags;
> -       uint32_t        padding;
> +       __u64   fh;
> +       __u32   open_flags;
> +       __u32   padding;
>  };
>
>  struct fuse_release_in {
> -       uint64_t        fh;
> -       uint32_t        flags;
> -       uint32_t        release_flags;
> -       uint64_t        lock_owner;
> +       __u64   fh;
> +       __u32   flags;
> +       __u32   release_flags;
> +       __u64   lock_owner;
>  };
>
>  struct fuse_flush_in {
> -       uint64_t        fh;
> -       uint32_t        unused;
> -       uint32_t        padding;
> -       uint64_t        lock_owner;
> +       __u64   fh;
> +       __u32   unused;
> +       __u32   padding;
> +       __u64   lock_owner;
>  };
>
>  struct fuse_read_in {
> -       uint64_t        fh;
> -       uint64_t        offset;
> -       uint32_t        size;
> -       uint32_t        read_flags;
> -       uint64_t        lock_owner;
> -       uint32_t        flags;
> -       uint32_t        padding;
> +       __u64   fh;
> +       __u64   offset;
> +       __u32   size;
> +       __u32   read_flags;
> +       __u64   lock_owner;
> +       __u32   flags;
> +       __u32   padding;
>  };
>
>  #define FUSE_COMPAT_WRITE_IN_SIZE 24
>
>  struct fuse_write_in {
> -       uint64_t        fh;
> -       uint64_t        offset;
> -       uint32_t        size;
> -       uint32_t        write_flags;
> -       uint64_t        lock_owner;
> -       uint32_t        flags;
> -       uint32_t        padding;
> +       __u64   fh;
> +       __u64   offset;
> +       __u32   size;
> +       __u32   write_flags;
> +       __u64   lock_owner;
> +       __u32   flags;
> +       __u32   padding;
>  };
>
>  struct fuse_write_out {
> -       uint32_t        size;
> -       uint32_t        padding;
> +       __u32   size;
> +       __u32   padding;
>  };
>
>  #define FUSE_COMPAT_STATFS_SIZE 48
> @@ -540,32 +536,32 @@ struct fuse_statfs_out {
>  };
>
>  struct fuse_fsync_in {
> -       uint64_t        fh;
> -       uint32_t        fsync_flags;
> -       uint32_t        padding;
> +       __u64   fh;
> +       __u32   fsync_flags;
> +       __u32   padding;
>  };
>
>  struct fuse_setxattr_in {
> -       uint32_t        size;
> -       uint32_t        flags;
> +       __u32   size;
> +       __u32   flags;
>  };
>
>  struct fuse_getxattr_in {
> -       uint32_t        size;
> -       uint32_t        padding;
> +       __u32   size;
> +       __u32   padding;
>  };
>
>  struct fuse_getxattr_out {
> -       uint32_t        size;
> -       uint32_t        padding;
> +       __u32   size;
> +       __u32   padding;
>  };
>
>  struct fuse_lk_in {
> -       uint64_t        fh;
> -       uint64_t        owner;
> +       __u64   fh;
> +       __u64   owner;
>         struct fuse_file_lock lk;
> -       uint32_t        lk_flags;
> -       uint32_t        padding;
> +       __u32   lk_flags;
> +       __u32   padding;
>  };
>
>  struct fuse_lk_out {
> @@ -573,140 +569,140 @@ struct fuse_lk_out {
>  };
>
>  struct fuse_access_in {
> -       uint32_t        mask;
> -       uint32_t        padding;
> +       __u32   mask;
> +       __u32   padding;
>  };
>
>  struct fuse_init_in {
> -       uint32_t        major;
> -       uint32_t        minor;
> -       uint32_t        max_readahead;
> -       uint32_t        flags;
> +       __u32   major;
> +       __u32   minor;
> +       __u32   max_readahead;
> +       __u32   flags;
>  };
>
>  #define FUSE_COMPAT_INIT_OUT_SIZE 8
>  #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
>
>  struct fuse_init_out {
> -       uint32_t        major;
> -       uint32_t        minor;
> -       uint32_t        max_readahead;
> -       uint32_t        flags;
> -       uint16_t        max_background;
> -       uint16_t        congestion_threshold;
> -       uint32_t        max_write;
> -       uint32_t        time_gran;
> -       uint32_t        unused[9];
> +       __u32   major;
> +       __u32   minor;
> +       __u32   max_readahead;
> +       __u32   flags;
> +       __u16   max_background;
> +       __u16   congestion_threshold;
> +       __u32   max_write;
> +       __u32   time_gran;
> +       __u32   unused[9];
>  };
>
>  #define CUSE_INIT_INFO_MAX 4096
>
>  struct cuse_init_in {
> -       uint32_t        major;
> -       uint32_t        minor;
> -       uint32_t        unused;
> -       uint32_t        flags;
> +       __u32   major;
> +       __u32   minor;
> +       __u32   unused;
> +       __u32   flags;
>  };
>
>  struct cuse_init_out {
> -       uint32_t        major;
> -       uint32_t        minor;
> -       uint32_t        unused;
> -       uint32_t        flags;
> -       uint32_t        max_read;
> -       uint32_t        max_write;
> -       uint32_t        dev_major;              /* chardev major */
> -       uint32_t        dev_minor;              /* chardev minor */
> -       uint32_t        spare[10];
> +       __u32   major;
> +       __u32   minor;
> +       __u32   unused;
> +       __u32   flags;
> +       __u32   max_read;
> +       __u32   max_write;
> +       __u32   dev_major;              /* chardev major */
> +       __u32   dev_minor;              /* chardev minor */
> +       __u32   spare[10];
>  };
>
>  struct fuse_interrupt_in {
> -       uint64_t        unique;
> +       __u64   unique;
>  };
>
>  struct fuse_bmap_in {
> -       uint64_t        block;
> -       uint32_t        blocksize;
> -       uint32_t        padding;
> +       __u64   block;
> +       __u32   blocksize;
> +       __u32   padding;
>  };
>
>  struct fuse_bmap_out {
> -       uint64_t        block;
> +       __u64   block;
>  };
>
>  struct fuse_ioctl_in {
> -       uint64_t        fh;
> -       uint32_t        flags;
> -       uint32_t        cmd;
> -       uint64_t        arg;
> -       uint32_t        in_size;
> -       uint32_t        out_size;
> +       __u64   fh;
> +       __u32   flags;
> +       __u32   cmd;
> +       __u64   arg;
> +       __u32   in_size;
> +       __u32   out_size;
>  };
>
>  struct fuse_ioctl_iovec {
> -       uint64_t        base;
> -       uint64_t        len;
> +       __u64   base;
> +       __u64   len;
>  };
>
>  struct fuse_ioctl_out {
> -       int32_t         result;
> -       uint32_t        flags;
> -       uint32_t        in_iovs;
> -       uint32_t        out_iovs;
> +       __s32           result;
> +       __u32   flags;
> +       __u32   in_iovs;
> +       __u32   out_iovs;
>  };
>
>  struct fuse_poll_in {
> -       uint64_t        fh;
> -       uint64_t        kh;
> -       uint32_t        flags;
> -       uint32_t        events;
> +       __u64   fh;
> +       __u64   kh;
> +       __u32   flags;
> +       __u32   events;
>  };
>
>  struct fuse_poll_out {
> -       uint32_t        revents;
> -       uint32_t        padding;
> +       __u32   revents;
> +       __u32   padding;
>  };
>
>  struct fuse_notify_poll_wakeup_out {
> -       uint64_t        kh;
> +       __u64   kh;
>  };
>
>  struct fuse_fallocate_in {
> -       uint64_t        fh;
> -       uint64_t        offset;
> -       uint64_t        length;
> -       uint32_t        mode;
> -       uint32_t        padding;
> +       __u64   fh;
> +       __u64   offset;
> +       __u64   length;
> +       __u32   mode;
> +       __u32   padding;
>  };
>
>  struct fuse_in_header {
> -       uint32_t        len;
> -       uint32_t        opcode;
> -       uint64_t        unique;
> -       uint64_t        nodeid;
> -       uint32_t        uid;
> -       uint32_t        gid;
> -       uint32_t        pid;
> -       uint32_t        padding;
> +       __u32   len;
> +       __u32   opcode;
> +       __u64   unique;
> +       __u64   nodeid;
> +       __u32   uid;
> +       __u32   gid;
> +       __u32   pid;
> +       __u32   padding;
>  };
>
>  struct fuse_out_header {
> -       uint32_t        len;
> -       int32_t         error;
> -       uint64_t        unique;
> +       __u32   len;
> +       __s32           error;
> +       __u64   unique;
>  };
>
>  struct fuse_dirent {
> -       uint64_t        ino;
> -       uint64_t        off;
> -       uint32_t        namelen;
> -       uint32_t        type;
> +       __u64   ino;
> +       __u64   off;
> +       __u32   namelen;
> +       __u32   type;
>         char name[];
>  };
>
>  #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
>  #define FUSE_DIRENT_ALIGN(x) \
> -       (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
> +       (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
>  #define FUSE_DIRENT_SIZE(d) \
>         FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
>
> @@ -721,61 +717,61 @@ struct fuse_direntplus {
>         FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
>
>  struct fuse_notify_inval_inode_out {
> -       uint64_t        ino;
> -       int64_t         off;
> -       int64_t         len;
> +       __u64   ino;
> +       __s64           off;
> +       __s64           len;
>  };
>
>  struct fuse_notify_inval_entry_out {
> -       uint64_t        parent;
> -       uint32_t        namelen;
> -       uint32_t        padding;
> +       __u64   parent;
> +       __u32   namelen;
> +       __u32   padding;
>  };
>
>  struct fuse_notify_delete_out {
> -       uint64_t        parent;
> -       uint64_t        child;
> -       uint32_t        namelen;
> -       uint32_t        padding;
> +       __u64   parent;
> +       __u64   child;
> +       __u32   namelen;
> +       __u32   padding;
>  };
>
>  struct fuse_notify_store_out {
> -       uint64_t        nodeid;
> -       uint64_t        offset;
> -       uint32_t        size;
> -       uint32_t        padding;
> +       __u64   nodeid;
> +       __u64   offset;
> +       __u32   size;
> +       __u32   padding;
>  };
>
>  struct fuse_notify_retrieve_out {
> -       uint64_t        notify_unique;
> -       uint64_t        nodeid;
> -       uint64_t        offset;
> -       uint32_t        size;
> -       uint32_t        padding;
> +       __u64   notify_unique;
> +       __u64   nodeid;
> +       __u64   offset;
> +       __u32   size;
> +       __u32   padding;
>  };
>
>  /* Matches the size of fuse_write_in */
>  struct fuse_notify_retrieve_in {
> -       uint64_t        dummy1;
> -       uint64_t        offset;
> -       uint32_t        size;
> -       uint32_t        dummy2;
> -       uint64_t        dummy3;
> -       uint64_t        dummy4;
> +       __u64   dummy1;
> +       __u64   offset;
> +       __u32   size;
> +       __u32   dummy2;
> +       __u64   dummy3;
> +       __u64   dummy4;
>  };
>
>  /* Device ioctls: */
> -#define FUSE_DEV_IOC_CLONE     _IOR(229, 0, uint32_t)
> +#define FUSE_DEV_IOC_CLONE     _IOR(229, 0, __u32)
>
>  struct fuse_lseek_in {
> -       uint64_t        fh;
> -       uint64_t        offset;
> -       uint32_t        whence;
> -       uint32_t        padding;
> +       __u64   fh;
> +       __u64   offset;
> +       __u32   whence;
> +       __u32   padding;
>  };
>
>  struct fuse_lseek_out {
> -       uint64_t        offset;
> +       __u64   offset;
>  };
>
>  #endif /* _LINUX_FUSE_H */
> --
> 2.8.1
>

[toc] | [prev] | [next] | [standalone]


#1468355 — Re: [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-23 09:50 +0200
SubjectRe: [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace
Message-ID<s9eD7-UA-17@gated-at.bofh.it>
In reply to#1468336
On Tue, Aug 23, 2016 at 09:16:22AM +0200, Miklos Szeredi wrote:
> On Mon, Aug 22, 2016 at 8:33 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> > Kernel headers should not use stdint.h.
> >
> 
> NACK.
> 
> This header is used by more than one OS.   Having a different version
> for different OS's makes no sense, hence the choice of stdint.  We've
> been over this many times.  I'll do a patch with a big fat warning at
> the top of this header so that people don't spend time doing this
> useless conversion over and over again.

Yes, saw this coming. drm developers have the same problem.

Is there some way to define which kernel uapi headers are allowed to use
stdint.h definitions in userspace and which not?

-Mikko

[toc] | [prev] | [next] | [standalone]


#1467993 — [PATCH v05 67/72] uapi uio.h: glibc sys/uio.h header file compatibility fixes

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:30 +0200
Subject[PATCH v05 67/72] uapi uio.h: glibc sys/uio.h header file compatibility fixes
Message-ID<s9350-22o-39@gated-at.bofh.it>
In reply to#1467924
Fixes this userspace compile error when glibc sys/uio.h is included
before linux/uio.h:

linux/uio.h:16:8: error: redefinition of ‘struct iovec’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/libc-compat.h | 10 ++++++++++
 include/uapi/linux/uio.h         |  4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 8a5a7cc..f793b09 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -180,6 +180,13 @@
 
 #endif /* defined(__NETIPX_IPX_H) */
 
+/* Definitions for sys/uio.h */
+#if defined(_SYS_UIO_H)
+#define __UAPI_DEF_IOVEC		0
+#else /* defined(_SYS_UIO_H) */
+#define __UAPI_DEF_IOVEC		1
+#endif /* defined(_SYS_UIO_H) */
+
 /* Definitions for xattr.h */
 #if defined(_SYS_XATTR_H)
 #define __UAPI_DEF_XATTR		0
@@ -235,6 +242,9 @@
 #define __UAPI_DEF_IPX_CONFIG_DATA		1
 #define __UAPI_DEF_IPX_ROUTE_DEF		1
 
+/* Definitions for uio.h */
+#define __UAPI_DEF_IOVEC		1
+
 /* Definitions for xattr.h */
 #define __UAPI_DEF_XATTR		1
 
diff --git a/include/uapi/linux/uio.h b/include/uapi/linux/uio.h
index 2731d56..cba4819 100644
--- a/include/uapi/linux/uio.h
+++ b/include/uapi/linux/uio.h
@@ -9,15 +9,17 @@
 #ifndef _UAPI__LINUX_UIO_H
 #define _UAPI__LINUX_UIO_H
 
+#include <linux/libc-compat.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
 
-
+#if __UAPI_DEF_IOVEC
 struct iovec
 {
 	void __user *iov_base;	/* BSD uses caddr_t (1003.1g requires void *) */
 	__kernel_size_t iov_len; /* Must be size_t (1003.1g) */
 };
+#endif /* __UAPI_DEF_IOVEC */
 
 /*
  *	UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1467997 — [PATCH v05 59/72] include/uapi/linux/errqueue.h: include time.h in userspace

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2016-08-22 21:40 +0200
Subject[PATCH v05 59/72] include/uapi/linux/errqueue.h: include time.h in userspace
Message-ID<s93eG-26x-29@gated-at.bofh.it>
In reply to#1467924
linux/time.h conflicts with userspace header time.h. Try to be compatible
for kernel and userspace.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/errqueue.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
index 6b1cdc6..b310b2c 100644
--- a/include/uapi/linux/errqueue.h
+++ b/include/uapi/linux/errqueue.h
@@ -2,7 +2,12 @@
 #define _UAPI_LINUX_ERRQUEUE_H
 
 #include <linux/types.h>
+
+#ifdef __KERNEL__
 #include <linux/time.h>
+#else
+#include <time.h>
+#endif /* __KERNEL__ */
 
 struct sock_extended_err {
 	__u32	ee_errno;	
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →

Back to top | Article view | linux.kernel


csiph-web