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/driver.h>
22 #define SECTOR_SIZE 512
25 ST_NIL
, /* Zero checksums */
26 ST_XOR
, /* XOR-based checksums */
27 ST_CRC
, /* CRC32-based checksums */
28 ST_MD5
/* MD5-based checksums */
32 FLT_WRITE
, /* write to up to two disks */
33 FLT_READ
, /* read from one disk */
34 FLT_READ2
/* read from both disks */
43 int problem
; /* one of BD_* */
44 int error
; /* one of E*, only relevant if problem>0 */
49 /* UP event characterization. */
54 /* Something was wrong and the disk driver has been restarted/refreshed,
55 * so the request needs to be redone.
59 /* The cases where the disk driver need to be restarted/refreshed by RS.
60 * BD_DEAD: the disk driver has died. Restart it.
61 * BD_PROTO: a protocol error has occurred. Refresh it.
62 * BD_DATA: a data error has occurred. Refresh it.
73 #define DRIVER_BACKUP 1
75 /* Requests for more than this many bytes will be allocated dynamically. */
76 #define BUF_SIZE (256 * 1024)
77 #define SBUF_SIZE (BUF_SIZE * 2)
81 typedef unsigned long sector_t
;
84 extern int USE_CHECKSUM
;
85 extern int USE_MIRROR
;
86 extern int BAD_SUM_ERROR
;
87 extern int USE_SUM_LAYOUT
;
90 extern int NR_SUM_SEC
;
91 extern int NR_RETRIES
;
92 extern int NR_RESTARTS
;
93 extern int DRIVER_TIMEOUT
;
94 extern int CHUNK_SIZE
;
96 extern char MAIN_LABEL
[LABEL_SIZE
];
97 extern char BACKUP_LABEL
[LABEL_SIZE
];
98 extern int MAIN_MINOR
;
99 extern int BACKUP_MINOR
;
102 extern void sum_init(void);
103 extern int transfer(u64_t pos
, char *buffer
, size_t *sizep
, int flag_rw
);
104 extern u64_t
convert(u64_t size
);
107 extern void driver_init(void);
108 extern void driver_shutdown(void);
109 extern u64_t
get_raw_size(void);
110 extern void reset_kills(void);
111 extern int check_driver(int which
);
112 extern int bad_driver(int which
, int type
, int error
);
113 extern int read_write(u64_t pos
, char *bufa
, char *bufb
, size_t *sizep
,
115 extern void ds_event(void);
118 extern char *flt_malloc(size_t size
, char *sbuf
, size_t ssize
);
119 extern void flt_free(char *buf
, size_t size
, const char *sbuf
);
120 extern char *print64(u64_t p
);
121 extern clock_t flt_alarm(clock_t dt
);