minix/include/sys/ioc_fbd.h
David van Moolenbroek 1760f1c717 Straighten ioctl.h
- include all ioctl subheaders, properly listing all letters;
- change FBD's ioctl calls to use 'B' instead of 'F', in
  preparation of the VND driver.

Change-Id: Ia718979568cc057f47cf505a89238d5b3b6695d4
2014-03-01 09:04:53 +01:00

66 lines
1.8 KiB
C

/* sys/ioc_fbd.h - Faulty Block Device ioctl() command codes.
*
*/
#ifndef _S_I_FBD_H
#define _S_I_FBD_H
/* FBD rule structure. */
typedef int fbd_rulenum_t;
struct fbd_rule {
fbd_rulenum_t num; /* rule number (1-based) */
u64_t start; /* start position of area to match */
u64_t end; /* end position (exclusive) (0 = up to EOF) */
int flags; /* match read and/or write requests */
unsigned int skip; /* # matches to skip before activating */
unsigned int count; /* # times left to trigger (0 = no limit) */
int action; /* action type to perform when triggered */
union { /* action parameters */
struct {
int type; /* corruption type */
} corrupt;
struct {
int code; /* error code to return (OK, EIO..) */
} error;
struct {
u64_t start; /* start position of target area */
u64_t end; /* end position of area (excl) */
u32_t align; /* alignment to use in target area */
} misdir;
struct {
u32_t lead; /* # bytes to process normally */
} losttorn;
} params;
};
/* Match flags. */
#define FBD_FLAG_READ 0x1 /* match read requests */
#define FBD_FLAG_WRITE 0x2 /* match write requests */
/* Action types. */
enum {
FBD_ACTION_CORRUPT, /* write or return corrupt data */
FBD_ACTION_ERROR, /* return an I/O error */
FBD_ACTION_MISDIR, /* perform a misdirected write */
FBD_ACTION_LOSTTORN /* perform a lost or torn write */
};
/* Corruption types. */
enum {
FBD_CORRUPT_ZERO, /* write or return ..zeroed data */
FBD_CORRUPT_PERSIST, /* ..consequently the same bad data */
FBD_CORRUPT_RANDOM /* ..new random data every time */
};
/* The I/O control requests. */
#define FBDCADDRULE _IOW('B', 1, struct fbd_rule) /* add a rule */
#define FBDCDELRULE _IOW('B', 2, fbd_rulenum_t) /* delete a rule */
#define FBDCGETRULE _IORW('B', 3, struct fbd_rule) /* retrieve a rule */
#endif /* _S_I_FBD_H */