root / block.h @ 7d890b40
History | View | Annotate | Download (12.8 kB)
1 | faf07963 | pbrook | #ifndef BLOCK_H
|
---|---|---|---|
2 | faf07963 | pbrook | #define BLOCK_H
|
3 | faf07963 | pbrook | |
4 | a76bab49 | aliguori | #include "qemu-aio.h" |
5 | 3b69e4b9 | aliguori | #include "qemu-common.h" |
6 | 0e7e1989 | Kevin Wolf | #include "qemu-option.h" |
7 | da1fa91d | Kevin Wolf | #include "qemu-coroutine.h" |
8 | d15e5465 | Luiz Capitulino | #include "qobject.h" |
9 | a76bab49 | aliguori | |
10 | faf07963 | pbrook | /* block.c */
|
11 | faf07963 | pbrook | typedef struct BlockDriver BlockDriver; |
12 | faf07963 | pbrook | |
13 | faf07963 | pbrook | typedef struct BlockDriverInfo { |
14 | faf07963 | pbrook | /* in bytes, 0 if irrelevant */
|
15 | faf07963 | pbrook | int cluster_size;
|
16 | faf07963 | pbrook | /* offset at which the VM state can be saved (0 if not possible) */
|
17 | faf07963 | pbrook | int64_t vm_state_offset; |
18 | faf07963 | pbrook | } BlockDriverInfo; |
19 | faf07963 | pbrook | |
20 | faf07963 | pbrook | typedef struct QEMUSnapshotInfo { |
21 | faf07963 | pbrook | char id_str[128]; /* unique snapshot id */ |
22 | faf07963 | pbrook | /* the following fields are informative. They are not needed for
|
23 | faf07963 | pbrook | the consistency of the snapshot */
|
24 | faf07963 | pbrook | char name[256]; /* user choosen name */ |
25 | faf07963 | pbrook | uint32_t vm_state_size; /* VM state info size */
|
26 | faf07963 | pbrook | uint32_t date_sec; /* UTC date of the snapshot */
|
27 | faf07963 | pbrook | uint32_t date_nsec; |
28 | faf07963 | pbrook | uint64_t vm_clock_nsec; /* VM clock relative to boot */
|
29 | faf07963 | pbrook | } QEMUSnapshotInfo; |
30 | faf07963 | pbrook | |
31 | 145feb17 | Markus Armbruster | /* Callbacks for block device models */
|
32 | 0e49de52 | Markus Armbruster | typedef struct BlockDevOps { |
33 | 145feb17 | Markus Armbruster | /*
|
34 | 145feb17 | Markus Armbruster | * Runs when virtual media changed (monitor commands eject, change)
|
35 | 145feb17 | Markus Armbruster | * Beware: doesn't run when a host device's physical media
|
36 | 145feb17 | Markus Armbruster | * changes. Sure would be useful if it did.
|
37 | 145feb17 | Markus Armbruster | */
|
38 | 145feb17 | Markus Armbruster | void (*change_media_cb)(void *opaque); |
39 | 145feb17 | Markus Armbruster | /*
|
40 | 145feb17 | Markus Armbruster | * Runs when the size changed (e.g. monitor command block_resize)
|
41 | 145feb17 | Markus Armbruster | */
|
42 | 145feb17 | Markus Armbruster | void (*resize_cb)(void *opaque); |
43 | 0e49de52 | Markus Armbruster | } BlockDevOps; |
44 | 0e49de52 | Markus Armbruster | |
45 | faf07963 | pbrook | #define BDRV_O_RDWR 0x0002 |
46 | faf07963 | pbrook | #define BDRV_O_SNAPSHOT 0x0008 /* open the file read only and save writes in a snapshot */ |
47 | 9f7965c7 | aliguori | #define BDRV_O_NOCACHE 0x0020 /* do not use the host page cache */ |
48 | 9f7965c7 | aliguori | #define BDRV_O_CACHE_WB 0x0040 /* use write-back caching */ |
49 | 5c6c3a6c | Christoph Hellwig | #define BDRV_O_NATIVE_AIO 0x0080 /* use native AIO instead of the thread pool */ |
50 | b783e409 | Kevin Wolf | #define BDRV_O_NO_BACKING 0x0100 /* don't open the backing file */ |
51 | 016f5cf6 | Alexander Graf | #define BDRV_O_NO_FLUSH 0x0200 /* disable flushing on this disk */ |
52 | 9f7965c7 | aliguori | |
53 | ceb25e5c | Kevin Wolf | #define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH)
|
54 | faf07963 | pbrook | |
55 | 6ea44308 | Jan Kiszka | #define BDRV_SECTOR_BITS 9 |
56 | c63782cb | Jes Sorensen | #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) |
57 | 3abbc4d9 | Stefan Hajnoczi | #define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1) |
58 | 6ea44308 | Jan Kiszka | |
59 | 2582bfed | Luiz Capitulino | typedef enum { |
60 | abd7f68d | Markus Armbruster | BLOCK_ERR_REPORT, BLOCK_ERR_IGNORE, BLOCK_ERR_STOP_ENOSPC, |
61 | abd7f68d | Markus Armbruster | BLOCK_ERR_STOP_ANY |
62 | abd7f68d | Markus Armbruster | } BlockErrorAction; |
63 | abd7f68d | Markus Armbruster | |
64 | abd7f68d | Markus Armbruster | typedef enum { |
65 | 2582bfed | Luiz Capitulino | BDRV_ACTION_REPORT, BDRV_ACTION_IGNORE, BDRV_ACTION_STOP |
66 | 2582bfed | Luiz Capitulino | } BlockMonEventAction; |
67 | 2582bfed | Luiz Capitulino | |
68 | 2582bfed | Luiz Capitulino | void bdrv_mon_event(const BlockDriverState *bdrv, |
69 | 2582bfed | Luiz Capitulino | BlockMonEventAction action, int is_read);
|
70 | d15e5465 | Luiz Capitulino | void bdrv_info_print(Monitor *mon, const QObject *data); |
71 | d15e5465 | Luiz Capitulino | void bdrv_info(Monitor *mon, QObject **ret_data);
|
72 | 218a536a | Luiz Capitulino | void bdrv_stats_print(Monitor *mon, const QObject *data); |
73 | 218a536a | Luiz Capitulino | void bdrv_info_stats(Monitor *mon, QObject **ret_data);
|
74 | faf07963 | pbrook | |
75 | faf07963 | pbrook | void bdrv_init(void); |
76 | eb852011 | Markus Armbruster | void bdrv_init_with_whitelist(void); |
77 | b50cbabc | MORITA Kazutaka | BlockDriver *bdrv_find_protocol(const char *filename); |
78 | faf07963 | pbrook | BlockDriver *bdrv_find_format(const char *format_name); |
79 | eb852011 | Markus Armbruster | BlockDriver *bdrv_find_whitelisted_format(const char *format_name); |
80 | 0e7e1989 | Kevin Wolf | int bdrv_create(BlockDriver *drv, const char* filename, |
81 | 0e7e1989 | Kevin Wolf | QEMUOptionParameter *options); |
82 | 84a12e66 | Christoph Hellwig | int bdrv_create_file(const char* filename, QEMUOptionParameter *options); |
83 | faf07963 | pbrook | BlockDriverState *bdrv_new(const char *device_name); |
84 | d22b2f41 | Ryan Harper | void bdrv_make_anon(BlockDriverState *bs);
|
85 | faf07963 | pbrook | void bdrv_delete(BlockDriverState *bs);
|
86 | c3993cdc | Stefan Hajnoczi | int bdrv_parse_cache_flags(const char *mode, int *flags); |
87 | faf07963 | pbrook | int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags); |
88 | d6e9098e | Kevin Wolf | int bdrv_open(BlockDriverState *bs, const char *filename, int flags, |
89 | d6e9098e | Kevin Wolf | BlockDriver *drv); |
90 | faf07963 | pbrook | void bdrv_close(BlockDriverState *bs);
|
91 | fa879d62 | Markus Armbruster | int bdrv_attach_dev(BlockDriverState *bs, void *dev); |
92 | fa879d62 | Markus Armbruster | void bdrv_attach_dev_nofail(BlockDriverState *bs, void *dev); |
93 | fa879d62 | Markus Armbruster | void bdrv_detach_dev(BlockDriverState *bs, void *dev); |
94 | fa879d62 | Markus Armbruster | void *bdrv_get_attached_dev(BlockDriverState *bs);
|
95 | 0e49de52 | Markus Armbruster | void bdrv_set_dev_ops(BlockDriverState *bs, const BlockDevOps *ops, |
96 | 0e49de52 | Markus Armbruster | void *opaque);
|
97 | faf07963 | pbrook | int bdrv_read(BlockDriverState *bs, int64_t sector_num,
|
98 | faf07963 | pbrook | uint8_t *buf, int nb_sectors);
|
99 | faf07963 | pbrook | int bdrv_write(BlockDriverState *bs, int64_t sector_num,
|
100 | faf07963 | pbrook | const uint8_t *buf, int nb_sectors); |
101 | faf07963 | pbrook | int bdrv_pread(BlockDriverState *bs, int64_t offset,
|
102 | faf07963 | pbrook | void *buf, int count); |
103 | faf07963 | pbrook | int bdrv_pwrite(BlockDriverState *bs, int64_t offset,
|
104 | faf07963 | pbrook | const void *buf, int count); |
105 | f08145fe | Kevin Wolf | int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset,
|
106 | f08145fe | Kevin Wolf | const void *buf, int count); |
107 | da1fa91d | Kevin Wolf | int coroutine_fn bdrv_co_readv(BlockDriverState *bs, int64_t sector_num,
|
108 | da1fa91d | Kevin Wolf | int nb_sectors, QEMUIOVector *qiov);
|
109 | da1fa91d | Kevin Wolf | int coroutine_fn bdrv_co_writev(BlockDriverState *bs, int64_t sector_num,
|
110 | da1fa91d | Kevin Wolf | int nb_sectors, QEMUIOVector *qiov);
|
111 | faf07963 | pbrook | int bdrv_truncate(BlockDriverState *bs, int64_t offset);
|
112 | faf07963 | pbrook | int64_t bdrv_getlength(BlockDriverState *bs); |
113 | 4a1d5e1f | Fam Zheng | int64_t bdrv_get_allocated_file_size(BlockDriverState *bs); |
114 | 96b8f136 | ths | void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
|
115 | f3d54fc4 | aliguori | void bdrv_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int *psecs); |
116 | faf07963 | pbrook | int bdrv_commit(BlockDriverState *bs);
|
117 | 6ab4b5ab | Markus Armbruster | void bdrv_commit_all(void); |
118 | 756e6736 | Kevin Wolf | int bdrv_change_backing_file(BlockDriverState *bs,
|
119 | 756e6736 | Kevin Wolf | const char *backing_file, const char *backing_fmt); |
120 | 5efa9d5a | Anthony Liguori | void bdrv_register(BlockDriver *bdrv);
|
121 | 5efa9d5a | Anthony Liguori | |
122 | e076f338 | Kevin Wolf | |
123 | e076f338 | Kevin Wolf | typedef struct BdrvCheckResult { |
124 | e076f338 | Kevin Wolf | int corruptions;
|
125 | e076f338 | Kevin Wolf | int leaks;
|
126 | e076f338 | Kevin Wolf | int check_errors;
|
127 | e076f338 | Kevin Wolf | } BdrvCheckResult; |
128 | e076f338 | Kevin Wolf | |
129 | e076f338 | Kevin Wolf | int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res);
|
130 | e076f338 | Kevin Wolf | |
131 | faf07963 | pbrook | /* async block I/O */
|
132 | faf07963 | pbrook | typedef struct BlockDriverAIOCB BlockDriverAIOCB; |
133 | faf07963 | pbrook | typedef void BlockDriverCompletionFunc(void *opaque, int ret); |
134 | 7cd1e32a | lirans@il.ibm.com | typedef void BlockDriverDirtyHandler(BlockDriverState *bs, int64_t sector, |
135 | 39aa9a12 | Devin Nakamura | int sector_num);
|
136 | 3b69e4b9 | aliguori | BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, |
137 | 3b69e4b9 | aliguori | QEMUIOVector *iov, int nb_sectors,
|
138 | 3b69e4b9 | aliguori | BlockDriverCompletionFunc *cb, void *opaque);
|
139 | 3b69e4b9 | aliguori | BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, |
140 | 3b69e4b9 | aliguori | QEMUIOVector *iov, int nb_sectors,
|
141 | 3b69e4b9 | aliguori | BlockDriverCompletionFunc *cb, void *opaque);
|
142 | b2e12bc6 | Christoph Hellwig | BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, |
143 | 39aa9a12 | Devin Nakamura | BlockDriverCompletionFunc *cb, void *opaque);
|
144 | faf07963 | pbrook | void bdrv_aio_cancel(BlockDriverAIOCB *acb);
|
145 | faf07963 | pbrook | |
146 | 40b4f539 | Kevin Wolf | typedef struct BlockRequest { |
147 | 40b4f539 | Kevin Wolf | /* Fields to be filled by multiwrite caller */
|
148 | 40b4f539 | Kevin Wolf | int64_t sector; |
149 | 40b4f539 | Kevin Wolf | int nb_sectors;
|
150 | 40b4f539 | Kevin Wolf | QEMUIOVector *qiov; |
151 | 40b4f539 | Kevin Wolf | BlockDriverCompletionFunc *cb; |
152 | 40b4f539 | Kevin Wolf | void *opaque;
|
153 | 40b4f539 | Kevin Wolf | |
154 | 40b4f539 | Kevin Wolf | /* Filled by multiwrite implementation */
|
155 | 40b4f539 | Kevin Wolf | int error;
|
156 | 40b4f539 | Kevin Wolf | } BlockRequest; |
157 | 40b4f539 | Kevin Wolf | |
158 | 40b4f539 | Kevin Wolf | int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs,
|
159 | 40b4f539 | Kevin Wolf | int num_reqs);
|
160 | 40b4f539 | Kevin Wolf | |
161 | 7d780669 | aliguori | /* sg packet commands */
|
162 | 221f715d | aliguori | int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf); |
163 | 221f715d | aliguori | BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, |
164 | 221f715d | aliguori | unsigned long int req, void *buf, |
165 | 221f715d | aliguori | BlockDriverCompletionFunc *cb, void *opaque);
|
166 | 7d780669 | aliguori | |
167 | faf07963 | pbrook | /* Ensure contents are flushed to disk. */
|
168 | 205ef796 | Kevin Wolf | int bdrv_flush(BlockDriverState *bs);
|
169 | c6ca28d6 | aliguori | void bdrv_flush_all(void); |
170 | 2bc93fed | MORITA Kazutaka | void bdrv_close_all(void); |
171 | c6ca28d6 | aliguori | |
172 | bb8bf76f | Christoph Hellwig | int bdrv_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors); |
173 | f2feebbd | Kevin Wolf | int bdrv_has_zero_init(BlockDriverState *bs);
|
174 | f58c7b35 | ths | int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, |
175 | 39aa9a12 | Devin Nakamura | int *pnum);
|
176 | faf07963 | pbrook | |
177 | faf07963 | pbrook | #define BIOS_ATA_TRANSLATION_AUTO 0 |
178 | faf07963 | pbrook | #define BIOS_ATA_TRANSLATION_NONE 1 |
179 | faf07963 | pbrook | #define BIOS_ATA_TRANSLATION_LBA 2 |
180 | faf07963 | pbrook | #define BIOS_ATA_TRANSLATION_LARGE 3 |
181 | faf07963 | pbrook | #define BIOS_ATA_TRANSLATION_RECHS 4 |
182 | faf07963 | pbrook | |
183 | faf07963 | pbrook | void bdrv_set_geometry_hint(BlockDriverState *bs,
|
184 | faf07963 | pbrook | int cyls, int heads, int secs); |
185 | faf07963 | pbrook | void bdrv_set_translation_hint(BlockDriverState *bs, int translation); |
186 | faf07963 | pbrook | void bdrv_get_geometry_hint(BlockDriverState *bs,
|
187 | faf07963 | pbrook | int *pcyls, int *pheads, int *psecs); |
188 | 5bbdbb46 | Blue Swirl | typedef enum FDriveType { |
189 | 5bbdbb46 | Blue Swirl | FDRIVE_DRV_144 = 0x00, /* 1.44 MB 3"5 drive */ |
190 | 5bbdbb46 | Blue Swirl | FDRIVE_DRV_288 = 0x01, /* 2.88 MB 3"5 drive */ |
191 | 5bbdbb46 | Blue Swirl | FDRIVE_DRV_120 = 0x02, /* 1.2 MB 5"25 drive */ |
192 | 5bbdbb46 | Blue Swirl | FDRIVE_DRV_NONE = 0x03, /* No drive connected */ |
193 | 5bbdbb46 | Blue Swirl | } FDriveType; |
194 | 5bbdbb46 | Blue Swirl | |
195 | 5bbdbb46 | Blue Swirl | void bdrv_get_floppy_geometry_hint(BlockDriverState *bs, int *nb_heads, |
196 | 5bbdbb46 | Blue Swirl | int *max_track, int *last_sect, |
197 | 5bbdbb46 | Blue Swirl | FDriveType drive_in, FDriveType *drive); |
198 | faf07963 | pbrook | int bdrv_get_translation_hint(BlockDriverState *bs);
|
199 | abd7f68d | Markus Armbruster | void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error,
|
200 | abd7f68d | Markus Armbruster | BlockErrorAction on_write_error); |
201 | abd7f68d | Markus Armbruster | BlockErrorAction bdrv_get_on_error(BlockDriverState *bs, int is_read);
|
202 | 7d0d6950 | Markus Armbruster | void bdrv_set_removable(BlockDriverState *bs, int removable); |
203 | faf07963 | pbrook | int bdrv_is_removable(BlockDriverState *bs);
|
204 | faf07963 | pbrook | int bdrv_is_read_only(BlockDriverState *bs);
|
205 | 985a03b0 | ths | int bdrv_is_sg(BlockDriverState *bs);
|
206 | e900a7b7 | Christoph Hellwig | int bdrv_enable_write_cache(BlockDriverState *bs);
|
207 | faf07963 | pbrook | int bdrv_is_inserted(BlockDriverState *bs);
|
208 | faf07963 | pbrook | int bdrv_media_changed(BlockDriverState *bs);
|
209 | faf07963 | pbrook | int bdrv_is_locked(BlockDriverState *bs);
|
210 | faf07963 | pbrook | void bdrv_set_locked(BlockDriverState *bs, int locked); |
211 | aea2a33c | Mark McLoughlin | int bdrv_eject(BlockDriverState *bs, int eject_flag); |
212 | faf07963 | pbrook | void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size); |
213 | faf07963 | pbrook | BlockDriverState *bdrv_find(const char *name); |
214 | 2f399b0a | Markus Armbruster | BlockDriverState *bdrv_next(BlockDriverState *bs); |
215 | 51de9760 | aliguori | void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), |
216 | 51de9760 | aliguori | void *opaque);
|
217 | faf07963 | pbrook | int bdrv_is_encrypted(BlockDriverState *bs);
|
218 | c0f4ce77 | aliguori | int bdrv_key_required(BlockDriverState *bs);
|
219 | faf07963 | pbrook | int bdrv_set_key(BlockDriverState *bs, const char *key); |
220 | c0f4ce77 | aliguori | int bdrv_query_missing_keys(void); |
221 | faf07963 | pbrook | void bdrv_iterate_format(void (*it)(void *opaque, const char *name), |
222 | faf07963 | pbrook | void *opaque);
|
223 | faf07963 | pbrook | const char *bdrv_get_device_name(BlockDriverState *bs); |
224 | faf07963 | pbrook | int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
|
225 | faf07963 | pbrook | const uint8_t *buf, int nb_sectors); |
226 | faf07963 | pbrook | int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
|
227 | faf07963 | pbrook | |
228 | 045df330 | aliguori | const char *bdrv_get_encrypted_filename(BlockDriverState *bs); |
229 | faf07963 | pbrook | void bdrv_get_backing_filename(BlockDriverState *bs,
|
230 | faf07963 | pbrook | char *filename, int filename_size); |
231 | feeee5ac | Miguel Di Ciurcio Filho | int bdrv_can_snapshot(BlockDriverState *bs);
|
232 | 199630b6 | Blue Swirl | int bdrv_is_snapshot(BlockDriverState *bs);
|
233 | f9092b10 | Markus Armbruster | BlockDriverState *bdrv_snapshots(void);
|
234 | faf07963 | pbrook | int bdrv_snapshot_create(BlockDriverState *bs,
|
235 | faf07963 | pbrook | QEMUSnapshotInfo *sn_info); |
236 | faf07963 | pbrook | int bdrv_snapshot_goto(BlockDriverState *bs,
|
237 | faf07963 | pbrook | const char *snapshot_id); |
238 | faf07963 | pbrook | int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id); |
239 | faf07963 | pbrook | int bdrv_snapshot_list(BlockDriverState *bs,
|
240 | faf07963 | pbrook | QEMUSnapshotInfo **psn_info); |
241 | 51ef6727 | edison | int bdrv_snapshot_load_tmp(BlockDriverState *bs,
|
242 | 51ef6727 | edison | const char *snapshot_name); |
243 | faf07963 | pbrook | char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn); |
244 | faf07963 | pbrook | |
245 | faf07963 | pbrook | char *get_human_readable_size(char *buf, int buf_size, int64_t size); |
246 | faf07963 | pbrook | int path_is_absolute(const char *path); |
247 | faf07963 | pbrook | void path_combine(char *dest, int dest_size, |
248 | faf07963 | pbrook | const char *base_path, |
249 | faf07963 | pbrook | const char *filename); |
250 | faf07963 | pbrook | |
251 | 45566e9c | Christoph Hellwig | int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf, |
252 | 45566e9c | Christoph Hellwig | int64_t pos, int size);
|
253 | 178e08a5 | aliguori | |
254 | 45566e9c | Christoph Hellwig | int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
|
255 | 45566e9c | Christoph Hellwig | int64_t pos, int size);
|
256 | 178e08a5 | aliguori | |
257 | f88e1a42 | Jes Sorensen | int bdrv_img_create(const char *filename, const char *fmt, |
258 | f88e1a42 | Jes Sorensen | const char *base_filename, const char *base_fmt, |
259 | f88e1a42 | Jes Sorensen | char *options, uint64_t img_size, int flags); |
260 | f88e1a42 | Jes Sorensen | |
261 | ba5b7ad4 | Markus Armbruster | void *qemu_blockalign(BlockDriverState *bs, size_t size);
|
262 | ba5b7ad4 | Markus Armbruster | |
263 | 23bd90d2 | Jan Kiszka | #define BDRV_SECTORS_PER_DIRTY_CHUNK 2048 |
264 | 6ea44308 | Jan Kiszka | |
265 | 7cd1e32a | lirans@il.ibm.com | void bdrv_set_dirty_tracking(BlockDriverState *bs, int enable); |
266 | 7cd1e32a | lirans@il.ibm.com | int bdrv_get_dirty(BlockDriverState *bs, int64_t sector);
|
267 | a55eb92c | Jan Kiszka | void bdrv_reset_dirty(BlockDriverState *bs, int64_t cur_sector,
|
268 | a55eb92c | Jan Kiszka | int nr_sectors);
|
269 | aaa0eb75 | Liran Schour | int64_t bdrv_get_dirty_count(BlockDriverState *bs); |
270 | 8b9b0cc2 | Kevin Wolf | |
271 | db593f25 | Marcelo Tosatti | void bdrv_set_in_use(BlockDriverState *bs, int in_use); |
272 | db593f25 | Marcelo Tosatti | int bdrv_in_use(BlockDriverState *bs);
|
273 | 8b9b0cc2 | Kevin Wolf | |
274 | a597e79c | Christoph Hellwig | enum BlockAcctType {
|
275 | a597e79c | Christoph Hellwig | BDRV_ACCT_READ, |
276 | a597e79c | Christoph Hellwig | BDRV_ACCT_WRITE, |
277 | a597e79c | Christoph Hellwig | BDRV_ACCT_FLUSH, |
278 | a597e79c | Christoph Hellwig | BDRV_MAX_IOTYPE, |
279 | a597e79c | Christoph Hellwig | }; |
280 | a597e79c | Christoph Hellwig | |
281 | a597e79c | Christoph Hellwig | typedef struct BlockAcctCookie { |
282 | a597e79c | Christoph Hellwig | int64_t bytes; |
283 | c488c7f6 | Christoph Hellwig | int64_t start_time_ns; |
284 | a597e79c | Christoph Hellwig | enum BlockAcctType type;
|
285 | a597e79c | Christoph Hellwig | } BlockAcctCookie; |
286 | a597e79c | Christoph Hellwig | |
287 | a597e79c | Christoph Hellwig | void bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie,
|
288 | a597e79c | Christoph Hellwig | int64_t bytes, enum BlockAcctType type);
|
289 | a597e79c | Christoph Hellwig | void bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie);
|
290 | a597e79c | Christoph Hellwig | |
291 | 8b9b0cc2 | Kevin Wolf | typedef enum { |
292 | 8252278a | Kevin Wolf | BLKDBG_L1_UPDATE, |
293 | 8252278a | Kevin Wolf | |
294 | 8252278a | Kevin Wolf | BLKDBG_L1_GROW_ALLOC_TABLE, |
295 | 8252278a | Kevin Wolf | BLKDBG_L1_GROW_WRITE_TABLE, |
296 | 8252278a | Kevin Wolf | BLKDBG_L1_GROW_ACTIVATE_TABLE, |
297 | 8252278a | Kevin Wolf | |
298 | 8252278a | Kevin Wolf | BLKDBG_L2_LOAD, |
299 | 8252278a | Kevin Wolf | BLKDBG_L2_UPDATE, |
300 | 8252278a | Kevin Wolf | BLKDBG_L2_UPDATE_COMPRESSED, |
301 | 8252278a | Kevin Wolf | BLKDBG_L2_ALLOC_COW_READ, |
302 | 8252278a | Kevin Wolf | BLKDBG_L2_ALLOC_WRITE, |
303 | 8252278a | Kevin Wolf | |
304 | 8252278a | Kevin Wolf | BLKDBG_READ, |
305 | 8252278a | Kevin Wolf | BLKDBG_READ_AIO, |
306 | 8252278a | Kevin Wolf | BLKDBG_READ_BACKING, |
307 | 8252278a | Kevin Wolf | BLKDBG_READ_BACKING_AIO, |
308 | 8252278a | Kevin Wolf | BLKDBG_READ_COMPRESSED, |
309 | 8252278a | Kevin Wolf | |
310 | 8252278a | Kevin Wolf | BLKDBG_WRITE_AIO, |
311 | 8252278a | Kevin Wolf | BLKDBG_WRITE_COMPRESSED, |
312 | 8252278a | Kevin Wolf | |
313 | 8252278a | Kevin Wolf | BLKDBG_VMSTATE_LOAD, |
314 | 8252278a | Kevin Wolf | BLKDBG_VMSTATE_SAVE, |
315 | 8252278a | Kevin Wolf | |
316 | 8252278a | Kevin Wolf | BLKDBG_COW_READ, |
317 | 8252278a | Kevin Wolf | BLKDBG_COW_WRITE, |
318 | 8252278a | Kevin Wolf | |
319 | 8252278a | Kevin Wolf | BLKDBG_REFTABLE_LOAD, |
320 | 8252278a | Kevin Wolf | BLKDBG_REFTABLE_GROW, |
321 | 8252278a | Kevin Wolf | |
322 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_LOAD, |
323 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_UPDATE, |
324 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_UPDATE_PART, |
325 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_ALLOC, |
326 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_ALLOC_HOOKUP, |
327 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_ALLOC_WRITE, |
328 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_ALLOC_WRITE_BLOCKS, |
329 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_ALLOC_WRITE_TABLE, |
330 | 8252278a | Kevin Wolf | BLKDBG_REFBLOCK_ALLOC_SWITCH_TABLE, |
331 | 8252278a | Kevin Wolf | |
332 | 8252278a | Kevin Wolf | BLKDBG_CLUSTER_ALLOC, |
333 | 8252278a | Kevin Wolf | BLKDBG_CLUSTER_ALLOC_BYTES, |
334 | 8252278a | Kevin Wolf | BLKDBG_CLUSTER_FREE, |
335 | 8252278a | Kevin Wolf | |
336 | 8b9b0cc2 | Kevin Wolf | BLKDBG_EVENT_MAX, |
337 | 8b9b0cc2 | Kevin Wolf | } BlkDebugEvent; |
338 | 8b9b0cc2 | Kevin Wolf | |
339 | 8b9b0cc2 | Kevin Wolf | #define BLKDBG_EVENT(bs, evt) bdrv_debug_event(bs, evt)
|
340 | 8b9b0cc2 | Kevin Wolf | void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event);
|
341 | 8b9b0cc2 | Kevin Wolf | |
342 | faf07963 | pbrook | #endif
|