Skip to contentSkip to conversation

Apply fanotify-related documentation changes

PATCH In review [email protected] 2 participants 6 messages Jul 24, 2024 – Jul 25, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Apply fanotify-related documentation changes

From: Chuck Lever <[email protected]>

These extra commits were requested by Amir Goldstein <[email protected]>. Note that c0baf9ac0b05 ("docs: Document the FAN_FS_ERROR event") is already applied to v5.15.y.

Gabriel Krisman Bertazi (3):
samples: Add fs error monitoring example
samples: Make fs-monitor depend on libc and headers
docs: Fix formatting of literal sections in fanotify docs

Linus Torvalds (1):
Add gitignore file for samples/fanotify/ subdirectory

 .../admin-guide/filesystem-monitoring.rst     |  20 ++-
 samples/Kconfig                               |   9 ++
 samples/Makefile                              |   1 +
 samples/fanotify/.gitignore                   |   1 +
 samples/fanotify/Makefile                     |   5 +
 samples/fanotify/fs-monitor.c                 | 142 ++++++++++++++++++
 6 files changed, 170 insertions(+), 8 deletions(-)
 create mode 100644 samples/fanotify/.gitignore
 create mode 100644 samples/fanotify/Makefile
 create mode 100644 samples/fanotify/fs-monitor.c
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/4 samples: Add fs error monitoring example

From: Gabriel Krisman Bertazi <[email protected]>

[ Upstream commit 5451093081db6ca1a708d149e11cfd219800bc4c ]

Introduce an example of a FAN_FS_ERROR fanotify user to track filesystem errors.

---
 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
samples/Kconfig +9 -0
index b0503ef058d3..88353b8eac0b 100644
@@ -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
+	help
+	  When enabled, this builds an example code that uses the
+	  FAN_FS_ERROR fanotify mechanism to monitor filesystem
+	  errors.
+	  See also Documentation/admin-guide/filesystem-monitoring.rst.
+
 config SAMPLE_HIDRAW
 	bool "hidraw sample"
 	depends on CC_CAN_LINK && HEADERS_INSTALL
samples/Makefile +1 -0
index 087e0988ccc5..931a81847c48 100644
@@ -5,6 +5,7 @@ subdir-$(CONFIG_SAMPLE_AUXDISPLAY)	+= auxdisplay
 subdir-$(CONFIG_SAMPLE_ANDROID_BINDERFS) += binderfs
 obj-$(CONFIG_SAMPLE_CONFIGFS)		+= configfs/
 obj-$(CONFIG_SAMPLE_CONNECTOR)		+= connector/
+obj-$(CONFIG_SAMPLE_FANOTIFY_ERROR)	+= fanotify/
 subdir-$(CONFIG_SAMPLE_HIDRAW)		+= hidraw
 obj-$(CONFIG_SAMPLE_HW_BREAKPOINT)	+= hw_breakpoint/
 obj-$(CONFIG_SAMPLE_KDB)		+= kdb/
samples/fanotify/Makefile new file +5 -0
new file mode 100644
index 000000000000..e20db1bdde3b
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+userprogs-always-y += fs-monitor
+
+userccflags += -I usr/include -Wall
+
samples/fanotify/fs-monitor.c new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
2.45.2
#2 lore raw

PATCH 2/4 samples: Make fs-monitor depend on libc and headers

In reply to [email protected]

From: Gabriel Krisman Bertazi <[email protected]>

[ Upstream commit 8fc70b3a142f97f7859bf052151df896933d2586 ]

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>

    |          ^~~~~~~~~
---
 samples/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
samples/Kconfig +1 -1
index 88353b8eac0b..56539b21f2c7 100644
@@ -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
Signature · 1 line
2.45.2
#3 lore raw

PATCH 3/4 docs: Fix formatting of literal sections in fanotify docs

In reply to [email protected]

From: Gabriel Krisman Bertazi <[email protected]>

