All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 15:54 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau, dri-devel, virtualization, dhowells,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-arm-msm, Coly Li, linux-bcache, Jaroslav Kysela,
	Jan Harkes, Michal Marek, Takashi Iwai, linux-kernel, Rob Clark,
	netfilter-devel, linux-fsdevel, freedreno


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).  All but the final patch perform fixups,
including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Replace usage of u32 and co. with __u32 and co.

 (6) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (7) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Don't use internal kernel structs in UAPI
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: sound: Fix use of u32 and co. in UAPI headers
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |    4 +
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   20 ++-
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   21 ++--
 include/uapi/linux/virtio_net.h                   |    7 +
 include/uapi/sound/skl-tplg-interface.h           |  106 +++++++++---------
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 14 files changed, 255 insertions(+), 84 deletions(-)
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 15:54 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, Masahiro Yamada,
	keyrings-u79uwXL29TY76Z2rM5mHXA, Ryusuke Konishi,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, Takashi Iwai, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Rob Clark


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).  All but the final patch perform fixups,
including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Replace usage of u32 and co. with __u32 and co.

 (6) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (7) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Don't use internal kernel structs in UAPI
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: sound: Fix use of u32 and co. in UAPI headers
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |    4 +
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   20 ++-
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   21 ++--
 include/uapi/linux/virtio_net.h                   |    7 +
 include/uapi/sound/skl-tplg-interface.h           |  106 +++++++++---------
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 14 files changed, 255 insertions(+), 84 deletions(-)
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 15:54 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, Masahiro Yamada,
	keyrings-u79uwXL29TY76Z2rM5mHXA, Ryusuke Konishi,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, Takashi Iwai, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Rob Clark


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).  All but the final patch perform fixups,
including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Replace usage of u32 and co. with __u32 and co.

 (6) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (7) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Don't use internal kernel structs in UAPI
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: sound: Fix use of u32 and co. in UAPI headers
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |    4 +
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   20 ++-
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   21 ++--
 include/uapi/linux/virtio_net.h                   |    7 +
 include/uapi/sound/skl-tplg-interface.h           |  106 +++++++++---------
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 14 files changed, 255 insertions(+), 84 deletions(-)
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 15:54 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Michal Marek, dri-devel, virtualization, keyrings, David Airlie,
	linux-nilfs, linux-nvdimm, Michael S. Tsirkin, codalist, coda,
	coreteam, Rob Clark, linux-arm-msm, Kent Overstreet,
	Dan Williams, Takashi Iwai, linux-bcache, Coly Li,
	Jaroslav Kysela, Jan Harkes, Masahiro Yamada, Ryusuke Konishi,
	Jason Wang, Mat Martineau, netfilter-devel, linux-fsdevel,
	moderated for non-subscribers, freedreno, linux-kernel, dhowells


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).  All but the final patch perform fixups,
including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Replace usage of u32 and co. with __u32 and co.

 (6) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (7) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Don't use internal kernel structs in UAPI
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: sound: Fix use of u32 and co. in UAPI headers
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |    4 +
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   20 ++-
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   21 ++--
 include/uapi/linux/virtio_net.h                   |    7 +
 include/uapi/sound/skl-tplg-interface.h           |  106 +++++++++---------
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 14 files changed, 255 insertions(+), 84 deletions(-)
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 15:54 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, Masahiro Yamada,
	keyrings-u79uwXL29TY76Z2rM5mHXA, Ryusuke Konishi,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, Takashi Iwai, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Rob Clark


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).  All but the final patch perform fixups,
including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Replace usage of u32 and co. with __u32 and co.

 (6) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (7) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Don't use internal kernel structs in UAPI
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: sound: Fix use of u32 and co. in UAPI headers
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |    4 +
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   20 ++-
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   21 ++--
 include/uapi/linux/virtio_net.h                   |    7 +
 include/uapi/sound/skl-tplg-interface.h           |  106 +++++++++---------
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 14 files changed, 255 insertions(+), 84 deletions(-)
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 01/11] UAPI: drm: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` David Howells
@ 2018-09-05 15:54   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: David Airlie, linux-arm-msm, linux-kernel, dri-devel, dhowells,
	freedreno

The i810 and msm drm drivers use C++ keywords as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Rob Clark <robdclark@gmail.com>
cc: David Airlie <airlied@linux.ie>
cc: linux-arm-msm@vger.kernel.org
cc: dri-devel@lists.freedesktop.org
cc: freedreno@lists.freedesktop.org
---

 include/uapi/drm/i810_drm.h |    7 ++++++-
 include/uapi/drm/msm_drm.h  |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/uapi/drm/i810_drm.h b/include/uapi/drm/i810_drm.h
index d285d5e72e6a..617d79ec3fc5 100644
--- a/include/uapi/drm/i810_drm.h
+++ b/include/uapi/drm/i810_drm.h
@@ -266,7 +266,12 @@ typedef struct _drm_i810_copy_t {
 #define PR_MASK              (0x7<<18)
 
 typedef struct drm_i810_dma {
-	void *virtual;
+	union {
+#ifndef __cplusplus
+		void *virtual;
+#endif
+		void *_virtual;
+	};
 	int request_idx;
 	int request_size;
 	int granted;
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index c06d0a5bdd80..e99bab72d58c 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -148,7 +148,12 @@ struct drm_msm_gem_cpu_fini {
  */
 struct drm_msm_gem_submit_reloc {
 	__u32 submit_offset;  /* in, offset from submit_bo */
-	__u32 or;             /* in, value OR'd with result */
+	union {
+#ifndef __cplusplus
+		__u32 or;	/* in, value OR'd with result */
+#endif
+		__u32 _or;	/* in, value OR'd with result */
+	};
 	__s32 shift;          /* in, amount of left shift (can be negative) */
 	__u32 reloc_idx;      /* in, index of reloc_bo buffer */
 	__u64 reloc_offset;   /* in, offset from start of reloc_bo */

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 01/11] UAPI: drm: Fix use of C++ keywords as structural members
@ 2018-09-05 15:54   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Rob Clark, David Airlie, linux-arm-msm, dri-devel, freedreno,
	linux-kernel, dhowells

The i810 and msm drm drivers use C++ keywords as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Rob Clark <robdclark@gmail.com>
cc: David Airlie <airlied@linux.ie>
cc: linux-arm-msm@vger.kernel.org
cc: dri-devel@lists.freedesktop.org
cc: freedreno@lists.freedesktop.org
---

 include/uapi/drm/i810_drm.h |    7 ++++++-
 include/uapi/drm/msm_drm.h  |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/uapi/drm/i810_drm.h b/include/uapi/drm/i810_drm.h
index d285d5e72e6a..617d79ec3fc5 100644
--- a/include/uapi/drm/i810_drm.h
+++ b/include/uapi/drm/i810_drm.h
@@ -266,7 +266,12 @@ typedef struct _drm_i810_copy_t {
 #define PR_MASK              (0x7<<18)
 
 typedef struct drm_i810_dma {
-	void *virtual;
+	union {
+#ifndef __cplusplus
+		void *virtual;
+#endif
+		void *_virtual;
+	};
 	int request_idx;
 	int request_size;
 	int granted;
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index c06d0a5bdd80..e99bab72d58c 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -148,7 +148,12 @@ struct drm_msm_gem_cpu_fini {
  */
 struct drm_msm_gem_submit_reloc {
 	__u32 submit_offset;  /* in, offset from submit_bo */
-	__u32 or;             /* in, value OR'd with result */
+	union {
+#ifndef __cplusplus
+		__u32 or;	/* in, value OR'd with result */
+#endif
+		__u32 _or;	/* in, value OR'd with result */
+	};
 	__s32 shift;          /* in, amount of left shift (can be negative) */
 	__u32 reloc_idx;      /* in, index of reloc_bo buffer */
 	__u64 reloc_offset;   /* in, offset from start of reloc_bo */


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 02/11] UAPI: keys: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` David Howells
@ 2018-09-05 15:54   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: Mat Martineau, keyrings, linux-kernel, dhowells

The keyctl_dh_params struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
cc: keyrings@vger.kernel.org
---

 include/uapi/linux/keyctl.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
index 7b8c9e19bad1..170f015d1f25 100644
--- a/include/uapi/linux/keyctl.h
+++ b/include/uapi/linux/keyctl.h
@@ -65,7 +65,12 @@
 
 /* keyctl structures */
 struct keyctl_dh_params {
-	__s32 private;
+	union {
+#ifndef __cplusplus
+		__s32 private;
+#endif
+		__s32 dh_private;
+	};
 	__s32 prime;
 	__s32 base;
 };

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 02/11] UAPI: keys: Fix use of C++ keywords as structural members
@ 2018-09-05 15:54   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: Mat Martineau, keyrings, linux-kernel, dhowells

The keyctl_dh_params struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
cc: keyrings@vger.kernel.org
---

 include/uapi/linux/keyctl.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
index 7b8c9e19bad1..170f015d1f25 100644
--- a/include/uapi/linux/keyctl.h
+++ b/include/uapi/linux/keyctl.h
@@ -65,7 +65,12 @@
 
 /* keyctl structures */
 struct keyctl_dh_params {
-	__s32 private;
+	union {
+#ifndef __cplusplus
+		__s32 private;
+#endif
+		__s32 dh_private;
+	};
 	__s32 prime;
 	__s32 base;
 };


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` David Howells
                   ` (5 preceding siblings ...)
  (?)
@ 2018-09-05 15:54 ` David Howells
  2018-09-05 16:54   ` Greg KH
                     ` (7 more replies)
  -1 siblings, 8 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Michael S. Tsirkin, Jason Wang, virtualization, linux-kernel, dhowells

The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: "Michael S. Tsirkin" <mst@redhat.com>
cc: Jason Wang <jasowang@redhat.com>
cc: virtualization@lists.linux-foundation.org
---

 include/uapi/linux/virtio_net.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index a3715a3224c1..967142bc0e05 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
  * command goes in between.
  */
 struct virtio_net_ctrl_hdr {
-	__u8 class;
+	union {
+#ifndef __cplusplus
+		__u8 class;
+#endif
+		__u8 _class;
+	};
 	__u8 cmd;
 } __attribute__((packed));
 


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` David Howells
                   ` (6 preceding siblings ...)
  (?)
@ 2018-09-05 15:54 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: dhowells, virtualization, linux-kernel, Michael S. Tsirkin

The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: "Michael S. Tsirkin" <mst@redhat.com>
cc: Jason Wang <jasowang@redhat.com>
cc: virtualization@lists.linux-foundation.org
---

 include/uapi/linux/virtio_net.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index a3715a3224c1..967142bc0e05 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
  * command goes in between.
  */
 struct virtio_net_ctrl_hdr {
-	__u8 class;
+	union {
+#ifndef __cplusplus
+		__u8 class;
+#endif
+		__u8 _class;
+	};
 	__u8 cmd;
 } __attribute__((packed));

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array
  2018-09-05 15:54 ` David Howells
                   ` (7 preceding siblings ...)
  (?)
@ 2018-09-05 15:55 ` David Howells
  2018-10-02 14:52   ` Jan Engelhardt
  2018-10-09 15:41   ` David Howells
  -1 siblings, 2 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Coly Li, Kent Overstreet, linux-bcache, linux-kernel, dhowells

The bkey struct defined by bcache is embedded in the jset struct.  However,
this is illegal in C++ as there's a "flexible array" at the end of the
struct.  Change this to be a 0-length struct instead.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Coly Li <colyli@suse.de>
cc: Kent Overstreet <kent.overstreet@gmail.com>
cc: linux-bcache@vger.kernel.org
---

 include/uapi/linux/bcache.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 5d4f58e059fd..11863e903bff 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -23,7 +23,7 @@ static inline void SET_##name(type *k, __u64 v)			\
 struct bkey {
 	__u64	high;
 	__u64	low;
-	__u64	ptr[];
+	__u64	ptr[0];
 };
 
 #define KEY_FIELD(name, field, offset, size)				\


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-05 15:54 ` David Howells
                   ` (8 preceding siblings ...)
  (?)
@ 2018-09-05 15:55 ` David Howells
  2018-09-05 16:54   ` Jan Harkes
                     ` (3 more replies)
  -1 siblings, 4 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Jan Harkes, coda, codalist, linux-fsdevel, linux-kernel, dhowells

The size and layout of internal kernel structures may not be relied upon
outside of the kernel and may even change in a containerised environment if
a container image is frozen and shifted to another machine.

Excise these from Coda's upc_req struct.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jan Harkes <jaharkes@cs.cmu.edu>
cc: coda@cs.cmu.edu
cc: codalist@coda.cs.cmu.edu
cc: linux-fsdevel@vger.kernel.org
---

 include/uapi/linux/coda_psdev.h |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h
index aa6623efd2dd..9c3acde393cd 100644
--- a/include/uapi/linux/coda_psdev.h
+++ b/include/uapi/linux/coda_psdev.h
@@ -10,14 +10,18 @@
 
 /* messages between coda filesystem in kernel and Venus */
 struct upc_req {
+#ifdef __KERNEL__
 	struct list_head    uc_chain;
+#endif
 	caddr_t	            uc_data;
 	u_short	            uc_flags;
 	u_short             uc_inSize;  /* Size is at most 5000 bytes */
 	u_short	            uc_outSize;
 	u_short	            uc_opcode;  /* copied from data to save lookup */
 	int		    uc_unique;
+#ifdef __KERNEL__
 	wait_queue_head_t   uc_sleep;   /* process' wait queue */
+#endif
 };
 
 #define CODA_REQ_ASYNC  0x1


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 06/11] UAPI: netfilter: Fix symbol collision issues
  2018-09-05 15:54 ` David Howells
                   ` (9 preceding siblings ...)
  (?)
@ 2018-09-05 15:55 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: netfilter-devel, coreteam, linux-kernel, dhowells

The netfilter UAPI headers have some symbol collision issues:

 (1) "enum nfnl_acct_msg_types" is defined twice, and each definition is
     completely different.

     Fix this by renaming the one in nfnetlink_cthelper.h to be "enum
     nfnl_cthelper_types" to be consistent with the other things in that
     file.

 (2) There's a disagreement between ipt_ECN.h and ipt_ecn.h over the
     definition of various IPT_ECN_* constants, leading to an error over
     IPT_ECN_IP_MASK being substituted when being defined as an enum value
     in ipt_ecn.h if ipt_ECN.h is #included first.

     Fix this by removing the conflicting constants from ipt_ECN.h and
     including ipt_ecn.h instead.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: netfilter-devel@vger.kernel.org
cc: coreteam@netfilter.org
---

 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 +-
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 +--------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/include/uapi/linux/netfilter/nfnetlink_cthelper.h b/include/uapi/linux/netfilter/nfnetlink_cthelper.h
index a13137afc429..b9313ed0c313 100644
--- a/include/uapi/linux/netfilter/nfnetlink_cthelper.h
+++ b/include/uapi/linux/netfilter/nfnetlink_cthelper.h
@@ -5,7 +5,7 @@
 #define NFCT_HELPER_STATUS_DISABLED	0
 #define NFCT_HELPER_STATUS_ENABLED	1
 
-enum nfnl_acct_msg_types {
+enum nfnl_cthelper_types {
 	NFNL_MSG_CTHELPER_NEW,
 	NFNL_MSG_CTHELPER_GET,
 	NFNL_MSG_CTHELPER_DEL,
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
index e3630fd045b8..d582119ad62a 100644
--- a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
@@ -12,14 +12,7 @@
 
 #include <linux/types.h>
 #include <linux/netfilter/xt_DSCP.h>
-
-#define IPT_ECN_IP_MASK	(~XT_DSCP_MASK)
-
-#define IPT_ECN_OP_SET_IP	0x01	/* set ECN bits of IPv4 header */
-#define IPT_ECN_OP_SET_ECE	0x10	/* set ECE bit of TCP header */
-#define IPT_ECN_OP_SET_CWR	0x20	/* set CWR bit of TCP header */
-
-#define IPT_ECN_OP_MASK		0xce
+#include <linux/netfilter_ipv4/ipt_ecn.h>
 
 struct ipt_ECN_info {
 	__u8 operation;	/* bitset of operations */


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 07/11] UAPI: nilfs2: Fix use of undefined byteswapping functions
  2018-09-05 15:54 ` David Howells
                   ` (10 preceding siblings ...)
  (?)
@ 2018-09-05 15:55 ` David Howells
  2018-09-05 22:20   ` Al Viro
  -1 siblings, 1 reply; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Ryusuke Konishi, linux-nilfs, linux-fsdevel, linux-kernel, dhowells

nilfs2 exports a load of inline functions to userspace that call kernel
byteswapping functions that don't exist in UAPI.  Fix this by making it
#include asm/byteorder.h and use the functions declared there.

A better way is probably to remove these inline functions from the nilfs2
header since they are technically broken.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
cc: linux-nilfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
---

 include/uapi/linux/nilfs2_ondisk.h |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/include/uapi/linux/nilfs2_ondisk.h b/include/uapi/linux/nilfs2_ondisk.h
index a7e66ab11d1d..d3bd2fe08791 100644
--- a/include/uapi/linux/nilfs2_ondisk.h
+++ b/include/uapi/linux/nilfs2_ondisk.h
@@ -29,6 +29,7 @@
 
 #include <linux/types.h>
 #include <linux/magic.h>
+#include <asm/byteorder.h>
 
 
 #define NILFS_INODE_BMAP_SIZE	7
@@ -533,19 +534,19 @@ enum {
 static inline void							\
 nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp)		\
 {									\
-	cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |		\
+	cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) |	\
 				   (1UL << NILFS_CHECKPOINT_##flag));	\
 }									\
 static inline void							\
 nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp)		\
 {									\
-	cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) &		\
+	cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) &	\
 				   ~(1UL << NILFS_CHECKPOINT_##flag));	\
 }									\
 static inline int							\
 nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp)		\
 {									\
-	return !!(le32_to_cpu(cp->cp_flags) &				\
+	return !!(__le32_to_cpu(cp->cp_flags) &				\
 		  (1UL << NILFS_CHECKPOINT_##flag));			\
 }
 
@@ -595,20 +596,20 @@ enum {
 static inline void							\
 nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su)		\
 {									\
-	su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) |		\
+	su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) |	\
 				   (1UL << NILFS_SEGMENT_USAGE_##flag));\
 }									\
 static inline void							\
 nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su)	\
 {									\
 	su->su_flags =							\
-		cpu_to_le32(le32_to_cpu(su->su_flags) &			\
+		__cpu_to_le32(__le32_to_cpu(su->su_flags) &		\
 			    ~(1UL << NILFS_SEGMENT_USAGE_##flag));      \
 }									\
 static inline int							\
 nilfs_segment_usage_##name(const struct nilfs_segment_usage *su)	\
 {									\
-	return !!(le32_to_cpu(su->su_flags) &				\
+	return !!(__le32_to_cpu(su->su_flags) &				\
 		  (1UL << NILFS_SEGMENT_USAGE_##flag));			\
 }
 
@@ -619,15 +620,15 @@ NILFS_SEGMENT_USAGE_FNS(ERROR, error)
 static inline void
 nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su)
 {
-	su->su_lastmod = cpu_to_le64(0);
-	su->su_nblocks = cpu_to_le32(0);
-	su->su_flags = cpu_to_le32(0);
+	su->su_lastmod = __cpu_to_le64(0);
+	su->su_nblocks = __cpu_to_le32(0);
+	su->su_flags = __cpu_to_le32(0);
 }
 
 static inline int
 nilfs_segment_usage_clean(const struct nilfs_segment_usage *su)
 {
-	return !le32_to_cpu(su->su_flags);
+	return !__le32_to_cpu(su->su_flags);
 }
 
 /**


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 08/11] UAPI: sound: Fix use of u32 and co. in UAPI headers
  2018-09-05 15:54 ` David Howells
@ 2018-09-05 15:55   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Jaroslav Kysela, Takashi Iwai, moderated for non-subscribers,
	linux-kernel, dhowells

Fix the use of u32 and co. in UAPI headers as these are not defined.  Switch
to using the __u32-style equivalents instead.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jaroslav Kysela <perex@perex.cz>
cc: Takashi Iwai <tiwai@suse.com>
cc: alsa-devel@alsa-project.org (moderated for non-subscribers)
---

 include/uapi/sound/skl-tplg-interface.h |  106 ++++++++++++++++---------------
 1 file changed, 54 insertions(+), 52 deletions(-)

diff --git a/include/uapi/sound/skl-tplg-interface.h b/include/uapi/sound/skl-tplg-interface.h
index f58cafa42f18..f39352cef382 100644
--- a/include/uapi/sound/skl-tplg-interface.h
+++ b/include/uapi/sound/skl-tplg-interface.h
@@ -10,6 +10,8 @@
 #ifndef __HDA_TPLG_INTERFACE_H__
 #define __HDA_TPLG_INTERFACE_H__
 
+#include <linux/types.h>
+
 /*
  * Default types range from 0~12. type can range from 0 to 0xff
  * SST types start at higher to avoid any overlapping in future
@@ -143,10 +145,10 @@ enum skl_module_param_type {
 };
 
 struct skl_dfw_algo_data {
-	u32 set_params:2;
-	u32 rsvd:30;
-	u32 param_id;
-	u32 max;
+	__u32 set_params:2;
+	__u32 rsvd:30;
+	__u32 param_id;
+	__u32 max;
 	char params[0];
 } __packed;
 
@@ -163,68 +165,68 @@ enum skl_tuple_type {
 /* v4 configuration data */
 
 struct skl_dfw_v4_module_pin {
-	u16 module_id;
-	u16 instance_id;
+	__u16 module_id;
+	__u16 instance_id;
 } __packed;
 
 struct skl_dfw_v4_module_fmt {
-	u32 channels;
-	u32 freq;
-	u32 bit_depth;
-	u32 valid_bit_depth;
-	u32 ch_cfg;
-	u32 interleaving_style;
-	u32 sample_type;
-	u32 ch_map;
+	__u32 channels;
+	__u32 freq;
+	__u32 bit_depth;
+	__u32 valid_bit_depth;
+	__u32 ch_cfg;
+	__u32 interleaving_style;
+	__u32 sample_type;
+	__u32 ch_map;
 } __packed;
 
 struct skl_dfw_v4_module_caps {
-	u32 set_params:2;
-	u32 rsvd:30;
-	u32 param_id;
-	u32 caps_size;
-	u32 caps[HDA_SST_CFG_MAX];
+	__u32 set_params:2;
+	__u32 rsvd:30;
+	__u32 param_id;
+	__u32 caps_size;
+	__u32 caps[HDA_SST_CFG_MAX];
 } __packed;
 
 struct skl_dfw_v4_pipe {
-	u8 pipe_id;
-	u8 pipe_priority;
-	u16 conn_type:4;
-	u16 rsvd:4;
-	u16 memory_pages:8;
+	__u8 pipe_id;
+	__u8 pipe_priority;
+	__u16 conn_type:4;
+	__u16 rsvd:4;
+	__u16 memory_pages:8;
 } __packed;
 
 struct skl_dfw_v4_module {
 	char uuid[SKL_UUID_STR_SZ];
 
-	u16 module_id;
-	u16 instance_id;
-	u32 max_mcps;
-	u32 mem_pages;
-	u32 obs;
-	u32 ibs;
-	u32 vbus_id;
-
-	u32 max_in_queue:8;
-	u32 max_out_queue:8;
-	u32 time_slot:8;
-	u32 core_id:4;
-	u32 rsvd1:4;
-
-	u32 module_type:8;
-	u32 conn_type:4;
-	u32 dev_type:4;
-	u32 hw_conn_type:4;
-	u32 rsvd2:12;
-
-	u32 params_fixup:8;
-	u32 converter:8;
-	u32 input_pin_type:1;
-	u32 output_pin_type:1;
-	u32 is_dynamic_in_pin:1;
-	u32 is_dynamic_out_pin:1;
-	u32 is_loadable:1;
-	u32 rsvd3:11;
+	__u16 module_id;
+	__u16 instance_id;
+	__u32 max_mcps;
+	__u32 mem_pages;
+	__u32 obs;
+	__u32 ibs;
+	__u32 vbus_id;
+
+	__u32 max_in_queue:8;
+	__u32 max_out_queue:8;
+	__u32 time_slot:8;
+	__u32 core_id:4;
+	__u32 rsvd1:4;
+
+	__u32 module_type:8;
+	__u32 conn_type:4;
+	__u32 dev_type:4;
+	__u32 hw_conn_type:4;
+	__u32 rsvd2:12;
+
+	__u32 params_fixup:8;
+	__u32 converter:8;
+	__u32 input_pin_type:1;
+	__u32 output_pin_type:1;
+	__u32 is_dynamic_in_pin:1;
+	__u32 is_dynamic_out_pin:1;
+	__u32 is_loadable:1;
+	__u32 rsvd3:11;
 
 	struct skl_dfw_v4_pipe pipe;
 	struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE];


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 08/11] UAPI: sound: Fix use of u32 and co. in UAPI headers
@ 2018-09-05 15:55   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: dhowells, linux-kernel, moderated for non-subscribers, Takashi Iwai

Fix the use of u32 and co. in UAPI headers as these are not defined.  Switch
to using the __u32-style equivalents instead.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jaroslav Kysela <perex@perex.cz>
cc: Takashi Iwai <tiwai@suse.com>
cc: alsa-devel@alsa-project.org (moderated for non-subscribers)
---

 include/uapi/sound/skl-tplg-interface.h |  106 ++++++++++++++++---------------
 1 file changed, 54 insertions(+), 52 deletions(-)

diff --git a/include/uapi/sound/skl-tplg-interface.h b/include/uapi/sound/skl-tplg-interface.h
index f58cafa42f18..f39352cef382 100644
--- a/include/uapi/sound/skl-tplg-interface.h
+++ b/include/uapi/sound/skl-tplg-interface.h
@@ -10,6 +10,8 @@
 #ifndef __HDA_TPLG_INTERFACE_H__
 #define __HDA_TPLG_INTERFACE_H__
 
