diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2023-03-27 23:37:32 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-04-13 07:38:54 -0600 |
commit | 4668c7a2940d134bea50058e138591b97485c5da (patch) | |
tree | d799f0eb3f7c5a55c27e461be08a368bf20a11fd /include/linux/fault-inject.h | |
parent | 4d5bba5bee0aa002523125e51789e95d47794a06 (diff) |
fault-inject: allow configuration via configfs
This provides a helper function to allow configuration of fault-injection
for configfs-based drivers.
The config items created by this function have the same interface as the
one created under debugfs by fault_create_debugfs_attr().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Link: https://lore.kernel.org/r/20230327143733.14599-2-akinobu.mita@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/fault-inject.h')
-rw-r--r-- | include/linux/fault-inject.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h index 444236dadcf0..481abf530b3c 100644 --- a/include/linux/fault-inject.h +++ b/include/linux/fault-inject.h @@ -6,6 +6,7 @@ #include <linux/types.h> #include <linux/debugfs.h> +#include <linux/configfs.h> #include <linux/ratelimit.h> #include <linux/atomic.h> @@ -65,6 +66,27 @@ static inline struct dentry *fault_create_debugfs_attr(const char *name, #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ +#ifdef CONFIG_FAULT_INJECTION_CONFIGFS + +struct fault_config { + struct fault_attr attr; + struct config_group group; +}; + +void fault_config_init(struct fault_config *config, const char *name); + +#else /* CONFIG_FAULT_INJECTION_CONFIGFS */ + +struct fault_config { +}; + +static inline void fault_config_init(struct fault_config *config, + const char *name) +{ +} + +#endif /* CONFIG_FAULT_INJECTION_CONFIGFS */ + #endif /* CONFIG_FAULT_INJECTION */ struct kmem_cache; |