commit ab9934da3316cf362e131acdcb2b3171ac7fbf5e from: Sergey Bronnikov date: Mon Jan 24 17:43:22 2022 UTC Move error injection structures to compilation unit Required for #86 commit - 6b7353dc98836f4224e5871d5b7a6cdc39292918 commit + ab9934da3316cf362e131acdcb2b3171ac7fbf5e blob - a71c63da063644a19fa0b53b3485807c6d165773 blob + a069f4d30b8733e56219169b4b1fdef1463ff865 --- unreliablefs_errinj.c +++ unreliablefs_errinj.c @@ -15,6 +15,37 @@ #include "unreliablefs.h" #include "unreliablefs_errinj.h" +const char *errinj_name[] = +{ + "errinj_errno", + "errinj_kill_caller", + "errinj_noop", + "errinj_slowdown", +}; + +typedef enum { + ERRINJ_ERRNO, + ERRINJ_KILL_CALLER, + ERRINJ_NOOP, + ERRINJ_SLOWDOWN, +} errinj_type; + +typedef struct errinj_conf errinj_conf; + +struct errinj_conf { + char *err_injection_name; + char *op_regexp; + char *path_regexp; + char *errno_regexp; + unsigned int probability; + unsigned int duration; + errinj_type type; + + TAILQ_ENTRY(errinj_conf) entries; +}; + +TAILQ_HEAD(err_inj_q, errinj_conf); + static int rand_range(int, int); int error_inject(const char* path, fuse_op operation); blob - 2dcc775ca5c9a010de8149d51d0bc8a92deee037 blob + 299d5027cf13cf486938e683038b60e40fb351c7 --- unreliablefs_errinj.h +++ unreliablefs_errinj.h @@ -31,35 +31,4 @@ int conf_option_handler(void* cfg, const char* section const char* name, const char* value); int is_regex_matched(const char *regex, const char *string); -const char *errinj_name[] = -{ - "errinj_errno", - "errinj_kill_caller", - "errinj_noop", - "errinj_slowdown", -}; - -typedef enum { - ERRINJ_ERRNO, - ERRINJ_KILL_CALLER, - ERRINJ_NOOP, - ERRINJ_SLOWDOWN, -} errinj_type; - -typedef struct errinj_conf errinj_conf; - -struct errinj_conf { - char *err_injection_name; - char *op_regexp; - char *path_regexp; - char *errno_regexp; - unsigned int probability; - unsigned int duration; - errinj_type type; - - TAILQ_ENTRY(errinj_conf) entries; -}; - -TAILQ_HEAD(err_inj_q, errinj_conf); - #endif /* ERRINJ_HH */ blob - e18c31074bb172917c87717375d3071335cc5cc3 blob + f9d48d5620657020de0adbd34b01a2a66fc90241 --- unreliablefs_ops.c +++ unreliablefs_ops.c @@ -17,6 +17,7 @@ #endif #include "unreliablefs_ops.h" +#include "unreliablefs_errinj.h" const char *fuse_op_name[] = { "getattr",