+#include <linux/types.h>
+
 /*
  * Default types range from 0~12. type can range from 0 to 0xff
  * SST types start at higher to avoid any overlapping in future
@@ -143,10 +145,10 @@ enum skl_module_param_type {
 };
 
 struct skl_dfw_algo_data {
-	u32 set_params:2;
-	u32 rsvd:30;
-	u32 param_id;
-	u32 max;
+	__u32 set_params:2;
+	__u32 rsvd:30;
+	__u32 param_id;
+	__u32 max;
 	char params[0];
 } __packed;
 
@@ -163,68 +165,68 @@ enum skl_tuple_type {
 /* v4 configuration data */
 
 struct skl_dfw_v4_module_pin {
-	u16 module_id;
-	u16 instance_id;
+	__u16 module_id;
+	__u16 instance_id;
 } __packed;
 
 struct skl_dfw_v4_module_fmt {
-	u32 channels;
-	u32 freq;
-	u32 bit_depth;
-	u32 valid_bit_depth;
-	u32 ch_cfg;
-	u32 interleaving_style;
-	u32 sample_type;
-	u32 ch_map;
+	__u32 channels;
+	__u32 freq;
+	__u32 bit_depth;
+	__u32 valid_bit_depth;
+	__u32 ch_cfg;
+	__u32 interleaving_style;
+	__u32 sample_type;
+	__u32 ch_map;
 } __packed;
 
 struct skl_dfw_v4_module_caps {
-	u32 set_params:2;
-	u32 rsvd:30;
-	u32 param_id;
-	u32 caps_size;
-	u32 caps[HDA_SST_CFG_MAX];
+	__u32 set_params:2;
+	__u32 rsvd:30;
+	__u32 param_id;
+	__u32 caps_size;
+	__u32 caps[HDA_SST_CFG_MAX];
 } __packed;
 
 struct skl_dfw_v4_pipe {
-	u8 pipe_id;
-	u8 pipe_priority;
-	u16 conn_type:4;
-	u16 rsvd:4;
-	u16 memory_pages:8;
+	__u8 pipe_id;
+	__u8 pipe_priority;
+	__u16 conn_type:4;
+	__u16 rsvd:4;
+	__u16 memory_pages:8;
 } __packed;
 
 struct skl_dfw_v4_module {
 	char uuid[SKL_UUID_STR_SZ];
 
-	u16 module_id;
-	u16 instance_id;
-	u32 max_mcps;
-	u32 mem_pages;
-	u32 obs;
-	u32 ibs;
-	u32 vbus_id;
-
-	u32 max_in_queue:8;
-	u32 max_out_queue:8;
-	u32 time_slot:8;
-	u32 core_id:4;
-	u32 rsvd1:4;
-
-	u32 module_type:8;
-	u32 conn_type:4;
-	u32 dev_type:4;
-	u32 hw_conn_type:4;
-	u32 rsvd2:12;
-
-	u32 params_fixup:8;
-	u32 converter:8;
-	u32 input_pin_type:1;
-	u32 output_pin_type:1;
-	u32 is_dynamic_in_pin:1;
-	u32 is_dynamic_out_pin:1;
-	u32 is_loadable:1;
-	u32 rsvd3:11;
+	__u16 module_id;
+	__u16 instance_id;
+	__u32 max_mcps;
+	__u32 mem_pages;
+	__u32 obs;
+	__u32 ibs;
+	__u32 vbus_id;
+
+	__u32 max_in_queue:8;
+	__u32 max_out_queue:8;
+	__u32 time_slot:8;
+	__u32 core_id:4;
+	__u32 rsvd1:4;
+
+	__u32 module_type:8;
+	__u32 conn_type:4;
+	__u32 dev_type:4;
+	__u32 hw_conn_type:4;
+	__u32 rsvd2:12;
+
+	__u32 params_fixup:8;
+	__u32 converter:8;
+	__u32 input_pin_type:1;
+	__u32 output_pin_type:1;
+	__u32 is_dynamic_in_pin:1;
+	__u32 is_dynamic_out_pin:1;
+	__u32 is_loadable:1;
+	__u32 rsvd3:11;
 
 	struct skl_dfw_v4_pipe pipe;
 	struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE];

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers
  2018-09-05 15:54 ` David Howells
  (?)
@ 2018-09-05 15:55   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: dhowells, linux-kernel, linux-nvdimm

The following code in the linux/ndctl header file:

	static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
	{
		static const char * const names[] = {
			[ND_CMD_ARS_CAP] = "ars_cap",
			[ND_CMD_ARS_START] = "ars_start",
			[ND_CMD_ARS_STATUS] = "ars_status",
			[ND_CMD_CLEAR_ERROR] = "clear_error",
			[ND_CMD_CALL] = "cmd_call",
		};

		if (cmd < ARRAY_SIZE(names) && names[cmd])
			return names[cmd];
		return "unknown";
	}

is broken in a number of ways:

 (1) ARRAY_SIZE() is not generally defined.  Fix this by defining a label
     in the enum that indicates the number of commands.

 (2) g++ does not support "non-trivial" array initialisers fully yet.  Fix
     this by defining the missing intermediate values.

 (3) Every file that calls this function will acquire a copy of names[].

The same goes for nvdimm_cmd_name().

A better way would be to remove these functions and their arrays from the
header entirely.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/uapi/linux/ndctl.h |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 7e27070b9440..9c89159f6a0f 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -117,6 +117,7 @@ enum {
 	ND_CMD_VENDOR_EFFECT_LOG = 8,
 	ND_CMD_VENDOR = 9,
 	ND_CMD_CALL = 10,
+	nr__ND_CMD = 11
 };
 
 enum {
@@ -128,22 +129,29 @@ enum {
 
 static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
+	static const char * const names[nr__ND_CMD] = {
+		[0] = NULL,
 		[ND_CMD_ARS_CAP] = "ars_cap",
 		[ND_CMD_ARS_START] = "ars_start",
 		[ND_CMD_ARS_STATUS] = "ars_status",
 		[ND_CMD_CLEAR_ERROR] = "clear_error",
+		[5] = NULL,
+		[6] = NULL,
+		[7] = NULL,
+		[8] = NULL,
+		[9] = NULL,
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
+	if (cmd < nr__ND_CMD && names[cmd])
 		return names[cmd];
 	return "unknown";
 }
 
 static inline const char *nvdimm_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
+	static const char * const names[nr__ND_CMD] = {
+		[0] = NULL,
 		[ND_CMD_SMART] = "smart",
 		[ND_CMD_SMART_THRESHOLD] = "smart_thresh",
 		[ND_CMD_DIMM_FLAGS] = "flags",
@@ -156,7 +164,7 @@ static inline const char *nvdimm_cmd_name(unsigned cmd)
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
+	if (cmd < nr__ND_CMD && names[cmd])
 		return names[cmd];
 	return "unknown";
 }

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers
@ 2018-09-05 15:55   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Dan Williams, linux-nvdimm, linux-kernel, dhowells

The following code in the linux/ndctl header file:

	static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
	{
		static const char * const names[] = {
			[ND_CMD_ARS_CAP] = "ars_cap",
			[ND_CMD_ARS_START] = "ars_start",
			[ND_CMD_ARS_STATUS] = "ars_status",
			[ND_CMD_CLEAR_ERROR] = "clear_error",
			[ND_CMD_CALL] = "cmd_call",
		};

		if (cmd < ARRAY_SIZE(names) && names[cmd])
			return names[cmd];
		return "unknown";
	}

is broken in a number of ways:

 (1) ARRAY_SIZE() is not generally defined.  Fix this by defining a label
     in the enum that indicates the number of commands.

 (2) g++ does not support "non-trivial" array initialisers fully yet.  Fix
     this by defining the missing intermediate values.

 (3) Every file that calls this function will acquire a copy of names[].

The same goes for nvdimm_cmd_name().

A better way would be to remove these functions and their arrays from the
header entirely.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/uapi/linux/ndctl.h |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 7e27070b9440..9c89159f6a0f 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -117,6 +117,7 @@ enum {
 	ND_CMD_VENDOR_EFFECT_LOG = 8,
 	ND_CMD_VENDOR = 9,
 	ND_CMD_CALL = 10,
+	nr__ND_CMD = 11
 };
 
 enum {
@@ -128,22 +129,29 @@ enum {
 
 static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
+	static const char * const names[nr__ND_CMD] = {
+		[0] = NULL,
 		[ND_CMD_ARS_CAP] = "ars_cap",
 		[ND_CMD_ARS_START] = "ars_start",
 		[ND_CMD_ARS_STATUS] = "ars_status",
 		[ND_CMD_CLEAR_ERROR] = "clear_error",
+		[5] = NULL,
+		[6] = NULL,
+		[7] = NULL,
+		[8] = NULL,
+		[9] = NULL,
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
+	if (cmd < nr__ND_CMD && names[cmd])
 		return names[cmd];
 	return "unknown";
 }
 
 static inline const char *nvdimm_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
+	static const char * const names[nr__ND_CMD] = {
+		[0] = NULL,
 		[ND_CMD_SMART] = "smart",
 		[ND_CMD_SMART_THRESHOLD] = "smart_thresh",
 		[ND_CMD_DIMM_FLAGS] = "flags",
@@ -156,7 +164,7 @@ static inline const char *nvdimm_cmd_name(unsigned cmd)
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
+	if (cmd < nr__ND_CMD && names[cmd])
 		return names[cmd];
 	return "unknown";
 }


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers
@ 2018-09-05 15:55   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

The following code in the linux/ndctl header file:

	static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
	{
		static const char * const names[] = {
			[ND_CMD_ARS_CAP] = "ars_cap",
			[ND_CMD_ARS_START] = "ars_start",
			[ND_CMD_ARS_STATUS] = "ars_status",
			[ND_CMD_CLEAR_ERROR] = "clear_error",
			[ND_CMD_CALL] = "cmd_call",
		};

		if (cmd < ARRAY_SIZE(names) && names[cmd])
			return names[cmd];
		return "unknown";
	}

is broken in a number of ways:

 (1) ARRAY_SIZE() is not generally defined.  Fix this by defining a label
     in the enum that indicates the number of commands.

 (2) g++ does not support "non-trivial" array initialisers fully yet.  Fix
     this by defining the missing intermediate values.

 (3) Every file that calls this function will acquire a copy of names[].

The same goes for nvdimm_cmd_name().

A better way would be to remove these functions and their arrays from the
header entirely.

Signed-off-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
---

 include/uapi/linux/ndctl.h |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 7e27070b9440..9c89159f6a0f 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -117,6 +117,7 @@ enum {
 	ND_CMD_VENDOR_EFFECT_LOG = 8,
 	ND_CMD_VENDOR = 9,
 	ND_CMD_CALL = 10,
+	nr__ND_CMD = 11
 };
 
 enum {
@@ -128,22 +129,29 @@ enum {
 
 static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
+	static const char * const names[nr__ND_CMD] = {
+		[0] = NULL,
 		[ND_CMD_ARS_CAP] = "ars_cap",
 		[ND_CMD_ARS_START] = "ars_start",
 		[ND_CMD_ARS_STATUS] = "ars_status",
 		[ND_CMD_CLEAR_ERROR] = "clear_error",
+		[5] = NULL,
+		[6] = NULL,
+		[7] = NULL,
+		[8] = NULL,
+		[9] = NULL,
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
+	if (cmd < nr__ND_CMD && names[cmd])
 		return names[cmd];
 	return "unknown";
 }
 
 static inline const char *nvdimm_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
+	static const char * const names[nr__ND_CMD] = {
+		[0] = NULL,
 		[ND_CMD_SMART] = "smart",
 		[ND_CMD_SMART_THRESHOLD] = "smart_thresh",
 		[ND_CMD_DIMM_FLAGS] = "flags",
@@ -156,7 +164,7 @@ static inline const char *nvdimm_cmd_name(unsigned cmd)
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
+	if (cmd < nr__ND_CMD && names[cmd])
 		return names[cmd];
 	return "unknown";
 }

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE
  2018-09-05 15:54 ` David Howells
@ 2018-09-05 15:55   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: dhowells, linux-kernel, linux-nvdimm

The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
appear in UAPI headers.

Furthermore, the actual machine page size could theoretically change from
an application's point of view if it's running in a container that gets
migrated to another machine (say 4K/ppc64 to 64K/ppc64).

Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/linux/ndctl.h      |   22 ++++++++++++++++++++++
 include/uapi/linux/ndctl.h |    4 ----
 2 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/ndctl.h

diff --git a/include/linux/ndctl.h b/include/linux/ndctl.h
new file mode 100644
index 000000000000..cd5a293ce3ae
--- /dev/null
+++ b/include/linux/ndctl.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014-2016, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+#ifndef _LINUX_NDCTL_H
+#define _LINUX_NDCTL_H
+
+#include <uapi/linux/ndctl.h>
+
+enum {
+	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
+};
+
+#endif /* _LINUX_NDCTL_H */
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 9c89159f6a0f..bcda968e6d80 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -216,10 +216,6 @@ enum nd_driver_flags {
 	ND_DRIVER_DAX_PMEM	  = 1 << ND_DEVICE_DAX_PMEM,
 };
 
-enum {
-	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
-};
-
 enum ars_masks {
 	ARS_STATUS_MASK = 0x0000FFFF,
 	ARS_EXT_STATUS_SHIFT = 16,

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE
@ 2018-09-05 15:55   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Dan Williams, linux-nvdimm, linux-kernel, dhowells

The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
appear in UAPI headers.

Furthermore, the actual machine page size could theoretically change from
an application's point of view if it's running in a container that gets
migrated to another machine (say 4K/ppc64 to 64K/ppc64).

Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/linux/ndctl.h      |   22 ++++++++++++++++++++++
 include/uapi/linux/ndctl.h |    4 ----
 2 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/ndctl.h

diff --git a/include/linux/ndctl.h b/include/linux/ndctl.h
new file mode 100644
index 000000000000..cd5a293ce3ae
--- /dev/null
+++ b/include/linux/ndctl.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014-2016, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+#ifndef _LINUX_NDCTL_H
+#define _LINUX_NDCTL_H
+
+#include <uapi/linux/ndctl.h>
+
+enum {
+	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
+};
+
+#endif /* _LINUX_NDCTL_H */
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 9c89159f6a0f..bcda968e6d80 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -216,10 +216,6 @@ enum nd_driver_flags {
 	ND_DRIVER_DAX_PMEM	  = 1 << ND_DEVICE_DAX_PMEM,
 };
 
-enum {
-	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
-};
-
 enum ars_masks {
 	ARS_STATUS_MASK = 0x0000FFFF,
 	ARS_EXT_STATUS_SHIFT = 16,


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 11/11] UAPI: Check headers build for C++
  2018-09-05 15:54 ` David Howells
                   ` (14 preceding siblings ...)
  (?)
@ 2018-09-05 15:55 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 15:55 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Masahiro Yamada, Michal Marek, linux-kernel, dhowells

Check that all the headers can be included from one file and built for C++,
thereby catching the use of C++ reserved words and bits of unimplemented
C++ in the UAPI headers.

Note that certain headers are excluded from the build, including:

 (1) Any header ending in "_32.h", "_64.h" or "_x32.h" as these are
     expected to be multiarch variant headers.

 (2) Endianness variant headers.

 (3) asm-generic/ headers (they're used conditionally by the asm/ headers
     and shouldn't be used directly).

 (4) netfilter_ipv*/ip*t_LOG.h headers.  They emit a warning indicating
     they're going to be removed soon.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Masahiro Yamada <yamada.masahiro@socionext.com>
cc: Michal Marek <michal.lkml@markovi.net>
cc: linux-kbuild@vger.kernel.org
---

 Makefile               |    1 
 scripts/headers-c++.sh |  124 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+)
 create mode 100755 scripts/headers-c++.sh

diff --git a/Makefile b/Makefile
index 2b458801ba74..f3c36c2bb4cf 100644
--- a/Makefile
+++ b/Makefile
@@ -1183,6 +1183,7 @@ headers_install: __headers
 	  $(error Headers not exportable for the $(SRCARCH) architecture))
 	$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
 	$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst)
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers-c++.sh check
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
diff --git a/scripts/headers-c++.sh b/scripts/headers-c++.sh
new file mode 100755
index 000000000000..7e56913629f8
--- /dev/null
+++ b/scripts/headers-c++.sh
@@ -0,0 +1,124 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Run headers_$1 command for all suitable architectures
+
+# Stop on error
+set -e
+
+if ! $CC -x c++ -c - -o /dev/null </dev/null 2>/dev/null
+then
+    echo "  CHECK   C++ HEADER COMPILATION [SKIPPED]"
+    exit 0
+fi
+
+echo "  CHECK   C++ HEADER COMPILATION"
+
+mkdir -p hdr-check
+cd hdr-check
+
+mkdir -p include/sys
+mkdir -p include/arpa
+mkdir -p include/xen/interface
+echo >include/endian.h
+echo >include/limits.h
+echo >include/stdint.h
+echo >include/stdlib.h
+echo >include/stdio.h
+echo >include/string.h
+echo >include/time.h
+echo >include/unistd.h
+echo >include/arpa/inet.h
+echo >include/sys/ioctl.h
+echo >include/sys/types.h
+echo >include/sys/time.h
+echo >include/sys/socket.h
+echo >include/xen/interface/xen.h
+
+cat >test.h <<EOF
+#ifdef __cplusplus
+#define NULL nullptr
+#define _Bool bool
+#else
+#define NULL ((void *)0)
+#define bool _Bool
+#endif
+#include <linux/types.h>
+#include <linux/socket.h>
+#include <linux/time.h>
+
+typedef __s8			int8_t;
+typedef __s16			int16_t;
+typedef __s32			int32_t;
+typedef __s64			int64_t;
+typedef __u8			uint8_t;
+typedef __u16			uint16_t;
+typedef __u32			uint32_t;
+typedef __u64			uint64_t;
+typedef long int		intptr_t;
+typedef unsigned long int	uintptr_t;
+typedef unsigned short		u_short;
+typedef unsigned int		u_int;
+typedef unsigned long		u_long;
+typedef char			*caddr_t;
+
+typedef __kernel_clockid_t	clockid_t;
+typedef __kernel_ino_t		ino_t;
+typedef __kernel_pid_t		pid_t;
+typedef __kernel_sa_family_t	sa_family_t;
+typedef __kernel_size_t		size_t;
+typedef __kernel_uid_t		uid_t;
+
+typedef unsigned long		elf_greg_t;
+typedef elf_greg_t		elf_gregset_t[1];
+typedef unsigned long long	elf_fpregset_t[1];
+typedef unsigned long long	elf_fpxregset_t[1];
+
+#define INT_MIN ((int)0x80000000)
+#define INT_MAX ((int)0x7fffffff)
+
+extern size_t strlen(const char *);
+extern void *memset(void *, int, size_t);
+extern void *memcpy(void *, const void *, size_t);
+extern __u16 ntohs(__u16);
+extern __u16 htons(__u16);
+extern __u32 ntohl(__u32);
+extern __u32 htonl(__u32);
+
+typedef uint32_t		grant_ref_t;
+typedef uint16_t		domid_t;
+typedef unsigned long		xen_pfn_t;
+
+#define MSG_FIN         0x200
+
+typedef int SVGA3dMSPattern;
+typedef int SVGA3dMSQualityLevel;
+
+struct sockaddr
+{
+	sa_family_t	sa_family;
+	char		sa_data[14];
+};
+#define sockaddr_storage __kernel_sockaddr_storage
+
+#define _LINUX_PATCHKEY_H_INDIRECT
+
+EOF
+
+find ../usr/include -name '*.h' |
+    grep -v 'linux/byteorder/big_endian.h' |
+    grep -v 'linux/byteorder/little_endian.h' |
+    grep -v '_\(32\|64\|x32\)[.]h$' |
+    grep -v '/asm-generic/' |
+    # ip*t_LOG.h are deprecated
+    grep -v 'linux/netfilter_ipv4/ipt_LOG[.]h' |
+    grep -v 'linux/netfilter_ipv6/ip6t_LOG[.]h' |
+    sed -e 's!../usr/include/!#include <!' -e 's!$!>!' >>test.h
+
+echo '#include "test.h"' >test.cpp
+
+$CC -x c++ -o /dev/null -c test.cpp \
+    -nostdinc \
+    -isystem ./include \
+    -isystem ../usr/include \
+    -fpermissive \
+    -D PAGE_SIZE='#PAGE_SIZE_IS_NOT_VALID_OUTSIDE_OF_KERNEL'


^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
  2018-09-05 16:54   ` Greg KH
@ 2018-09-05 16:54   ` Greg KH
  2018-09-05 17:15   ` David Howells
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 124+ messages in thread
From: Greg KH @ 2018-09-05 16:54 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Michael S. Tsirkin, Jason Wang,
	virtualization, linux-kernel

On Wed, Sep 05, 2018 at 04:54:55PM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
> 
>  include/uapi/linux/virtio_net.h |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
>   * command goes in between.
>   */
>  struct virtio_net_ctrl_hdr {
> -	__u8 class;
> +	union {
> +#ifndef __cplusplus
> +		__u8 class;
> +#endif
> +		__u8 _class;
> +	};

Ugh, ick, no!

Come on now, either put the whole C namespace stuff around the file, or
don't care about this at all.  Doing this whack-a-mole style is a mess.

"class" is a fine variable name for C code, there's no reason this has
to change here at all.

greg k-h

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
@ 2018-09-05 16:54   ` Greg KH
  2018-09-05 16:54   ` Greg KH
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 124+ messages in thread
From: Greg KH @ 2018-09-05 16:54 UTC (permalink / raw)
  To: David Howells
  Cc: Michael S. Tsirkin, linux-api, linux-kbuild, linux-kernel,
	virtualization

On Wed, Sep 05, 2018 at 04:54:55PM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
> 
>  include/uapi/linux/virtio_net.h |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
>   * command goes in between.
>   */
>  struct virtio_net_ctrl_hdr {
> -	__u8 class;
> +	union {
> +#ifndef __cplusplus
> +		__u8 class;
> +#endif
> +		__u8 _class;
> +	};

Ugh, ick, no!

Come on now, either put the whole C namespace stuff around the file, or
don't care about this at all.  Doing this whack-a-mole style is a mess.

"class" is a fine variable name for C code, there's no reason this has
to change here at all.

greg k-h

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-05 15:55 ` [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI David Howells
@ 2018-09-05 16:54   ` Jan Harkes
  2018-09-05 17:12   ` Yann Droneaud
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 124+ messages in thread
From: Jan Harkes @ 2018-09-05 16:54 UTC (permalink / raw)
  To: David Howells; +Cc: linux-api, linux-kbuild, linux-fsdevel, linux-kernel

On Wed, Sep 05, 2018 at 04:55:10PM +0100, David Howells wrote:
> The size and layout of internal kernel structures may not be relied upon
> outside of the kernel and may even change in a containerised environment if
> a container image is frozen and shifted to another machine.
> 
> Excise these from Coda's upc_req struct.

Argh, that won't work.

I still have to look at where this structure is used exactly, but...

Either this structure is used by the messages that the kernel sends to
userspace, in which case we don't want the kernel to pack the larger
structure that includes a list_head and a wait_queue_head_t in the
message while userspace reads as if it was a smaller structure without
those.

But my gut feeling is that this is not part of the upcall request
messages and never gets to userspace and as such shouldn't be in uapi to
begin with.

Jan


^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 16:55   ` Greg KH
  0 siblings, 0 replies; 124+ messages in thread
From: Greg KH @ 2018-09-05 16:55 UTC (permalink / raw)
  To: David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau, dri-devel, virtualization,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache,
	Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api,
	Takashi Iwai, linux-kernel, Rob Clark, netfilter-devel,
	linux-fsdevel, freedreno

On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> 
> Here's a set of patches that inserts a step into the build process to make
> sure that the UAPI headers can all be built together with C++ (if the
> compiler being used supports C++).  All but the final patch perform fixups,
> including:

Wait, why do we care?  What has recently changed to start to directly
import kernel uapi files into C++ code?

And if userspace wants to do this, can't they do the C namespace trick
themselves when they do the import?  That must be how they are doing it
today, right?

thanks,

greg k-h
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 16:55   ` Greg KH
  0 siblings, 0 replies; 124+ messages in thread
From: Greg KH @ 2018-09-05 16:55 UTC (permalink / raw)
  To: David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takashi Iwai,
	linux-kernel

On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> 
> Here's a set of patches that inserts a step into the build process to make
> sure that the UAPI headers can all be built together with C++ (if the
> compiler being used supports C++).  All but the final patch perform fixups,
> including:

Wait, why do we care?  What has recently changed to start to directly
import kernel uapi files into C++ code?

And if userspace wants to do this, can't they do the C namespace trick
themselves when they do the import?  That must be how they are doing it
today, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 16:55   ` Greg KH
  0 siblings, 0 replies; 124+ messages in thread
From: Greg KH @ 2018-09-05 16:55 UTC (permalink / raw)
  To: David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takashi Iwai

On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> 
> Here's a set of patches that inserts a step into the build process to make
> sure that the UAPI headers can all be built together with C++ (if the
> compiler being used supports C++).  All but the final patch perform fixups,
> including:

Wait, why do we care?  What has recently changed to start to directly
import kernel uapi files into C++ code?

And if userspace wants to do this, can't they do the C namespace trick
themselves when they do the import?  That must be how they are doing it
today, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 16:55   ` Greg KH
  0 siblings, 0 replies; 124+ messages in thread
From: Greg KH @ 2018-09-05 16:55 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Michal Marek, dri-devel, virtualization,
	keyrings, David Airlie, linux-nilfs, linux-nvdimm,
	Michael S. Tsirkin, codalist, coda, coreteam, Rob Clark,
	linux-arm-msm, Kent Overstreet, Dan Williams, Takashi Iwai,
	linux-bcache, Coly Li, Jaroslav Kysela, Jan Harkes,
	Masahiro Yamada, Ryusuke Konishi, Jason Wang, Mat Martineau,
	netfilter-devel, linux-fsdevel, moderated for non-subscribers,
	freedreno, linux-kernel

On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> 
> Here's a set of patches that inserts a step into the build process to make
> sure that the UAPI headers can all be built together with C++ (if the
> compiler being used supports C++).  All but the final patch perform fixups,
> including:

Wait, why do we care?  What has recently changed to start to directly
import kernel uapi files into C++ code?

And if userspace wants to do this, can't they do the C namespace trick
themselves when they do the import?  That must be how they are doing it
today, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
  2018-09-05 15:54 ` David Howells
                   ` (15 preceding siblings ...)
  (?)
@ 2018-09-05 16:55 ` Greg KH
  -1 siblings, 0 replies; 124+ messages in thread
From: Greg KH @ 2018-09-05 16:55 UTC (permalink / raw)
  To: David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Mat Martineau, dri-devel, virtualization, Masahiro Yamada,
	keyrings, Ryusuke Konishi, linux-nilfs, linux-nvdimm, codalist,
	coda, coreteam, Kent Overstreet, linux-kbuild, linux-arm-msm,
	Coly Li, linux-bcache, Dan Williams, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api, Takashi Iwai

On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> 
> Here's a set of patches that inserts a step into the build process to make
> sure that the UAPI headers can all be built together with C++ (if the
> compiler being used supports C++).  All but the final patch perform fixups,
> including:

Wait, why do we care?  What has recently changed to start to directly
import kernel uapi files into C++ code?

And if userspace wants to do this, can't they do the C namespace trick
themselves when they do the import?  That must be how they are doing it
today, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-05 15:55 ` [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI David Howells
  2018-09-05 16:54   ` Jan Harkes
@ 2018-09-05 17:12   ` Yann Droneaud
  2018-09-05 17:28       ` Jan Harkes
  2018-09-05 17:24   ` David Howells
  2018-09-06  7:13   ` David Howells
  3 siblings, 1 reply; 124+ messages in thread
From: Yann Droneaud @ 2018-09-05 17:12 UTC (permalink / raw)
  To: David Howells, linux-api, linux-kbuild
  Cc: Jan Harkes, coda, codalist, linux-fsdevel, linux-kernel

Le mercredi 05 septembre 2018 à 16:55 +0100, David Howells a écrit :
> The size and layout of internal kernel structures may not be relied
> upon outside of the kernel and may even change in a containerised
> environment if a container image is frozen and shifted to another
> machine.
> 
> Excise these from Coda's upc_req struct.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jan Harkes <jaharkes@cs.cmu.edu>
> cc: coda@cs.cmu.edu
> cc: codalist@coda.cs.cmu.edu
> cc: linux-fsdevel@vger.kernel.org
> ---
> 
>  include/uapi/linux/coda_psdev.h |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h
> index aa6623efd2dd..9c3acde393cd 100644
> --- a/include/uapi/linux/coda_psdev.h
> +++ b/include/uapi/linux/coda_psdev.h
> @@ -10,14 +10,18 @@
>  
>  /* messages between coda filesystem in kernel and Venus */
>  struct upc_req {
> +#ifdef __KERNEL__
>  	struct list_head    uc_chain;
> +#endif
>  	caddr_t	            uc_data;
>  	u_short	            uc_flags;
>  	u_short             uc_inSize;  /* Size is at most 5000 bytes */
>  	u_short	            uc_outSize;
>  	u_short	            uc_opcode;  /* copied from data to save lookup */
>  	int		    uc_unique;
> +#ifdef __KERNEL__
>  	wait_queue_head_t   uc_sleep;   /* process' wait queue */
> +#endif
>  };
>  

This structure should not have been exposed to userspace in the first
place: it's unusable by userspace as it is. It was incorrect to have it
outside of #ifdef __KERNEL__ before commit 607ca46e97a1b ... 

... and it's not exchanged between kernel and userspace, see
coda_psdev_write():

        struct upc_req *req = NULL;

        ...

        if (copy_from_user(req->uc_data, buf, nbytes)) {
                req->uc_flags |= CODA_REQ_ABORT;
                wake_up(&req->uc_sleep);
                retval = -EFAULT;
                goto out;
        }

Only data, a caddr_t, is read from userspace.

So the structure can be moved back to <linux/coda_psdev.h>.

>  #define CODA_REQ_ASYNC  0x1
> 

All CODA_REQ_* defines internals to kernel side and not exchanged with userspace.

Please move them back to <linux/coda_psdev.h>

Regards.

-- 
Yann Droneaud
OPTEYA




^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
                     ` (2 preceding siblings ...)
  2018-09-05 17:15   ` David Howells
@ 2018-09-05 17:15   ` David Howells
  2018-09-05 17:35   ` Michael S. Tsirkin
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 17:15 UTC (permalink / raw)
  To: Greg KH
  Cc: dhowells, linux-api, linux-kbuild, Michael S. Tsirkin,
	Jason Wang, virtualization, linux-kernel

Greg KH <gregkh@linuxfoundation.org> wrote:

> Come on now, either put the whole C namespace stuff around the file,

You mean wrap it with 'extern "C" { ... }'?  That doesn't fix it.  That only
affects the symbols generated by the compiler.

> "class" is a fine variable name for C code, there's no reason this has
> to change here at all.

I'm trying to prevent future accidents like the one in linux/keyctl.h.  The
easiest way to do this[**] is to pass the entire set of UAPI headers[*]
through the compiler together.

Besides I still have my dark plan to C++-ise the kernel[***] :-D

David

[*] with some obvious exceptions

[**] and it catches other errors too

[***] https://lkml.org/lkml/2018/4/1/116

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
  2018-09-05 16:54   ` Greg KH
  2018-09-05 16:54   ` Greg KH
@ 2018-09-05 17:15   ` David Howells
  2018-09-05 17:15   ` David Howells
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 17:15 UTC (permalink / raw)
  To: Greg KH
  Cc: Michael S. Tsirkin, linux-api, linux-kbuild, linux-kernel,
	virtualization, dhowells

Greg KH <gregkh@linuxfoundation.org> wrote:

> Come on now, either put the whole C namespace stuff around the file,

You mean wrap it with 'extern "C" { ... }'?  That doesn't fix it.  That only
affects the symbols generated by the compiler.

> "class" is a fine variable name for C code, there's no reason this has
> to change here at all.

I'm trying to prevent future accidents like the one in linux/keyctl.h.  The
easiest way to do this[**] is to pass the entire set of UAPI headers[*]
through the compiler together.

Besides I still have my dark plan to C++-ise the kernel[***] :-D

David

[*] with some obvious exceptions

[**] and it catches other errors too

[***] https://lkml.org/lkml/2018/4/1/116

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-05 15:55 ` [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI David Howells
  2018-09-05 16:54   ` Jan Harkes
  2018-09-05 17:12   ` Yann Droneaud
@ 2018-09-05 17:24   ` David Howells
  2018-09-06  7:13   ` David Howells
  3 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 17:24 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: dhowells, linux-api, linux-kbuild, Jan Harkes, coda, codalist,
	linux-fsdevel, linux-kernel

Yann Droneaud <ydroneaud@opteya.com> wrote:

> Please move them back to <linux/coda_psdev.h>

Will do.

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-05 17:12   ` Yann Droneaud
@ 2018-09-05 17:28       ` Jan Harkes
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Harkes @ 2018-09-05 17:28 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: David Howells, linux-api, linux-kbuild, linux-fsdevel, linux-kernel

On Wed, Sep 05, 2018 at 07:12:37PM +0200, Yann Droneaud wrote:
> Le mercredi 05 septembre 2018 à 16:55 +0100, David Howells a écrit :
> > The size and layout of internal kernel structures may not be relied
> > upon outside of the kernel and may even change in a containerised
> > environment if a container image is frozen and shifted to another
> > machine.
> > 
> > Excise these from Coda's upc_req struct.
...
> 
> This structure should not have been exposed to userspace in the first
> place: it's unusable by userspace as it is. It was incorrect to have it
> outside of #ifdef __KERNEL__ before commit 607ca46e97a1b ... 
...
> So the structure can be moved back to <linux/coda_psdev.h>.

I found a year old patch that clearly fell through the cracks that
fixes this exact thing.

    https://lkml.org/lkml/2017/8/6/186

Jan

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
@ 2018-09-05 17:28       ` Jan Harkes
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Harkes @ 2018-09-05 17:28 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: David Howells, linux-api, linux-kbuild, linux-fsdevel, linux-kernel

On Wed, Sep 05, 2018 at 07:12:37PM +0200, Yann Droneaud wrote:
> Le mercredi 05 septembre 2018 � 16:55 +0100, David Howells a �crit :
> > The size and layout of internal kernel structures may not be relied
> > upon outside of the kernel and may even change in a containerised
> > environment if a container image is frozen and shifted to another
> > machine.
> > 
> > Excise these from Coda's upc_req struct.
...
> 
> This structure should not have been exposed to userspace in the first
> place: it's unusable by userspace as it is. It was incorrect to have it
> outside of #ifdef __KERNEL__ before commit 607ca46e97a1b ... 
...
> So the structure can be moved back to <linux/coda_psdev.h>.

I found a year old patch that clearly fell through the cracks that
fixes this exact thing.

    https://lkml.org/lkml/2017/8/6/186

Jan

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:33     ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-05 17:33 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau, dri-devel, virtualization,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache,
	Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api,
	Takashi Iwai, linux-kernel, Rob Clark, netfilter-devel,
	linux-fsdevel, freedreno

Hi,

Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > 
> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++).  All but the final patch perform fixups,
> > including:
> 
> Wait, why do we care?  What has recently changed to start to directly
> import kernel uapi files into C++ code?
> 
> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import?  That must be how they are doing it
> today, right?
> 

They can't.


Adding extern "C" { } doesn't magically make "class" a non keyword.
Even if it was the case, writing C++ code using whatever->class would
probably broke because class is a keyword in C++.

-- 
Yann Droneaud
OPTEYA


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:33     ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-05 17:33 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takashi Iwai,
	linux-kernel

Hi,

Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > 
> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++).  All but the final patch perform fixups,
> > including:
> 
> Wait, why do we care?  What has recently changed to start to directly
> import kernel uapi files into C++ code?
> 
> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import?  That must be how they are doing it
> today, right?
> 

They can't.


Adding extern "C" { } doesn't magically make "class" a non keyword.
Even if it was the case, writing C++ code using whatever->class would
probably broke because class is a keyword in C++.

-- 
Yann Droneaud
OPTEYA


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:33     ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-05 17:33 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takashi Iwai

Hi,

Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > 
> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++).  All but the final patch perform fixups,
> > including:
> 
> Wait, why do we care?  What has recently changed to start to directly
> import kernel uapi files into C++ code?
> 
> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import?  That must be how they are doing it
> today, right?
> 

They can't.


Adding extern "C" { } doesn't magically make "class" a non keyword.
Even if it was the case, writing C++ code using whatever->class would
probably broke because class is a keyword in C++.

-- 
Yann Droneaud
OPTEYA

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:33     ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-05 17:33 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: linux-api, linux-kbuild, Michal Marek, dri-devel, virtualization,
	keyrings, David Airlie, linux-nilfs, linux-nvdimm,
	Michael S. Tsirkin, codalist, coda, coreteam, Rob Clark,
	linux-arm-msm, Kent Overstreet, Dan Williams, Takashi Iwai,
	linux-bcache, Coly Li, Jaroslav Kysela, Jan Harkes,
	Masahiro Yamada, Ryusuke Konishi, Jason Wang, Mat Martineau,
	netfilter-devel, linux-fsdevel, moderated for non-subscribers,
	freedreno, linux-kernel

Hi,

Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > 
> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++).  All but the final patch perform fixups,
> > including:
> 
> Wait, why do we care?  What has recently changed to start to directly
> import kernel uapi files into C++ code?
> 
> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import?  That must be how they are doing it
> today, right?
> 

They can't.


Adding extern "C" { } doesn't magically make "class" a non keyword.
Even if it was the case, writing C++ code using whatever->class would
probably broke because class is a keyword in C++.

-- 
Yann Droneaud
OPTEYA



^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
                     ` (4 preceding siblings ...)
  2018-09-05 17:35   ` Michael S. Tsirkin
@ 2018-09-05 17:35   ` Michael S. Tsirkin
  2018-09-06  7:09   ` David Howells
  2018-09-06  7:09   ` David Howells
  7 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:35 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Jason Wang, virtualization, linux-kernel

On Wed, Sep 05, 2018 at 04:54:55PM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
> 
>  include/uapi/linux/virtio_net.h |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
>   * command goes in between.
>   */
>  struct virtio_net_ctrl_hdr {
> -	__u8 class;
> +	union {
> +#ifndef __cplusplus
> +		__u8 class;
> +#endif
> +		__u8 _class;
> +	};
>  	__u8 cmd;
>  } __attribute__((packed));


As long as you do not intend to use any classes, how about
simply adding

-Dclass=_class

to your command line?

Seems to work fine with gcc 8.1.1 on Fedora.

-- 
MST

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
                     ` (3 preceding siblings ...)
  2018-09-05 17:15   ` David Howells
@ 2018-09-05 17:35   ` Michael S. Tsirkin
  2018-09-05 17:35   ` Michael S. Tsirkin
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:35 UTC (permalink / raw)
  To: David Howells; +Cc: linux-api, virtualization, linux-kernel, linux-kbuild

On Wed, Sep 05, 2018 at 04:54:55PM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
> 
>  include/uapi/linux/virtio_net.h |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
>   * command goes in between.
>   */
>  struct virtio_net_ctrl_hdr {
> -	__u8 class;
> +	union {
> +#ifndef __cplusplus
> +		__u8 class;
> +#endif
> +		__u8 _class;
> +	};
>  	__u8 cmd;
>  } __attribute__((packed));


As long as you do not intend to use any classes, how about
simply adding

-Dclass=_class

to your command line?

Seems to work fine with gcc 8.1.1 on Fedora.

-- 
MST

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
  2018-09-05 17:33     ` Yann Droneaud
                         ` (3 preceding siblings ...)
  (?)
@ 2018-09-05 17:42       ` Michael S. Tsirkin
  -1 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: moderated for non-subscribers, David Airlie, Greg KH, Jason Wang,
	Mat Martineau, dri-devel, virtualization, David Howells,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache,
	Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api,
	Takashi Iwai, linux-kernel, Rob Clark, netfilter-devel,
	linux-fsdevel, freedreno

On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++).  All but the final patch perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import?  That must be how they are doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.

I think it's a bug in the language TBH.

> -- 
> Yann Droneaud
> OPTEYA
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:42       ` Michael S. Tsirkin
  0 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: moderated for non-subscribers, David Airlie, Greg KH, Jason Wang,
	Mat Martineau, dri-devel, virtualization, David Howells,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
	Jaroslav Kysela, Jan Harkes, Michal Marek

On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++).  All but the final patch perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import?  That must be how they are doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.

I think it's a bug in the language TBH.

> -- 
> Yann Droneaud
> OPTEYA
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:42       ` Michael S. Tsirkin
  0 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: moderated for non-subscribers, David Airlie, Greg KH, Jason Wang,
	Mat Martineau, dri-devel, virtualization, David Howells,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
	Jaroslav Kysela, Jan Harkes, Michal Marek

On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++).  All but the final patch perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import?  That must be how they are doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.

I think it's a bug in the language TBH.

> -- 
> Yann Droneaud
> OPTEYA
> 

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:42       ` Michael S. Tsirkin
  0 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: Greg KH, David Howells, linux-api, linux-kbuild, Michal Marek,
	dri-devel, virtualization, keyrings, David Airlie, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Rob Clark, linux-arm-msm,
	Kent Overstreet, Dan Williams, Takashi Iwai, linux-bcache,
	Coly Li, Jaroslav Kysela, Jan Harkes, Masahiro Yamada,
	Ryusuke Konishi, Jason Wang, Mat Martineau, netfilter-devel,
	linux-fsdevel, moderated for non-subscribers, freedreno,
	linux-kernel

On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++).  All but the final patch perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import?  That must be how they are doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.

I think it's a bug in the language TBH.

> -- 
> Yann Droneaud
> OPTEYA
> 

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:42       ` Michael S. Tsirkin
  0 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: Greg KH, David Howells, linux-api, linux-kbuild, Michal Marek,
	dri-devel, virtualization, keyrings, David Airlie, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Rob Clark, linux-arm-msm,
	Kent Overstreet, Dan Williams, Takashi Iwai, linux-bcache,
	Coly Li, Jaroslav Kysela, Jan Harkes, Masahiro Yamada,
	Ryusuke Konishi, Jason Wang, Mat Martineau, netfilter-devel,
	linux-fsdevel, moderated for non-subscribers, freedreno,
	linux-kernel

On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le mercredi 05 septembre 2018 � 18:55 +0200, Greg KH a �crit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++).  All but the final patch perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import?  That must be how they are doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.

I think it's a bug in the language TBH.

> -- 
> Yann Droneaud
> OPTEYA
> 

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:42       ` Michael S. Tsirkin
  0 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: moderated for non-subscribers, David Airlie, Greg KH, Jason Wang,
	Mat Martineau, dri-devel, virtualization, David Howells,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
	Jaroslav Kysela, Jan Harkes, Michal Marek, linux

On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++).  All but the final patch perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import?  That must be how they are doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.

