* [PATCH] ioctl.h: add missing kernel compatibility header for BUILD_ASSERT
@ 2016-10-24 8:29 slyich
2016-10-24 12:52 ` David Sterba
0 siblings, 1 reply; 5+ messages in thread
From: slyich @ 2016-10-24 8:29 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Sergei Trofimovich
From: Sergei Trofimovich <slyfox@gentoo.org>
Header breakage noticed by cynede. Reproducible as:
$ gcc -c /usr/include/btrfs/ioctl.h -o /tmp/a.o
/usr/include/btrfs/ioctl.h:42:14: error: expected declaration specifiers or '...' before 'sizeof'
BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args) == 4096);
^~~~~~
Basically gcc tries to say us BUILD_ASSERT is not visible.
BUILD_ASSERT lives in kerncompat.h which this change adds.
Reported-by: Mikhail Pukhlikov <cynede@gentoo.org>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
ioctl.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ioctl.h b/ioctl.h
index 238e7ef..ee650a9 100644
--- a/ioctl.h
+++ b/ioctl.h
@@ -26,6 +26,12 @@ extern "C" {
#include <asm/types.h>
#include <linux/ioctl.h>
+#if BTRFS_FLAT_INCLUDES
+#include "kerncompat.h"
+#else
+#include <btrfs/kerncompat.h>
+#endif /* BTRFS_FLAT_INCLUDES */
+
#ifndef __user
#define __user
#endif
--
2.10.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ioctl.h: add missing kernel compatibility header for BUILD_ASSERT
2016-10-24 8:29 [PATCH] ioctl.h: add missing kernel compatibility header for BUILD_ASSERT slyich
@ 2016-10-24 12:52 ` David Sterba
2016-11-12 22:14 ` Sergei Trofimovich
0 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2016-10-24 12:52 UTC (permalink / raw)
To: slyich; +Cc: David Sterba, linux-btrfs, Sergei Trofimovich
Hi,
On Mon, Oct 24, 2016 at 09:29:12AM +0100, slyich@gmail.com wrote:
> From: Sergei Trofimovich <slyfox@gentoo.org>
>
> Header breakage noticed by cynede. Reproducible as:
>
> $ gcc -c /usr/include/btrfs/ioctl.h -o /tmp/a.o
> /usr/include/btrfs/ioctl.h:42:14: error: expected declaration specifiers or '...' before 'sizeof'
> BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args) == 4096);
> ^~~~~~
>
> Basically gcc tries to say us BUILD_ASSERT is not visible.
>
> BUILD_ASSERT lives in kerncompat.h which this change adds.
I think including the kerncompat.h is too intrusive here, I've fixed by
providing an empty macro if it's not defined. I'll release 4.8.2 soon.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ioctl.h: add missing kernel compatibility header for BUILD_ASSERT
2016-10-24 12:52 ` David Sterba
@ 2016-11-12 22:14 ` Sergei Trofimovich
2016-11-14 12:34 ` David Sterba
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Trofimovich @ 2016-11-12 22:14 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
On Mon, 24 Oct 2016 14:52:05 +0200
David Sterba <dsterba@suse.cz> wrote:
> Hi,
>
> On Mon, Oct 24, 2016 at 09:29:12AM +0100, slyich@gmail.com wrote:
> > From: Sergei Trofimovich <slyfox@gentoo.org>
> >
> > Header breakage noticed by cynede. Reproducible as:
> >
> > $ gcc -c /usr/include/btrfs/ioctl.h -o /tmp/a.o
> > /usr/include/btrfs/ioctl.h:42:14: error: expected declaration specifiers or '...' before 'sizeof'
> > BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args) == 4096);
> > ^~~~~~
> >
> > Basically gcc tries to say us BUILD_ASSERT is not visible.
> >
> > BUILD_ASSERT lives in kerncompat.h which this change adds.
>
> I think including the kerncompat.h is too intrusive here, I've fixed by
> providing an empty macro if it's not defined. I'll release 4.8.2 soon.
Apologies. I did not test your fix right afterwards. Seems now header is incomplete
due to missing NULL (gcc-6):
btrfs-progs-v4.8.3 $ gcc -c ioctl.h -o /tmp/a.o
ioctl.h: In function 'btrfs_err_str':
ioctl.h:711:11: error: 'NULL' undeclared (first use in this function)
return NULL;
^~~~
ioctl.h:711:11: note: each undeclared identifier is reported only once for each function it appears in
--
Sergei
[-- Attachment #2: ЦиÑÑÐ¾Ð²Ð°Ñ Ð¿Ð¾Ð´Ð¿Ð¸ÑÑ OpenPGP --]
[-- Type: application/pgp-signature, Size: 163 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ioctl.h: add missing kernel compatibility header for BUILD_ASSERT
2016-11-12 22:14 ` Sergei Trofimovich
@ 2016-11-14 12:34 ` David Sterba
2016-11-14 15:50 ` David Sterba
0 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2016-11-14 12:34 UTC (permalink / raw)
To: Sergei Trofimovich; +Cc: linux-btrfs
On Sat, Nov 12, 2016 at 10:14:49PM +0000, Sergei Trofimovich wrote:
> > > Basically gcc tries to say us BUILD_ASSERT is not visible.
> > >
> > > BUILD_ASSERT lives in kerncompat.h which this change adds.
> >
> > I think including the kerncompat.h is too intrusive here, I've fixed by
> > providing an empty macro if it's not defined. I'll release 4.8.2 soon.
>
> Apologies. I did not test your fix right afterwards. Seems now header is incomplete
> due to missing NULL (gcc-6):
>
> btrfs-progs-v4.8.3 $ gcc -c ioctl.h -o /tmp/a.o
> ioctl.h: In function 'btrfs_err_str':
> ioctl.h:711:11: error: 'NULL' undeclared (first use in this function)
> return NULL;
> ^~~~
> ioctl.h:711:11: note: each undeclared identifier is reported only once for each function it appears in
The ioctl.h file can be included in both C and C++ code, I'd rahter
avoid to ifdef the right definition of NULL, so s/NULL/0/ seems as a
best fix to me.
Compiling with g++ shows other type errors like
ioctl.h:709:5: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
"in progress";
so we'd have to change the type to 'const char*'. I'm not sure how much
breakage this could cause in programs using the header.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ioctl.h: add missing kernel compatibility header for BUILD_ASSERT
2016-11-14 12:34 ` David Sterba
@ 2016-11-14 15:50 ` David Sterba
0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-11-14 15:50 UTC (permalink / raw)
To: dsterba, Sergei Trofimovich, linux-btrfs
On Mon, Nov 14, 2016 at 01:34:49PM +0100, David Sterba wrote:
> On Sat, Nov 12, 2016 at 10:14:49PM +0000, Sergei Trofimovich wrote:
> > > > Basically gcc tries to say us BUILD_ASSERT is not visible.
> > > >
> > > > BUILD_ASSERT lives in kerncompat.h which this change adds.
> > >
> > > I think including the kerncompat.h is too intrusive here, I've fixed by
> > > providing an empty macro if it's not defined. I'll release 4.8.2 soon.
> >
> > Apologies. I did not test your fix right afterwards. Seems now header is incomplete
> > due to missing NULL (gcc-6):
> >
> > btrfs-progs-v4.8.3 $ gcc -c ioctl.h -o /tmp/a.o
> > ioctl.h: In function 'btrfs_err_str':
> > ioctl.h:711:11: error: 'NULL' undeclared (first use in this function)
> > return NULL;
> > ^~~~
> > ioctl.h:711:11: note: each undeclared identifier is reported only once for each function it appears in
>
> The ioctl.h file can be included in both C and C++ code, I'd rahter
> avoid to ifdef the right definition of NULL, so s/NULL/0/ seems as a
> best fix to me.
Or #include <stddef.h>, now committed to devel.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-14 15:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-24 8:29 [PATCH] ioctl.h: add missing kernel compatibility header for BUILD_ASSERT slyich
2016-10-24 12:52 ` David Sterba
2016-11-12 22:14 ` Sergei Trofimovich
2016-11-14 12:34 ` David Sterba
2016-11-14 15:50 ` David Sterba
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.