Skip to content

Commit

Permalink
Move error injection structures to compilation unit
Browse files Browse the repository at this point in the history
Required for #86
  • Loading branch information
ligurio committed Jan 24, 2022
1 parent 6b7353d commit ab9934d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
31 changes: 31 additions & 0 deletions unreliablefs_errinj.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
31 changes: 0 additions & 31 deletions unreliablefs_errinj.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
1 change: 1 addition & 0 deletions unreliablefs_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#endif

#include "unreliablefs_ops.h"
#include "unreliablefs_errinj.h"

const char *fuse_op_name[] = {
"getattr",
Expand Down

0 comments on commit ab9934d

Please sign in to comment.