I think it's a bug in the language TBH.

> -- 
> Yann Droneaud
> OPTEYA
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
  2018-09-05 17:33     ` Yann Droneaud
                       ` (2 preceding siblings ...)
  (?)
@ 2018-09-05 17:42     ` Michael S. Tsirkin
  -1 siblings, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: moderated for non-subscribers, David Airlie, Greg KH,
	Mat Martineau, dri-devel, virtualization, David Howells,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
	Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api, Takashi

On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++).  All but the final patch perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import?  That must be how they are doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.

I think it's a bug in the language TBH.

> -- 
> Yann Droneaud
> OPTEYA
> 

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
  2018-09-05 15:54 ` David Howells
@ 2018-09-05 17:50   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 17:50 UTC (permalink / raw)
  To: Greg KH
  Cc: dhowells, linux-api, linux-kbuild, dri-devel, virtualization,
	keyrings, netfilter-devel, linux-fsdevel, alsa-devel, freedreno,
	linux-kernel

Greg KH <greg@kroah.com> wrote:

> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++).  All but the final patch perform fixups,
> > including:
> 
> Wait, why do we care?  What has recently changed to start to directly
> import kernel uapi files into C++ code?

There's at least one outstanding bug due to a C++ identifier in the kernel
UAPI headers.

Are you saying you explicitly don't want people to be able to use the kernel
UAPI headers in C++?

> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import?  That must be how they are doing it
> today, right?

No, because there's no such trick (except with the preprocessor).

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 17:50   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 17:50 UTC (permalink / raw)
  To: Greg KH
  Cc: dhowells, linux-api, linux-kbuild, dri-devel, virtualization,
	keyrings, netfilter-devel, linux-fsdevel, alsa-devel, freedreno,
	linux-kernel

Greg KH <greg@kroah.com> wrote:

> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++).  All but the final patch perform fixups,
> > including:
> 
> Wait, why do we care?  What has recently changed to start to directly
> import kernel uapi files into C++ code?

There's at least one outstanding bug due to a C++ identifier in the kernel
UAPI headers.

Are you saying you explicitly don't want people to be able to use the kernel
UAPI headers in C++?

> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import?  That must be how they are doing it
> today, right?

No, because there's no such trick (except with the preprocessor).

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
  2018-09-05 15:54 ` David Howells
                   ` (17 preceding siblings ...)
  (?)
@ 2018-09-05 17:50 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-05 17:50 UTC (permalink / raw)
  To: Greg KH
  Cc: alsa-devel, linux-kbuild, linux-api, linux-kernel, dri-devel,
	virtualization, dhowells, keyrings, netfilter-devel,
	linux-fsdevel, freedreno

Greg KH <greg@kroah.com> wrote:

> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++).  All but the final patch perform fixups,
> > including:
> 
> Wait, why do we care?  What has recently changed to start to directly
> import kernel uapi files into C++ code?

There's at least one outstanding bug due to a C++ identifier in the kernel
UAPI headers.

Are you saying you explicitly don't want people to be able to use the kernel
UAPI headers in C++?

> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import?  That must be how they are doing it
> today, right?

No, because there's no such trick (except with the preprocessor).

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 19:22     ` Jan Engelhardt
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Engelhardt @ 2018-09-05 19:22 UTC (permalink / raw)
  To: Greg KH
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau, dri-devel, virtualization,
	David Howells, Masahiro Yamada, keyrings, Ryusuke Konishi,
	linux-nilfs, linux-nvdimm, codalist, coda, coreteam,
	Kent Overstreet, linux-kbuild, linux-arm-msm, Coly Li,
	linux-bcache, Jaroslav Kysela, Jan Harkes, Michal Marek,
	linux-api, Takashi Iwai, linux-kernel, Rob Clark,
	netfilter-devel, linux-fsdevel, freedreno

On Wednesday 2018-09-05 18:55, Greg KH wrote:

>On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
>> 
>> Here's a set of patches that inserts a step into the build process to make
>> sure that the UAPI headers can all be built together with C++ (if the
>> compiler being used supports C++).  All but the final patch perform fixups,
>> including:
>
>Wait, why do we care?  What has recently changed to start to directly
>import kernel uapi files into C++ code?

With C++11, C++ has become a much nicer language to use (for userspace, anyway).

>And if userspace wants to do this, can't they do the C namespace trick
>themselves when they do the import?

The only trick is to use an extra C source file and extensively wrap things.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 19:22     ` Jan Engelhardt
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Engelhardt @ 2018-09-05 19:22 UTC (permalink / raw)
  To: Greg KH
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	David Howells, Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takash

On Wednesday 2018-09-05 18:55, Greg KH wrote:

>On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
>> 
>> Here's a set of patches that inserts a step into the build process to make
>> sure that the UAPI headers can all be built together with C++ (if the
>> compiler being used supports C++).  All but the final patch perform fixups,
>> including:
>
>Wait, why do we care?  What has recently changed to start to directly
>import kernel uapi files into C++ code?

With C++11, C++ has become a much nicer language to use (for userspace, anyway).

>And if userspace wants to do this, can't they do the C namespace trick
>themselves when they do the import?

The only trick is to use an extra C source file and extensively wrap things.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 19:22     ` Jan Engelhardt
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Engelhardt @ 2018-09-05 19:22 UTC (permalink / raw)
  To: Greg KH
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	David Howells, Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takash

On Wednesday 2018-09-05 18:55, Greg KH wrote:

>On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
>> 
>> Here's a set of patches that inserts a step into the build process to make
>> sure that the UAPI headers can all be built together with C++ (if the
>> compiler being used supports C++).  All but the final patch perform fixups,
>> including:
>
>Wait, why do we care?  What has recently changed to start to directly
>import kernel uapi files into C++ code?

With C++11, C++ has become a much nicer language to use (for userspace, anyway).

>And if userspace wants to do this, can't they do the C namespace trick
>themselves when they do the import?

The only trick is to use an extra C source file and extensively wrap things.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-05 19:22     ` Jan Engelhardt
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Engelhardt @ 2018-09-05 19:22 UTC (permalink / raw)
  To: Greg KH
  Cc: David Howells, linux-api, linux-kbuild, Michal Marek, dri-devel,
	virtualization, keyrings, David Airlie, linux-nilfs,
	linux-nvdimm, Michael S. Tsirkin, codalist, coda, coreteam,
	Rob Clark, linux-arm-msm, Kent Overstreet, Dan Williams,
	Takashi Iwai, linux-bcache, Coly Li, Jaroslav Kysela, Jan Harkes,
	Masahiro Yamada, Ryusuke Konishi, Jason Wang, Mat Martineau,
	netfilter-devel, linux-fsdevel, moderated for non-subscribers,
	freedreno, linux-kernel

On Wednesday 2018-09-05 18:55, Greg KH wrote:

>On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
>> 
>> Here's a set of patches that inserts a step into the build process to make
>> sure that the UAPI headers can all be built together with C++ (if the
>> compiler being used supports C++).  All but the final patch perform fixups,
>> including:
>
>Wait, why do we care?  What has recently changed to start to directly
>import kernel uapi files into C++ code?

With C++11, C++ has become a much nicer language to use (for userspace, anyway).

>And if userspace wants to do this, can't they do the C namespace trick
>themselves when they do the import?

The only trick is to use an extra C source file and extensively wrap things.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
  2018-09-05 16:55   ` Greg KH
                     ` (3 preceding siblings ...)
  (?)
@ 2018-09-05 19:22   ` Jan Engelhardt
  -1 siblings, 0 replies; 124+ messages in thread
From: Jan Engelhardt @ 2018-09-05 19:22 UTC (permalink / raw)
  To: Greg KH
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Mat Martineau, dri-devel, virtualization, David Howells,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
	Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api

On Wednesday 2018-09-05 18:55, Greg KH wrote:

>On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
>> 
>> Here's a set of patches that inserts a step into the build process to make
>> sure that the UAPI headers can all be built together with C++ (if the
>> compiler being used supports C++).  All but the final patch perform fixups,
>> including:
>
>Wait, why do we care?  What has recently changed to start to directly
>import kernel uapi files into C++ code?

With C++11, C++ has become a much nicer language to use (for userspace, anyway).

>And if userspace wants to do this, can't they do the C namespace trick
>themselves when they do the import?

The only trick is to use an extra C source file and extensively wrap things.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 07/11] UAPI: nilfs2: Fix use of undefined byteswapping functions
  2018-09-05 15:55 ` [PATCH 07/11] UAPI: nilfs2: Fix use of undefined byteswapping functions David Howells
@ 2018-09-05 22:20   ` Al Viro
  0 siblings, 0 replies; 124+ messages in thread
From: Al Viro @ 2018-09-05 22:20 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Ryusuke Konishi, linux-nilfs,
	linux-fsdevel, linux-kernel

On Wed, Sep 05, 2018 at 04:55:23PM +0100, David Howells wrote:
>  nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp)		\
>  {									\
> -	cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |		\
> +	cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) |	\
>  				   (1UL << NILFS_CHECKPOINT_##flag));	\

How about sanitiziung the damn thing to
	cp->cp_flags |= __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag));

while you are at it?  Or, perhaps, even
#define NILFS2_CP_FLAG(flag) __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag)

and cp->cp_flags |= NILFS2_CP_FLAG(flag) for this one,

>  }									\
>  static inline void							\
>  nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp)		\
>  {									\
> -	cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) &		\
> +	cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) &	\
>  				   ~(1UL << NILFS_CHECKPOINT_##flag));	\
	cp->cp_flags &= ~NILFS2_CP_FLAG(flag);
here

>  }									\
>  static inline int							\
>  nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp)		\
>  {									\
> -	return !!(le32_to_cpu(cp->cp_flags) &				\
> +	return !!(__le32_to_cpu(cp->cp_flags) &				\
>  		  (1UL << NILFS_CHECKPOINT_##flag));			\

and !!(cp->cp_flags & NILFS2_CP_FLAG(flag)
here?  Or maybe even make the damn thing bool and lose the !! here...

)>  }
>  

and similar for those:

> @@ -595,20 +596,20 @@ enum {
>  static inline void							\
>  nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su)		\
>  {									\
> -	su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) |		\
> +	su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) |	\
>  				   (1UL << NILFS_SEGMENT_USAGE_##flag));\
>  }									\
>  static inline void							\
>  nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su)	\
>  {									\
>  	su->su_flags =							\
> -		cpu_to_le32(le32_to_cpu(su->su_flags) &			\
> +		__cpu_to_le32(__le32_to_cpu(su->su_flags) &		\
>  			    ~(1UL << NILFS_SEGMENT_USAGE_##flag));      \
>  }									\
>  static inline int							\
>  nilfs_segment_usage_##name(const struct nilfs_segment_usage *su)	\
>  {									\
> -	return !!(le32_to_cpu(su->su_flags) &				\
> +	return !!(__le32_to_cpu(su->su_flags) &				\
>  		  (1UL << NILFS_SEGMENT_USAGE_##flag));			\
>  }



> @@ -619,15 +620,15 @@ NILFS_SEGMENT_USAGE_FNS(ERROR, error)
>  static inline void
>  nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su)
>  {
> -	su->su_lastmod = cpu_to_le64(0);
> -	su->su_nblocks = cpu_to_le32(0);
> -	su->su_flags = cpu_to_le32(0);
> +	su->su_lastmod = __cpu_to_le64(0);
> +	su->su_nblocks = __cpu_to_le32(0);
> +	su->su_flags = __cpu_to_le32(0);
>  }
>  
>  static inline int
>  nilfs_segment_usage_clean(const struct nilfs_segment_usage *su)
>  {
> -	return !le32_to_cpu(su->su_flags);
> +	return !__le32_to_cpu(su->su_flags);

"Check that after byteswap it becomes 0", is it?  How is that different
from return !su->su_flags; ?

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 08/11] UAPI: sound: Fix use of u32 and co. in UAPI headers
  2018-09-05 15:55   ` David Howells
@ 2018-09-06  5:59     ` Takashi Sakamoto
  -1 siblings, 0 replies; 124+ messages in thread
From: Takashi Sakamoto @ 2018-09-06  5:59 UTC (permalink / raw)
  To: David Howells, linux-api, linux-kbuild
  Cc: linux-kernel, moderated for non-subscribers, Takashi Iwai

Hi,

On Sep 6 2018 00:55, David Howells wrote:
> Fix the use of u32 and co. in UAPI headers as these are not defined.  Switch
> to using the __u32-style equivalents instead.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jaroslav Kysela <perex@perex.cz>
> cc: Takashi Iwai <tiwai@suse.com>
> cc: alsa-devel@alsa-project.org (moderated for non-subscribers)
> ---
> 
>   include/uapi/sound/skl-tplg-interface.h |  106 ++++++++++++++++---------------
>   1 file changed, 54 insertions(+), 52 deletions(-)

A similar patch was already proposed[1] and has been applied by Mark to
his tree[2]. Your issue (3) is going to be solved soon for v4.19
kernel.

[1] [alsa-devel] [PATCH] uapi: fix sound/skl-tplg-interface.h userspace 
compilation errors
http://mailman.alsa-project.org/pipermail/alsa-devel/2018-August/139392.html
[2] ASoC: uapi: fix sound/skl-tplg-interface.h userspace compilation errors
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/log/?h=for-4.19


Thanks

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 08/11] UAPI: sound: Fix use of u32 and co. in UAPI headers
@ 2018-09-06  5:59     ` Takashi Sakamoto
  0 siblings, 0 replies; 124+ messages in thread
From: Takashi Sakamoto @ 2018-09-06  5:59 UTC (permalink / raw)
  To: David Howells, linux-api, linux-kbuild
  Cc: moderated for non-subscribers, linux-kernel, Takashi Iwai

Hi,

On Sep 6 2018 00:55, David Howells wrote:
> Fix the use of u32 and co. in UAPI headers as these are not defined.  Switch
> to using the __u32-style equivalents instead.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jaroslav Kysela <perex@perex.cz>
> cc: Takashi Iwai <tiwai@suse.com>
> cc: alsa-devel@alsa-project.org (moderated for non-subscribers)
> ---
> 
>   include/uapi/sound/skl-tplg-interface.h |  106 ++++++++++++++++---------------
>   1 file changed, 54 insertions(+), 52 deletions(-)

A similar patch was already proposed[1] and has been applied by Mark to
his tree[2]. Your issue (3) is going to be solved soon for v4.19
kernel.

[1] [alsa-devel] [PATCH] uapi: fix sound/skl-tplg-interface.h userspace 
compilation errors
http://mailman.alsa-project.org/pipermail/alsa-devel/2018-August/139392.html
[2] ASoC: uapi: fix sound/skl-tplg-interface.h userspace compilation errors
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/log/?h=for-4.19


Thanks

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
                     ` (6 preceding siblings ...)
  2018-09-06  7:09   ` David Howells
@ 2018-09-06  7:09   ` David Howells
  2018-09-06 14:36     ` Michael S. Tsirkin
  2018-09-06 14:36     ` Michael S. Tsirkin
  7 siblings, 2 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  7:09 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: dhowells, linux-api, linux-kbuild, Jason Wang, virtualization,
	linux-kernel

Michael S. Tsirkin <mst@redhat.com> wrote:

> As long as you do not intend to use any classes, how about
> simply adding
> 
> -Dclass=_class
> 
> to your command line?

That kind of misses the point;-).  It's not reasonable to expect all userspace
C++ users to do this.

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
                     ` (5 preceding siblings ...)
  2018-09-05 17:35   ` Michael S. Tsirkin
@ 2018-09-06  7:09   ` David Howells
  2018-09-06  7:09   ` David Howells
  7 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  7:09 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kbuild, linux-api, linux-kernel, virtualization, dhowells

Michael S. Tsirkin <mst@redhat.com> wrote:

> As long as you do not intend to use any classes, how about
> simply adding
> 
> -Dclass=_class
> 
> to your command line?

That kind of misses the point;-).  It's not reasonable to expect all userspace
C++ users to do this.

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  7:12       ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-06  7:12 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau, dri-devel, virtualization,
	Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
	linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
	linux-kbuild, linux-arm-msm, Coly Li, linux-bcache,
	Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api,
	Takashi Iwai, linux-kernel, Rob Clark, netfilter-devel,
	linux-fsdevel, freedreno

Le mercredi 05 septembre 2018 à 19:33 +0200, Yann Droneaud a écrit :
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build
> > > process to make
> > > sure that the UAPI headers can all be built together with C++ (if
> > > the
> > > compiler being used supports C++).  All but the final patch
> > > perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to
> > directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace
> > trick
> > themselves when they do the import?  That must be how they are
> > doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.
> 

For the record, libX11 has to handle the kink pf issue with C++
keyword:


https://gitlab.freedesktop.org/xorg/lib/libx11/blob/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef/include/X11/Xlib.h#L227

typedef struct {
	XExtData *ext_data;	/* hook for extension to hang data */
	VisualID visualid;	/* visual id of this visual */
#if defined(__cplusplus) || defined(c_plusplus)
	int c_class;		/* C++ class of screen (monochrome, etc.) */
#else
	int class;		/* class of screen (monochrome, etc.) */
#endif
	unsigned long red_mask, green_mask, blue_mask;	/* mask values */
	int bits_per_rgb;	/* log base 2 of distinct color values */
	int map_entries;	/* color map entries */
} Visual;


Regards.

-- 
Yann Droneaud
OPTEYA


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  7:12       ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-06  7:12 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takashi Iwai,
	linux-kernel

Le mercredi 05 septembre 2018 à 19:33 +0200, Yann Droneaud a écrit :
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build
> > > process to make
> > > sure that the UAPI headers can all be built together with C++ (if
> > > the
> > > compiler being used supports C++).  All but the final patch
> > > perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to
> > directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace
> > trick
> > themselves when they do the import?  That must be how they are
> > doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.
> 

For the record, libX11 has to handle the kink pf issue with C++
keyword:


https://gitlab.freedesktop.org/xorg/lib/libx11/blob/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef/include/X11/Xlib.h#L227

typedef struct {
	XExtData *ext_data;	/* hook for extension to hang data */
	VisualID visualid;	/* visual id of this visual */
#if defined(__cplusplus) || defined(c_plusplus)
	int c_class;		/* C++ class of screen (monochrome, etc.) */
#else
	int class;		/* class of screen (monochrome, etc.) */
#endif
	unsigned long red_mask, green_mask, blue_mask;	/* mask values */
	int bits_per_rgb;	/* log base 2 of distinct color values */
	int map_entries;	/* color map entries */
} Visual;


Regards.

-- 
Yann Droneaud
OPTEYA


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  7:12       ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-06  7:12 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
	Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Masahiro Yamada, keyrings-u79uwXL29TY76Z2rM5mHXA,
	Ryusuke Konishi, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela, Jan Harkes,
	Michal Marek, linux-api-u79uwXL29TY76Z2rM5mHXA, Takashi Iwai

Le mercredi 05 septembre 2018 à 19:33 +0200, Yann Droneaud a écrit :
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build
> > > process to make
> > > sure that the UAPI headers can all be built together with C++ (if
> > > the
> > > compiler being used supports C++).  All but the final patch
> > > perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to
> > directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace
> > trick
> > themselves when they do the import?  That must be how they are
> > doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.
> 

For the record, libX11 has to handle the kink pf issue with C++
keyword:


https://gitlab.freedesktop.org/xorg/lib/libx11/blob/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef/include/X11/Xlib.h#L227

typedef struct {
	XExtData *ext_data;	/* hook for extension to hang data */
	VisualID visualid;	/* visual id of this visual */
#if defined(__cplusplus) || defined(c_plusplus)
	int c_class;		/* C++ class of screen (monochrome, etc.) */
#else
	int class;		/* class of screen (monochrome, etc.) */
#endif
	unsigned long red_mask, green_mask, blue_mask;	/* mask values */
	int bits_per_rgb;	/* log base 2 of distinct color values */
	int map_entries;	/* color map entries */
} Visual;


Regards.

-- 
Yann Droneaud
OPTEYA

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  7:12       ` Yann Droneaud
  0 siblings, 0 replies; 124+ messages in thread
