1 /* Filter driver - general include file */
4 #include <minix/config.h>
5 #include <minix/const.h>
6 #include <minix/type.h>
9 #include <sys/ioc_disk.h>
10 #include <minix/sysutil.h>
11 #include <minix/syslib.h>
12 #include <minix/partition.h>
14 #include <minix/callnr.h>
15 #include <minix/blockdriver.h>
16 #include <minix/optset.h>
23 #define SECTOR_SIZE 512
26 ST_NIL
, /* Zero checksums */
27 ST_XOR
, /* XOR-based checksums */
28 ST_CRC
, /* CRC32-based checksums */
29 ST_MD5
/* MD5-based checksums */
33 FLT_WRITE
, /* write to up to two disks */
34 FLT_READ
, /* read from one disk */
35 FLT_READ2
/* read from both disks */
44 int problem
; /* one of BD_* */
45 int error
; /* one of E*, only relevant if problem>0 */
50 /* UP event characterization. */
55 /* Something was wrong and the disk driver has been restarted/refreshed,
56 * so the request needs to be redone.
60 /* The cases where the disk driver need to be restarted/refreshed by RS.
61 * BD_DEAD: the disk driver has died. Restart it.
62 * BD_PROTO: a protocol error has occurred. Refresh it.
63 * BD_DATA: a data error has occurred. Refresh it.
74 #define DRIVER_BACKUP 1
76 /* Requests for more than this many bytes will be allocated dynamically. */
77 #define BUF_SIZE (256 * 1024)
78 #define SBUF_SIZE (BUF_SIZE * 2)
82 typedef unsigned long sector_t
;
85 extern int USE_CHECKSUM
;
86 extern int USE_MIRROR
;
87 extern int BAD_SUM_ERROR
;
88 extern int USE_SUM_LAYOUT
;
91 extern int NR_SUM_SEC
;
92 extern int NR_RETRIES
;
93 extern int NR_RESTARTS
;
94 extern int DRIVER_TIMEOUT
;
95 extern int CHUNK_SIZE
;
97 extern char MAIN_LABEL
[LABEL_SIZE
];
98 extern char BACKUP_LABEL
[LABEL_SIZE
];
99 extern int MAIN_MINOR
;
100 extern int BACKUP_MINOR
;
103 extern void sum_init(void);
104 extern int transfer(u64_t pos
, char *buffer
, size_t *sizep
, int flag_rw
);
105 extern u64_t
convert(u64_t size
);
108 extern void driver_init(void);
109 extern void driver_shutdown(void);
110 extern u64_t
get_raw_size(void);
111 extern void reset_kills(void);
112 extern int check_driver(int which
);
113 extern int bad_driver(int which
, int type
, int error
);
114 extern int read_write(u64_t pos
, char *bufa
, char *bufb
, size_t *sizep
,
116 extern void ds_event(void);
119 extern char *flt_malloc(size_t size
, char *sbuf
, size_t ssize
);
120 extern void flt_free(char *buf
, size_t size
, const char *sbuf
);
121 extern clock_t flt_alarm(clock_t dt
);