1 /* sys/ioc_fbd.h - Faulty Block Device ioctl() command codes.
8 /* FBD rule structure. */
10 typedef int fbd_rulenum_t
;
13 fbd_rulenum_t num
; /* rule number (1-based) */
14 u64_t start
; /* start position of area to match */
15 u64_t end
; /* end position (exclusive) (0 = up to EOF) */
16 int flags
; /* match read and/or write requests */
17 unsigned int skip
; /* # matches to skip before activating */
18 unsigned int count
; /* # times left to trigger (0 = no limit) */
19 int action
; /* action type to perform when triggered */
21 union { /* action parameters */
23 int type
; /* corruption type */
27 int code
; /* error code to return (OK, EIO..) */
31 u64_t start
; /* start position of target area */
32 u64_t end
; /* end position of area (excl) */
33 u32_t align
; /* alignment to use in target area */
37 u32_t lead
; /* # bytes to process normally */
43 #define FBD_FLAG_READ 0x1 /* match read requests */
44 #define FBD_FLAG_WRITE 0x2 /* match write requests */
48 FBD_ACTION_CORRUPT
, /* write or return corrupt data */
49 FBD_ACTION_ERROR
, /* return an I/O error */
50 FBD_ACTION_MISDIR
, /* perform a misdirected write */
51 FBD_ACTION_LOSTTORN
/* perform a lost or torn write */
54 /* Corruption types. */
56 FBD_CORRUPT_ZERO
, /* write or return ..zeroed data */
57 FBD_CORRUPT_PERSIST
, /* ..consequently the same bad data */
58 FBD_CORRUPT_RANDOM
/* ..new random data every time */
61 /* The I/O control requests. */
62 #define FBDCADDRULE _IOW('F', 1, struct fbd_rule) /* add a rule */
63 #define FBDCDELRULE _IOW('F', 2, fbd_rulenum_t) /* delete a rule */
64 #define FBDCGETRULE _IORW('F', 3, struct fbd_rule) /* retrieve a rule */
66 #endif /* _S_I_FBD_H */