Commit Graph

4 Commits

Author SHA1 Message Date
Linus Torvalds c107fb9b4f Add gitignore file for samples/fanotify/ subdirectory
Commit 5451093081 ("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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-11-07 11:19:24 -08:00
Zhang Mingyu 15c72660fe samples: remove duplicate include in fs-monitor.c
'sys/types.h' included in 'samples/fanotify/fs-monitor.c'
is duplicated.It is also included on 15 line.

Link: https://lore.kernel.org/r/20211101075152.35780-1-zhang.mingyu@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Zhang Mingyu <zhang.mingyu@zte.com.cn>
Signed-off-by: Jan Kara <jack@suse.cz>
2021-11-01 13:17:47 +01:00
Jan Kara b7eccf75c2 samples: Fix warning in fsnotify sample
The fsnotify sample code generates the following warning on powerpc:

samples/fanotify/fs-monitor.c: In function 'handle_notifications':
samples/fanotify/fs-monitor.c:68:36: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
   68 |    printf("unexpected FAN MARK: %llx\n", event->mask);
      |                                 ~~~^     ~~~~~~~~~~~
      |                                    |          |
      |                                    |          __u64 {aka long unsigned int}
      |                                    long long unsigned int
      |                                 %lx

Fix the problem by explicitely typing the argument to proper type.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jan Kara <jack@suse.cz>
2021-11-01 12:48:01 +01:00
Gabriel Krisman Bertazi 5451093081 samples: Add fs error monitoring example
Introduce an example of a FAN_FS_ERROR fanotify user to track filesystem
errors.

Link: https://lore.kernel.org/r/20211025192746.66445-31-krisman@collabora.com
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Jan Kara <jack@suse.cz>
2021-10-27 12:53:47 +02:00