From: Mikko Rapeli <mikko.rapeli@iki.fi>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: linux-api@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Maling list - DRI developers <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v4 04/79] drm_mode.h: use __u32 and __u64 from linux/types.h
Date: Thu, 15 Oct 2015 16:48:44 +0300 [thread overview]
Message-ID: <20151015134844.GY6104@lakka.kapsi.fi> (raw)
In-Reply-To: <CADnq5_N5LK4Dy1okY7G6jPNB68PN2ijpwv=bt2bBC0FPGASoSQ@mail.gmail.com>
On Thu, Oct 15, 2015 at 09:32:10AM -0400, Alex Deucher wrote:
> On Thu, Oct 15, 2015 at 1:55 AM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> > Fixes userspace compilation error:
> >
> > drm/drm_mode.h:472:2: error: unknown type name ‘uint32_t’
> >
> > Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
>
> NACK on all these type conversions. This has not been a problem for
> years and years and the result looks terrible.
Documentation/CodingStyle, section 5
(e) Types safe for use in userspace.
In certain structures which are visible to userspace, we cannot
require C99 types and cannot use the 'u32' form above. Thus, we
use __u32 and similar types in all structures which are shared
with userspace.
I have only been looking at kernel headers from userspace occationally in
the past 10 years and had a several cases where the provided headers did
not compile when included into trivial programs trying to use the structs
for an ioctl() for example. This long lasting problem triggered me to write
a test for this and provide these fixes too. In previous reviews usage
of <stdint.h> and its types in kernel headers was already NACK'ed
so I changed several places from uint32_t's to __u32.
With these changes it is btw trivial now to add a grep test the there
are no uint32_t's in include/uapi/ anymore, thus enforcing that coding style
rule.
-Mikko
> Alex
>
> > ---
> > include/uapi/drm/drm_mode.h | 16 ++++++++--------
> > 1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> > index 359107a..0ed8d9d 100644
> > --- a/include/uapi/drm/drm_mode.h
> > +++ b/include/uapi/drm/drm_mode.h
> > @@ -508,14 +508,14 @@ struct drm_mode_crtc_page_flip {
> >
> > /* create a dumb scanout buffer */
> > struct drm_mode_create_dumb {
> > - uint32_t height;
> > - uint32_t width;
> > - uint32_t bpp;
> > - uint32_t flags;
> > + __u32 height;
> > + __u32 width;
> > + __u32 bpp;
> > + __u32 flags;
> > /* handle, pitch, size will be returned */
> > - uint32_t handle;
> > - uint32_t pitch;
> > - uint64_t size;
> > + __u32 handle;
> > + __u32 pitch;
> > + __u64 size;
> > };
> >
> > /* set up for mmap of a dumb scanout buffer */
> > @@ -532,7 +532,7 @@ struct drm_mode_map_dumb {
> > };
> >
> > struct drm_mode_destroy_dumb {
> > - uint32_t handle;
> > + __u32 handle;
> > };
> >
> > /* page-flip flags are valid, plus: */
> > --
> > 2.5.0
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-10-15 13:48 UTC|newest]
Thread overview: 116+ 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 03/79] drm.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 04/79] drm_mode.h: use __u32 and __u64 from linux/types.h Mikko Rapeli
[not found] ` <1444888618-4506-5-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 13:32 ` Alex Deucher
2015-10-15 13:48 ` Mikko Rapeli [this message]
[not found] ` <20151015134844.GY6104-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2015-10-21 15:09 ` Emil Velikov
2015-10-21 15:18 ` Alex Deucher
2015-10-21 16:21 ` Emil Velikov
2015-10-21 16:27 ` Alex Deucher
[not found] ` <CADnq5_OgN6tNKSGU-zUdhjNbqK+XRkGXccgxVtz+5092unza4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-21 17:42 ` Emil Velikov
2015-10-15 5:55 ` [PATCH v4 05/79] exynos_drm.h: use " Mikko Rapeli
2015-10-15 16:17 ` Gustavo Padovan
2015-10-15 5:55 ` [PATCH v4 06/79] nouveau_drm.h: use __u32 and " Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 07/79] radeon_drm.h: " Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 08/79] r128_drm.h: include drm/drm.h Mikko Rapeli
2015-10-15 7:43 ` Daniel Vetter
2015-10-15 5:55 ` [PATCH v4 09/79] via_drm.h: don't include non-existing via_drmclient.h Mikko Rapeli
2015-10-21 15:01 ` Emil Velikov
2015-10-15 5:55 ` [PATCH v4 10/79] via_drm.h: move struct via_file_private definition to drivers/gpu/drm/via/via_drv.h Mikko Rapeli
2015-10-21 14:36 ` Emil Velikov
[not found] ` <CACvgo515FB4MSTWdR0dQdvNccYhMMhBD1bgL=heMLfrw7iqdmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-21 15:33 ` Daniel Vetter
[not found] ` <20151021153323.GF16848-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2015-10-21 16:25 ` Emil Velikov
2015-10-15 5:55 ` [PATCH v4 12/79] include/uapi/drm/sis_drm.h: move sis_file_private to drivers/gpu/drm/sis/sis_drv.h Mikko Rapeli
2015-10-21 14:39 ` Emil Velikov
2015-10-21 15:34 ` Daniel Vetter
2015-10-15 5:55 ` [PATCH v4 13/79] drm/i810_drm.h: include drm/drm.h Mikko Rapeli
[not found] ` <1444888618-4506-14-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 7:44 ` Daniel Vetter
2015-10-15 5:55 ` [PATCH v4 14/79] include/uapi/drm/vmwgfx_drm.h: use __s32, __u32 and __u64 from linux/types.h Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 15/79] include/uapi/drm/qxl_drm.h: " Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 16/79] include/uapi/linux/agpgart.h: include stdlib.h in userspace Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 17/79] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP macro Mikko Rapeli
2015-10-15 8:04 ` Takashi Iwai
2015-10-15 5:55 ` [PATCH v4 18/79] dm-log-userspace.h: use __u32, __s32 and __u64 from linux/types.h Mikko Rapeli
[not found] ` <1444888618-4506-19-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 8:09 ` Mike Snitzer
[not found] ` <20151015080950.GA25635-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-15 17:53 ` Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 19/79] hsi_char.h: use __u32 " Mikko Rapeli
2015-10-15 5:55 ` [PATCH v4 20/79] include/uapi/linux/hsi/cs-protocol.h: include linux/time.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 22/79] cld.h: use __u8, __u16, __s16, __u32 and __s64 from linux/types.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 23/79] rds.h: " Mikko Rapeli
[not found] ` <1444888618-4506-24-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 11:06 ` Sowmini Varadhan
[not found] ` <20151015110614.GL948-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-10-15 22:00 ` Mikko Rapeli
2015-10-15 22:21 ` Sowmini Varadhan
[not found] ` <20151015222105.GA12132-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-10-15 22:39 ` Mikko Rapeli
[not found] ` <20151015223911.GH6104-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2015-10-15 23:03 ` Sowmini Varadhan
2015-10-15 5:56 ` [PATCH v4 25/79] scsi_bsg_fc.h: use __u8, __u32 and __u64 " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 26/79] scsi_netlink.h: use __u8, __u16 " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 27/79] scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 28/79] hdspm.h: use __u8, __u32 and __u64 from linux/types.h instead of stdint.h Mikko Rapeli
2015-10-15 8:04 ` Takashi Iwai
2015-10-15 5:56 ` [PATCH v4 30/79] gntdev.h: use __u32 and __u64 from linux/types.h Mikko Rapeli
2015-10-15 10:56 ` [Xen-devel] " David Vrabel
2015-10-15 5:56 ` [PATCH v4 31/79] include/uapi/linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 32/79] include/uapi/asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 33/79] include/uapi/asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 34/79] include/uapi/asm-generic/shmbuf.h: include fixes Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 36/79] include/uapi/asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 37/79] include/uapi/linux/socket.h: include sys/socket.h in userspace Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 38/79] include/uapi/linux/rds.h: include linux/socket.h and linux/types.h Mikko Rapeli
[not found] ` <1444888618-4506-39-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 11:10 ` Sowmini Varadhan
2015-10-15 5:56 ` [PATCH v4 39/79] include/uapi/linux/if_pppox.h: include linux/if.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 40/79] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 41/79] include/uapi/linux/ipv6_route.h: include linux/in6.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 42/79] " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 43/79] include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 44/79] include/uapi/linux/if_pppox.h: " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 45/79] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ definition to hdlc/ioctl.h Mikko Rapeli
[not found] ` <1444888618-4506-46-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 8:49 ` Frans Klaver
[not found] ` <CAH6sp9Pc48Qfux9K68rCRvfBUhEpxqM9k43Nn2vCpKh4Ewa+QQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-15 18:08 ` Mikko Rapeli
[not found] ` <20151015180850.GC6104-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2015-10-15 18:11 ` [PATCH] " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 46/79] include/uapi/linux/packet_diag.h: include linux/netdevice.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 47/79] include/uapi/linux/llc.h: include linux/if.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 49/79] include/uapi/linux/mroute.h: include linux/in.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 51/79] include/uapi/linux/ip6_tunnel.h: include linux/if.h and linux/in6.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 52/79] include/uapi/netfilter/*.h: fix include files for compilation Mikko Rapeli
2015-11-23 16:55 ` Pablo Neira Ayuso
2015-10-15 5:56 ` [PATCH v4 53/79] include/uapi/linux/errqueue.h: include linux/time.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 58/79] include/uapi/linux/target_core_user.h: use __u8, __u16, __u32 and __u64 from linux/types.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 60/79] include/uapi/linux/atm_zatm.h: include linux/time.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 61/79] include/uapi/linux/scc.h: include linux/sockios.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 62/79] include/uapi/linux/btrfs.h: define NULL Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 64/79] include/uapi/linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 65/79] include/uapi/linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 66/79] include/uapi/linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 67/79] include/uapi/linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 69/79] include/uapi/linux/dvb/video.h: remove stdint.h include Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 71/79] include/uapi/linux/fuse.h: use linux/types.h also in userspace Mikko Rapeli
[not found] ` <1444888618-4506-72-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 15:20 ` Miklos Szeredi
[not found] ` <CAJfpegv2P0=FCsqriYteyZQ9Ldu4DE1JfNs=URW7Cd-9fpA=oQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-15 17:41 ` Mikko Rapeli
[not found] ` <20151015174154.GZ6104-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2015-10-15 18:32 ` Miklos Szeredi
[not found] ` <CAJfpegtSK-ttDXN+vz+yzsU9P1m7fDCn2VwXfHyJuWL6-O-g3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-15 18:59 ` Arnd Bergmann
2015-10-15 19:25 ` Miklos Szeredi
[not found] ` <CAJfpegtYhwMW7vBPXG02fuijfsv3cGCwe9z=LWE56jKqvJwDMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-15 21:03 ` Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 75/79] include/uapi/xen/privcmd.h: fix compilation " Mikko Rapeli
[not found] ` <1444888618-4506-76-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 10:07 ` kbuild test robot
2015-10-15 10:29 ` David Vrabel
2015-10-15 11:18 ` Mikko Rapeli
[not found] ` <20151015111801.GW6104-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2015-10-15 11:24 ` David Vrabel
[not found] ` <561F8CF7.9070102-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2015-10-15 11:35 ` Mikko Rapeli
[not found] ` <1444888618-4506-1-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 5:55 ` [PATCH v4 11/79] savage_drm.h: include <drm/drm.h> Mikko Rapeli
[not found] ` <1444888618-4506-12-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-10-15 6:44 ` Daniel Vetter
2015-10-15 5:55 ` [PATCH v4 21/79] ebtables.h: use __u64 from linux/types.h Mikko Rapeli
2015-11-23 16:55 ` Pablo Neira Ayuso
2015-10-15 5:56 ` [PATCH v4 24/79] sctp.h: use __u8 and __u32 " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 29/79] gntalloc.h: use __u16, __u32 and __u64 " Mikko Rapeli
2015-10-15 10:55 ` [Xen-devel] " David Vrabel
2015-10-15 5:56 ` [PATCH v4 35/79] asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 48/79] include/uapi/linux/mqueue.h: include linux/types.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 50/79] include/uapi/linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 54/79] include/uapi/asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 56/79] include/uapi/linux/auto_fs.h: include linux/limits.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 57/79] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 59/79] include/uapi/linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 63/79] include/uapi/linux/kexec.h: " Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 70/79] include/uapi/mtd/mtd-user.h: remove stdint.h include Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 76/79] coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 77/79] include/uapi/linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli
2015-10-15 5:56 ` [PATCH v4 78/79] include/uapi/linux/errqueue.h: include time.h in userspace 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=20151015134844.GY6104@lakka.kapsi.fi \
--to=mikko.rapeli@iki.fi \
--cc=alexdeucher@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).