On Thu, Oct 28, 2021 at 03:56:28PM -0300, Gabriel Krisman Bertazi wrote:
Guenter Roeck [off-list ref] writes:
quoted
On Mon, Oct 18, 2021 at 09:00:14PM -0300, Gabriel Krisman Bertazi wrote:
quoted
Introduce an example of a FAN_FS_ERROR fanotify user to track filesystem
errors.
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Gabriel Krisman Bertazi <redacted>
Reviewed-by: Jan Kara <jack@suse.cz>
---
Changes since v4:
- Protect file_handle defines with ifdef guards
Changes since v1:
- minor fixes
---
samples/Kconfig | 9 +++
samples/Makefile | 1 +
samples/fanotify/Makefile | 5 ++
samples/fanotify/fs-monitor.c | 142 ++++++++++++++++++++++++++++++++++
4 files changed, 157 insertions(+)
create mode 100644 samples/fanotify/Makefile
create mode 100644 samples/fanotify/fs-monitor.c
diff --git a/samples/Kconfig b/samples/Kconfig
index b0503ef058d3..88353b8eac0b 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -120,6 +120,15 @@ config SAMPLE_CONNECTOR
with it.
See also Documentation/driver-api/connector.rst
+config SAMPLE_FANOTIFY_ERROR
+ bool "Build fanotify error monitoring sample"
+ depends on FANOTIFY
This needs something like
depends on CC_CAN_LINK
or possibly even
depends on CC_CAN_LINK && HEADERS_INSTALL
to avoid compilation errors such as
samples/fanotify/fs-monitor.c:7:10: fatal error: errno.h: No such file or directory
7 | #include <errno.h>
| ^~~~~~~~~
compilation terminated.
when using a toolchain without C library support, such as those provided
on kernel.org.
Thank you, Guenter.
We discussed this, but I wasn't sure how to silence the error and it
didn't trigger in the past versions.
The original patch is already in Jan's tree. Jan, would you pick the
pack below to address it? Feel free to squash it into the original
commit, if you think it is saner..
Thanks,
-- >8 --
From: Gabriel Krisman Bertazi <redacted>
Date: Thu, 28 Oct 2021 15:34:46 -0300
Subject: [PATCH] samples: Make fs-monitor depend on libc and headers
Prevent build errors when headers or libc are not available, such as on
kernel build bots, like the below:
samples/fanotify/fs-monitor.c:7:10: fatal error: errno.h: No such file
or directory
7 | #include <errno.h>
| ^~~~~~~~~
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Gabriel Krisman Bertazi <redacted>
Tested-by: Guenter Roeck <linux@roeck-us.net>
quoted hunk ↗ jump to hunk
---
samples/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/Kconfig b/samples/Kconfig
index 88353b8eac0b..56539b21f2c7 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -122,7 +122,7 @@ config SAMPLE_CONNECTOR
config SAMPLE_FANOTIFY_ERROR
bool "Build fanotify error monitoring sample"
- depends on FANOTIFY
+ depends on FANOTIFY && CC_CAN_LINK && HEADERS_INSTALL
help
When enabled, this builds an example code that uses the
FAN_FS_ERROR fanotify mechanism to monitor filesystem
--
2.33.0