[PATCH] samples: Kconfig: readd BROKEN to SAMPLE_STATX

From: Anders Roxell
Date: Wed Dec 19 2018 - 09:01:02 EST


Commit c1cae12e6b4a ("vfs: Add a sample program for the new mount API")
introduced a build error (regression) when building an allmodconfig
kernel. Before that SAMPLE_STATX had a "depends on BROKEN", and it got
removed in the patch.

When building an allmodconfig kernel, option SAMPLE_VFS gets enabled
and produce the following build error:

In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:446,
from ../samples/vfs/test-statx.c:28:
/usr/include/x86_64-linux-gnu/bits/statx.h:25:8: error: redefinition of âstruct statx_timestampâ
struct statx_timestamp
^~~~~~~~~~~~~~~
In file included from ../samples/vfs/test-statx.c:26:
./usr/include/linux/stat.h:56:8: note: originally defined here
struct statx_timestamp {
^~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:446,
from ../samples/vfs/test-statx.c:28:
/usr/include/x86_64-linux-gnu/bits/statx.h:36:8: error: redefinition of âstruct statxâ
struct statx
^~~~~
In file included from ../samples/vfs/test-statx.c:26:
./usr/include/linux/stat.h:99:8: note: originally defined here
struct statx {
^~~~~
../samples/vfs/test-statx.c:40:9: error: conflicting types for âstatxâ
ssize_t statx(int dfd, const char *filename, unsigned flags,
^~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:446,
from ../samples/vfs/test-statx.c:28:
/usr/include/x86_64-linux-gnu/bits/statx.h:87:5: note: previous declaration of âstatxâ was here
int statx (int __dirfd, const char *__restrict __path, int __flags,
^~~~~
make[3]: *** [scripts/Makefile.host:90: samples/vfs/test-statx] Error 1
make[3]: Target '__build' not remade because of errors.
make[2]: *** [../scripts/Makefile.build:492: samples/vfs] Error 2
make[2]: Target '__build' not remade because of errors.
make[1]: *** [/srv/src/kernel/testing/Makefile:1065: samples] Error 2

Rework so that SAMPLE_STATX depends on BROKEN, and SAMPLE_VFS enables
the newly added test.

Signed-off-by: Anders Roxell <anders.roxell@xxxxxxxxxx>
---
samples/Kconfig | 7 +++++++
samples/vfs/Makefile | 3 ++-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/samples/Kconfig b/samples/Kconfig
index dc4eb5355fad..8253c8ce7632 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -147,6 +147,13 @@ config SAMPLE_VFIO_MDEV_MBOCHS
Specifically it does *not* include any legacy vga stuff.
Device looks a lot like "qemu -device secondary-vga".

+config SAMPLE_STATX
+ bool "Build example extended-stat using code"
+ depends on BROKEN
+ depends on SAMPLE_VFS
+ help
+ Build example userspace program to use the new extended-stat syscall.
+
config SAMPLE_VFS
bool "Build example programs that use new VFS system calls"
help
diff --git a/samples/vfs/Makefile b/samples/vfs/Makefile
index 4ac9690fb3c4..fe510c6d5e52 100644
--- a/samples/vfs/Makefile
+++ b/samples/vfs/Makefile
@@ -1,6 +1,7 @@
# List of programs to build
hostprogs-$(CONFIG_SAMPLE_VFS) := \
- test-fsmount \
+ test-fsmount
+hostprogs-$(CONFIG_SAMPLE_STATX) := \
test-statx

# Tell kbuild to always build the programs
--
2.19.2