From: Yann Droneaud @ 2018-09-06  7:12 UTC (permalink / raw)
  To: Greg KH, David Howells
  Cc: linux-api, linux-kbuild, Michal Marek, dri-devel, virtualization,
	keyrings, David Airlie, linux-nilfs, linux-nvdimm,
	Michael S. Tsirkin, codalist, coda, coreteam, Rob Clark,
	linux-arm-msm, Kent Overstreet, Dan Williams, Takashi Iwai,
	linux-bcache, Coly Li, Jaroslav Kysela, Jan Harkes,
	Masahiro Yamada, Ryusuke Konishi, Jason Wang, Mat Martineau,
	netfilter-devel, linux-fsdevel, moderated for non-subscribers,
	freedreno, linux-kernel

Le mercredi 05 septembre 2018 à 19:33 +0200, Yann Droneaud a écrit :
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > > 
> > > Here's a set of patches that inserts a step into the build
> > > process to make
> > > sure that the UAPI headers can all be built together with C++ (if
> > > the
> > > compiler being used supports C++).  All but the final patch
> > > perform fixups,
> > > including:
> > 
> > Wait, why do we care?  What has recently changed to start to
> > directly
> > import kernel uapi files into C++ code?
> > 
> > And if userspace wants to do this, can't they do the C namespace
> > trick
> > themselves when they do the import?  That must be how they are
> > doing it
> > today, right?
> > 
> 
> They can't.
> 
> 
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.
> 

For the record, libX11 has to handle the kink pf issue with C++
keyword:


https://gitlab.freedesktop.org/xorg/lib/libx11/blob/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef/include/X11/Xlib.h#L227

typedef struct {
	XExtData *ext_data;	/* hook for extension to hang data */
	VisualID visualid;	/* visual id of this visual */
#if defined(__cplusplus) || defined(c_plusplus)
	int c_class;		/* C++ class of screen (monochrome, etc.) */
#else
	int class;		/* class of screen (monochrome, etc.) */
#endif
	unsigned long red_mask, green_mask, blue_mask;	/* mask values */
	int bits_per_rgb;	/* log base 2 of distinct color values */
	int map_entries;	/* color map entries */
} Visual;


Regards.

-- 
Yann Droneaud
OPTEYA



^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-05 15:55 ` [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI David Howells
                     ` (2 preceding siblings ...)
  2018-09-05 17:24   ` David Howells
@ 2018-09-06  7:13   ` David Howells
  2018-09-06 11:52     ` Yann Droneaud
  2018-09-06 14:53     ` David Howells
  3 siblings, 2 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  7:13 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: dhowells, linux-api, linux-kbuild, Jan Harkes, coda, codalist,
	linux-fsdevel, linux-kernel

Yann Droneaud <ydroneaud@opteya.com> wrote:

> This structure should not have been exposed to userspace in the first
> place: it's unusable by userspace as it is. It was incorrect to have it
> outside of #ifdef __KERNEL__ before commit 607ca46e97a1b ... 
> ...
> All CODA_REQ_* defines internals to kernel side and not exchanged with
> userspace.
> 
> Please move them back to <linux/coda_psdev.h>

Is there any reason coda_psdev.h needs to be in include/linux/ rather than
fs/coda/?

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 08/11] UAPI: sound: Fix use of u32 and co. in UAPI headers
  2018-09-05 15:55   ` David Howells
  (?)
  (?)
@ 2018-09-06  8:17   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  8:17 UTC (permalink / raw)
  To: Takashi Sakamoto
  Cc: dhowells, linux-api, linux-kbuild, linux-kernel,
	moderated for non-subscribers, Takashi Iwai

Takashi Sakamoto <o-takashi@sakamocchi.jp> wrote:

> A similar patch was already proposed[1] and has been applied by Mark to
> his tree[2]. Your issue (3) is going to be solved soon for v4.19
> kernel.

Thanks, I've pulled the branch leading up to that commit into the base of
mine.  It seems the changes were identical:-)

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  9:18 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Michael S. Tsirkin, David Airlie, Jason Wang, Mat Martineau,
	dri-devel, virtualization, dhowells, Masahiro Yamada, keyrings,
	Ryusuke Konishi, Yann Droneaud, linux-nilfs, linux-nvdimm,
	codalist, coda, coreteam, Kent Overstreet, linux-arm-msm,
	Coly Li, linux-bcache, Jan Harkes, Michal Marek, linux-kernel,
	Rob Clark, netfilter-devel, linux-fsdevel, freedreno


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).

Note that it's based on a commit from the sound tree to fix usage of u32
and co..

Most of the patches perform fixups, including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (6) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

There's also:

 (7) Move the coda_psdev.h header file to fs/coda/.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

Changes for v2:

 - Merge commit from sound tree to fix u32 usage issues
 - Use a switch to fix sparse array initialisation
 - Simplify nilfs2 by performing bitwise ops in LE space not CPU space
 - Handle conflicting fix to use of 'private' in keyctl.h
 - Move kernel internal coda bits to coda internal headers
 - Move coda_psdev.h header to fs/coda/.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Move kernel internals out of public view
      coda: Move internal defs out of include/linux/
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 fs/coda/cache.c                                   |    2 
 fs/coda/cnode.c                                   |    2 
 fs/coda/coda_linux.c                              |    2 
 fs/coda/coda_psdev.h                              |   88 +++++++++++++++
 fs/coda/dir.c                                     |    2 
 fs/coda/file.c                                    |    3 -
 fs/coda/inode.c                                   |    2 
 fs/coda/pioctl.c                                  |    3 -
 fs/coda/psdev.c                                   |    3 -
 fs/coda/symlink.c                                 |    3 -
 fs/coda/upcall.c                                  |    2 
 include/linux/coda_psdev.h                        |   72 ------------
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |   18 ---
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   52 ++++-----
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   28 ++---
 include/uapi/linux/virtio_net.h                   |    7 +
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 25 files changed, 304 insertions(+), 166 deletions(-)
 create mode 100644 fs/coda/coda_psdev.h
 delete mode 100644 include/linux/coda_psdev.h
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  9:18 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: Michael S. Tsirkin, David Airlie, Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, Masahiro Yamada,
	keyrings-u79uwXL29TY76Z2rM5mHXA, Ryusuke Konishi, Yann Droneaud,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Dan Williams, Jan Harkes,
	Michal Marek, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Clark,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).

Note that it's based on a commit from the sound tree to fix usage of u32
and co..

Most of the patches perform fixups, including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (6) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

There's also:

 (7) Move the coda_psdev.h header file to fs/coda/.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

Changes for v2:

 - Merge commit from sound tree to fix u32 usage issues
 - Use a switch to fix sparse array initialisation
 - Simplify nilfs2 by performing bitwise ops in LE space not CPU space
 - Handle conflicting fix to use of 'private' in keyctl.h
 - Move kernel internal coda bits to coda internal headers
 - Move coda_psdev.h header to fs/coda/.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Move kernel internals out of public view
      coda: Move internal defs out of include/linux/
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 fs/coda/cache.c                                   |    2 
 fs/coda/cnode.c                                   |    2 
 fs/coda/coda_linux.c                              |    2 
 fs/coda/coda_psdev.h                              |   88 +++++++++++++++
 fs/coda/dir.c                                     |    2 
 fs/coda/file.c                                    |    3 -
 fs/coda/inode.c                                   |    2 
 fs/coda/pioctl.c                                  |    3 -
 fs/coda/psdev.c                                   |    3 -
 fs/coda/symlink.c                                 |    3 -
 fs/coda/upcall.c                                  |    2 
 include/linux/coda_psdev.h                        |   72 ------------
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |   18 ---
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   52 ++++-----
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   28 ++---
 include/uapi/linux/virtio_net.h                   |    7 +
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 25 files changed, 304 insertions(+), 166 deletions(-)
 create mode 100644 fs/coda/coda_psdev.h
 delete mode 100644 include/linux/coda_psdev.h
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  9:18 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: Michael S. Tsirkin, David Airlie, Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, Masahiro Yamada,
	keyrings-u79uwXL29TY76Z2rM5mHXA, Ryusuke Konishi, Yann Droneaud,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Dan Williams, Jan Harkes,
	Michal Marek, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Clark,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).

Note that it's based on a commit from the sound tree to fix usage of u32
and co..

Most of the patches perform fixups, including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (6) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

There's also:

 (7) Move the coda_psdev.h header file to fs/coda/.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

Changes for v2:

 - Merge commit from sound tree to fix u32 usage issues
 - Use a switch to fix sparse array initialisation
 - Simplify nilfs2 by performing bitwise ops in LE space not CPU space
 - Handle conflicting fix to use of 'private' in keyctl.h
 - Move kernel internal coda bits to coda internal headers
 - Move coda_psdev.h header to fs/coda/.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Move kernel internals out of public view
      coda: Move internal defs out of include/linux/
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 fs/coda/cache.c                                   |    2 
 fs/coda/cnode.c                                   |    2 
 fs/coda/coda_linux.c                              |    2 
 fs/coda/coda_psdev.h                              |   88 +++++++++++++++
 fs/coda/dir.c                                     |    2 
 fs/coda/file.c                                    |    3 -
 fs/coda/inode.c                                   |    2 
 fs/coda/pioctl.c                                  |    3 -
 fs/coda/psdev.c                                   |    3 -
 fs/coda/symlink.c                                 |    3 -
 fs/coda/upcall.c                                  |    2 
 include/linux/coda_psdev.h                        |   72 ------------
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |   18 ---
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   52 ++++-----
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   28 ++---
 include/uapi/linux/virtio_net.h                   |    7 +
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 25 files changed, 304 insertions(+), 166 deletions(-)
 create mode 100644 fs/coda/coda_psdev.h
 delete mode 100644 include/linux/coda_psdev.h
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  9:18 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Michal Marek, dri-devel, virtualization, keyrings, David Airlie,
	linux-nilfs, linux-nvdimm, Michael S. Tsirkin, codalist, coda,
	coreteam, Rob Clark, linux-arm-msm, Kent Overstreet,
	Dan Williams, linux-bcache, Coly Li, Jan Harkes, Yann Droneaud,
	Masahiro Yamada, Ryusuke Konishi, Jason Wang, Mat Martineau,
	netfilter-devel, linux-fsdevel, freedreno, linux-kernel,
	dhowells


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).

Note that it's based on a commit from the sound tree to fix usage of u32
and co..

Most of the patches perform fixups, including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (6) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

There's also:

 (7) Move the coda_psdev.h header file to fs/coda/.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

Changes for v2:

 - Merge commit from sound tree to fix u32 usage issues
 - Use a switch to fix sparse array initialisation
 - Simplify nilfs2 by performing bitwise ops in LE space not CPU space
 - Handle conflicting fix to use of 'private' in keyctl.h
 - Move kernel internal coda bits to coda internal headers
 - Move coda_psdev.h header to fs/coda/.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Move kernel internals out of public view
      coda: Move internal defs out of include/linux/
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 fs/coda/cache.c                                   |    2 
 fs/coda/cnode.c                                   |    2 
 fs/coda/coda_linux.c                              |    2 
 fs/coda/coda_psdev.h                              |   88 +++++++++++++++
 fs/coda/dir.c                                     |    2 
 fs/coda/file.c                                    |    3 -
 fs/coda/inode.c                                   |    2 
 fs/coda/pioctl.c                                  |    3 -
 fs/coda/psdev.c                                   |    3 -
 fs/coda/symlink.c                                 |    3 -
 fs/coda/upcall.c                                  |    2 
 include/linux/coda_psdev.h                        |   72 ------------
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |   18 ---
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   52 ++++-----
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   28 ++---
 include/uapi/linux/virtio_net.h                   |    7 +
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 25 files changed, 304 insertions(+), 166 deletions(-)
 create mode 100644 fs/coda/coda_psdev.h
 delete mode 100644 include/linux/coda_psdev.h
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [RFC] UAPI: Check headers by compiling all together as C++
@ 2018-09-06  9:18 ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: Michael S. Tsirkin, David Airlie, Jason Wang, Mat Martineau,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, Masahiro Yamada,
	keyrings-u79uwXL29TY76Z2rM5mHXA, Ryusuke Konishi, Yann Droneaud,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw,
	coreteam-Cap9r6Oaw4JrovVCs/uTlw, Kent Overstreet,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Coly Li,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA, Dan Williams, Jan Harkes,
	Michal Marek, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Clark,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA


Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++).

Note that it's based on a commit from the sound tree to fix usage of u32
and co..

Most of the patches perform fixups, including:

 (1) Fix member names that conflict with C++ reserved words by providing
     alternates that can be used anywhere.  An anonymous union is used so
     that that the conflicting name is still available outside of C++.

 (2) Fix the use of flexible arrays in structs that get embedded (which is
     illegal in C++).

 (3) Remove the use of internal kernel structs in UAPI structures.

 (4) Fix symbol collisions.

 (5) Fix use of sparsely initialised arrays (which g++ doesn't implement).

 (6) Remove some use of PAGE_SIZE since this isn't valid outside of the
     kernel.

There's also:

 (7) Move the coda_psdev.h header file to fs/coda/.

And lastly:

 (8) Compile all of the UAPI headers (with a few exceptions) together as
     C++ to catch new errors occurring as part of the regular build
     process.

Changes for v2:

 - Merge commit from sound tree to fix u32 usage issues
 - Use a switch to fix sparse array initialisation
 - Simplify nilfs2 by performing bitwise ops in LE space not CPU space
 - Handle conflicting fix to use of 'private' in keyctl.h
 - Move kernel internal coda bits to coda internal headers
 - Move coda_psdev.h header to fs/coda/.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check

Thanks,
David
---
David Howells (11):
      UAPI: drm: Fix use of C++ keywords as structural members
      UAPI: keys: Fix use of C++ keywords as structural members
      UAPI: virtio_net: Fix use of C++ keywords as structural members
      UAPI: bcache: Fix use of embedded flexible array
      UAPI: coda: Move kernel internals out of public view
      coda: Move internal defs out of include/linux/
      UAPI: netfilter: Fix symbol collision issues
      UAPI: nilfs2: Fix use of undefined byteswapping functions
      UAPI: ndctl: Fix g++-unsupported initialisation in headers
      UAPI: ndctl: Remove use of PAGE_SIZE
      UAPI: Check headers build for C++


 Makefile                                          |    1 
 fs/coda/cache.c                                   |    2 
 fs/coda/cnode.c                                   |    2 
 fs/coda/coda_linux.c                              |    2 
 fs/coda/coda_psdev.h                              |   88 +++++++++++++++
 fs/coda/dir.c                                     |    2 
 fs/coda/file.c                                    |    3 -
 fs/coda/inode.c                                   |    2 
 fs/coda/pioctl.c                                  |    3 -
 fs/coda/psdev.c                                   |    3 -
 fs/coda/symlink.c                                 |    3 -
 fs/coda/upcall.c                                  |    2 
 include/linux/coda_psdev.h                        |   72 ------------
 include/linux/ndctl.h                             |   22 ++++
 include/uapi/drm/i810_drm.h                       |    7 +
 include/uapi/drm/msm_drm.h                        |    7 +
 include/uapi/linux/bcache.h                       |    2 
 include/uapi/linux/coda_psdev.h                   |   18 ---
 include/uapi/linux/keyctl.h                       |    7 +
 include/uapi/linux/ndctl.h                        |   52 ++++-----
 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 --
 include/uapi/linux/nilfs2_ondisk.h                |   28 ++---
 include/uapi/linux/virtio_net.h                   |    7 +
 scripts/headers-c++.sh                            |  124 +++++++++++++++++++++
 25 files changed, 304 insertions(+), 166 deletions(-)
 create mode 100644 fs/coda/coda_psdev.h
 delete mode 100644 include/linux/coda_psdev.h
 create mode 100644 include/linux/ndctl.h
 create mode 100755 scripts/headers-c++.sh

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 01/11] UAPI: drm: Fix use of C++ keywords as structural members [ver #2]
  2018-09-06  9:18 ` David Howells
@ 2018-09-06  9:18     ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: David Airlie, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, Rob Clark,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The i810 and msm drm drivers use C++ keywords as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Rob Clark <robdclark@gmail.com>
cc: David Airlie <airlied@linux.ie>
cc: linux-arm-msm@vger.kernel.org
cc: dri-devel@lists.freedesktop.org
cc: freedreno@lists.freedesktop.org
---

 include/uapi/drm/i810_drm.h |    7 ++++++-
 include/uapi/drm/msm_drm.h  |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/uapi/drm/i810_drm.h b/include/uapi/drm/i810_drm.h
