#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/random.h>
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/stacktrace.h>
#include <linux/fault-inject.h>
int setup_fault_attr(struct fault_attr *attr, char *str)
{ … }
EXPORT_SYMBOL_GPL(…);
static void fail_dump(struct fault_attr *attr)
{ … }
#define atomic_dec_not_zero(v) …
static bool fail_task(struct fault_attr *attr, struct task_struct *task)
{ … }
#define MAX_STACK_TRACE_DEPTH …
#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
static bool fail_stacktrace(struct fault_attr *attr)
{ … }
#else
static inline bool fail_stacktrace(struct fault_attr *attr)
{
return true;
}
#endif
bool should_fail_ex(struct fault_attr *attr, ssize_t size, int flags)
{ … }
bool should_fail(struct fault_attr *attr, ssize_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
static int debugfs_ul_set(void *data, u64 val)
{ … }
static int debugfs_ul_get(void *data, u64 *val)
{ … }
DEFINE_SIMPLE_ATTRIBUTE(…);
static void debugfs_create_ul(const char *name, umode_t mode,
struct dentry *parent, unsigned long *value)
{ … }
#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
static int debugfs_stacktrace_depth_set(void *data, u64 val)
{ … }
DEFINE_SIMPLE_ATTRIBUTE(…);
static void debugfs_create_stacktrace_depth(const char *name, umode_t mode,
struct dentry *parent,
unsigned long *value)
{ … }
#endif
struct dentry *fault_create_debugfs_attr(const char *name,
struct dentry *parent, struct fault_attr *attr)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
#ifdef CONFIG_FAULT_INJECTION_CONFIGFS
static ssize_t fault_uint_attr_show(unsigned int val, char *page)
{ … }
static ssize_t fault_ulong_attr_show(unsigned long val, char *page)
{ … }
static ssize_t fault_bool_attr_show(bool val, char *page)
{ … }
static ssize_t fault_atomic_t_attr_show(atomic_t val, char *page)
{ … }
static ssize_t fault_uint_attr_store(unsigned int *val, const char *page, size_t count)
{ … }
static ssize_t fault_ulong_attr_store(unsigned long *val, const char *page, size_t count)
{ … }
static ssize_t fault_bool_attr_store(bool *val, const char *page, size_t count)
{ … }
static ssize_t fault_atomic_t_attr_store(atomic_t *val, const char *page, size_t count)
{ … }
#define CONFIGFS_ATTR_NAMED(_pfx, _name, _attr_name) …
static struct fault_config *to_fault_config(struct config_item *item)
{ … }
#define FAULT_CONFIGFS_ATTR_NAMED(NAME, ATTR_NAME, MEMBER, TYPE) …
#define FAULT_CONFIGFS_ATTR(NAME, TYPE) …
FAULT_CONFIGFS_ATTR(…);
FAULT_CONFIGFS_ATTR(…);
FAULT_CONFIGFS_ATTR(…);
FAULT_CONFIGFS_ATTR(…);
FAULT_CONFIGFS_ATTR(…);
FAULT_CONFIGFS_ATTR_NAMED(…);
FAULT_CONFIGFS_ATTR_NAMED(…);
FAULT_CONFIGFS_ATTR_NAMED(…);
#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
static ssize_t fault_stacktrace_depth_show(struct config_item *item, char *page)
{ … }
static ssize_t fault_stacktrace_depth_store(struct config_item *item, const char *page,
size_t count)
{ … }
CONFIGFS_ATTR_NAMED(…);
static ssize_t fault_xul_attr_show(unsigned long val, char *page)
{ … }
static ssize_t fault_xul_attr_store(unsigned long *val, const char *page, size_t count)
{ … }
FAULT_CONFIGFS_ATTR_NAMED(…);
FAULT_CONFIGFS_ATTR_NAMED(…);
FAULT_CONFIGFS_ATTR_NAMED(…);
FAULT_CONFIGFS_ATTR_NAMED(…);
#endif
static struct configfs_attribute *fault_config_attrs[] = …;
static const struct config_item_type fault_config_type = …;
void fault_config_init(struct fault_config *config, const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif