diff options
| author | David Howells <dhowells@redhat.com> | 2018-11-01 19:07:23 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-01-30 17:44:28 -0500 |
| commit | c6b82263f9c6e745eb4c5dfc2578d147c4cd7604 (patch) | |
| tree | ea5b8ed22b446c4a23f81e07e1d8e23ae7da6702 | |
| parent | f3a09c92018a91ad0981146a4ac59414f814d801 (diff) | |
vfs: Introduce logging functions
Introduce a set of logging functions through which informational messages,
warnings and error messages incurred by the mount procedure can be logged
and, in a future patch, passed to userspace instead by way of the
filesystem configuration context file descriptor.
There are four functions:
(1) infof(const char *fmt, ...);
Logs an informational message.
(2) warnf(const char *fmt, ...);
Logs a warning message.
(3) errorf(const char *fmt, ...);
Logs an error message.
(4) invalf(const char *fmt, ...);
As errof(), but returns -EINVAL so can be used on a return statement.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | include/linux/fs_context.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h index 087c12954360..d208cc40b868 100644 --- a/include/linux/fs_context.h +++ b/include/linux/fs_context.h | |||
| @@ -81,4 +81,46 @@ extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_ty | |||
| 81 | extern int vfs_get_tree(struct fs_context *fc); | 81 | extern int vfs_get_tree(struct fs_context *fc); |
| 82 | extern void put_fs_context(struct fs_context *fc); | 82 | extern void put_fs_context(struct fs_context *fc); |
| 83 | 83 | ||
| 84 | #define logfc(FC, FMT, ...) pr_notice(FMT, ## __VA_ARGS__) | ||
| 85 | |||
| 86 | /** | ||
| 87 | * infof - Store supplementary informational message | ||
| 88 | * @fc: The context in which to log the informational message | ||
| 89 | * @fmt: The format string | ||
| 90 | * | ||
| 91 | * Store the supplementary informational message for the process if the process | ||
| 92 | * has enabled the facility. | ||
| 93 | */ | ||
| 94 | #define infof(fc, fmt, ...) ({ logfc(fc, fmt, ## __VA_ARGS__); }) | ||
| 95 | |||
| 96 | /** | ||
| 97 | * warnf - Store supplementary warning message | ||
| 98 | * @fc: The context in which to log the error message | ||
| 99 | * @fmt: The format string | ||
| 100 | * | ||
| 101 | * Store the supplementary warning message for the process if the process has | ||
| 102 | * enabled the facility. | ||
| 103 | */ | ||
| 104 | #define warnf(fc, fmt, ...) ({ logfc(fc, fmt, ## __VA_ARGS__); }) | ||
| 105 | |||
| 106 | /** | ||
| 107 | * errorf - Store supplementary error message | ||
| 108 | * @fc: The context in which to log the error message | ||
| 109 | * @fmt: The format string | ||
| 110 | * | ||
| 111 | * Store the supplementary error message for the process if the process has | ||
| 112 | * enabled the facility. | ||
| 113 | */ | ||
| 114 | #define errorf(fc, fmt, ...) ({ logfc(fc, fmt, ## __VA_ARGS__); }) | ||
| 115 | |||
| 116 | /** | ||
| 117 | * invalf - Store supplementary invalid argument error message | ||
| 118 | * @fc: The context in which to log the error message | ||
| 119 | * @fmt: The format string | ||
| 120 | * | ||
| 121 | * Store the supplementary error message for the process if the process has | ||
| 122 | * enabled the facility and return -EINVAL. | ||
| 123 | */ | ||
| 124 | #define invalf(fc, fmt, ...) ({ errorf(fc, fmt, ## __VA_ARGS__); -EINVAL; }) | ||
| 125 | |||
| 84 | #endif /* _LINUX_FS_CONTEXT_H */ | 126 | #endif /* _LINUX_FS_CONTEXT_H */ |
