^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #include <linux/atomic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) struct notifier_err_inject_action {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) unsigned long val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define NOTIFIER_ERR_INJECT_ACTION(action) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) .name = #action, .val = (action),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct notifier_err_inject {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct notifier_block nb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct notifier_err_inject_action actions[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /* The last slot must be terminated with zero sentinel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) extern struct dentry *notifier_err_inject_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern struct dentry *notifier_err_inject_init(const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct dentry *parent, struct notifier_err_inject *err_inject,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int priority);