index d285d5e72e6a..617d79ec3fc5 100644
--- a/include/uapi/drm/i810_drm.h
+++ b/include/uapi/drm/i810_drm.h
@@ -266,7 +266,12 @@ typedef struct _drm_i810_copy_t {
 #define PR_MASK              (0x7<<18)
 
 typedef struct drm_i810_dma {
-	void *virtual;
+	union {
+#ifndef __cplusplus
+		void *virtual;
+#endif
+		void *_virtual;
+	};
 	int request_idx;
 	int request_size;
 	int granted;
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index c06d0a5bdd80..e99bab72d58c 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -148,7 +148,12 @@ struct drm_msm_gem_cpu_fini {
  */
 struct drm_msm_gem_submit_reloc {
 	__u32 submit_offset;  /* in, offset from submit_bo */
-	__u32 or;             /* in, value OR'd with result */
+	union {
+#ifndef __cplusplus
+		__u32 or;	/* in, value OR'd with result */
+#endif
+		__u32 _or;	/* in, value OR'd with result */
+	};
 	__s32 shift;          /* in, amount of left shift (can be negative) */
 	__u32 reloc_idx;      /* in, index of reloc_bo buffer */
 	__u64 reloc_offset;   /* in, offset from start of reloc_bo */

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 01/11] UAPI: drm: Fix use of C++ keywords as structural members [ver #2]
@ 2018-09-06  9:18     ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Rob Clark, David Airlie, linux-arm-msm, dri-devel, freedreno,
	linux-kernel, dhowells

The i810 and msm drm drivers use C++ keywords as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Rob Clark <robdclark@gmail.com>
cc: David Airlie <airlied@linux.ie>
cc: linux-arm-msm@vger.kernel.org
cc: dri-devel@lists.freedesktop.org
cc: freedreno@lists.freedesktop.org
---

 include/uapi/drm/i810_drm.h |    7 ++++++-
 include/uapi/drm/msm_drm.h  |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/uapi/drm/i810_drm.h b/include/uapi/drm/i810_drm.h
index d285d5e72e6a..617d79ec3fc5 100644
--- a/include/uapi/drm/i810_drm.h
+++ b/include/uapi/drm/i810_drm.h
@@ -266,7 +266,12 @@ typedef struct _drm_i810_copy_t {
 #define PR_MASK              (0x7<<18)
 
 typedef struct drm_i810_dma {
-	void *virtual;
+	union {
+#ifndef __cplusplus
+		void *virtual;
+#endif
+		void *_virtual;
+	};
 	int request_idx;
 	int request_size;
 	int granted;
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index c06d0a5bdd80..e99bab72d58c 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -148,7 +148,12 @@ struct drm_msm_gem_cpu_fini {
  */
 struct drm_msm_gem_submit_reloc {
 	__u32 submit_offset;  /* in, offset from submit_bo */
-	__u32 or;             /* in, value OR'd with result */
+	union {
+#ifndef __cplusplus
+		__u32 or;	/* in, value OR'd with result */
+#endif
+		__u32 _or;	/* in, value OR'd with result */
+	};
 	__s32 shift;          /* in, amount of left shift (can be negative) */
 	__u32 reloc_idx;      /* in, index of reloc_bo buffer */
 	__u64 reloc_offset;   /* in, offset from start of reloc_bo */


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 02/11] UAPI: keys: Fix use of C++ keywords as structural members [ver #2]
  2018-09-06  9:18 ` David Howells
@ 2018-09-06  9:18   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: Mat Martineau, keyrings, linux-kernel, dhowells

The keyctl_dh_params struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
cc: keyrings@vger.kernel.org
---

 include/uapi/linux/keyctl.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
index 910cc4334b21..170f015d1f25 100644
--- a/include/uapi/linux/keyctl.h
+++ b/include/uapi/linux/keyctl.h
@@ -65,7 +65,12 @@
 
 /* keyctl structures */
 struct keyctl_dh_params {
-	__s32 dh_private;
+	union {
+#ifndef __cplusplus
+		__s32 private;
+#endif
+		__s32 dh_private;
+	};
 	__s32 prime;
 	__s32 base;
 };

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 02/11] UAPI: keys: Fix use of C++ keywords as structural members [ver #2]
@ 2018-09-06  9:18   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: Mat Martineau, keyrings, linux-kernel, dhowells

The keyctl_dh_params struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
cc: keyrings@vger.kernel.org
---

 include/uapi/linux/keyctl.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
index 910cc4334b21..170f015d1f25 100644
--- a/include/uapi/linux/keyctl.h
+++ b/include/uapi/linux/keyctl.h
@@ -65,7 +65,12 @@
 
 /* keyctl structures */
 struct keyctl_dh_params {
-	__s32 dh_private;
+	union {
+#ifndef __cplusplus
+		__s32 private;
+#endif
+		__s32 dh_private;
+	};
 	__s32 prime;
 	__s32 base;
 };


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members [ver #2]
  2018-09-06  9:18 ` David Howells
                   ` (5 preceding siblings ...)
  (?)
@ 2018-09-06  9:18 ` David Howells
  2018-09-06 15:02   ` Michael S. Tsirkin
  2018-09-06 15:02   ` Michael S. Tsirkin
  -1 siblings, 2 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Michael S. Tsirkin, Jason Wang, virtualization, linux-kernel, dhowells

The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: "Michael S. Tsirkin" <mst@redhat.com>
cc: Jason Wang <jasowang@redhat.com>
cc: virtualization@lists.linux-foundation.org
---

 include/uapi/linux/virtio_net.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index a3715a3224c1..967142bc0e05 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
  * command goes in between.
  */
 struct virtio_net_ctrl_hdr {
-	__u8 class;
+	union {
+#ifndef __cplusplus
+		__u8 class;
+#endif
+		__u8 _class;
+	};
 	__u8 cmd;
 } __attribute__((packed));
 


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members [ver #2]
  2018-09-06  9:18 ` David Howells
                   ` (6 preceding siblings ...)
  (?)
@ 2018-09-06  9:18 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: dhowells, virtualization, linux-kernel, Michael S. Tsirkin

The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: "Michael S. Tsirkin" <mst@redhat.com>
cc: Jason Wang <jasowang@redhat.com>
cc: virtualization@lists.linux-foundation.org
---

 include/uapi/linux/virtio_net.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index a3715a3224c1..967142bc0e05 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
  * command goes in between.
  */
 struct virtio_net_ctrl_hdr {
-	__u8 class;
+	union {
+#ifndef __cplusplus
+		__u8 class;
+#endif
+		__u8 _class;
+	};
 	__u8 cmd;
 } __attribute__((packed));

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array [ver #2]
  2018-09-06  9:18 ` David Howells
                   ` (7 preceding siblings ...)
  (?)
@ 2018-09-06  9:18 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Coly Li, Kent Overstreet, linux-bcache, linux-kernel, dhowells

The bkey struct defined by bcache is embedded in the jset struct.  However,
this is illegal in C++ as there's a "flexible array" at the end of the
struct.  Change this to be a 0-length struct instead.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Coly Li <colyli@suse.de>
cc: Kent Overstreet <kent.overstreet@gmail.com>
cc: linux-bcache@vger.kernel.org
---

 include/uapi/linux/bcache.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 5d4f58e059fd..11863e903bff 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -23,7 +23,7 @@ static inline void SET_##name(type *k, __u64 v)			\
 struct bkey {
 	__u64	high;
 	__u64	low;
-	__u64	ptr[];
+	__u64	ptr[0];
 };
 
 #define KEY_FIELD(name, field, offset, size)				\


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 05/11] UAPI: coda: Move kernel internals out of public view [ver #2]
  2018-09-06  9:18 ` David Howells
@ 2018-09-06  9:18   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Yann Droneaud, Yann Droneaud, Jan Harkes, coda, codalist,
	linux-fsdevel, linux-kernel, dhowells

The upc_req struct and the CODA_REQ_* constants are kernel internals and
shouldn't have been exposed to userspace.  Indeed, the upc_req struct
contains other kernel internal structs.

Move them to include/linux/coda_psdev.h.

Suggested-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Yann Droneaud <ydroneaud@opteya.com>
cc: Jan Harkes <jaharkes@cs.cmu.edu>
cc: coda@cs.cmu.edu
cc: codalist@coda.cs.cmu.edu
cc: linux-fsdevel@vger.kernel.org
---

 include/linux/coda_psdev.h      |   18 +++++++++++++++++-
 include/uapi/linux/coda_psdev.h |   18 ------------------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 15170954aa2b..c61e70b97319 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -8,6 +8,23 @@
 
 struct kstatfs;
 
+/* messages between coda filesystem in kernel and Venus */
+struct upc_req {
+	struct list_head    uc_chain;
+	caddr_t	            uc_data;
+	u_short	            uc_flags;
+	u_short             uc_inSize;  /* Size is at most 5000 bytes */
+	u_short	            uc_outSize;
+	u_short	            uc_opcode;  /* copied from data to save lookup */
+	int		    uc_unique;
+	wait_queue_head_t   uc_sleep;   /* process' wait queue */
+};
+
+#define CODA_REQ_ASYNC  0x1
+#define CODA_REQ_READ   0x2
+#define CODA_REQ_WRITE  0x4
+#define CODA_REQ_ABORT  0x8
+
 /* communication pending/processing queues */
 struct venus_comm {
 	u_long		    vc_seq;
@@ -19,7 +36,6 @@ struct venus_comm {
 	struct mutex	    vc_mutex;
 };
 
-
 static inline struct venus_comm *coda_vcp(struct super_block *sb)
 {
 	return (struct venus_comm *)((sb)->s_fs_info);
diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h
index aa6623efd2dd..3dacb7fad66a 100644
--- a/include/uapi/linux/coda_psdev.h
+++ b/include/uapi/linux/coda_psdev.h
@@ -7,22 +7,4 @@
 #define CODA_PSDEV_MAJOR 67
 #define MAX_CODADEVS  5	   /* how many do we allow */
 
-
-/* messages between coda filesystem in kernel and Venus */
-struct upc_req {
-	struct list_head    uc_chain;
-	caddr_t	            uc_data;
-	u_short	            uc_flags;
-	u_short             uc_inSize;  /* Size is at most 5000 bytes */
-	u_short	            uc_outSize;
-	u_short	            uc_opcode;  /* copied from data to save lookup */
-	int		    uc_unique;
-	wait_queue_head_t   uc_sleep;   /* process' wait queue */
-};
-
-#define CODA_REQ_ASYNC  0x1
-#define CODA_REQ_READ   0x2
-#define CODA_REQ_WRITE  0x4
-#define CODA_REQ_ABORT  0x8
-
 #endif /* _UAPI__CODA_PSDEV_H */


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 05/11] UAPI: coda: Move kernel internals out of public view [ver #2]
@ 2018-09-06  9:18   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:18 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: Yann Droneaud

The upc_req struct and the CODA_REQ_* constants are kernel internals and
shouldn't have been exposed to userspace.  Indeed, the upc_req struct
contains other kernel internal structs.

Move them to include/linux/coda_psdev.h.

Suggested-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Yann Droneaud <ydroneaud@opteya.com>
cc: Jan Harkes <jaharkes@cs.cmu.edu>
cc: coda@cs.cmu.edu
cc: codalist@coda.cs.cmu.edu
cc: linux-fsdevel@vger.kernel.org
---

 include/linux/coda_psdev.h      |   18 +++++++++++++++++-
 include/uapi/linux/coda_psdev.h |   18 ------------------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 15170954aa2b..c61e70b97319 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -8,6 +8,23 @@
 
 struct kstatfs;
 
+/* messages between coda filesystem in kernel and Venus */
+struct upc_req {
+	struct list_head    uc_chain;
+	caddr_t	            uc_data;
+	u_short	            uc_flags;
+	u_short             uc_inSize;  /* Size is at most 5000 bytes */
+	u_short	            uc_outSize;
+	u_short	            uc_opcode;  /* copied from data to save lookup */
+	int		    uc_unique;
+	wait_queue_head_t   uc_sleep;   /* process' wait queue */
+};
+
+#define CODA_REQ_ASYNC  0x1
+#define CODA_REQ_READ   0x2
+#define CODA_REQ_WRITE  0x4
+#define CODA_REQ_ABORT  0x8
+
 /* communication pending/processing queues */
 struct venus_comm {
 	u_long		    vc_seq;
@@ -19,7 +36,6 @@ struct venus_comm {
 	struct mutex	    vc_mutex;
 };
 
-
 static inline struct venus_comm *coda_vcp(struct super_block *sb)
 {
 	return (struct venus_comm *)((sb)->s_fs_info);
diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h
index aa6623efd2dd..3dacb7fad66a 100644
--- a/include/uapi/linux/coda_psdev.h
+++ b/include/uapi/linux/coda_psdev.h
@@ -7,22 +7,4 @@
 #define CODA_PSDEV_MAJOR 67
 #define MAX_CODADEVS  5	   /* how many do we allow */
 
-
-/* messages between coda filesystem in kernel and Venus */
-struct upc_req {
-	struct list_head    uc_chain;
-	caddr_t	            uc_data;
-	u_short	            uc_flags;
-	u_short             uc_inSize;  /* Size is at most 5000 bytes */
-	u_short	            uc_outSize;
-	u_short	            uc_opcode;  /* copied from data to save lookup */
-	int		    uc_unique;
-	wait_queue_head_t   uc_sleep;   /* process' wait queue */
-};
-
-#define CODA_REQ_ASYNC  0x1
-#define CODA_REQ_READ   0x2
-#define CODA_REQ_WRITE  0x4
-#define CODA_REQ_ABORT  0x8
-
 #endif /* _UAPI__CODA_PSDEV_H */

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 06/11] coda: Move internal defs out of include/linux/ [ver #2]
  2018-09-06  9:18 ` David Howells
                   ` (9 preceding siblings ...)
  (?)
@ 2018-09-06  9:19 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Yann Droneaud, Jan Harkes, coda, codalist, linux-fsdevel,
	linux-kernel, dhowells

Move include/linux/coda_psdev.h to fs/coda/ as there's nothing else that
uses it.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Yann Droneaud <ydroneaud@opteya.com>
cc: Jan Harkes <jaharkes@cs.cmu.edu>
cc: coda@cs.cmu.edu
cc: codalist@coda.cs.cmu.edu
cc: linux-fsdevel@vger.kernel.org
---

 fs/coda/cache.c            |    2 +
 fs/coda/cnode.c            |    2 +
 fs/coda/coda_linux.c       |    2 +
 fs/coda/coda_psdev.h       |   88 ++++++++++++++++++++++++++++++++++++++++++++
 fs/coda/dir.c              |    2 +
 fs/coda/file.c             |    3 +-
 fs/coda/inode.c            |    2 +
 fs/coda/pioctl.c           |    3 +-
 fs/coda/psdev.c            |    3 +-
 fs/coda/symlink.c          |    3 +-
 fs/coda/upcall.c           |    2 +
 include/linux/coda_psdev.h |   88 --------------------------------------------
 12 files changed, 98 insertions(+), 102 deletions(-)
 create mode 100644 fs/coda/coda_psdev.h
 delete mode 100644 include/linux/coda_psdev.h

diff --git a/fs/coda/cache.c b/fs/coda/cache.c
index 201fc08a8b4f..3b8c4513118f 100644
--- a/fs/coda/cache.c
+++ b/fs/coda/cache.c
@@ -21,7 +21,7 @@
 #include <linux/spinlock.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
+#include "coda_psdev.h"
 #include "coda_linux.h"
 #include "coda_cache.h"
 
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index 845b5a66952a..2e5badf67f98 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -8,8 +8,8 @@
 #include <linux/time.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
 #include <linux/pagemap.h>
+#include "coda_psdev.h"
 #include "coda_linux.h"
 
 static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2)
diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c
index f3d543dd9a98..f7741e4f499a 100644
--- a/fs/coda/coda_linux.c
+++ b/fs/coda/coda_linux.c
@@ -18,7 +18,7 @@
 #include <linux/string.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
+#include "coda_psdev.h"
 #include "coda_linux.h"
 
 /* initialize the debugging variables */
diff --git a/fs/coda/coda_psdev.h b/fs/coda/coda_psdev.h
new file mode 100644
index 000000000000..e1abfb0fc9f9
--- /dev/null
+++ b/fs/coda/coda_psdev.h
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __CODA_PSDEV_H
+#define __CODA_PSDEV_H
+
+#include <linux/backing-dev.h>
+#include <linux/mutex.h>
+#include <linux/coda_psdev.h>
+
+struct kstatfs;
+
+/* messages between coda filesystem in kernel and Venus */
+struct upc_req {
+	struct list_head    uc_chain;
+	caddr_t	            uc_data;
+	u_short	            uc_flags;
+	u_short             uc_inSize;  /* Size is at most 5000 bytes */
+	u_short	            uc_outSize;
+	u_short	            uc_opcode;  /* copied from data to save lookup */
+	int		    uc_unique;
+	wait_queue_head_t   uc_sleep;   /* process' wait queue */
+};
+
+#define CODA_REQ_ASYNC  0x1
+#define CODA_REQ_READ   0x2
+#define CODA_REQ_WRITE  0x4
+#define CODA_REQ_ABORT  0x8
+
+/* communication pending/processing queues */
+struct venus_comm {
+	u_long		    vc_seq;
+	wait_queue_head_t   vc_waitq; /* Venus wait queue */
+	struct list_head    vc_pending;
+	struct list_head    vc_processing;
+	int                 vc_inuse;
+	struct super_block *vc_sb;
+	struct mutex	    vc_mutex;
+};
+
+static inline struct venus_comm *coda_vcp(struct super_block *sb)
+{
+	return (struct venus_comm *)((sb)->s_fs_info);
+}
+
+/* upcalls */
+int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
+int venus_getattr(struct super_block *sb, struct CodaFid *fid,
+		  struct coda_vattr *attr);
+int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
+int venus_lookup(struct super_block *sb, struct CodaFid *fid, 
+		 const char *name, int length, int *type, 
+		 struct CodaFid *resfid);
+int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
+		kuid_t uid);
+int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
+	       struct file **f);
+int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, 
+		const char *name, int length, 
+		struct CodaFid *newfid, struct coda_vattr *attrs);
+int venus_create(struct super_block *sb, struct CodaFid *dirfid, 
+		 const char *name, int length, int excl, int mode,
+		 struct CodaFid *newfid, struct coda_vattr *attrs) ;
+int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, 
+		const char *name, int length);
+int venus_remove(struct super_block *sb, struct CodaFid *dirfid, 
+		 const char *name, int length);
+int venus_readlink(struct super_block *sb, struct CodaFid *fid, 
+		   char *buffer, int *length);
+int venus_rename(struct super_block *, struct CodaFid *new_fid, 
+		 struct CodaFid *old_fid, size_t old_length, 
+		 size_t new_length, const char *old_name, 
+		 const char *new_name);
+int venus_link(struct super_block *sb, struct CodaFid *fid, 
+		  struct CodaFid *dirfid, const char *name, int len );
+int venus_symlink(struct super_block *sb, struct CodaFid *fid,
+		  const char *name, int len, const char *symname, int symlen);
+int venus_access(struct super_block *sb, struct CodaFid *fid, int mask);
+int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
+		 unsigned int cmd, struct PioctlData *data);
+int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out);
+int venus_fsync(struct super_block *sb, struct CodaFid *fid);
+int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
+
+/*
+ * Statistics
+ */
+
+extern struct venus_comm coda_comms[];
+#endif
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 00876ddadb43..b4bb34862899 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -23,7 +23,7 @@
 #include <linux/uaccess.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
+#include "coda_psdev.h"
 #include "coda_linux.h"
 #include "coda_cache.h"
 
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 1cbc1f2298ee..ef135b209e18 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -22,8 +22,7 @@
 #include <linux/uaccess.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
-
+#include "coda_psdev.h"
 #include "coda_linux.h"
 #include "coda_int.h"
 
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 97424cf206c0..4c512572f257 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -27,7 +27,7 @@
 #include <linux/vmalloc.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
+#include "coda_psdev.h"
 #include "coda_linux.h"
 #include "coda_cache.h"
 
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index e0c17b7dccce..644d48c12ce8 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -20,8 +20,7 @@
 #include <linux/uaccess.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
-
+#include "coda_psdev.h"
 #include "coda_linux.h"
 
 /* pioctl ops */
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index c5234c21b539..a13764e9bb79 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -43,8 +43,7 @@
 #include <linux/uaccess.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
-
+#include "coda_psdev.h"
 #include "coda_linux.h"
 
 #include "coda_int.h"
diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c
index 202297d156df..8907d0508198 100644
--- a/fs/coda/symlink.c
+++ b/fs/coda/symlink.c
@@ -17,8 +17,7 @@
 #include <linux/pagemap.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
-
+#include "coda_psdev.h"
 #include "coda_linux.h"
 
 static int coda_symlink_filler(struct file *file, struct page *page)
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 1175a1722411..8babd2cc647a 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -33,7 +33,7 @@
 #include <linux/vfs.h>
 
 #include <linux/coda.h>
-#include <linux/coda_psdev.h>
+#include "coda_psdev.h"
 #include "coda_linux.h"
 #include "coda_cache.h"
 
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
deleted file mode 100644
index c61e70b97319..000000000000
--- a/include/linux/coda_psdev.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __CODA_PSDEV_H
-#define __CODA_PSDEV_H
-
-#include <linux/backing-dev.h>
-#include <linux/mutex.h>
-#include <uapi/linux/coda_psdev.h>
-
-struct kstatfs;
-
-/* messages between coda filesystem in kernel and Venus */
-struct upc_req {
-	struct list_head    uc_chain;
-	caddr_t	            uc_data;
-	u_short	            uc_flags;
-	u_short             uc_inSize;  /* Size is at most 5000 bytes */
-	u_short	            uc_outSize;
-	u_short	            uc_opcode;  /* copied from data to save lookup */
-	int		    uc_unique;
-	wait_queue_head_t   uc_sleep;   /* process' wait queue */
-};
-
-#define CODA_REQ_ASYNC  0x1
-#define CODA_REQ_READ   0x2
-#define CODA_REQ_WRITE  0x4
-#define CODA_REQ_ABORT  0x8
-
-/* communication pending/processing queues */
-struct venus_comm {
-	u_long		    vc_seq;
-	wait_queue_head_t   vc_waitq; /* Venus wait queue */
-	struct list_head    vc_pending;
-	struct list_head    vc_processing;
-	int                 vc_inuse;
-	struct super_block *vc_sb;
-	struct mutex	    vc_mutex;
-};
-
-static inline struct venus_comm *coda_vcp(struct super_block *sb)
-{
-	return (struct venus_comm *)((sb)->s_fs_info);
-}
-
-/* upcalls */
-int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
-int venus_getattr(struct super_block *sb, struct CodaFid *fid,
-		  struct coda_vattr *attr);
-int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
-int venus_lookup(struct super_block *sb, struct CodaFid *fid, 
-		 const char *name, int length, int *type, 
-		 struct CodaFid *resfid);
-int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
-		kuid_t uid);
-int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
-	       struct file **f);
-int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, 
-		const char *name, int length, 
-		struct CodaFid *newfid, struct coda_vattr *attrs);
-int venus_create(struct super_block *sb, struct CodaFid *dirfid, 
-		 const char *name, int length, int excl, int mode,
-		 struct CodaFid *newfid, struct coda_vattr *attrs) ;
-int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, 
-		const char *name, int length);
-int venus_remove(struct super_block *sb, struct CodaFid *dirfid, 
-		 const char *name, int length);
-int venus_readlink(struct super_block *sb, struct CodaFid *fid, 
-		   char *buffer, int *length);
-int venus_rename(struct super_block *, struct CodaFid *new_fid, 
-		 struct CodaFid *old_fid, size_t old_length, 
-		 size_t new_length, const char *old_name, 
-		 const char *new_name);
-int venus_link(struct super_block *sb, struct CodaFid *fid, 
-		  struct CodaFid *dirfid, const char *name, int len );
-int venus_symlink(struct super_block *sb, struct CodaFid *fid,
-		  const char *name, int len, const char *symname, int symlen);
-int venus_access(struct super_block *sb, struct CodaFid *fid, int mask);
-int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
-		 unsigned int cmd, struct PioctlData *data);
-int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out);
-int venus_fsync(struct super_block *sb, struct CodaFid *fid);
-int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
-
-/*
- * Statistics
- */
-
-extern struct venus_comm coda_comms[];
-#endif


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues [ver #2]
  2018-09-06  9:18 ` David Howells
                   ` (10 preceding siblings ...)
  (?)
@ 2018-09-06  9:19 ` David Howells
  2018-09-10 17:32     ` kbuild test robot
                     ` (2 more replies)
  -1 siblings, 3 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: netfilter-devel, coreteam, linux-kernel, dhowells

The netfilter UAPI headers have some symbol collision issues:

 (1) "enum nfnl_acct_msg_types" is defined twice, and each definition is
     completely different.

     Fix this by renaming the one in nfnetlink_cthelper.h to be "enum
     nfnl_cthelper_types" to be consistent with the other things in that
     file.

 (2) There's a disagreement between ipt_ECN.h and ipt_ecn.h over the
     definition of various IPT_ECN_* constants, leading to an error over
     IPT_ECN_IP_MASK being substituted when being defined as an enum value
     in ipt_ecn.h if ipt_ECN.h is #included first.

     Fix this by removing the conflicting constants from ipt_ECN.h and
     including ipt_ecn.h instead.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: netfilter-devel@vger.kernel.org
cc: coreteam@netfilter.org
---

 include/uapi/linux/netfilter/nfnetlink_cthelper.h |    2 +-
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h       |    9 +--------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/include/uapi/linux/netfilter/nfnetlink_cthelper.h b/include/uapi/linux/netfilter/nfnetlink_cthelper.h
index a13137afc429..b9313ed0c313 100644
--- a/include/uapi/linux/netfilter/nfnetlink_cthelper.h
+++ b/include/uapi/linux/netfilter/nfnetlink_cthelper.h
@@ -5,7 +5,7 @@
 #define NFCT_HELPER_STATUS_DISABLED	0
 #define NFCT_HELPER_STATUS_ENABLED	1
 
-enum nfnl_acct_msg_types {
+enum nfnl_cthelper_types {
 	NFNL_MSG_CTHELPER_NEW,
 	NFNL_MSG_CTHELPER_GET,
 	NFNL_MSG_CTHELPER_DEL,
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
index e3630fd045b8..d582119ad62a 100644
--- a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
@@ -12,14 +12,7 @@
 
 #include <linux/types.h>
 #include <linux/netfilter/xt_DSCP.h>
-
-#define IPT_ECN_IP_MASK	(~XT_DSCP_MASK)
-
-#define IPT_ECN_OP_SET_IP	0x01	/* set ECN bits of IPv4 header */
-#define IPT_ECN_OP_SET_ECE	0x10	/* set ECE bit of TCP header */
-#define IPT_ECN_OP_SET_CWR	0x20	/* set CWR bit of TCP header */
-
-#define IPT_ECN_OP_MASK		0xce
+#include <linux/netfilter_ipv4/ipt_ecn.h>
 
 struct ipt_ECN_info {
 	__u8 operation;	/* bitset of operations */


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 08/11] UAPI: nilfs2: Fix use of undefined byteswapping functions [ver #2]
  2018-09-06  9:18 ` David Howells
                   ` (11 preceding siblings ...)
  (?)
@ 2018-09-06  9:19 ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Ryusuke Konishi, linux-nilfs, linux-fsdevel, linux-kernel, dhowells

nilfs2 exports a load of inline functions to userspace that call kernel
byteswapping functions that don't exist in UAPI.  Fix this by making it
#include asm/byteorder.h and use the functions declared there.

A better way is probably to remove these inline functions from the nilfs2
header since they are technically broken.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
cc: linux-nilfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
---

 include/uapi/linux/nilfs2_ondisk.h |   28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/include/uapi/linux/nilfs2_ondisk.h b/include/uapi/linux/nilfs2_ondisk.h
index a7e66ab11d1d..47f8f596ff1c 100644
--- a/include/uapi/linux/nilfs2_ondisk.h
+++ b/include/uapi/linux/nilfs2_ondisk.h
@@ -29,6 +29,7 @@
 
 #include <linux/types.h>
 #include <linux/magic.h>
+#include <asm/byteorder.h>
 
 
 #define NILFS_INODE_BMAP_SIZE	7
@@ -533,20 +534,17 @@ enum {
 static inline void							\
 nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp)		\
 {									\
-	cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |		\
-				   (1UL << NILFS_CHECKPOINT_##flag));	\
+	cp->cp_flags |= __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag);	\
 }									\
 static inline void							\
 nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp)		\
 {									\
-	cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) &		\
-				   ~(1UL << NILFS_CHECKPOINT_##flag));	\
+	cp->cp_flags &= __cpu_to_le32(~(1UL << NILFS_CHECKPOINT_##flag)); \
 }									\
 static inline int							\
 nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp)		\
 {									\
-	return !!(le32_to_cpu(cp->cp_flags) &				\
-		  (1UL << NILFS_CHECKPOINT_##flag));			\
+	return !!(cp->cp_flags & __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag)); \
 }
 
 NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
@@ -595,21 +593,17 @@ enum {
 static inline void							\
 nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su)		\
 {									\
-	su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) |		\
-				   (1UL << NILFS_SEGMENT_USAGE_##flag));\
+	su->su_flags |= __cpu_to_le32(1UL << NILFS_SEGMENT_USAGE_##flag); \
 }									\
 static inline void							\
 nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su)	\
 {									\
-	su->su_flags =							\
-		cpu_to_le32(le32_to_cpu(su->su_flags) &			\
-			    ~(1UL << NILFS_SEGMENT_USAGE_##flag));      \
+	su->su_flags &= __cpu_to_le32(~(1UL << NILFS_SEGMENT_USAGE_##flag)); \
 }									\
 static inline int							\
 nilfs_segment_usage_##name(const struct nilfs_segment_usage *su)	\
 {									\
-	return !!(le32_to_cpu(su->su_flags) &				\
-		  (1UL << NILFS_SEGMENT_USAGE_##flag));			\
+	return !!(su->su_flags & __cpu_to_le32(1UL << NILFS_SEGMENT_USAGE_##flag)); \
 }
 
 NILFS_SEGMENT_USAGE_FNS(ACTIVE, active)
@@ -619,15 +613,15 @@ NILFS_SEGMENT_USAGE_FNS(ERROR, error)
 static inline void
 nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su)
 {
-	su->su_lastmod = cpu_to_le64(0);
-	su->su_nblocks = cpu_to_le32(0);
-	su->su_flags = cpu_to_le32(0);
+	su->su_lastmod = __cpu_to_le64(0);
+	su->su_nblocks = __cpu_to_le32(0);
+	su->su_flags = __cpu_to_le32(0);
 }
 
 static inline int
 nilfs_segment_usage_clean(const struct nilfs_segment_usage *su)
 {
-	return !le32_to_cpu(su->su_flags);
+	return !su->su_flags;
 }
 
 /**


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers [ver #2]
  2018-09-06  9:18 ` David Howells
  (?)
@ 2018-09-06  9:19   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: dhowells, linux-kernel, linux-nvdimm

The following code in the linux/ndctl header file:

	static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
	{
		static const char * const names[] = {
			[ND_CMD_ARS_CAP] = "ars_cap",
			[ND_CMD_ARS_START] = "ars_start",
			[ND_CMD_ARS_STATUS] = "ars_status",
			[ND_CMD_CLEAR_ERROR] = "clear_error",
			[ND_CMD_CALL] = "cmd_call",
		};

		if (cmd < ARRAY_SIZE(names) && names[cmd])
			return names[cmd];
		return "unknown";
	}

is broken in a number of ways:

 (1) ARRAY_SIZE() is not generally defined.

 (2) g++ does not support "non-trivial" array initialisers fully yet.

 (3) Every file that calls this function will acquire a copy of names[].

The same goes for nvdimm_cmd_name().

Fix all three by converting to a switch statement where each case returns a
string.  That way if cmd is a constant, the compiler can trivially reduce it
and, if not, the compiler can use a shared lookup table if it thinks that is
more efficient.

A better way would be to remove these functions and their arrays from the
header entirely.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/uapi/linux/ndctl.h |   48 +++++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 7e27070b9440..2f2c43d633c5 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -128,37 +128,31 @@ enum {
 
 static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
-		[ND_CMD_ARS_CAP] = "ars_cap",
-		[ND_CMD_ARS_START] = "ars_start",
-		[ND_CMD_ARS_STATUS] = "ars_status",
-		[ND_CMD_CLEAR_ERROR] = "clear_error",
-		[ND_CMD_CALL] = "cmd_call",
-	};
-
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
-		return names[cmd];
-	return "unknown";
+	switch (cmd) {
+	case ND_CMD_ARS_CAP:		return "ars_cap";
+	case ND_CMD_ARS_START:		return "ars_start";
+	case ND_CMD_ARS_STATUS:		return "ars_status";
+	case ND_CMD_CLEAR_ERROR:	return "clear_error";
+	case ND_CMD_CALL:		return "cmd_call";
+	default:			return "unknown";
+	}
 }
 
 static inline const char *nvdimm_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
-		[ND_CMD_SMART] = "smart",
-		[ND_CMD_SMART_THRESHOLD] = "smart_thresh",
-		[ND_CMD_DIMM_FLAGS] = "flags",
-		[ND_CMD_GET_CONFIG_SIZE] = "get_size",
-		[ND_CMD_GET_CONFIG_DATA] = "get_data",
-		[ND_CMD_SET_CONFIG_DATA] = "set_data",
-		[ND_CMD_VENDOR_EFFECT_LOG_SIZE] = "effect_size",
-		[ND_CMD_VENDOR_EFFECT_LOG] = "effect_log",
-		[ND_CMD_VENDOR] = "vendor",
-		[ND_CMD_CALL] = "cmd_call",
-	};
-
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
-		return names[cmd];
-	return "unknown";
+	switch (cmd) {
+	case ND_CMD_SMART:			return "smart";
+	case ND_CMD_SMART_THRESHOLD:		return "smart_thresh";
+	case ND_CMD_DIMM_FLAGS:			return "flags";
+	case ND_CMD_GET_CONFIG_SIZE:		return "get_size";
+	case ND_CMD_GET_CONFIG_DATA:		return "get_data";
+	case ND_CMD_SET_CONFIG_DATA:		return "set_data";
+	case ND_CMD_VENDOR_EFFECT_LOG_SIZE:	return "effect_size";
+	case ND_CMD_VENDOR_EFFECT_LOG:		return "effect_log";
+	case ND_CMD_VENDOR:			return "vendor";
+	case ND_CMD_CALL:			return "cmd_call";
+	default:				return "unknown";
+	}
 }
 
 #define ND_IOCTL 'N'

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers [ver #2]
@ 2018-09-06  9:19   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Dan Williams, linux-nvdimm, linux-kernel, dhowells

The following code in the linux/ndctl header file:

	static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
	{
		static const char * const names[] = {
			[ND_CMD_ARS_CAP] = "ars_cap",
			[ND_CMD_ARS_START] = "ars_start",
			[ND_CMD_ARS_STATUS] = "ars_status",
			[ND_CMD_CLEAR_ERROR] = "clear_error",
			[ND_CMD_CALL] = "cmd_call",
		};

		if (cmd < ARRAY_SIZE(names) && names[cmd])
			return names[cmd];
		return "unknown";
	}

is broken in a number of ways:

 (1) ARRAY_SIZE() is not generally defined.

 (2) g++ does not support "non-trivial" array initialisers fully yet.

 (3) Every file that calls this function will acquire a copy of names[].

The same goes for nvdimm_cmd_name().

Fix all three by converting to a switch statement where each case returns a
string.  That way if cmd is a constant, the compiler can trivially reduce it
and, if not, the compiler can use a shared lookup table if it thinks that is
more efficient.

A better way would be to remove these functions and their arrays from the
header entirely.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/uapi/linux/ndctl.h |   48 +++++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 7e27070b9440..2f2c43d633c5 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -128,37 +128,31 @@ enum {
 
 static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
-		[ND_CMD_ARS_CAP] = "ars_cap",
-		[ND_CMD_ARS_START] = "ars_start",
-		[ND_CMD_ARS_STATUS] = "ars_status",
-		[ND_CMD_CLEAR_ERROR] = "clear_error",
-		[ND_CMD_CALL] = "cmd_call",
-	};
-
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
-		return names[cmd];
-	return "unknown";
+	switch (cmd) {
+	case ND_CMD_ARS_CAP:		return "ars_cap";
+	case ND_CMD_ARS_START:		return "ars_start";
+	case ND_CMD_ARS_STATUS:		return "ars_status";
+	case ND_CMD_CLEAR_ERROR:	return "clear_error";
+	case ND_CMD_CALL:		return "cmd_call";
+	default:			return "unknown";
+	}
 }
 
 static inline const char *nvdimm_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
-		[ND_CMD_SMART] = "smart",
-		[ND_CMD_SMART_THRESHOLD] = "smart_thresh",
-		[ND_CMD_DIMM_FLAGS] = "flags",
-		[ND_CMD_GET_CONFIG_SIZE] = "get_size",
-		[ND_CMD_GET_CONFIG_DATA] = "get_data",
-		[ND_CMD_SET_CONFIG_DATA] = "set_data",
-		[ND_CMD_VENDOR_EFFECT_LOG_SIZE] = "effect_size",
-		[ND_CMD_VENDOR_EFFECT_LOG] = "effect_log",
-		[ND_CMD_VENDOR] = "vendor",
-		[ND_CMD_CALL] = "cmd_call",
-	};
-
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
-		return names[cmd];
-	return "unknown";
+	switch (cmd) {
+	case ND_CMD_SMART:			return "smart";
+	case ND_CMD_SMART_THRESHOLD:		return "smart_thresh";
+	case ND_CMD_DIMM_FLAGS:			return "flags";
+	case ND_CMD_GET_CONFIG_SIZE:		return "get_size";
+	case ND_CMD_GET_CONFIG_DATA:		return "get_data";
+	case ND_CMD_SET_CONFIG_DATA:		return "set_data";
+	case ND_CMD_VENDOR_EFFECT_LOG_SIZE:	return "effect_size";
+	case ND_CMD_VENDOR_EFFECT_LOG:		return "effect_log";
+	case ND_CMD_VENDOR:			return "vendor";
+	case ND_CMD_CALL:			return "cmd_call";
+	default:				return "unknown";
+	}
 }
 
 #define ND_IOCTL 'N'


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers [ver #2]
@ 2018-09-06  9:19   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

The following code in the linux/ndctl header file:

	static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
	{
		static const char * const names[] = {
			[ND_CMD_ARS_CAP] = "ars_cap",
			[ND_CMD_ARS_START] = "ars_start",
			[ND_CMD_ARS_STATUS] = "ars_status",
			[ND_CMD_CLEAR_ERROR] = "clear_error",
			[ND_CMD_CALL] = "cmd_call",
		};

		if (cmd < ARRAY_SIZE(names) && names[cmd])
			return names[cmd];
		return "unknown";
	}

is broken in a number of ways:

 (1) ARRAY_SIZE() is not generally defined.

 (2) g++ does not support "non-trivial" array initialisers fully yet.

 (3) Every file that calls this function will acquire a copy of names[].

The same goes for nvdimm_cmd_name().

Fix all three by converting to a switch statement where each case returns a
string.  That way if cmd is a constant, the compiler can trivially reduce it
and, if not, the compiler can use a shared lookup table if it thinks that is
more efficient.

A better way would be to remove these functions and their arrays from the
header entirely.

Signed-off-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
---

 include/uapi/linux/ndctl.h |   48 +++++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 7e27070b9440..2f2c43d633c5 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -128,37 +128,31 @@ enum {
 
 static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
-		[ND_CMD_ARS_CAP] = "ars_cap",
-		[ND_CMD_ARS_START] = "ars_start",
-		[ND_CMD_ARS_STATUS] = "ars_status",
-		[ND_CMD_CLEAR_ERROR] = "clear_error",
-		[ND_CMD_CALL] = "cmd_call",
-	};
-
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
-		return names[cmd];
-	return "unknown";
+	switch (cmd) {
+	case ND_CMD_ARS_CAP:		return "ars_cap";
+	case ND_CMD_ARS_START:		return "ars_start";
+	case ND_CMD_ARS_STATUS:		return "ars_status";
+	case ND_CMD_CLEAR_ERROR:	return "clear_error";
+	case ND_CMD_CALL:		return "cmd_call";
+	default:			return "unknown";
+	}
 }
 
 static inline const char *nvdimm_cmd_name(unsigned cmd)
 {
-	static const char * const names[] = {
-		[ND_CMD_SMART] = "smart",
-		[ND_CMD_SMART_THRESHOLD] = "smart_thresh",
-		[ND_CMD_DIMM_FLAGS] = "flags",
-		[ND_CMD_GET_CONFIG_SIZE] = "get_size",
-		[ND_CMD_GET_CONFIG_DATA] = "get_data",
-		[ND_CMD_SET_CONFIG_DATA] = "set_data",
-		[ND_CMD_VENDOR_EFFECT_LOG_SIZE] = "effect_size",
-		[ND_CMD_VENDOR_EFFECT_LOG] = "effect_log",
-		[ND_CMD_VENDOR] = "vendor",
-		[ND_CMD_CALL] = "cmd_call",
-	};
-
-	if (cmd < ARRAY_SIZE(names) && names[cmd])
-		return names[cmd];
-	return "unknown";
+	switch (cmd) {
+	case ND_CMD_SMART:			return "smart";
+	case ND_CMD_SMART_THRESHOLD:		return "smart_thresh";
+	case ND_CMD_DIMM_FLAGS:			return "flags";
+	case ND_CMD_GET_CONFIG_SIZE:		return "get_size";
+	case ND_CMD_GET_CONFIG_DATA:		return "get_data";
+	case ND_CMD_SET_CONFIG_DATA:		return "set_data";
+	case ND_CMD_VENDOR_EFFECT_LOG_SIZE:	return "effect_size";
+	case ND_CMD_VENDOR_EFFECT_LOG:		return "effect_log";
+	case ND_CMD_VENDOR:			return "vendor";
+	case ND_CMD_CALL:			return "cmd_call";
+	default:				return "unknown";
+	}
 }
 
 #define ND_IOCTL 'N'

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
  2018-09-06  9:18 ` David Howells
  (?)
@ 2018-09-06  9:19   ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild; +Cc: dhowells, linux-kernel, linux-nvdimm

The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
appear in UAPI headers.

Furthermore, the actual machine page size could theoretically change from
an application's point of view if it's running in a container that gets
migrated to another machine (say 4K/ppc64 to 64K/ppc64).

Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/linux/ndctl.h      |   22 ++++++++++++++++++++++
 include/uapi/linux/ndctl.h |    4 ----
 2 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/ndctl.h

diff --git a/include/linux/ndctl.h b/include/linux/ndctl.h
new file mode 100644
index 000000000000..cd5a293ce3ae
--- /dev/null
+++ b/include/linux/ndctl.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014-2016, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+#ifndef _LINUX_NDCTL_H
+#define _LINUX_NDCTL_H
+
+#include <uapi/linux/ndctl.h>
+
+enum {
+	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
+};
+
+#endif /* _LINUX_NDCTL_H */
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 2f2c43d633c5..f57c9e434d2d 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -202,10 +202,6 @@ enum nd_driver_flags {
 	ND_DRIVER_DAX_PMEM	  = 1 << ND_DEVICE_DAX_PMEM,
 };
 
-enum {
-	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
-};
-
 enum ars_masks {
 	ARS_STATUS_MASK = 0x0000FFFF,
 	ARS_EXT_STATUS_SHIFT = 16,

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
@ 2018-09-06  9:19   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Dan Williams, linux-nvdimm, linux-kernel, dhowells

The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
appear in UAPI headers.

Furthermore, the actual machine page size could theoretically change from
an application's point of view if it's running in a container that gets
migrated to another machine (say 4K/ppc64 to 64K/ppc64).

Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dan Williams <dan.j.williams@intel.com>
cc: linux-nvdimm@lists.01.org
---

 include/linux/ndctl.h      |   22 ++++++++++++++++++++++
 include/uapi/linux/ndctl.h |    4 ----
 2 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/ndctl.h

diff --git a/include/linux/ndctl.h b/include/linux/ndctl.h
new file mode 100644
index 000000000000..cd5a293ce3ae
--- /dev/null
+++ b/include/linux/ndctl.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014-2016, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+#ifndef _LINUX_NDCTL_H
+#define _LINUX_NDCTL_H
+
+#include <uapi/linux/ndctl.h>
+
+enum {
+	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
+};
+
+#endif /* _LINUX_NDCTL_H */
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 2f2c43d633c5..f57c9e434d2d 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -202,10 +202,6 @@ enum nd_driver_flags {
 	ND_DRIVER_DAX_PMEM	  = 1 << ND_DEVICE_DAX_PMEM,
 };
 
-enum {
-	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
-};
-
 enum ars_masks {
 	ARS_STATUS_MASK = 0x0000FFFF,
 	ARS_EXT_STATUS_SHIFT = 16,


^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
@ 2018-09-06  9:19   ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kbuild-u79uwXL29TY76Z2rM5mHXA
  Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
appear in UAPI headers.

Furthermore, the actual machine page size could theoretically change from
an application's point of view if it's running in a container that gets
migrated to another machine (say 4K/ppc64 to 64K/ppc64).

Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
Signed-off-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
---

 include/linux/ndctl.h      |   22 ++++++++++++++++++++++
 include/uapi/linux/ndctl.h |    4 ----
 2 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/ndctl.h

diff --git a/include/linux/ndctl.h b/include/linux/ndctl.h
new file mode 100644
index 000000000000..cd5a293ce3ae
--- /dev/null
+++ b/include/linux/ndctl.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014-2016, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+#ifndef _LINUX_NDCTL_H
+#define _LINUX_NDCTL_H
+
+#include <uapi/linux/ndctl.h>
+
+enum {
+	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
+};
+
+#endif /* _LINUX_NDCTL_H */
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 2f2c43d633c5..f57c9e434d2d 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -202,10 +202,6 @@ enum nd_driver_flags {
 	ND_DRIVER_DAX_PMEM	  = 1 << ND_DEVICE_DAX_PMEM,
 };
 
-enum {
-	ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
-};
-
 enum ars_masks {
 	ARS_STATUS_MASK = 0x0000FFFF,
 	ARS_EXT_STATUS_SHIFT = 16,

^ permalink raw reply	[flat|nested] 124+ messages in thread

* [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
  2018-09-06  9:18 ` David Howells
                   ` (14 preceding siblings ...)
  (?)
@ 2018-09-06  9:19 ` David Howells
  2018-09-10 16:26     ` kbuild test robot
                     ` (2 more replies)
  -1 siblings, 3 replies; 124+ messages in thread
From: David Howells @ 2018-09-06  9:19 UTC (permalink / raw)
  To: linux-api, linux-kbuild
  Cc: Masahiro Yamada, Michal Marek, linux-kernel, dhowells

Check that all the headers can be included from one file and built for C++,
thereby catching the use of C++ reserved words and bits of unimplemented
C++ in the UAPI headers.

Note that certain headers are excluded from the build, including:

 (1) Any header ending in "_32.h", "_64.h" or "_x32.h" as these are
     expected to be multiarch variant headers.

 (2) Endianness variant headers.

 (3) asm-generic/ headers (they're used conditionally by the asm/ headers
     and shouldn't be used directly).

 (4) netfilter_ipv*/ip*t_LOG.h headers.  They emit a warning indicating
     they're going to be removed soon.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Masahiro Yamada <yamada.masahiro@socionext.com>
cc: Michal Marek <michal.lkml@markovi.net>
cc: linux-kbuild@vger.kernel.org
---

 Makefile               |    1 
 scripts/headers-c++.sh |  124 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+)
 create mode 100755 scripts/headers-c++.sh

diff --git a/Makefile b/Makefile
index 19948e556941..38d655cb4474 100644
--- a/Makefile
+++ b/Makefile
@@ -1186,6 +1186,7 @@ headers_install: __headers
 	  $(error Headers not exportable for the $(SRCARCH) architecture))
 	$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
 	$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst)
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers-c++.sh check
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
diff --git a/scripts/headers-c++.sh b/scripts/headers-c++.sh
new file mode 100755
index 000000000000..7e56913629f8
--- /dev/null
+++ b/scripts/headers-c++.sh
@@ -0,0 +1,124 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Run headers_$1 command for all suitable architectures
+
+# Stop on error
+set -e
+
+if ! $CC -x c++ -c - -o /dev/null </dev/null 2>/dev/null
+then
+    echo "  CHECK   C++ HEADER COMPILATION [SKIPPED]"
+    exit 0
+fi
+
+echo "  CHECK   C++ HEADER COMPILATION"
+
+mkdir -p hdr-check
+cd hdr-check
+
+mkdir -p include/sys
+mkdir -p include/arpa
+mkdir -p include/xen/interface
+echo >include/endian.h
+echo >include/limits.h
+echo >include/stdint.h
+echo >include/stdlib.h
+echo >include/stdio.h
+echo >include/string.h
+echo >include/time.h
+echo >include/unistd.h
+echo >include/arpa/inet.h
+echo >include/sys/ioctl.h
+echo >include/sys/types.h
+echo >include/sys/time.h
+echo >include/sys/socket.h
+echo >include/xen/interface/xen.h
+
+cat >test.h <<EOF
+#ifdef __cplusplus
+#define NULL nullptr
+#define _Bool bool
+#else
+#define NULL ((void *)0)
+#define bool _Bool
+#endif
+#include <linux/types.h>
+#include <linux/socket.h>
+#include <linux/time.h>
+
+typedef __s8			int8_t;
+typedef __s16			int16_t;
+typedef __s32			int32_t;
+typedef __s64			int64_t;
+typedef __u8			uint8_t;
+typedef __u16			uint16_t;
+typedef __u32			uint32_t;
+typedef __u64			uint64_t;
+typedef long int		intptr_t;
+typedef unsigned long int	uintptr_t;
+typedef unsigned short		u_short;
+typedef unsigned int		u_int;
+typedef unsigned long		u_long;
+typedef char			*caddr_t;
+
+typedef __kernel_clockid_t	clockid_t;
+typedef __kernel_ino_t		ino_t;
+typedef __kernel_pid_t		pid_t;
+typedef __kernel_sa_family_t	sa_family_t;
+typedef __kernel_size_t		size_t;
+typedef __kernel_uid_t		uid_t;
+
+typedef unsigned long		elf_greg_t;
+typedef elf_greg_t		elf_gregset_t[1];
+typedef unsigned long long	elf_fpregset_t[1];
+typedef unsigned long long	elf_fpxregset_t[1];
+
+#define INT_MIN ((int)0x80000000)
+#define INT_MAX ((int)0x7fffffff)
+
+extern size_t strlen(const char *);
+extern void *memset(void *, int, size_t);
+extern void *memcpy(void *, const void *, size_t);
+extern __u16 ntohs(__u16);
+extern __u16 htons(__u16);
+extern __u32 ntohl(__u32);
+extern __u32 htonl(__u32);
+
+typedef uint32_t		grant_ref_t;
+typedef uint16_t		domid_t;
+typedef unsigned long		xen_pfn_t;
+
+#define MSG_FIN         0x200
+
+typedef int SVGA3dMSPattern;
+typedef int SVGA3dMSQualityLevel;
+
+struct sockaddr
+{
+	sa_family_t	sa_family;
+	char		sa_data[14];
+};
+#define sockaddr_storage __kernel_sockaddr_storage
+
+#define _LINUX_PATCHKEY_H_INDIRECT
+
+EOF
+
+find ../usr/include -name '*.h' |
+    grep -v 'linux/byteorder/big_endian.h' |
+    grep -v 'linux/byteorder/little_endian.h' |
+    grep -v '_\(32\|64\|x32\)[.]h$' |
+    grep -v '/asm-generic/' |
+    # ip*t_LOG.h are deprecated
+    grep -v 'linux/netfilter_ipv4/ipt_LOG[.]h' |
+    grep -v 'linux/netfilter_ipv6/ip6t_LOG[.]h' |
+    sed -e 's!../usr/include/!#include <!' -e 's!$!>!' >>test.h
+
+echo '#include "test.h"' >test.cpp
+
+$CC -x c++ -o /dev/null -c test.cpp \
+    -nostdinc \
+    -isystem ./include \
+    -isystem ../usr/include \
+    -fpermissive \
+    -D PAGE_SIZE='#PAGE_SIZE_IS_NOT_VALID_OUTSIDE_OF_KERNEL'


^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-06  7:13   ` David Howells
@ 2018-09-06 11:52     ` Yann Droneaud
  2018-09-06 12:16         ` Jan Harkes
  2018-09-06 14:53     ` David Howells
  1 sibling, 1 reply; 124+ messages in thread
From: Yann Droneaud @ 2018-09-06 11:52 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Jan Harkes, coda, codalist,
	linux-fsdevel, linux-kernel

Hi,

Le jeudi 06 septembre 2018 à 08:13 +0100, David Howells a écrit :
> Yann Droneaud <ydroneaud@opteya.com> wrote:
> 
> > This structure should not have been exposed to userspace in the
> > first
> > place: it's unusable by userspace as it is. It was incorrect to
> > have it
> > outside of #ifdef __KERNEL__ before commit 607ca46e97a1b ... 
> > ...
> > All CODA_REQ_* defines internals to kernel side and not exchanged
> > with
> > userspace.
> > 
> > Please move them back to <linux/coda_psdev.h>
> 
> Is there any reason coda_psdev.h needs to be in include/linux/ rather
> than fs/coda/?
> 

It's a valid concern.

At first I thought the first lines (see below) could have been useful
for userspace:

  #define CODA_PSDEV_MAJOR 67
  #define MAX_CODADEVS  5    /* how many do we allow */


But the file was unsuable for a long long time so we can assume it's
usage by userspace is deprecated, then we could remove it from UAPI,
and moves its content back to include/linux.

As one could see include/linux/coda_psdev.h is not used outside of
fs/coda, moving the header here as you suggests seems to be the correct
solution.

Regards.

-- 
Yann Droneaud
OPTEYA



^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-06 11:52     ` Yann Droneaud
@ 2018-09-06 12:16         ` Jan Harkes
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Harkes @ 2018-09-06 12:16 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: David Howells, linux-api, linux-kbuild, linux-fsdevel, linux-kernel

On Thu, Sep 06, 2018 at 01:52:29PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le jeudi 06 septembre 2018 à 08:13 +0100, David Howells a écrit :
> > Yann Droneaud <ydroneaud@opteya.com> wrote:
> > 
> > > This structure should not have been exposed to userspace in the
> > > first
> > > place: it's unusable by userspace as it is. It was incorrect to
> > > have it
> > > outside of #ifdef __KERNEL__ before commit 607ca46e97a1b ... 
> > > ...
> > > All CODA_REQ_* defines internals to kernel side and not exchanged
> > > with
> > > userspace.
> > > 
> > > Please move them back to <linux/coda_psdev.h>
> > 
> > Is there any reason coda_psdev.h needs to be in include/linux/ rather
> > than fs/coda/?
> > 
> 
> It's a valid concern.
> 
> At first I thought the first lines (see below) could have been useful
> for userspace:
> 
>   #define CODA_PSDEV_MAJOR 67
>   #define MAX_CODADEVS  5    /* how many do we allow */

Nope, userspace just tries to open /dev/cfs0, or a manually configured
alternative. We have only used linux/coda.h, and actually carry our own
copy of that file which is kept in sync manually, which is why there are
all those ifdefs for different systems in there. This all originates
from the time of the 2.1.x kernels when Coda was built externally.

> But the file was unsuable for a long long time so we can assume it's
> usage by userspace is deprecated, then we could remove it from UAPI,
> and moves its content back to include/linux.
> 
> As one could see include/linux/coda_psdev.h is not used outside of
> fs/coda, moving the header here as you suggests seems to be the correct
> solution.

Agreed.

Jan

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
@ 2018-09-06 12:16         ` Jan Harkes
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Harkes @ 2018-09-06 12:16 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: David Howells, linux-api, linux-kbuild, linux-fsdevel, linux-kernel

On Thu, Sep 06, 2018 at 01:52:29PM +0200, Yann Droneaud wrote:
> Hi,
> 
> Le jeudi 06 septembre 2018 � 08:13 +0100, David Howells a �crit :
> > Yann Droneaud <ydroneaud@opteya.com> wrote:
> > 
> > > This structure should not have been exposed to userspace in the
> > > first
> > > place: it's unusable by userspace as it is. It was incorrect to
> > > have it
> > > outside of #ifdef __KERNEL__ before commit 607ca46e97a1b ... 
> > > ...
> > > All CODA_REQ_* defines internals to kernel side and not exchanged
> > > with
> > > userspace.
> > > 
> > > Please move them back to <linux/coda_psdev.h>
> > 
> > Is there any reason coda_psdev.h needs to be in include/linux/ rather
> > than fs/coda/?
> > 
> 
> It's a valid concern.
> 
> At first I thought the first lines (see below) could have been useful
> for userspace:
> 
>   #define CODA_PSDEV_MAJOR 67
>   #define MAX_CODADEVS  5    /* how many do we allow */

Nope, userspace just tries to open /dev/cfs0, or a manually configured
alternative. We have only used linux/coda.h, and actually carry our own
copy of that file which is kept in sync manually, which is why there are
all those ifdefs for different systems in there. This all originates
from the time of the 2.1.x kernels when Coda was built externally.

> But the file was unsuable for a long long time so we can assume it's
> usage by userspace is deprecated, then we could remove it from UAPI,
> and moves its content back to include/linux.
> 
> As one could see include/linux/coda_psdev.h is not used outside of
> fs/coda, moving the header here as you suggests seems to be the correct
> solution.

Agreed.

Jan

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-06  7:09   ` David Howells
@ 2018-09-06 14:36     ` Michael S. Tsirkin
  2018-09-06 14:36     ` Michael S. Tsirkin
  1 sibling, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-06 14:36 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Jason Wang, virtualization, linux-kernel

On Thu, Sep 06, 2018 at 08:09:19AM +0100, David Howells wrote:
> Michael S. Tsirkin <mst@redhat.com> wrote:
> 
> > As long as you do not intend to use any classes, how about
> > simply adding
> > 
> > -Dclass=_class
> > 
> > to your command line?
> 
> That kind of misses the point;-).  It's not reasonable to expect all userspace
> C++ users to do this.
> 
> David

I thought one of the points was that building kernel with c++ catches
some bugs, no?  If the point is to make life easier for c++ userspace
I'm not sure what we can do to be frank. C++ seems to be adding new
keywords with no restraint (C99 did it with inline and restrict too, but
it seems this stopped) so no good way to future-proof code for all
language dialects.

So I'd like to know which are the actual c++ users asking for this - we
can then accomodate the specific version they need.
Meanwhile people can get by with a wrapper along the lines of
#define class _class
#include <linux/virtio_net.h>
#undef class

-- 
MST

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
  2018-09-06  7:09   ` David Howells
  2018-09-06 14:36     ` Michael S. Tsirkin
@ 2018-09-06 14:36     ` Michael S. Tsirkin
  1 sibling, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-06 14:36 UTC (permalink / raw)
  To: David Howells; +Cc: linux-api, virtualization, linux-kernel, linux-kbuild

On Thu, Sep 06, 2018 at 08:09:19AM +0100, David Howells wrote:
> Michael S. Tsirkin <mst@redhat.com> wrote:
> 
> > As long as you do not intend to use any classes, how about
> > simply adding
> > 
> > -Dclass=_class
> > 
> > to your command line?
> 
> That kind of misses the point;-).  It's not reasonable to expect all userspace
> C++ users to do this.
> 
> David

I thought one of the points was that building kernel with c++ catches
some bugs, no?  If the point is to make life easier for c++ userspace
I'm not sure what we can do to be frank. C++ seems to be adding new
keywords with no restraint (C99 did it with inline and restrict too, but
it seems this stopped) so no good way to future-proof code for all
language dialects.

So I'd like to know which are the actual c++ users asking for this - we
can then accomodate the specific version they need.
Meanwhile people can get by with a wrapper along the lines of
#define class _class
#include <linux/virtio_net.h>
#undef class

-- 
MST

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI
  2018-09-06  7:13   ` David Howells
  2018-09-06 11:52     ` Yann Droneaud
@ 2018-09-06 14:53     ` David Howells
  1 sibling, 0 replies; 124+ messages in thread
From: David Howells @ 2018-09-06 14:53 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: dhowells, linux-api, linux-kbuild, Jan Harkes, coda, codalist,
	linux-fsdevel, linux-kernel

Yann Droneaud <ydroneaud@opteya.com> wrote:

> At first I thought the first lines (see below) could have been useful
> for userspace:
> 
>   #define CODA_PSDEV_MAJOR 67
>   #define MAX_CODADEVS  5    /* how many do we allow */

Note that I was asking about include/linux/coda_psdev.h (the internal kernel
header), not include/uapi/linux/coda_psdev.h (the UAPI header).

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members [ver #2]
  2018-09-06  9:18 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
@ 2018-09-06 15:02   ` Michael S. Tsirkin
  2018-09-06 15:02   ` Michael S. Tsirkin
  1 sibling, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-06 15:02 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Jason Wang, virtualization, linux-kernel

On Thu, Sep 06, 2018 at 10:18:42AM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
> 
>  include/uapi/linux/virtio_net.h |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
>   * command goes in between.
>   */
>  struct virtio_net_ctrl_hdr {
> -	__u8 class;
> +	union {
> +#ifndef __cplusplus
> +		__u8 class;
> +#endif
> +		__u8 _class;
> +	};
>  	__u8 cmd;
>  } __attribute__((packed));
>  

So if we are going to do this, I think I'd prefer something like:

struct virtio_net_ctrl_hdr_v2 {
	__u8 cmd_class;
  	__u8 cmd;
};

And then hide the whole old structure. This also gets rid of the packed
keyword which we don't really need here.

Only issue is virtio_net_ctrl_hdr_v2 is ugly. But oh well.

And then rework at least QEMU to use the v2 of the header.

Quite a bit of churn, so I don't think it makes sense to apply just this
one in isolation - only if rest of the changes go in.


-- 
MST

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members [ver #2]
  2018-09-06  9:18 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
  2018-09-06 15:02   ` Michael S. Tsirkin
@ 2018-09-06 15:02   ` Michael S. Tsirkin
  1 sibling, 0 replies; 124+ messages in thread
From: Michael S. Tsirkin @ 2018-09-06 15:02 UTC (permalink / raw)
  To: David Howells; +Cc: linux-api, virtualization, linux-kernel, linux-kbuild

On Thu, Sep 06, 2018 at 10:18:42AM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members.  Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
> 
>  include/uapi/linux/virtio_net.h |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
>   * command goes in between.
>   */
>  struct virtio_net_ctrl_hdr {
> -	__u8 class;
> +	union {
> +#ifndef __cplusplus
> +		__u8 class;
> +#endif
> +		__u8 _class;
> +	};
>  	__u8 cmd;
>  } __attribute__((packed));
>  

So if we are going to do this, I think I'd prefer something like:

struct virtio_net_ctrl_hdr_v2 {
	__u8 cmd_class;
  	__u8 cmd;
};

And then hide the whole old structure. This also gets rid of the packed
keyword which we don't really need here.

Only issue is virtio_net_ctrl_hdr_v2 is ugly. But oh well.

And then rework at least QEMU to use the v2 of the header.

Quite a bit of churn, so I don't think it makes sense to apply just this
one in isolation - only if rest of the changes go in.


-- 
MST

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
  2018-09-06  9:19 ` [PATCH 11/11] UAPI: Check headers build for C++ " David Howells
  2018-09-10 16:26     ` kbuild test robot
@ 2018-09-10 16:26     ` kbuild test robot
  2018-09-14  9:10   ` Arnd Bergmann
  2 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 16:26 UTC (permalink / raw)
  To: David Howells
  Cc: kbuild-all, linux-api, linux-kbuild, Masahiro Yamada,
	Michal Marek, linux-kernel, dhowells

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> find: '../usr/include': No such file or directory
   In file included from test.cpp:1:0:
>> test.h:8:10: fatal error: linux/types.h: No such file or directory
    #include <linux/types.h>
             ^~~~~~~~~~~~~~~
   compilation terminated.
   make[1]: *** [headers_install] Error 1
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26038 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
@ 2018-09-10 16:26     ` kbuild test robot
  0 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 16:26 UTC (permalink / raw)
  To: David Howells
  Cc: kbuild-all, linux-api, linux-kbuild, Masahiro Yamada,
	Michal Marek, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> find: '../usr/include': No such file or directory
   In file included from test.cpp:1:0:
>> test.h:8:10: fatal error: linux/types.h: No such file or directory
    #include <linux/types.h>
             ^~~~~~~~~~~~~~~
   compilation terminated.
   make[1]: *** [headers_install] Error 1
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26038 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
@ 2018-09-10 16:26     ` kbuild test robot
  0 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 16:26 UTC (permalink / raw)
  Cc: kbuild-all, linux-api, linux-kbuild, Masahiro Yamada,
	Michal Marek, linux-kernel, dhowells

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> find: '../usr/include': No such file or directory
   In file included from test.cpp:1:0:
>> test.h:8:10: fatal error: linux/types.h: No such file or directory
    #include <linux/types.h>
             ^~~~~~~~~~~~~~~
   compilation terminated.
   make[1]: *** [headers_install] Error 1
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26038 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
  2018-09-06  9:19 ` [PATCH 11/11] UAPI: Check headers build for C++ " David Howells
  2018-09-10 16:26     ` kbuild test robot
@ 2018-09-10 17:02     ` kbuild test robot
  2018-09-14  9:10   ` Arnd Bergmann
  2 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 17:02 UTC (permalink / raw)
  To: David Howells
  Cc: kbuild-all, linux-api, linux-kbuild, Masahiro Yamada,
	Michal Marek, linux-kernel, dhowells

[-- Attachment #1: Type: text/plain, Size: 5884 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from test.h:225:0,
                    from test.cpp:1:
>> ../usr/include/linux/patchkey.h:15:2: error: #error "patchkey.h included directly"
    #error "patchkey.h included directly"
     ^~~~~
   In file included from ../usr/include/asm/shmbuf.h:6:0,
                    from test.h:83,
                    from test.cpp:1:
>> ../usr/include/asm-generic/shmbuf.h:26:20: error: field 'shm_perm' has incomplete type 'ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
                       ^~~~~~~~
   ../usr/include/asm-generic/shmbuf.h:26:9: note: forward declaration of 'struct ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
            ^~~~~~~~~~
   In file included from ../usr/include/asm/msgbuf.h:6:0,
                    from test.h:112,
                    from test.cpp:1:
>> ../usr/include/asm-generic/msgbuf.h:25:20: error: field 'msg_perm' has incomplete type 'ipc64_perm'
     struct ipc64_perm msg_perm;
                       ^~~~~~~~
   In file included from ../usr/include/asm/shmbuf.h:6:0,
                    from test.h:83,
                    from test.cpp:1:
   ../usr/include/asm-generic/shmbuf.h:26:9: note: forward declaration of 'struct ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
            ^~~~~~~~~~
   In file included from test.h:868:0,
                    from test.cpp:1:
   ../usr/include/sound/skl-tplg-interface.h:146:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 set_params:2;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:147:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 rsvd:30;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:148:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 param_id;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:149:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 max;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:166:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 module_id;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:167:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 instance_id;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:171:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 channels;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:172:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 freq;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:173:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 bit_depth;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:174:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 valid_bit_depth;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:175:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 ch_cfg;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:176:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 interleaving_style;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:177:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 sample_type;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:178:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 ch_map;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:182:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 set_params:2;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:183:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 rsvd:30;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:184:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 param_id;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:185:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 caps_size;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:186:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 caps[HDA_SST_CFG_MAX];
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:190:2: error: 'u8' does not name a type; did you mean '__u8'?
     u8 pipe_id;
     ^~
     __u8
   ../usr/include/sound/skl-tplg-interface.h:191:2: error: 'u8' does not name a type; did you mean '__u8'?
     u8 pipe_priority;
     ^~
     __u8
   ../usr/include/sound/skl-tplg-interface.h:192:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 conn_type:4;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:193:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 rsvd:4;
--
>> find: '../usr/include': No such file or directory
   In file included from test.cpp:1:0:
>> test.h:8:10: fatal error: linux/types.h: No such file or directory
    #include <linux/types.h>
             ^~~~~~~~~~~~~~~
   compilation terminated.
   make[1]: *** [headers_install] Error 1
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26038 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
@ 2018-09-10 17:02     ` kbuild test robot
  0 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 17:02 UTC (permalink / raw)
  To: David Howells
  Cc: kbuild-all, linux-api, linux-kbuild, Masahiro Yamada,
	Michal Marek, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5884 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from test.h:225:0,
                    from test.cpp:1:
>> ../usr/include/linux/patchkey.h:15:2: error: #error "patchkey.h included directly"
    #error "patchkey.h included directly"
     ^~~~~
   In file included from ../usr/include/asm/shmbuf.h:6:0,
                    from test.h:83,
                    from test.cpp:1:
>> ../usr/include/asm-generic/shmbuf.h:26:20: error: field 'shm_perm' has incomplete type 'ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
                       ^~~~~~~~
   ../usr/include/asm-generic/shmbuf.h:26:9: note: forward declaration of 'struct ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
            ^~~~~~~~~~
   In file included from ../usr/include/asm/msgbuf.h:6:0,
                    from test.h:112,
                    from test.cpp:1:
>> ../usr/include/asm-generic/msgbuf.h:25:20: error: field 'msg_perm' has incomplete type 'ipc64_perm'
     struct ipc64_perm msg_perm;
                       ^~~~~~~~
   In file included from ../usr/include/asm/shmbuf.h:6:0,
                    from test.h:83,
                    from test.cpp:1:
   ../usr/include/asm-generic/shmbuf.h:26:9: note: forward declaration of 'struct ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
            ^~~~~~~~~~
   In file included from test.h:868:0,
                    from test.cpp:1:
   ../usr/include/sound/skl-tplg-interface.h:146:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 set_params:2;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:147:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 rsvd:30;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:148:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 param_id;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:149:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 max;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:166:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 module_id;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:167:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 instance_id;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:171:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 channels;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:172:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 freq;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:173:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 bit_depth;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:174:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 valid_bit_depth;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:175:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 ch_cfg;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:176:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 interleaving_style;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:177:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 sample_type;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:178:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 ch_map;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:182:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 set_params:2;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:183:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 rsvd:30;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:184:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 param_id;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:185:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 caps_size;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:186:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 caps[HDA_SST_CFG_MAX];
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:190:2: error: 'u8' does not name a type; did you mean '__u8'?
     u8 pipe_id;
     ^~
     __u8
   ../usr/include/sound/skl-tplg-interface.h:191:2: error: 'u8' does not name a type; did you mean '__u8'?
     u8 pipe_priority;
     ^~
     __u8
   ../usr/include/sound/skl-tplg-interface.h:192:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 conn_type:4;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:193:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 rsvd:4;
--
>> find: '../usr/include': No such file or directory
   In file included from test.cpp:1:0:
>> test.h:8:10: fatal error: linux/types.h: No such file or directory
    #include <linux/types.h>
             ^~~~~~~~~~~~~~~
   compilation terminated.
   make[1]: *** [headers_install] Error 1
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26038 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
@ 2018-09-10 17:02     ` kbuild test robot
  0 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 17:02 UTC (permalink / raw)
  Cc: kbuild-all, linux-api, linux-kbuild, Masahiro Yamada,
	Michal Marek, linux-kernel, dhowells

[-- Attachment #1: Type: text/plain, Size: 5884 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from test.h:225:0,
                    from test.cpp:1:
>> ../usr/include/linux/patchkey.h:15:2: error: #error "patchkey.h included directly"
    #error "patchkey.h included directly"
     ^~~~~
   In file included from ../usr/include/asm/shmbuf.h:6:0,
                    from test.h:83,
                    from test.cpp:1:
>> ../usr/include/asm-generic/shmbuf.h:26:20: error: field 'shm_perm' has incomplete type 'ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
                       ^~~~~~~~
   ../usr/include/asm-generic/shmbuf.h:26:9: note: forward declaration of 'struct ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
            ^~~~~~~~~~
   In file included from ../usr/include/asm/msgbuf.h:6:0,
                    from test.h:112,
                    from test.cpp:1:
>> ../usr/include/asm-generic/msgbuf.h:25:20: error: field 'msg_perm' has incomplete type 'ipc64_perm'
     struct ipc64_perm msg_perm;
                       ^~~~~~~~
   In file included from ../usr/include/asm/shmbuf.h:6:0,
                    from test.h:83,
                    from test.cpp:1:
   ../usr/include/asm-generic/shmbuf.h:26:9: note: forward declaration of 'struct ipc64_perm'
     struct ipc64_perm shm_perm; /* operation perms */
            ^~~~~~~~~~
   In file included from test.h:868:0,
                    from test.cpp:1:
   ../usr/include/sound/skl-tplg-interface.h:146:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 set_params:2;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:147:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 rsvd:30;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:148:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 param_id;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:149:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 max;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:166:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 module_id;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:167:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 instance_id;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:171:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 channels;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:172:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 freq;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:173:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 bit_depth;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:174:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 valid_bit_depth;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:175:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 ch_cfg;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:176:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 interleaving_style;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:177:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 sample_type;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:178:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 ch_map;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:182:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 set_params:2;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:183:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 rsvd:30;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:184:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 param_id;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:185:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 caps_size;
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:186:2: error: 'u32' does not name a type; did you mean '__u32'?
     u32 caps[HDA_SST_CFG_MAX];
     ^~~
     __u32
   ../usr/include/sound/skl-tplg-interface.h:190:2: error: 'u8' does not name a type; did you mean '__u8'?
     u8 pipe_id;
     ^~
     __u8
   ../usr/include/sound/skl-tplg-interface.h:191:2: error: 'u8' does not name a type; did you mean '__u8'?
     u8 pipe_priority;
     ^~
     __u8
   ../usr/include/sound/skl-tplg-interface.h:192:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 conn_type:4;
     ^~~
     __u16
   ../usr/include/sound/skl-tplg-interface.h:193:2: error: 'u16' does not name a type; did you mean '__u16'?
     u16 rsvd:4;
--
>> find: '../usr/include': No such file or directory
   In file included from test.cpp:1:0:
>> test.h:8:10: fatal error: linux/types.h: No such file or directory
    #include <linux/types.h>
             ^~~~~~~~~~~~~~~
   compilation terminated.
   make[1]: *** [headers_install] Error 1
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26038 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues [ver #2]
  2018-09-06  9:19 ` [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues " David Howells
  2018-09-10 17:32     ` kbuild test robot
@ 2018-09-10 17:32     ` kbuild test robot
  2018-10-09 15:35   ` David Howells
  2 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 17:32 UTC (permalink / raw)
  To: David Howells
  Cc: kbuild-all, linux-api, linux-kbuild, netfilter-devel, coreteam,
	linux-kernel, dhowells

[-- Attachment #1: Type: text/plain, Size: 8915 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/ipv4/netfilter/ipt_ECN.c: In function 'set_ect_tcp':
>> net/ipv4/netfilter/ipt_ECN.c:58:28: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_ECE'?
     if ((!(einfo->operation & IPT_ECN_OP_SET_ECE) ||
                               ^~~~~~~~~~~~~~~~~~
                               IPT_ECN_OP_MATCH_ECE
   net/ipv4/netfilter/ipt_ECN.c:58:28: note: each undeclared identifier is reported only once for each function it appears in
>> net/ipv4/netfilter/ipt_ECN.c:60:28: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
         (!(einfo->operation & IPT_ECN_OP_SET_CWR) ||
                               ^~~~~~~~~~~~~~~~~~
                               IPT_ECN_OP_SET_ECE
   net/ipv4/netfilter/ipt_ECN.c: In function 'ecn_tg':
>> net/ipv4/netfilter/ipt_ECN.c:84:25: error: 'IPT_ECN_OP_SET_IP' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_IP'?
     if (einfo->operation & IPT_ECN_OP_SET_IP)
                            ^~~~~~~~~~~~~~~~~
                            IPT_ECN_OP_MATCH_IP
>> net/ipv4/netfilter/ipt_ECN.c:88:26: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_IP'?
     if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
                             ^~~~~~~~~~~~~~~~~~
                             IPT_ECN_OP_SET_IP
   net/ipv4/netfilter/ipt_ECN.c:88:47: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
     if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
                                                  ^~~~~~~~~~~~~~~~~~
                                                  IPT_ECN_OP_SET_ECE
   net/ipv4/netfilter/ipt_ECN.c: In function 'ecn_tg_check':
>> net/ipv4/netfilter/ipt_ECN.c:101:25: error: 'IPT_ECN_OP_MASK' undeclared (first use in this function); did you mean 'IPT_ECN_IP_MASK'?
     if (einfo->operation & IPT_ECN_OP_MASK)
                            ^~~~~~~~~~~~~~~
                            IPT_ECN_IP_MASK
   net/ipv4/netfilter/ipt_ECN.c:107:27: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_ECE'?
     if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
                              ^~~~~~~~~~~~~~~~~~
                              IPT_ECN_OP_MATCH_ECE
   net/ipv4/netfilter/ipt_ECN.c:107:46: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
     if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
                                                 ^~~~~~~~~~~~~~~~~~
                                                 IPT_ECN_OP_SET_ECE

vim +58 net/ipv4/netfilter/ipt_ECN.c

^1da177e4 Linus Torvalds     2005-04-16   45  
e1931b784 Jan Engelhardt     2007-07-07   46  /* Return false if there was an error. */
e1931b784 Jan Engelhardt     2007-07-07   47  static inline bool
3db05fea5 Herbert Xu         2007-10-15   48  set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
^1da177e4 Linus Torvalds     2005-04-16   49  {
^1da177e4 Linus Torvalds     2005-04-16   50  	struct tcphdr _tcph, *tcph;
6a19d6147 Al Viro            2006-09-28   51  	__be16 oldval;
^1da177e4 Linus Torvalds     2005-04-16   52  
af901ca18 André Goddard Rosa 2009-11-14   53  	/* Not enough header? */
3db05fea5 Herbert Xu         2007-10-15   54  	tcph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
^1da177e4 Linus Torvalds     2005-04-16   55  	if (!tcph)
e1931b784 Jan Engelhardt     2007-07-07   56  		return false;
^1da177e4 Linus Torvalds     2005-04-16   57  
fd841326d Patrick McHardy    2005-08-20  @58  	if ((!(einfo->operation & IPT_ECN_OP_SET_ECE) ||
fd841326d Patrick McHardy    2005-08-20   59  	     tcph->ece == einfo->proto.tcp.ece) &&
7c4e36bc1 Jan Engelhardt     2007-07-07  @60  	    (!(einfo->operation & IPT_ECN_OP_SET_CWR) ||
7c4e36bc1 Jan Engelhardt     2007-07-07   61  	     tcph->cwr == einfo->proto.tcp.cwr))
e1931b784 Jan Engelhardt     2007-07-07   62  		return true;
^1da177e4 Linus Torvalds     2005-04-16   63  
3db05fea5 Herbert Xu         2007-10-15   64  	if (!skb_make_writable(skb, ip_hdrlen(skb) + sizeof(*tcph)))
e1931b784 Jan Engelhardt     2007-07-07   65  		return false;
3db05fea5 Herbert Xu         2007-10-15   66  	tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb);
^1da177e4 Linus Torvalds     2005-04-16   67  
6a19d6147 Al Viro            2006-09-28   68  	oldval = ((__be16 *)tcph)[6];
^1da177e4 Linus Torvalds     2005-04-16   69  	if (einfo->operation & IPT_ECN_OP_SET_ECE)
^1da177e4 Linus Torvalds     2005-04-16   70  		tcph->ece = einfo->proto.tcp.ece;
^1da177e4 Linus Torvalds     2005-04-16   71  	if (einfo->operation & IPT_ECN_OP_SET_CWR)
^1da177e4 Linus Torvalds     2005-04-16   72  		tcph->cwr = einfo->proto.tcp.cwr;
^1da177e4 Linus Torvalds     2005-04-16   73  
be0ea7d5d Patrick McHardy    2007-11-30   74  	inet_proto_csum_replace2(&tcph->check, skb,
4b048d6d9 Tom Herbert        2015-08-17   75  				 oldval, ((__be16 *)tcph)[6], false);
e1931b784 Jan Engelhardt     2007-07-07   76  	return true;
^1da177e4 Linus Torvalds     2005-04-16   77  }
^1da177e4 Linus Torvalds     2005-04-16   78  
^1da177e4 Linus Torvalds     2005-04-16   79  static unsigned int
4b560b447 Jan Engelhardt     2009-07-05   80  ecn_tg(struct sk_buff *skb, const struct xt_action_param *par)
^1da177e4 Linus Torvalds     2005-04-16   81  {
7eb355865 Jan Engelhardt     2008-10-08   82  	const struct ipt_ECN_info *einfo = par->targinfo;
^1da177e4 Linus Torvalds     2005-04-16   83  
^1da177e4 Linus Torvalds     2005-04-16  @84  	if (einfo->operation & IPT_ECN_OP_SET_IP)
3db05fea5 Herbert Xu         2007-10-15   85  		if (!set_ect_ip(skb, einfo))
^1da177e4 Linus Torvalds     2005-04-16   86  			return NF_DROP;
^1da177e4 Linus Torvalds     2005-04-16   87  
3666ed1c4 Joe Perches        2009-11-23  @88  	if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
3666ed1c4 Joe Perches        2009-11-23   89  	    ip_hdr(skb)->protocol == IPPROTO_TCP)
3db05fea5 Herbert Xu         2007-10-15   90  		if (!set_ect_tcp(skb, einfo))
^1da177e4 Linus Torvalds     2005-04-16   91  			return NF_DROP;
^1da177e4 Linus Torvalds     2005-04-16   92  
6709dbbb1 Jan Engelhardt     2007-02-07   93  	return XT_CONTINUE;
^1da177e4 Linus Torvalds     2005-04-16   94  }
^1da177e4 Linus Torvalds     2005-04-16   95  
135367b8f Jan Engelhardt     2010-03-19   96  static int ecn_tg_check(const struct xt_tgchk_param *par)
^1da177e4 Linus Torvalds     2005-04-16   97  {
af5d6dc20 Jan Engelhardt     2008-10-08   98  	const struct ipt_ECN_info *einfo = par->targinfo;
af5d6dc20 Jan Engelhardt     2008-10-08   99  	const struct ipt_entry *e = par->entryinfo;
^1da177e4 Linus Torvalds     2005-04-16  100  
0cc9501f9 Florian Westphal   2018-02-09 @101  	if (einfo->operation & IPT_ECN_OP_MASK)
d6b00a534 Jan Engelhardt     2010-03-25  102  		return -EINVAL;
0cc9501f9 Florian Westphal   2018-02-09  103  
0cc9501f9 Florian Westphal   2018-02-09  104  	if (einfo->ip_ect & ~IPT_ECN_IP_MASK)
d6b00a534 Jan Engelhardt     2010-03-25  105  		return -EINVAL;
0cc9501f9 Florian Westphal   2018-02-09  106  
3666ed1c4 Joe Perches        2009-11-23  107  	if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
3666ed1c4 Joe Perches        2009-11-23  108  	    (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {
b26066447 Florian Westphal   2018-02-09  109  		pr_info_ratelimited("cannot use operation on non-tcp rule\n");
d6b00a534 Jan Engelhardt     2010-03-25  110  		return -EINVAL;
^1da177e4 Linus Torvalds     2005-04-16  111  	}
d6b00a534 Jan Engelhardt     2010-03-25  112  	return 0;
^1da177e4 Linus Torvalds     2005-04-16  113  }
^1da177e4 Linus Torvalds     2005-04-16  114  

:::::: The code at line 58 was first introduced by commit
:::::: fd841326d73096ad79be9c3fa348f9ad04541cc2 [NETFILTER]: Fix ECN target TCP marking

:::::: TO: Patrick McHardy <kaber@trash.net>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41196 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues [ver #2]
@ 2018-09-10 17:32     ` kbuild test robot
  0 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 17:32 UTC (permalink / raw)
  To: David Howells
  Cc: kbuild-all, linux-api, linux-kbuild, netfilter-devel, coreteam,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 8915 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/ipv4/netfilter/ipt_ECN.c: In function 'set_ect_tcp':
>> net/ipv4/netfilter/ipt_ECN.c:58:28: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_ECE'?
     if ((!(einfo->operation & IPT_ECN_OP_SET_ECE) ||
                               ^~~~~~~~~~~~~~~~~~
                               IPT_ECN_OP_MATCH_ECE
   net/ipv4/netfilter/ipt_ECN.c:58:28: note: each undeclared identifier is reported only once for each function it appears in
>> net/ipv4/netfilter/ipt_ECN.c:60:28: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
         (!(einfo->operation & IPT_ECN_OP_SET_CWR) ||
                               ^~~~~~~~~~~~~~~~~~
                               IPT_ECN_OP_SET_ECE
   net/ipv4/netfilter/ipt_ECN.c: In function 'ecn_tg':
>> net/ipv4/netfilter/ipt_ECN.c:84:25: error: 'IPT_ECN_OP_SET_IP' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_IP'?
     if (einfo->operation & IPT_ECN_OP_SET_IP)
                            ^~~~~~~~~~~~~~~~~
                            IPT_ECN_OP_MATCH_IP
>> net/ipv4/netfilter/ipt_ECN.c:88:26: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_IP'?
     if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
                             ^~~~~~~~~~~~~~~~~~
                             IPT_ECN_OP_SET_IP
   net/ipv4/netfilter/ipt_ECN.c:88:47: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
     if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
                                                  ^~~~~~~~~~~~~~~~~~
                                                  IPT_ECN_OP_SET_ECE
   net/ipv4/netfilter/ipt_ECN.c: In function 'ecn_tg_check':
>> net/ipv4/netfilter/ipt_ECN.c:101:25: error: 'IPT_ECN_OP_MASK' undeclared (first use in this function); did you mean 'IPT_ECN_IP_MASK'?
     if (einfo->operation & IPT_ECN_OP_MASK)
                            ^~~~~~~~~~~~~~~
                            IPT_ECN_IP_MASK
   net/ipv4/netfilter/ipt_ECN.c:107:27: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_ECE'?
     if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
                              ^~~~~~~~~~~~~~~~~~
                              IPT_ECN_OP_MATCH_ECE
   net/ipv4/netfilter/ipt_ECN.c:107:46: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
     if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
                                                 ^~~~~~~~~~~~~~~~~~
                                                 IPT_ECN_OP_SET_ECE

vim +58 net/ipv4/netfilter/ipt_ECN.c

^1da177e4 Linus Torvalds     2005-04-16   45  
e1931b784 Jan Engelhardt     2007-07-07   46  /* Return false if there was an error. */
e1931b784 Jan Engelhardt     2007-07-07   47  static inline bool
3db05fea5 Herbert Xu         2007-10-15   48  set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
^1da177e4 Linus Torvalds     2005-04-16   49  {
^1da177e4 Linus Torvalds     2005-04-16   50  	struct tcphdr _tcph, *tcph;
6a19d6147 Al Viro            2006-09-28   51  	__be16 oldval;
^1da177e4 Linus Torvalds     2005-04-16   52  
af901ca18 André Goddard Rosa 2009-11-14   53  	/* Not enough header? */
3db05fea5 Herbert Xu         2007-10-15   54  	tcph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
^1da177e4 Linus Torvalds     2005-04-16   55  	if (!tcph)
e1931b784 Jan Engelhardt     2007-07-07   56  		return false;
^1da177e4 Linus Torvalds     2005-04-16   57  
fd841326d Patrick McHardy    2005-08-20  @58  	if ((!(einfo->operation & IPT_ECN_OP_SET_ECE) ||
fd841326d Patrick McHardy    2005-08-20   59  	     tcph->ece == einfo->proto.tcp.ece) &&
7c4e36bc1 Jan Engelhardt     2007-07-07  @60  	    (!(einfo->operation & IPT_ECN_OP_SET_CWR) ||
7c4e36bc1 Jan Engelhardt     2007-07-07   61  	     tcph->cwr == einfo->proto.tcp.cwr))
e1931b784 Jan Engelhardt     2007-07-07   62  		return true;
^1da177e4 Linus Torvalds     2005-04-16   63  
3db05fea5 Herbert Xu         2007-10-15   64  	if (!skb_make_writable(skb, ip_hdrlen(skb) + sizeof(*tcph)))
e1931b784 Jan Engelhardt     2007-07-07   65  		return false;
3db05fea5 Herbert Xu         2007-10-15   66  	tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb);
^1da177e4 Linus Torvalds     2005-04-16   67  
6a19d6147 Al Viro            2006-09-28   68  	oldval = ((__be16 *)tcph)[6];
^1da177e4 Linus Torvalds     2005-04-16   69  	if (einfo->operation & IPT_ECN_OP_SET_ECE)
^1da177e4 Linus Torvalds     2005-04-16   70  		tcph->ece = einfo->proto.tcp.ece;
^1da177e4 Linus Torvalds     2005-04-16   71  	if (einfo->operation & IPT_ECN_OP_SET_CWR)
^1da177e4 Linus Torvalds     2005-04-16   72  		tcph->cwr = einfo->proto.tcp.cwr;
^1da177e4 Linus Torvalds     2005-04-16   73  
be0ea7d5d Patrick McHardy    2007-11-30   74  	inet_proto_csum_replace2(&tcph->check, skb,
4b048d6d9 Tom Herbert        2015-08-17   75  				 oldval, ((__be16 *)tcph)[6], false);
e1931b784 Jan Engelhardt     2007-07-07   76  	return true;
^1da177e4 Linus Torvalds     2005-04-16   77  }
^1da177e4 Linus Torvalds     2005-04-16   78  
^1da177e4 Linus Torvalds     2005-04-16   79  static unsigned int
4b560b447 Jan Engelhardt     2009-07-05   80  ecn_tg(struct sk_buff *skb, const struct xt_action_param *par)
^1da177e4 Linus Torvalds     2005-04-16   81  {
7eb355865 Jan Engelhardt     2008-10-08   82  	const struct ipt_ECN_info *einfo = par->targinfo;
^1da177e4 Linus Torvalds     2005-04-16   83  
^1da177e4 Linus Torvalds     2005-04-16  @84  	if (einfo->operation & IPT_ECN_OP_SET_IP)
3db05fea5 Herbert Xu         2007-10-15   85  		if (!set_ect_ip(skb, einfo))
^1da177e4 Linus Torvalds     2005-04-16   86  			return NF_DROP;
^1da177e4 Linus Torvalds     2005-04-16   87  
3666ed1c4 Joe Perches        2009-11-23  @88  	if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
3666ed1c4 Joe Perches        2009-11-23   89  	    ip_hdr(skb)->protocol == IPPROTO_TCP)
3db05fea5 Herbert Xu         2007-10-15   90  		if (!set_ect_tcp(skb, einfo))
^1da177e4 Linus Torvalds     2005-04-16   91  			return NF_DROP;
^1da177e4 Linus Torvalds     2005-04-16   92  
6709dbbb1 Jan Engelhardt     2007-02-07   93  	return XT_CONTINUE;
^1da177e4 Linus Torvalds     2005-04-16   94  }
^1da177e4 Linus Torvalds     2005-04-16   95  
135367b8f Jan Engelhardt     2010-03-19   96  static int ecn_tg_check(const struct xt_tgchk_param *par)
^1da177e4 Linus Torvalds     2005-04-16   97  {
af5d6dc20 Jan Engelhardt     2008-10-08   98  	const struct ipt_ECN_info *einfo = par->targinfo;
af5d6dc20 Jan Engelhardt     2008-10-08   99  	const struct ipt_entry *e = par->entryinfo;
^1da177e4 Linus Torvalds     2005-04-16  100  
0cc9501f9 Florian Westphal   2018-02-09 @101  	if (einfo->operation & IPT_ECN_OP_MASK)
d6b00a534 Jan Engelhardt     2010-03-25  102  		return -EINVAL;
0cc9501f9 Florian Westphal   2018-02-09  103  
0cc9501f9 Florian Westphal   2018-02-09  104  	if (einfo->ip_ect & ~IPT_ECN_IP_MASK)
d6b00a534 Jan Engelhardt     2010-03-25  105  		return -EINVAL;
0cc9501f9 Florian Westphal   2018-02-09  106  
3666ed1c4 Joe Perches        2009-11-23  107  	if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
3666ed1c4 Joe Perches        2009-11-23  108  	    (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {
b26066447 Florian Westphal   2018-02-09  109  		pr_info_ratelimited("cannot use operation on non-tcp rule\n");
d6b00a534 Jan Engelhardt     2010-03-25  110  		return -EINVAL;
^1da177e4 Linus Torvalds     2005-04-16  111  	}
d6b00a534 Jan Engelhardt     2010-03-25  112  	return 0;
^1da177e4 Linus Torvalds     2005-04-16  113  }
^1da177e4 Linus Torvalds     2005-04-16  114  

:::::: The code at line 58 was first introduced by commit
:::::: fd841326d73096ad79be9c3fa348f9ad04541cc2 [NETFILTER]: Fix ECN target TCP marking

:::::: TO: Patrick McHardy <kaber@trash.net>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41196 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues [ver #2]
@ 2018-09-10 17:32     ` kbuild test robot
  0 siblings, 0 replies; 124+ messages in thread
From: kbuild test robot @ 2018-09-10 17:32 UTC (permalink / raw)
  Cc: kbuild-all, linux-api, linux-kbuild, netfilter-devel, coreteam,
	linux-kernel, dhowells

[-- Attachment #1: Type: text/plain, Size: 8915 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/David-Howells/UAPI-drm-Fix-use-of-C-keywords-as-structural-members-ver-2/20180907-092121
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/ipv4/netfilter/ipt_ECN.c: In function 'set_ect_tcp':
>> net/ipv4/netfilter/ipt_ECN.c:58:28: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_ECE'?
     if ((!(einfo->operation & IPT_ECN_OP_SET_ECE) ||
                               ^~~~~~~~~~~~~~~~~~
                               IPT_ECN_OP_MATCH_ECE
   net/ipv4/netfilter/ipt_ECN.c:58:28: note: each undeclared identifier is reported only once for each function it appears in
>> net/ipv4/netfilter/ipt_ECN.c:60:28: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
         (!(einfo->operation & IPT_ECN_OP_SET_CWR) ||
                               ^~~~~~~~~~~~~~~~~~
                               IPT_ECN_OP_SET_ECE
   net/ipv4/netfilter/ipt_ECN.c: In function 'ecn_tg':
>> net/ipv4/netfilter/ipt_ECN.c:84:25: error: 'IPT_ECN_OP_SET_IP' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_IP'?
     if (einfo->operation & IPT_ECN_OP_SET_IP)
                            ^~~~~~~~~~~~~~~~~
                            IPT_ECN_OP_MATCH_IP
>> net/ipv4/netfilter/ipt_ECN.c:88:26: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_IP'?
     if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
                             ^~~~~~~~~~~~~~~~~~
                             IPT_ECN_OP_SET_IP
   net/ipv4/netfilter/ipt_ECN.c:88:47: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
     if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
                                                  ^~~~~~~~~~~~~~~~~~
                                                  IPT_ECN_OP_SET_ECE
   net/ipv4/netfilter/ipt_ECN.c: In function 'ecn_tg_check':
>> net/ipv4/netfilter/ipt_ECN.c:101:25: error: 'IPT_ECN_OP_MASK' undeclared (first use in this function); did you mean 'IPT_ECN_IP_MASK'?
     if (einfo->operation & IPT_ECN_OP_MASK)
                            ^~~~~~~~~~~~~~~
                            IPT_ECN_IP_MASK
   net/ipv4/netfilter/ipt_ECN.c:107:27: error: 'IPT_ECN_OP_SET_ECE' undeclared (first use in this function); did you mean 'IPT_ECN_OP_MATCH_ECE'?
     if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
                              ^~~~~~~~~~~~~~~~~~
                              IPT_ECN_OP_MATCH_ECE
   net/ipv4/netfilter/ipt_ECN.c:107:46: error: 'IPT_ECN_OP_SET_CWR' undeclared (first use in this function); did you mean 'IPT_ECN_OP_SET_ECE'?
     if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
                                                 ^~~~~~~~~~~~~~~~~~
                                                 IPT_ECN_OP_SET_ECE

vim +58 net/ipv4/netfilter/ipt_ECN.c

^1da177e4 Linus Torvalds     2005-04-16   45  
e1931b784 Jan Engelhardt     2007-07-07   46  /* Return false if there was an error. */
e1931b784 Jan Engelhardt     2007-07-07   47  static inline bool
3db05fea5 Herbert Xu         2007-10-15   48  set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
^1da177e4 Linus Torvalds     2005-04-16   49  {
^1da177e4 Linus Torvalds     2005-04-16   50  	struct tcphdr _tcph, *tcph;
6a19d6147 Al Viro            2006-09-28   51  	__be16 oldval;
^1da177e4 Linus Torvalds     2005-04-16   52  
af901ca18 André Goddard Rosa 2009-11-14   53  	/* Not enough header? */
3db05fea5 Herbert Xu         2007-10-15   54  	tcph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
^1da177e4 Linus Torvalds     2005-04-16   55  	if (!tcph)
e1931b784 Jan Engelhardt     2007-07-07   56  		return false;
^1da177e4 Linus Torvalds     2005-04-16   57  
fd841326d Patrick McHardy    2005-08-20  @58  	if ((!(einfo->operation & IPT_ECN_OP_SET_ECE) ||
fd841326d Patrick McHardy    2005-08-20   59  	     tcph->ece == einfo->proto.tcp.ece) &&
7c4e36bc1 Jan Engelhardt     2007-07-07  @60  	    (!(einfo->operation & IPT_ECN_OP_SET_CWR) ||
7c4e36bc1 Jan Engelhardt     2007-07-07   61  	     tcph->cwr == einfo->proto.tcp.cwr))
e1931b784 Jan Engelhardt     2007-07-07   62  		return true;
^1da177e4 Linus Torvalds     2005-04-16   63  
3db05fea5 Herbert Xu         2007-10-15   64  	if (!skb_make_writable(skb, ip_hdrlen(skb) + sizeof(*tcph)))
e1931b784 Jan Engelhardt     2007-07-07   65  		return false;
3db05fea5 Herbert Xu         2007-10-15   66  	tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb);
^1da177e4 Linus Torvalds     2005-04-16   67  
6a19d6147 Al Viro            2006-09-28   68  	oldval = ((__be16 *)tcph)[6];
^1da177e4 Linus Torvalds     2005-04-16   69  	if (einfo->operation & IPT_ECN_OP_SET_ECE)
^1da177e4 Linus Torvalds     2005-04-16   70  		tcph->ece = einfo->proto.tcp.ece;
^1da177e4 Linus Torvalds     2005-04-16   71  	if (einfo->operation & IPT_ECN_OP_SET_CWR)
^1da177e4 Linus Torvalds     2005-04-16   72  		tcph->cwr = einfo->proto.tcp.cwr;
^1da177e4 Linus Torvalds     2005-04-16   73  
be0ea7d5d Patrick McHardy    2007-11-30   74  	inet_proto_csum_replace2(&tcph->check, skb,
4b048d6d9 Tom Herbert        2015-08-17   75  				 oldval, ((__be16 *)tcph)[6], false);
e1931b784 Jan Engelhardt     2007-07-07   76  	return true;
^1da177e4 Linus Torvalds     2005-04-16   77  }
^1da177e4 Linus Torvalds     2005-04-16   78  
^1da177e4 Linus Torvalds     2005-04-16   79  static unsigned int
4b560b447 Jan Engelhardt     2009-07-05   80  ecn_tg(struct sk_buff *skb, const struct xt_action_param *par)
^1da177e4 Linus Torvalds     2005-04-16   81  {
7eb355865 Jan Engelhardt     2008-10-08   82  	const struct ipt_ECN_info *einfo = par->targinfo;
^1da177e4 Linus Torvalds     2005-04-16   83  
^1da177e4 Linus Torvalds     2005-04-16  @84  	if (einfo->operation & IPT_ECN_OP_SET_IP)
3db05fea5 Herbert Xu         2007-10-15   85  		if (!set_ect_ip(skb, einfo))
^1da177e4 Linus Torvalds     2005-04-16   86  			return NF_DROP;
^1da177e4 Linus Torvalds     2005-04-16   87  
3666ed1c4 Joe Perches        2009-11-23  @88  	if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
3666ed1c4 Joe Perches        2009-11-23   89  	    ip_hdr(skb)->protocol == IPPROTO_TCP)
3db05fea5 Herbert Xu         2007-10-15   90  		if (!set_ect_tcp(skb, einfo))
^1da177e4 Linus Torvalds     2005-04-16   91  			return NF_DROP;
^1da177e4 Linus Torvalds     2005-04-16   92  
6709dbbb1 Jan Engelhardt     2007-02-07   93  	return XT_CONTINUE;
^1da177e4 Linus Torvalds     2005-04-16   94  }
^1da177e4 Linus Torvalds     2005-04-16   95  
135367b8f Jan Engelhardt     2010-03-19   96  static int ecn_tg_check(const struct xt_tgchk_param *par)
^1da177e4 Linus Torvalds     2005-04-16   97  {
af5d6dc20 Jan Engelhardt     2008-10-08   98  	const struct ipt_ECN_info *einfo = par->targinfo;
af5d6dc20 Jan Engelhardt     2008-10-08   99  	const struct ipt_entry *e = par->entryinfo;
^1da177e4 Linus Torvalds     2005-04-16  100  
0cc9501f9 Florian Westphal   2018-02-09 @101  	if (einfo->operation & IPT_ECN_OP_MASK)
d6b00a534 Jan Engelhardt     2010-03-25  102  		return -EINVAL;
0cc9501f9 Florian Westphal   2018-02-09  103  
0cc9501f9 Florian Westphal   2018-02-09  104  	if (einfo->ip_ect & ~IPT_ECN_IP_MASK)
d6b00a534 Jan Engelhardt     2010-03-25  105  		return -EINVAL;
0cc9501f9 Florian Westphal   2018-02-09  106  
3666ed1c4 Joe Perches        2009-11-23  107  	if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
3666ed1c4 Joe Perches        2009-11-23  108  	    (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {
b26066447 Florian Westphal   2018-02-09  109  		pr_info_ratelimited("cannot use operation on non-tcp rule\n");
d6b00a534 Jan Engelhardt     2010-03-25  110  		return -EINVAL;
^1da177e4 Linus Torvalds     2005-04-16  111  	}
d6b00a534 Jan Engelhardt     2010-03-25  112  	return 0;
^1da177e4 Linus Torvalds     2005-04-16  113  }
^1da177e4 Linus Torvalds     2005-04-16  114  

:::::: The code at line 58 was first introduced by commit
:::::: fd841326d73096ad79be9c3fa348f9ad04541cc2 [NETFILTER]: Fix ECN target TCP marking

:::::: TO: Patrick McHardy <kaber@trash.net>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41196 bytes --]

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 11/11] UAPI: Check headers build for C++ [ver #2]
  2018-09-06  9:19 ` [PATCH 11/11] UAPI: Check headers build for C++ " David Howells
  2018-09-10 16:26     ` kbuild test robot
  2018-09-10 17:02     ` kbuild test robot
@ 2018-09-14  9:10   ` Arnd Bergmann
  2 siblings, 0 replies; 124+ messages in thread
From: Arnd Bergmann @ 2018-09-14  9:10 UTC (permalink / raw)
  To: David Howells
  Cc: Linux API, Linux Kbuild mailing list, Masahiro Yamada,
	Michal Marek, Linux Kernel Mailing List, Joseph Myers

On Thu, Sep 6, 2018 at 11:21 AM David Howells <dhowells@redhat.com> wrote:

> +
> +typedef __s8                   int8_t;
> +typedef __s16                  int16_t;
> +typedef __s32                  int32_t;
> +typedef __s64                  int64_t;
> +typedef __u8                   uint8_t;
> +typedef __u16                  uint16_t;
> +typedef __u32                  uint32_t;
> +typedef __u64                  uint64_t;
> +typedef long int               intptr_t;
> +typedef unsigned long int      uintptr_t;
> +typedef unsigned short         u_short;
> +typedef unsigned int           u_int;
> +typedef unsigned long          u_long;
> +typedef char                   *caddr_t;
> +
> +typedef __kernel_clockid_t     clockid_t;
> +typedef __kernel_ino_t         ino_t;
> +typedef __kernel_pid_t         pid_t;
> +typedef __kernel_sa_family_t   sa_family_t;
> +typedef __kernel_size_t                size_t;
> +typedef __kernel_uid_t         uid_t;
> +
> +typedef unsigned long          elf_greg_t;
> +typedef elf_greg_t             elf_gregset_t[1];
> +typedef unsigned long long     elf_fpregset_t[1];
> +typedef unsigned long long     elf_fpxregset_t[1];
> +
> +#define INT_MIN ((int)0x80000000)
> +#define INT_MAX ((int)0x7fffffff)
> +
> +extern size_t strlen(const char *);
> +extern void *memset(void *, int, size_t);
> +extern void *memcpy(void *, const void *, size_t);
> +extern __u16 ntohs(__u16);
> +extern __u16 htons(__u16);
> +extern __u32 ntohl(__u32);
> +extern __u32 htonl(__u32);
> +
> +typedef uint32_t               grant_ref_t;
> +typedef uint16_t               domid_t;
> +typedef unsigned long          xen_pfn_t;
> +
> +#define MSG_FIN         0x200
> +
> +typedef int SVGA3dMSPattern;
> +typedef int SVGA3dMSQualityLevel;
> +
> +struct sockaddr
> +{
> +       sa_family_t     sa_family;
> +       char            sa_data[14];
> +};
> +#define sockaddr_storage __kernel_sockaddr_storage

I think we need to reduce that list as much as we can. In
https://patchwork.ozlabs.org/patch/968814/, Joseph Myers pointed
out  header file (linux/elfcore.h) that simply cannot be included from
user space at all, because its dependencies cannot be met without
running into conflicting type definitions, and he would like to include
that file in order to automatically check that it's compatible with
the glibc version (I pointed out a couple of architectures on which
it is in fact incompatible right now).

In the list above, I see multiple classes of bugs that could be
addressed:

- references to identifiers that are only present in kernel internal
  headers: SVGA3dMSPattern, MSG_FIN, xen_pfn_t, ...
  I think these are all simple bugs, and we should either remove
  the references, or make sure the respective dependencies are
  included in the uapi headers as well, possibly renamed with
  a __kernel_ prefix to avoid clashing with user space headers.

- references to user space types that should use the uapi
  internal types: sockaddr_storage, clockid_t, uid_t, ...
  I think these just need to get the __kernel_prefix
  consistently as we did a few years ago. Note that using
  the headers otherwise is broken anyway when the types
  in libc are different from the ones in the kernel.

- standard types (uint32_t): either include the correct user
  space headers ifndef __KERNEL__ or use the kernel types

- standard functions (memcpy(), ntohs(), ...): These should
  already be handled in the headers by including the user space.
  If we missed any, we should probably do the same thing
  there.


       Arnd

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
  2018-09-06  9:19   ` David Howells
  (?)
@ 2018-09-25 20:17     ` Dan Williams
  -1 siblings, 0 replies; 124+ messages in thread
From: Dan Williams @ 2018-09-25 20:17 UTC (permalink / raw)
  To: David Howells
  Cc: Linux API, linux-nvdimm, Linux Kernel Mailing List, linux-kbuild

On Thu, Sep 6, 2018 at 2:19 AM David Howells <dhowells@redhat.com> wrote:
>
> The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
> appear in UAPI headers.
>
> Furthermore, the actual machine page size could theoretically change from
> an application's point of view if it's running in a container that gets
> migrated to another machine (say 4K/ppc64 to 64K/ppc64).
>
> Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Dan Williams <dan.j.williams@intel.com>

Acked-by: Dan Williams <dan.j.williams@intel.com>

Let me know if you want me to pick this up for 4.20.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
@ 2018-09-25 20:17     ` Dan Williams
  0 siblings, 0 replies; 124+ messages in thread
From: Dan Williams @ 2018-09-25 20:17 UTC (permalink / raw)
  To: David Howells
  Cc: Linux API, linux-kbuild, linux-nvdimm, Linux Kernel Mailing List

On Thu, Sep 6, 2018 at 2:19 AM David Howells <dhowells@redhat.com> wrote:
>
> The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
> appear in UAPI headers.
>
> Furthermore, the actual machine page size could theoretically change from
> an application's point of view if it's running in a container that gets
> migrated to another machine (say 4K/ppc64 to 64K/ppc64).
>
> Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Dan Williams <dan.j.williams@intel.com>

Acked-by: Dan Williams <dan.j.williams@intel.com>

Let me know if you want me to pick this up for 4.20.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
@ 2018-09-25 20:17     ` Dan Williams
  0 siblings, 0 replies; 124+ messages in thread
From: Dan Williams @ 2018-09-25 20:17 UTC (permalink / raw)
  To: David Howells
  Cc: Linux API, linux-nvdimm, Linux Kernel Mailing List,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA

On Thu, Sep 6, 2018 at 2:19 AM David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>
> The macro PAGE_SIZE isn't valid outside of the kernel, so it should not
> appear in UAPI headers.
>
> Furthermore, the actual machine page size could theoretically change from
> an application's point of view if it's running in a container that gets
> migrated to another machine (say 4K/ppc64 to 64K/ppc64).
>
> Fixes: f2ba5a5baecf ("libnvdimm, namespace: make min namespace size 4K")
> Signed-off-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Acked-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Let me know if you want me to pick this up for 4.20.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers [ver #2]
  2018-09-06  9:19   ` David Howells
  (?)
@ 2018-09-25 20:22     ` Dan Williams
  -1 siblings, 0 replies; 124+ messages in thread
From: Dan Williams @ 2018-09-25 20:22 UTC (permalink / raw)
  To: David Howells
  Cc: Linux API, linux-nvdimm, Linux Kernel Mailing List, linux-kbuild

On Thu, Sep 6, 2018 at 2:19 AM David Howells <dhowells@redhat.com> wrote:
>
> The following code in the linux/ndctl header file:
>
>         static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
>         {
>                 static const char * const names[] = {
>                         [ND_CMD_ARS_CAP] = "ars_cap",
>                         [ND_CMD_ARS_START] = "ars_start",
>                         [ND_CMD_ARS_STATUS] = "ars_status",
>                         [ND_CMD_CLEAR_ERROR] = "clear_error",
>                         [ND_CMD_CALL] = "cmd_call",
>                 };
>
>                 if (cmd < ARRAY_SIZE(names) && names[cmd])
>                         return names[cmd];
>                 return "unknown";
>         }
>
> is broken in a number of ways:
>
>  (1) ARRAY_SIZE() is not generally defined.
>
>  (2) g++ does not support "non-trivial" array initialisers fully yet.
>
>  (3) Every file that calls this function will acquire a copy of names[].
>
> The same goes for nvdimm_cmd_name().
>
> Fix all three by converting to a switch statement where each case returns a
> string.  That way if cmd is a constant, the compiler can trivially reduce it
> and, if not, the compiler can use a shared lookup table if it thinks that is
> more efficient.
>
> A better way would be to remove these functions and their arrays from the
> header entirely.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Dan Williams <dan.j.williams@intel.com>

Acked-by: Dan Williams <dan.j.williams@intel.com>

...again let me know if you'll take this with g++ series or want me to
carry it directly.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers [ver #2]
@ 2018-09-25 20:22     ` Dan Williams
  0 siblings, 0 replies; 124+ messages in thread
From: Dan Williams @ 2018-09-25 20:22 UTC (permalink / raw)
  To: David Howells
  Cc: Linux API, linux-kbuild, linux-nvdimm, Linux Kernel Mailing List

On Thu, Sep 6, 2018 at 2:19 AM David Howells <dhowells@redhat.com> wrote:
>
> The following code in the linux/ndctl header file:
>
>         static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
>         {
>                 static const char * const names[] = {
>                         [ND_CMD_ARS_CAP] = "ars_cap",
>                         [ND_CMD_ARS_START] = "ars_start",
>                         [ND_CMD_ARS_STATUS] = "ars_status",
>                         [ND_CMD_CLEAR_ERROR] = "clear_error",
>                         [ND_CMD_CALL] = "cmd_call",
>                 };
>
>                 if (cmd < ARRAY_SIZE(names) && names[cmd])
>                         return names[cmd];
>                 return "unknown";
>         }
>
> is broken in a number of ways:
>
>  (1) ARRAY_SIZE() is not generally defined.
>
>  (2) g++ does not support "non-trivial" array initialisers fully yet.
>
>  (3) Every file that calls this function will acquire a copy of names[].
>
> The same goes for nvdimm_cmd_name().
>
> Fix all three by converting to a switch statement where each case returns a
> string.  That way if cmd is a constant, the compiler can trivially reduce it
> and, if not, the compiler can use a shared lookup table if it thinks that is
> more efficient.
>
> A better way would be to remove these functions and their arrays from the
> header entirely.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Dan Williams <dan.j.williams@intel.com>

Acked-by: Dan Williams <dan.j.williams@intel.com>

...again let me know if you'll take this with g++ series or want me to
carry it directly.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers [ver #2]
@ 2018-09-25 20:22     ` Dan Williams
  0 siblings, 0 replies; 124+ messages in thread
From: Dan Williams @ 2018-09-25 20:22 UTC (permalink / raw)
  To: David Howells
  Cc: Linux API, linux-nvdimm, Linux Kernel Mailing List,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA

On Thu, Sep 6, 2018 at 2:19 AM David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>
> The following code in the linux/ndctl header file:
>
>         static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
>         {
>                 static const char * const names[] = {
>                         [ND_CMD_ARS_CAP] = "ars_cap",
>                         [ND_CMD_ARS_START] = "ars_start",
>                         [ND_CMD_ARS_STATUS] = "ars_status",
>                         [ND_CMD_CLEAR_ERROR] = "clear_error",
>                         [ND_CMD_CALL] = "cmd_call",
>                 };
>
>                 if (cmd < ARRAY_SIZE(names) && names[cmd])
>                         return names[cmd];
>                 return "unknown";
>         }
>
> is broken in a number of ways:
>
>  (1) ARRAY_SIZE() is not generally defined.
>
>  (2) g++ does not support "non-trivial" array initialisers fully yet.
>
>  (3) Every file that calls this function will acquire a copy of names[].
>
> The same goes for nvdimm_cmd_name().
>
> Fix all three by converting to a switch statement where each case returns a
> string.  That way if cmd is a constant, the compiler can trivially reduce it
> and, if not, the compiler can use a shared lookup table if it thinks that is
> more efficient.
>
> A better way would be to remove these functions and their arrays from the
> header entirely.
>
> Signed-off-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Acked-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

...again let me know if you'll take this with g++ series or want me to
carry it directly.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [netfilter-core] [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues [ver #2]
  2018-09-06  9:19 ` [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues " David Howells
  2018-09-10 17:32     ` kbuild test robot
@ 2018-09-28 13:07   ` Pablo Neira Ayuso
  2018-10-09 15:35   ` David Howells
  2 siblings, 0 replies; 124+ messages in thread
From: Pablo Neira Ayuso @ 2018-09-28 13:07 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, coreteam, netfilter-devel, linux-kernel

On Thu, Sep 06, 2018 at 10:19:11AM +0100, David Howells wrote:
> The netfilter UAPI headers have some symbol collision issues:
> 
>  (1) "enum nfnl_acct_msg_types" is defined twice, and each definition is
>      completely different.
> 
>      Fix this by renaming the one in nfnetlink_cthelper.h to be "enum
>      nfnl_cthelper_types" to be consistent with the other things in that
>      file.
> 
>  (2) There's a disagreement between ipt_ECN.h and ipt_ecn.h over the
>      definition of various IPT_ECN_* constants, leading to an error over
>      IPT_ECN_IP_MASK being substituted when being defined as an enum value
>      in ipt_ecn.h if ipt_ECN.h is #included first.
> 
>      Fix this by removing the conflicting constants from ipt_ECN.h and
>      including ipt_ecn.h instead.

David, may I upstream this or you will pass it to Greg? I can just
take this, as you prefer.

Thanks.

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array
  2018-09-05 15:55 ` [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array David Howells
@ 2018-10-02 14:52   ` Jan Engelhardt
  2018-10-09 15:41   ` David Howells
  1 sibling, 0 replies; 124+ messages in thread
From: Jan Engelhardt @ 2018-10-02 14:52 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Coly Li, Kent Overstreet, linux-bcache,
	linux-kernel


On Wed, 05 Sep 2018 16:55:03 +0100, David Howells wrote:
>
>The bkey struct defined by bcache is embedded in the jset struct. However,
>this is illegal in C++ as there's a "flexible array" at the end of the struct.
>Change this to be a 0-length struct instead.
>
>-	__u64	ptr[];
>+	__u64	ptr[0];

As per the C++ standard, it is _also_ illegal to declare an array of size zero.

"""it [the array size expression] shall be a converted constant expression of
type std::size_t and its value shall be greater than zero."""
—http://eel.is/c++draft/dcl.array

That makes both "__u64 ptr[]" and "__u64 ptr[0]" *implementation-specific
extensions*.


3rd party tooling (concerns both C and C++):

Coverity Scan (IIRC) treats "__u64 ptr[0]" as an array of "definitely-zero"
size. Writing to any element will outright flag an out-of-bounds violation.
That is sensible, since only "ptr[]" was standardized.


Conclusion:

So please, do never use __u64 ptr[0].

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [netfilter-core] [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues [ver #2]
  2018-09-06  9:19 ` [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues " David Howells
  2018-09-10 17:32     ` kbuild test robot
  2018-09-28 13:07   ` [netfilter-core] " Pablo Neira Ayuso
@ 2018-10-09 15:35   ` David Howells
  2 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-10-09 15:35 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: dhowells, linux-api, linux-kbuild, coreteam, netfilter-devel,
	linux-kernel

Pablo Neira Ayuso <pablo@netfilter.org> wrote:

> David, may I upstream this or you will pass it to Greg? I can just
> take this, as you prefer.

Feel free to take it.

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
  2018-09-06  9:19   ` David Howells
@ 2018-10-09 15:36     ` David Howells
  -1 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-10-09 15:36 UTC (permalink / raw)
  To: Dan Williams
  Cc: dhowells, Linux API, linux-nvdimm, Linux Kernel Mailing List,
	linux-kbuild

Dan Williams <dan.j.williams@intel.com> wrote:

> Let me know if you want me to pick this up for 4.20.

If you could pick this and also 09?

Thanks,
David
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE [ver #2]
@ 2018-10-09 15:36     ` David Howells
  0 siblings, 0 replies; 124+ messages in thread
From: David Howells @ 2018-10-09 15:36 UTC (permalink / raw)
  To: Dan Williams
  Cc: dhowells, Linux API, linux-kbuild, linux-nvdimm,
	Linux Kernel Mailing List

Dan Williams <dan.j.williams@intel.com> wrote:

> Let me know if you want me to pick this up for 4.20.

If you could pick this and also 09?

Thanks,
David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array
  2018-09-05 15:55 ` [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array David Howells
  2018-10-02 14:52   ` Jan Engelhardt
@ 2018-10-09 15:41   ` David Howells
  2018-10-09 16:54     ` Jan Engelhardt
  1 sibling, 1 reply; 124+ messages in thread
From: David Howells @ 2018-10-09 15:41 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: dhowells, linux-api, linux-kbuild, Coly Li, Kent Overstreet,
	linux-bcache, linux-kernel

Jan Engelhardt <jengelh@inai.de> wrote:

> """it [the array size expression] shall be a converted constant expression of
> type std::size_t and its value shall be greater than zero."""
> —http://eel.is/c++draft/dcl.array

Interesting.  You're not actually quoting the full sentence:

	If the constant-expression is present, it shall be a converted
	constant expression of type std​::​size_­t and its value shall be
	greater than zero.

This suggests that:

	__u64 ptr[]

is actually valid since:

	D1 [ constant-expressionopt ] attribute-specifier-seqopt

suggests that the part between the brackets is optional.

David

^ permalink raw reply	[flat|nested] 124+ messages in thread

* Re: [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array
  2018-10-09 15:41   ` David Howells
@ 2018-10-09 16:54     ` Jan Engelhardt
  0 siblings, 0 replies; 124+ messages in thread
From: Jan Engelhardt @ 2018-10-09 16:54 UTC (permalink / raw)
  To: David Howells
  Cc: linux-api, linux-kbuild, Coly Li, Kent Overstreet, linux-bcache,
	linux-kernel

On Tuesday 2018-10-09 17:41, David Howells wrote:

>Jan Engelhardt <jengelh@inai.de> wrote:
>
>> """it [the array size expression] shall be a converted constant expression of
>> type std::size_t and its value shall be greater than zero."""
>> —http://eel.is/c++draft/dcl.array
>
>Interesting.  You're not actually quoting the full sentence:
>
>	If the constant-expression is present, it shall be a converted
>	constant expression of type std​::​size_­t and its value shall be
>	greater than zero.
>
>This suggests that:
>
>	__u64 ptr[]
>
>is actually valid

I think that kind of validity only goes for this kind of standalone 
decl:

	extern int myints[];

but not for []-inside-struct.

^ permalink raw reply	[flat|nested] 124+ messages in thread

end of thread, other threads:[~2018-10-09 16:54 UTC | newest]

Thread overview: 124+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05 15:54 [RFC] UAPI: Check headers by compiling all together as C++ David Howells
2018-09-05 15:54 ` David Howells
2018-09-05 15:54 ` David Howells
2018-09-05 15:54 ` David Howells
2018-09-05 15:54 ` David Howells
2018-09-05 15:54 ` [PATCH 01/11] UAPI: drm: Fix use of C++ keywords as structural members David Howells
2018-09-05 15:54   ` David Howells
2018-09-05 15:54 ` [PATCH 02/11] UAPI: keys: " David Howells
2018-09-05 15:54   ` David Howells
2018-09-05 15:54 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
2018-09-05 16:54   ` Greg KH
2018-09-05 16:54   ` Greg KH
2018-09-05 17:15   ` David Howells
2018-09-05 17:15   ` David Howells
2018-09-05 17:35   ` Michael S. Tsirkin
2018-09-05 17:35   ` Michael S. Tsirkin
2018-09-06  7:09   ` David Howells
2018-09-06  7:09   ` David Howells
2018-09-06 14:36     ` Michael S. Tsirkin
2018-09-06 14:36     ` Michael S. Tsirkin
2018-09-05 15:54 ` David Howells
2018-09-05 15:55 ` [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array David Howells
2018-10-02 14:52   ` Jan Engelhardt
2018-10-09 15:41   ` David Howells
2018-10-09 16:54     ` Jan Engelhardt
2018-09-05 15:55 ` [PATCH 05/11] UAPI: coda: Don't use internal kernel structs in UAPI David Howells
2018-09-05 16:54   ` Jan Harkes
2018-09-05 17:12   ` Yann Droneaud
2018-09-05 17:28     ` Jan Harkes
2018-09-05 17:28       ` Jan Harkes
2018-09-05 17:24   ` David Howells
2018-09-06  7:13   ` David Howells
2018-09-06 11:52     ` Yann Droneaud
2018-09-06 12:16       ` Jan Harkes
2018-09-06 12:16         ` Jan Harkes
2018-09-06 14:53     ` David Howells
2018-09-05 15:55 ` [PATCH 06/11] UAPI: netfilter: Fix symbol collision issues David Howells
2018-09-05 15:55 ` [PATCH 07/11] UAPI: nilfs2: Fix use of undefined byteswapping functions David Howells
2018-09-05 22:20   ` Al Viro
2018-09-05 15:55 ` [PATCH 08/11] UAPI: sound: Fix use of u32 and co. in UAPI headers David Howells
2018-09-05 15:55   ` David Howells
2018-09-06  5:59   ` Takashi Sakamoto
2018-09-06  5:59     ` Takashi Sakamoto
2018-09-06  8:17   ` David Howells
2018-09-05 15:55 ` [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers David Howells
2018-09-05 15:55   ` David Howells
2018-09-05 15:55   ` David Howells
2018-09-05 15:55 ` [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE David Howells
2018-09-05 15:55   ` David Howells
2018-09-05 15:55 ` [PATCH 11/11] UAPI: Check headers build for C++ David Howells
2018-09-05 16:55 ` [RFC] UAPI: Check headers by compiling all together as C++ Greg KH
2018-09-05 16:55 ` Greg KH
2018-09-05 16:55   ` Greg KH
2018-09-05 16:55   ` Greg KH
2018-09-05 16:55   ` Greg KH
2018-09-05 17:33   ` Yann Droneaud
2018-09-05 17:33     ` Yann Droneaud
2018-09-05 17:33     ` Yann Droneaud
2018-09-05 17:33     ` Yann Droneaud
2018-09-05 17:42     ` Michael S. Tsirkin
2018-09-05 17:42     ` Michael S. Tsirkin
2018-09-05 17:42       ` Michael S. Tsirkin
2018-09-05 17:42       ` Michael S. Tsirkin
2018-09-05 17:42       ` Michael S. Tsirkin
2018-09-05 17:42       ` Michael S. Tsirkin
2018-09-05 17:42       ` Michael S. Tsirkin
2018-09-06  7:12     ` Yann Droneaud
2018-09-06  7:12       ` Yann Droneaud
2018-09-06  7:12       ` Yann Droneaud
2018-09-06  7:12       ` Yann Droneaud
2018-09-05 19:22   ` Jan Engelhardt
2018-09-05 19:22   ` Jan Engelhardt
2018-09-05 19:22     ` Jan Engelhardt
2018-09-05 19:22     ` Jan Engelhardt
2018-09-05 19:22     ` Jan Engelhardt
2018-09-05 17:50 ` David Howells
2018-09-05 17:50 ` David Howells
2018-09-05 17:50   ` David Howells
2018-09-06  9:18 David Howells
2018-09-06  9:18 ` David Howells
2018-09-06  9:18 ` David Howells
2018-09-06  9:18 ` David Howells
2018-09-06  9:18 ` David Howells
     [not found] ` <153622549721.14298.8116794954073122489.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2018-09-06  9:18   ` [PATCH 01/11] UAPI: drm: Fix use of C++ keywords as structural members [ver #2] David Howells
2018-09-06  9:18     ` David Howells
2018-09-06  9:18 ` [PATCH 02/11] UAPI: keys: " David Howells
2018-09-06  9:18   ` David Howells
2018-09-06  9:18 ` [PATCH 03/11] UAPI: virtio_net: " David Howells
2018-09-06 15:02   ` Michael S. Tsirkin
2018-09-06 15:02   ` Michael S. Tsirkin
2018-09-06  9:18 ` David Howells
2018-09-06  9:18 ` [PATCH 04/11] UAPI: bcache: Fix use of embedded flexible array " David Howells
2018-09-06  9:18 ` [PATCH 05/11] UAPI: coda: Move kernel internals out of public view " David Howells
2018-09-06  9:18   ` David Howells
2018-09-06  9:19 ` [PATCH 06/11] coda: Move internal defs out of include/linux/ " David Howells
2018-09-06  9:19 ` [PATCH 07/11] UAPI: netfilter: Fix symbol collision issues " David Howells
2018-09-10 17:32   ` kbuild test robot
2018-09-10 17:32     ` kbuild test robot
2018-09-10 17:32     ` kbuild test robot
2018-09-28 13:07   ` [netfilter-core] " Pablo Neira Ayuso
2018-10-09 15:35   ` David Howells
2018-09-06  9:19 ` [PATCH 08/11] UAPI: nilfs2: Fix use of undefined byteswapping functions " David Howells
2018-09-06  9:19 ` [PATCH 09/11] UAPI: ndctl: Fix g++-unsupported initialisation in headers " David Howells
2018-09-06  9:19   ` David Howells
2018-09-06  9:19   ` David Howells
2018-09-25 20:22   ` Dan Williams
2018-09-25 20:22     ` Dan Williams
2018-09-25 20:22     ` Dan Williams
2018-09-06  9:19 ` [PATCH 10/11] UAPI: ndctl: Remove use of PAGE_SIZE " David Howells
2018-09-06  9:19   ` David Howells
2018-09-06  9:19   ` David Howells
2018-09-25 20:17   ` Dan Williams
2018-09-25 20:17     ` Dan Williams
2018-09-25 20:17     ` Dan Williams
2018-10-09 15:36   ` David Howells
2018-10-09 15:36     ` David Howells
2018-09-06  9:19 ` [PATCH 11/11] UAPI: Check headers build for C++ " David Howells
2018-09-10 16:26   ` kbuild test robot
2018-09-10 16:26     ` kbuild test robot
2018-09-10 16:26     ` kbuild test robot
2018-09-10 17:02   ` kbuild test robot
2018-09-10 17:02     ` kbuild test robot
2018-09-10 17:02     ` kbuild test robot
2018-09-14  9:10   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.