[ Upstream commit 9abeae5d4458326e16df7ea237104b58c27dfd77 ]

Stephen Rothwell reported the following warning was introduced by commit c0baf9ac0b05 ("docs: Document the FAN_FS_ERROR event").

Documentation/admin-guide/filesystem-monitoring.rst:60: WARNING:
Definition list ends without a blank line; unexpected unindent.

---
 .../admin-guide/filesystem-monitoring.rst     | 20 +++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
Documentation/admin-guide/filesystem-monitoring.rst +12 -8
index 5a3c84e60095..ab8dba76283c 100644
@@ -35,9 +35,11 @@ notifications is Ext4.
 
 A FAN_FS_ERROR Notification has the following format::
 
-  [ Notification Metadata (Mandatory) ]
-  [ Generic Error Record  (Mandatory) ]
-  [ FID record            (Mandatory) ]
+  ::
+
+     [ Notification Metadata (Mandatory) ]
+     [ Generic Error Record  (Mandatory) ]
+     [ FID record            (Mandatory) ]
 
 The order of records is not guaranteed, and new records might be added
 in the future.  Therefore, applications must not rely on the order and
@@ -53,11 +55,13 @@ providing any additional details about the problem.  This record is
 identified by ``struct fanotify_event_info_header.info_type`` being set
 to FAN_EVENT_INFO_TYPE_ERROR.
 
-  struct fanotify_event_info_error {
-	struct fanotify_event_info_header hdr;
-	__s32 error;
-	__u32 error_count;
-  };
+  ::
+
+     struct fanotify_event_info_error {
+          struct fanotify_event_info_header hdr;
+         __s32 error;
+         __u32 error_count;
+     };
 
 The `error` field identifies the type of error using errno values.
 `error_count` tracks the number of errors that occurred and were
Signature · 1 line
2.45.2
#4 lore raw

PATCH 4/4 Add gitignore file for samples/fanotify/ subdirectory

In reply to [email protected]

From: Linus Torvalds <[email protected]>

[ Upstream commit c107fb9b4f8338375b3e865c3d2c1d98ccb3a95a ]

Commit 5451093081db ("samples: Add fs error monitoring example") added a new sample program, but didn't teach git to ignore the new generated files, causing unnecessary noise from 'git status' after a full build.

Add the 'fs-monitor' sample executable to the .gitignore for this subdirectory to silence it all again.

---
 samples/fanotify/.gitignore | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 samples/fanotify/.gitignore
samples/fanotify/.gitignore new file +1 -0
new file mode 100644
index 000000000000..d74593e8b2de
@@ -0,0 +1 @@
+fs-monitor
Signature · 1 line
2.45.2
maintainer
#5 lore raw
In reply to [email protected]
Quoted 14 lines · On Wed, Jul 24, 2024 at 03:06:19PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>

These extra commits were requested by Amir Goldstein <[email protected]>. Note that c0baf9ac0b05 ("docs: Document the FAN_FS_ERROR event") is already applied to v5.15.y.

Gabriel Krisman Bertazi (3):
samples: Add fs error monitoring example
samples: Make fs-monitor depend on libc and headers
docs: Fix formatting of literal sections in fanotify docs

Linus Torvalds (1):
Add gitignore file for samples/fanotify/ subdirectory

Quoted 15 lines
 .../admin-guide/filesystem-monitoring.rst     |  20 ++-
 samples/Kconfig                               |   9 ++
 samples/Makefile                              |   1 +
 samples/fanotify/.gitignore                   |   1 +
 samples/fanotify/Makefile                     |   5 +
 samples/fanotify/fs-monitor.c                 | 142 ++++++++++++++++++
 6 files changed, 170 insertions(+), 8 deletions(-)
 create mode 100644 samples/fanotify/.gitignore
 create mode 100644 samples/fanotify/Makefile
 create mode 100644 samples/fanotify/fs-monitor.c
Signature · 1 line
2.45.2

All now queued up, thanks.

greg k-h