16
19
extern BlockDriver bdrv_vvfat;
17
20
extern BlockDriver bdrv_qcow2;
18
21
extern BlockDriver bdrv_parallels;
22
extern BlockDriver bdrv_nbd;
20
24
typedef struct BlockDriverInfo {
21
25
/* in bytes, 0 if irrelevant */
44
48
use a disk image format on top of
46
50
bdrv_file_open()) */
47
#define BDRV_O_DIRECT 0x0020
51
#define BDRV_O_NOCACHE 0x0020 /* do not use the host page cache */
52
#define BDRV_O_CACHE_WB 0x0040 /* use write-back caching */
53
#define BDRV_O_CACHE_DEF 0x0080 /* use default caching */
55
#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_CACHE_DEF)
50
57
void bdrv_info(void);
51
58
void bdrv_info_stats(void);
54
60
void bdrv_init(void);
55
61
BlockDriver *bdrv_find_format(const char *format_name);
74
80
int bdrv_truncate(BlockDriverState *bs, int64_t offset);
75
81
int64_t bdrv_getlength(BlockDriverState *bs);
76
82
void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
83
void bdrv_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int *psecs);
77
84
int bdrv_commit(BlockDriverState *bs);
78
void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size);
79
85
/* async block I/O */
80
86
typedef struct BlockDriverAIOCB BlockDriverAIOCB;
81
87
typedef void BlockDriverCompletionFunc(void *opaque, int ret);
89
BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
90
QEMUIOVector *iov, int nb_sectors,
91
BlockDriverCompletionFunc *cb, void *opaque);
92
BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
93
QEMUIOVector *iov, int nb_sectors,
94
BlockDriverCompletionFunc *cb, void *opaque);
83
96
BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num,
84
97
uint8_t *buf, int nb_sectors,
85
98
BlockDriverCompletionFunc *cb, void *opaque);
88
101
BlockDriverCompletionFunc *cb, void *opaque);
89
102
void bdrv_aio_cancel(BlockDriverAIOCB *acb);
91
void qemu_aio_init(void);
92
void qemu_aio_poll(void);
93
void qemu_aio_flush(void);
94
void qemu_aio_wait_start(void);
95
void qemu_aio_wait(void);
96
void qemu_aio_wait_end(void);
98
int qemu_key_check(BlockDriverState *bs, const char *name);
100
104
/* Ensure contents are flushed to disk. */
101
105
void bdrv_flush(BlockDriverState *bs);
106
void bdrv_flush_all(void);
108
int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
103
111
#define BDRV_TYPE_HD 0
104
112
#define BDRV_TYPE_CDROM 1
129
137
void (*change_cb)(void *opaque), void *opaque);
130
138
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
131
139
BlockDriverState *bdrv_find(const char *name);
132
void bdrv_iterate(void (*it)(void *opaque, const char *name), void *opaque);
140
void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs),
133
142
int bdrv_is_encrypted(BlockDriverState *bs);
143
int bdrv_key_required(BlockDriverState *bs);
134
144
int bdrv_set_key(BlockDriverState *bs, const char *key);
145
int bdrv_query_missing_keys(void);
135
146
void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
137
148
const char *bdrv_get_device_name(BlockDriverState *bs);
139
150
const uint8_t *buf, int nb_sectors);
140
151
int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
153
const char *bdrv_get_encrypted_filename(BlockDriverState *bs);
142
154
void bdrv_get_backing_filename(BlockDriverState *bs,
143
155
char *filename, int filename_size);
144
156
int bdrv_snapshot_create(BlockDriverState *bs,