mkfs: symlink support
[minix.git] / common / include / sys / ioc_fbd.h
blobda72667981a297205c6b67ae6db4d9b42a397b9d
1 /* sys/ioc_fbd.h - Faulty Block Device ioctl() command codes.
3 */
5 #ifndef _S_I_FBD_H
6 #define _S_I_FBD_H
8 /* FBD rule structure. */
10 typedef int fbd_rulenum_t;
12 struct fbd_rule {
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 */
22 struct {
23 int type; /* corruption type */
24 } corrupt;
26 struct {
27 int code; /* error code to return (OK, EIO..) */
28 } error;
30 struct {
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 */
34 } misdir;
36 struct {
37 u32_t lead; /* # bytes to process normally */
38 } losttorn;
39 } params;
42 /* Match flags. */
43 #define FBD_FLAG_READ 0x1 /* match read requests */
44 #define FBD_FLAG_WRITE 0x2 /* match write requests */
46 /* Action types. */
47 enum {
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. */
55 enum {
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 */