81 |
81 |
#define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS)
|
82 |
82 |
#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1)
|
83 |
83 |
|
|
84 |
/* BDRV_BLOCK_DATA: data is read from bs->file or another file
|
|
85 |
* BDRV_BLOCK_ZERO: sectors read as zero
|
|
86 |
* BDRV_BLOCK_OFFSET_VALID: sector stored in bs->file as raw data
|
|
87 |
*
|
|
88 |
* If BDRV_BLOCK_OFFSET_VALID is set, bits 9-62 represent the offset in
|
|
89 |
* bs->file where sector data can be read from as raw data.
|
|
90 |
*
|
|
91 |
* DATA == 0 && ZERO == 0 means that data is read from backing_hd if present.
|
|
92 |
*
|
|
93 |
* DATA ZERO OFFSET_VALID
|
|
94 |
* t t t sectors read as zero, bs->file is zero at offset
|
|
95 |
* t f t sectors read as valid from bs->file at offset
|
|
96 |
* f t t sectors preallocated, read as zero, bs->file not
|
|
97 |
* necessarily zero at offset
|
|
98 |
* f f t sectors preallocated but read from backing_hd,
|
|
99 |
* bs->file contains garbage at offset
|
|
100 |
* t t f sectors preallocated, read as zero, unknown offset
|
|
101 |
* t f f sectors read from unknown file or offset
|
|
102 |
* f t f not allocated or unknown offset, read as zero
|
|
103 |
* f f f not allocated or unknown offset, read from backing_hd
|
|
104 |
*/
|
|
105 |
#define BDRV_BLOCK_DATA 1
|
|
106 |
#define BDRV_BLOCK_ZERO 2
|
|
107 |
#define BDRV_BLOCK_OFFSET_VALID 4
|
|
108 |
#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK
|
|
109 |
|
84 |
110 |
typedef enum {
|
85 |
111 |
BDRV_ACTION_REPORT, BDRV_ACTION_IGNORE, BDRV_ACTION_STOP
|
86 |
112 |
} BlockErrorAction;
|