Statistics
| Branch: | Revision:

root / block_int.h @ 371c6489

History | View | Annotate | Download (12.2 kB)

1 ea2384d3 bellard
/*
2 ea2384d3 bellard
 * QEMU System Emulator block driver
3 5fafdf24 ths
 *
4 ea2384d3 bellard
 * Copyright (c) 2003 Fabrice Bellard
5 5fafdf24 ths
 *
6 ea2384d3 bellard
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 ea2384d3 bellard
 * of this software and associated documentation files (the "Software"), to deal
8 ea2384d3 bellard
 * in the Software without restriction, including without limitation the rights
9 ea2384d3 bellard
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 ea2384d3 bellard
 * copies of the Software, and to permit persons to whom the Software is
11 ea2384d3 bellard
 * furnished to do so, subject to the following conditions:
12 ea2384d3 bellard
 *
13 ea2384d3 bellard
 * The above copyright notice and this permission notice shall be included in
14 ea2384d3 bellard
 * all copies or substantial portions of the Software.
15 ea2384d3 bellard
 *
16 ea2384d3 bellard
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 ea2384d3 bellard
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 ea2384d3 bellard
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 ea2384d3 bellard
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 ea2384d3 bellard
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 ea2384d3 bellard
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 ea2384d3 bellard
 * THE SOFTWARE.
23 ea2384d3 bellard
 */
24 ea2384d3 bellard
#ifndef BLOCK_INT_H
25 ea2384d3 bellard
#define BLOCK_INT_H
26 ea2384d3 bellard
27 faf07963 pbrook
#include "block.h"
28 0e7e1989 Kevin Wolf
#include "qemu-option.h"
29 1b7bdbc1 Stefan Hajnoczi
#include "qemu-queue.h"
30 da1fa91d Kevin Wolf
#include "qemu-coroutine.h"
31 c488c7f6 Christoph Hellwig
#include "qemu-timer.h"
32 b2023818 Luiz Capitulino
#include "qapi-types.h"
33 faf07963 pbrook
34 ec36ba14 ths
#define BLOCK_FLAG_ENCRYPT        1
35 ec36ba14 ths
#define BLOCK_FLAG_COMPAT6        4
36 ec36ba14 ths
37 0563e191 Zhi Yong Wu
#define BLOCK_IO_LIMIT_READ     0
38 0563e191 Zhi Yong Wu
#define BLOCK_IO_LIMIT_WRITE    1
39 0563e191 Zhi Yong Wu
#define BLOCK_IO_LIMIT_TOTAL    2
40 0563e191 Zhi Yong Wu
41 0563e191 Zhi Yong Wu
#define BLOCK_IO_SLICE_TIME     100000000
42 98f90dba Zhi Yong Wu
#define NANOSECONDS_PER_SECOND  1000000000.0
43 0563e191 Zhi Yong Wu
44 0e7e1989 Kevin Wolf
#define BLOCK_OPT_SIZE          "size"
45 0e7e1989 Kevin Wolf
#define BLOCK_OPT_ENCRYPT       "encryption"
46 0e7e1989 Kevin Wolf
#define BLOCK_OPT_COMPAT6       "compat6"
47 0e7e1989 Kevin Wolf
#define BLOCK_OPT_BACKING_FILE  "backing_file"
48 0e7e1989 Kevin Wolf
#define BLOCK_OPT_BACKING_FMT   "backing_fmt"
49 73c632ed Kevin Wolf
#define BLOCK_OPT_CLUSTER_SIZE  "cluster_size"
50 75411d23 Stefan Hajnoczi
#define BLOCK_OPT_TABLE_SIZE    "table_size"
51 a35e1c17 Kevin Wolf
#define BLOCK_OPT_PREALLOC      "preallocation"
52 f66fd6c3 Fam Zheng
#define BLOCK_OPT_SUBFMT        "subformat"
53 0e7e1989 Kevin Wolf
54 dbffbdcf Stefan Hajnoczi
typedef struct BdrvTrackedRequest BdrvTrackedRequest;
55 dbffbdcf Stefan Hajnoczi
56 6bbff9a0 aliguori
typedef struct AIOPool {
57 6bbff9a0 aliguori
    void (*cancel)(BlockDriverAIOCB *acb);
58 6bbff9a0 aliguori
    int aiocb_size;
59 6bbff9a0 aliguori
    BlockDriverAIOCB *free_aiocb;
60 6bbff9a0 aliguori
} AIOPool;
61 6bbff9a0 aliguori
62 0563e191 Zhi Yong Wu
typedef struct BlockIOLimit {
63 0563e191 Zhi Yong Wu
    int64_t bps[3];
64 0563e191 Zhi Yong Wu
    int64_t iops[3];
65 0563e191 Zhi Yong Wu
} BlockIOLimit;
66 0563e191 Zhi Yong Wu
67 0563e191 Zhi Yong Wu
typedef struct BlockIOBaseValue {
68 0563e191 Zhi Yong Wu
    uint64_t bytes[2];
69 0563e191 Zhi Yong Wu
    uint64_t ios[2];
70 0563e191 Zhi Yong Wu
} BlockIOBaseValue;
71 0563e191 Zhi Yong Wu
72 eeec61f2 Stefan Hajnoczi
typedef void BlockJobCancelFunc(void *opaque);
73 eeec61f2 Stefan Hajnoczi
typedef struct BlockJob BlockJob;
74 eeec61f2 Stefan Hajnoczi
typedef struct BlockJobType {
75 eeec61f2 Stefan Hajnoczi
    /** Derived BlockJob struct size */
76 eeec61f2 Stefan Hajnoczi
    size_t instance_size;
77 eeec61f2 Stefan Hajnoczi
78 eeec61f2 Stefan Hajnoczi
    /** String describing the operation, part of query-block-jobs QMP API */
79 eeec61f2 Stefan Hajnoczi
    const char *job_type;
80 eeec61f2 Stefan Hajnoczi
81 eeec61f2 Stefan Hajnoczi
    /** Optional callback for job types that support setting a speed limit */
82 eeec61f2 Stefan Hajnoczi
    int (*set_speed)(BlockJob *job, int64_t value);
83 eeec61f2 Stefan Hajnoczi
} BlockJobType;
84 eeec61f2 Stefan Hajnoczi
85 eeec61f2 Stefan Hajnoczi
/**
86 eeec61f2 Stefan Hajnoczi
 * Long-running operation on a BlockDriverState
87 eeec61f2 Stefan Hajnoczi
 */
88 eeec61f2 Stefan Hajnoczi
struct BlockJob {
89 eeec61f2 Stefan Hajnoczi
    const BlockJobType *job_type;
90 eeec61f2 Stefan Hajnoczi
    BlockDriverState *bs;
91 eeec61f2 Stefan Hajnoczi
    bool cancelled;
92 eeec61f2 Stefan Hajnoczi
93 eeec61f2 Stefan Hajnoczi
    /* These fields are published by the query-block-jobs QMP API */
94 eeec61f2 Stefan Hajnoczi
    int64_t offset;
95 eeec61f2 Stefan Hajnoczi
    int64_t len;
96 eeec61f2 Stefan Hajnoczi
    int64_t speed;
97 eeec61f2 Stefan Hajnoczi
98 eeec61f2 Stefan Hajnoczi
    BlockDriverCompletionFunc *cb;
99 eeec61f2 Stefan Hajnoczi
    void *opaque;
100 eeec61f2 Stefan Hajnoczi
};
101 eeec61f2 Stefan Hajnoczi
102 ea2384d3 bellard
struct BlockDriver {
103 ea2384d3 bellard
    const char *format_name;
104 ea2384d3 bellard
    int instance_size;
105 ea2384d3 bellard
    int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename);
106 508c7cb3 Christoph Hellwig
    int (*bdrv_probe_device)(const char *filename);
107 66f82cee Kevin Wolf
    int (*bdrv_open)(BlockDriverState *bs, int flags);
108 66f82cee Kevin Wolf
    int (*bdrv_file_open)(BlockDriverState *bs, const char *filename, int flags);
109 5fafdf24 ths
    int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
110 ea2384d3 bellard
                     uint8_t *buf, int nb_sectors);
111 5fafdf24 ths
    int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num,
112 ea2384d3 bellard
                      const uint8_t *buf, int nb_sectors);
113 e2731add bellard
    void (*bdrv_close)(BlockDriverState *bs);
114 0e7e1989 Kevin Wolf
    int (*bdrv_create)(const char *filename, QEMUOptionParameter *options);
115 ea2384d3 bellard
    int (*bdrv_set_key)(BlockDriverState *bs, const char *key);
116 95389c86 bellard
    int (*bdrv_make_empty)(BlockDriverState *bs);
117 83f64091 bellard
    /* aio */
118 f141eafe aliguori
    BlockDriverAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs,
119 f141eafe aliguori
        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
120 ce1a14dc pbrook
        BlockDriverCompletionFunc *cb, void *opaque);
121 f141eafe aliguori
    BlockDriverAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs,
122 f141eafe aliguori
        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
123 ce1a14dc pbrook
        BlockDriverCompletionFunc *cb, void *opaque);
124 b2e12bc6 Christoph Hellwig
    BlockDriverAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs,
125 b2e12bc6 Christoph Hellwig
        BlockDriverCompletionFunc *cb, void *opaque);
126 4265d620 Paolo Bonzini
    BlockDriverAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs,
127 4265d620 Paolo Bonzini
        int64_t sector_num, int nb_sectors,
128 4265d620 Paolo Bonzini
        BlockDriverCompletionFunc *cb, void *opaque);
129 83f64091 bellard
130 da1fa91d Kevin Wolf
    int coroutine_fn (*bdrv_co_readv)(BlockDriverState *bs,
131 da1fa91d Kevin Wolf
        int64_t sector_num, int nb_sectors, QEMUIOVector *qiov);
132 da1fa91d Kevin Wolf
    int coroutine_fn (*bdrv_co_writev)(BlockDriverState *bs,
133 da1fa91d Kevin Wolf
        int64_t sector_num, int nb_sectors, QEMUIOVector *qiov);
134 f08f2dda Stefan Hajnoczi
    /*
135 f08f2dda Stefan Hajnoczi
     * Efficiently zero a region of the disk image.  Typically an image format
136 f08f2dda Stefan Hajnoczi
     * would use a compact metadata representation to implement this.  This
137 f08f2dda Stefan Hajnoczi
     * function pointer may be NULL and .bdrv_co_writev() will be called
138 f08f2dda Stefan Hajnoczi
     * instead.
139 f08f2dda Stefan Hajnoczi
     */
140 f08f2dda Stefan Hajnoczi
    int coroutine_fn (*bdrv_co_write_zeroes)(BlockDriverState *bs,
141 f08f2dda Stefan Hajnoczi
        int64_t sector_num, int nb_sectors);
142 4265d620 Paolo Bonzini
    int coroutine_fn (*bdrv_co_discard)(BlockDriverState *bs,
143 4265d620 Paolo Bonzini
        int64_t sector_num, int nb_sectors);
144 376ae3f1 Stefan Hajnoczi
    int coroutine_fn (*bdrv_co_is_allocated)(BlockDriverState *bs,
145 376ae3f1 Stefan Hajnoczi
        int64_t sector_num, int nb_sectors, int *pnum);
146 da1fa91d Kevin Wolf
147 c68b89ac Kevin Wolf
    /*
148 0f15423c Anthony Liguori
     * Invalidate any cached meta-data.
149 0f15423c Anthony Liguori
     */
150 0f15423c Anthony Liguori
    void (*bdrv_invalidate_cache)(BlockDriverState *bs);
151 0f15423c Anthony Liguori
152 0f15423c Anthony Liguori
    /*
153 c68b89ac Kevin Wolf
     * Flushes all data that was already written to the OS all the way down to
154 c68b89ac Kevin Wolf
     * the disk (for example raw-posix calls fsync()).
155 c68b89ac Kevin Wolf
     */
156 c68b89ac Kevin Wolf
    int coroutine_fn (*bdrv_co_flush_to_disk)(BlockDriverState *bs);
157 c68b89ac Kevin Wolf
158 eb489bb1 Kevin Wolf
    /*
159 eb489bb1 Kevin Wolf
     * Flushes all internal caches to the OS. The data may still sit in a
160 eb489bb1 Kevin Wolf
     * writeback cache of the host OS, but it will survive a crash of the qemu
161 eb489bb1 Kevin Wolf
     * process.
162 eb489bb1 Kevin Wolf
     */
163 eb489bb1 Kevin Wolf
    int coroutine_fn (*bdrv_co_flush_to_os)(BlockDriverState *bs);
164 eb489bb1 Kevin Wolf
165 83f64091 bellard
    const char *protocol_name;
166 83f64091 bellard
    int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset);
167 83f64091 bellard
    int64_t (*bdrv_getlength)(BlockDriverState *bs);
168 4a1d5e1f Fam Zheng
    int64_t (*bdrv_get_allocated_file_size)(BlockDriverState *bs);
169 5fafdf24 ths
    int (*bdrv_write_compressed)(BlockDriverState *bs, int64_t sector_num,
170 faea38e7 bellard
                                 const uint8_t *buf, int nb_sectors);
171 faea38e7 bellard
172 5fafdf24 ths
    int (*bdrv_snapshot_create)(BlockDriverState *bs,
173 faea38e7 bellard
                                QEMUSnapshotInfo *sn_info);
174 5fafdf24 ths
    int (*bdrv_snapshot_goto)(BlockDriverState *bs,
175 faea38e7 bellard
                              const char *snapshot_id);
176 faea38e7 bellard
    int (*bdrv_snapshot_delete)(BlockDriverState *bs, const char *snapshot_id);
177 5fafdf24 ths
    int (*bdrv_snapshot_list)(BlockDriverState *bs,
178 faea38e7 bellard
                              QEMUSnapshotInfo **psn_info);
179 51ef6727 edison
    int (*bdrv_snapshot_load_tmp)(BlockDriverState *bs,
180 51ef6727 edison
                                  const char *snapshot_name);
181 faea38e7 bellard
    int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi);
182 83f64091 bellard
183 45566e9c Christoph Hellwig
    int (*bdrv_save_vmstate)(BlockDriverState *bs, const uint8_t *buf,
184 45566e9c Christoph Hellwig
                             int64_t pos, int size);
185 45566e9c Christoph Hellwig
    int (*bdrv_load_vmstate)(BlockDriverState *bs, uint8_t *buf,
186 45566e9c Christoph Hellwig
                             int64_t pos, int size);
187 178e08a5 aliguori
188 756e6736 Kevin Wolf
    int (*bdrv_change_backing_file)(BlockDriverState *bs,
189 756e6736 Kevin Wolf
        const char *backing_file, const char *backing_fmt);
190 756e6736 Kevin Wolf
191 19cb3738 bellard
    /* removable device specific */
192 19cb3738 bellard
    int (*bdrv_is_inserted)(BlockDriverState *bs);
193 19cb3738 bellard
    int (*bdrv_media_changed)(BlockDriverState *bs);
194 f36f3949 Luiz Capitulino
    void (*bdrv_eject)(BlockDriverState *bs, bool eject_flag);
195 025e849a Markus Armbruster
    void (*bdrv_lock_medium)(BlockDriverState *bs, bool locked);
196 3b46e624 ths
197 985a03b0 ths
    /* to control generic scsi devices */
198 985a03b0 ths
    int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf);
199 221f715d aliguori
    BlockDriverAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs,
200 221f715d aliguori
        unsigned long int req, void *buf,
201 221f715d aliguori
        BlockDriverCompletionFunc *cb, void *opaque);
202 985a03b0 ths
203 0e7e1989 Kevin Wolf
    /* List of options for creating images, terminated by name == NULL */
204 0e7e1989 Kevin Wolf
    QEMUOptionParameter *create_options;
205 0e7e1989 Kevin Wolf
206 5eb45639 aliguori
207 9ac228e0 Kevin Wolf
    /*
208 9ac228e0 Kevin Wolf
     * Returns 0 for completed check, -errno for internal errors.
209 9ac228e0 Kevin Wolf
     * The check results are stored in result.
210 9ac228e0 Kevin Wolf
     */
211 9ac228e0 Kevin Wolf
    int (*bdrv_check)(BlockDriverState* bs, BdrvCheckResult *result);
212 e97fc193 aliguori
213 8b9b0cc2 Kevin Wolf
    void (*bdrv_debug_event)(BlockDriverState *bs, BlkDebugEvent event);
214 8b9b0cc2 Kevin Wolf
215 336c1c12 Kevin Wolf
    /*
216 336c1c12 Kevin Wolf
     * Returns 1 if newly created images are guaranteed to contain only
217 336c1c12 Kevin Wolf
     * zeros, 0 otherwise.
218 336c1c12 Kevin Wolf
     */
219 336c1c12 Kevin Wolf
    int (*bdrv_has_zero_init)(BlockDriverState *bs);
220 12c09b8c Kevin Wolf
221 8a22f02a Stefan Hajnoczi
    QLIST_ENTRY(BlockDriver) list;
222 ea2384d3 bellard
};
223 ea2384d3 bellard
224 8802d1fd Jeff Cody
/*
225 8802d1fd Jeff Cody
 * Note: the function bdrv_append() copies and swaps contents of
226 8802d1fd Jeff Cody
 * BlockDriverStates, so if you add new fields to this struct, please
227 8802d1fd Jeff Cody
 * inspect bdrv_append() to determine if the new fields need to be
228 8802d1fd Jeff Cody
 * copied as well.
229 8802d1fd Jeff Cody
 */
230 ea2384d3 bellard
struct BlockDriverState {
231 d15a771d bellard
    int64_t total_sectors; /* if we are reading a disk image, give its
232 d15a771d bellard
                              size in sectors */
233 ea2384d3 bellard
    int read_only; /* if true, the media is read only */
234 4dca4b63 Naphtali Sprei
    int keep_read_only; /* if true, the media was requested to stay read only */
235 4dca4b63 Naphtali Sprei
    int open_flags; /* flags used to open the file, re-used for re-open */
236 ea2384d3 bellard
    int encrypted; /* if true, the media is encrypted */
237 c0f4ce77 aliguori
    int valid_key; /* if true, a valid encryption key has been set */
238 985a03b0 ths
    int sg;        /* if true, the device is a /dev/sg* */
239 53fec9d3 Stefan Hajnoczi
    int copy_on_read; /* if true, copy read backing sectors into image
240 53fec9d3 Stefan Hajnoczi
                         note this is a reference count */
241 ea2384d3 bellard
242 19cb3738 bellard
    BlockDriver *drv; /* NULL means no media */
243 ea2384d3 bellard
    void *opaque;
244 ea2384d3 bellard
245 fa879d62 Markus Armbruster
    void *dev;                  /* attached device model, if any */
246 fa879d62 Markus Armbruster
    /* TODO change to DeviceState when all users are qdevified */
247 0e49de52 Markus Armbruster
    const BlockDevOps *dev_ops;
248 0e49de52 Markus Armbruster
    void *dev_opaque;
249 18846dee Markus Armbruster
250 ea2384d3 bellard
    char filename[1024];
251 ea2384d3 bellard
    char backing_file[1024]; /* if non zero, the image is a diff of
252 ea2384d3 bellard
                                this file image */
253 5eb45639 aliguori
    char backing_format[16]; /* if non-zero and backing_file exists */
254 ea2384d3 bellard
    int is_temporary;
255 19cb3738 bellard
256 ea2384d3 bellard
    BlockDriverState *backing_hd;
257 66f82cee Kevin Wolf
    BlockDriverState *file;
258 66f82cee Kevin Wolf
259 470c0504 Stefan Hajnoczi
    /* number of in-flight copy-on-read requests */
260 470c0504 Stefan Hajnoczi
    unsigned int copy_on_read_in_flight;
261 470c0504 Stefan Hajnoczi
262 0563e191 Zhi Yong Wu
    /* the time for latest disk I/O */
263 0563e191 Zhi Yong Wu
    int64_t slice_time;
264 0563e191 Zhi Yong Wu
    int64_t slice_start;
265 0563e191 Zhi Yong Wu
    int64_t slice_end;
266 0563e191 Zhi Yong Wu
    BlockIOLimit io_limits;
267 0563e191 Zhi Yong Wu
    BlockIOBaseValue  io_base;
268 0563e191 Zhi Yong Wu
    CoQueue      throttled_reqs;
269 0563e191 Zhi Yong Wu
    QEMUTimer    *block_timer;
270 0563e191 Zhi Yong Wu
    bool         io_limits_enabled;
271 0563e191 Zhi Yong Wu
272 a36e69dd ths
    /* I/O stats (display with "info blockstats"). */
273 a597e79c Christoph Hellwig
    uint64_t nr_bytes[BDRV_MAX_IOTYPE];
274 a597e79c Christoph Hellwig
    uint64_t nr_ops[BDRV_MAX_IOTYPE];
275 c488c7f6 Christoph Hellwig
    uint64_t total_time_ns[BDRV_MAX_IOTYPE];
276 294cc35f Kevin Wolf
    uint64_t wr_highest_sector;
277 a36e69dd ths
278 71d0770c aliguori
    /* Whether the disk can expand beyond total_sectors */
279 71d0770c aliguori
    int growable;
280 71d0770c aliguori
281 e268ca52 aliguori
    /* the memory alignment required for the buffers handled by this driver */
282 e268ca52 aliguori
    int buffer_alignment;
283 e268ca52 aliguori
284 e900a7b7 Christoph Hellwig
    /* do we need to tell the quest if we have a volatile write cache? */
285 e900a7b7 Christoph Hellwig
    int enable_write_cache;
286 e900a7b7 Christoph Hellwig
287 ea2384d3 bellard
    /* NOTE: the following infos are only hints for real hardware
288 ea2384d3 bellard
       drivers. They are not used by the block driver */
289 46d4767d bellard
    int cyls, heads, secs, translation;
290 abd7f68d Markus Armbruster
    BlockErrorAction on_read_error, on_write_error;
291 d6bf279e Luiz Capitulino
    bool iostatus_enabled;
292 b2023818 Luiz Capitulino
    BlockDeviceIoStatus iostatus;
293 ea2384d3 bellard
    char device_name[32];
294 c6d22830 Jan Kiszka
    unsigned long *dirty_bitmap;
295 aaa0eb75 Liran Schour
    int64_t dirty_count;
296 db593f25 Marcelo Tosatti
    int in_use; /* users other than guest access, eg. block migration */
297 1b7bdbc1 Stefan Hajnoczi
    QTAILQ_ENTRY(BlockDriverState) list;
298 dbffbdcf Stefan Hajnoczi
299 dbffbdcf Stefan Hajnoczi
    QLIST_HEAD(, BdrvTrackedRequest) tracked_requests;
300 eeec61f2 Stefan Hajnoczi
301 eeec61f2 Stefan Hajnoczi
    /* long-running background operation */
302 eeec61f2 Stefan Hajnoczi
    BlockJob *job;
303 ea2384d3 bellard
};
304 ea2384d3 bellard
305 83f64091 bellard
struct BlockDriverAIOCB {
306 6bbff9a0 aliguori
    AIOPool *pool;
307 83f64091 bellard
    BlockDriverState *bs;
308 83f64091 bellard
    BlockDriverCompletionFunc *cb;
309 ce1a14dc pbrook
    void *opaque;
310 ce1a14dc pbrook
    BlockDriverAIOCB *next;
311 83f64091 bellard
};
312 83f64091 bellard
313 95389c86 bellard
void get_tmp_filename(char *filename, int size);
314 95389c86 bellard
315 c16b5a2c Christoph Hellwig
void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
316 c16b5a2c Christoph Hellwig
                   BlockDriverCompletionFunc *cb, void *opaque);
317 ce1a14dc pbrook
void qemu_aio_release(void *p);
318 ce1a14dc pbrook
319 0563e191 Zhi Yong Wu
void bdrv_set_io_limits(BlockDriverState *bs,
320 0563e191 Zhi Yong Wu
                        BlockIOLimit *io_limits);
321 0563e191 Zhi Yong Wu
322 508c7cb3 Christoph Hellwig
#ifdef _WIN32
323 508c7cb3 Christoph Hellwig
int is_windows_drive(const char *filename);
324 508c7cb3 Christoph Hellwig
#endif
325 508c7cb3 Christoph Hellwig
326 eeec61f2 Stefan Hajnoczi
void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
327 eeec61f2 Stefan Hajnoczi
                       BlockDriverCompletionFunc *cb, void *opaque);
328 eeec61f2 Stefan Hajnoczi
void block_job_complete(BlockJob *job, int ret);
329 eeec61f2 Stefan Hajnoczi
int block_job_set_speed(BlockJob *job, int64_t value);
330 eeec61f2 Stefan Hajnoczi
void block_job_cancel(BlockJob *job);
331 eeec61f2 Stefan Hajnoczi
bool block_job_is_cancelled(BlockJob *job);
332 eeec61f2 Stefan Hajnoczi
333 4f1043b4 Stefan Hajnoczi
int stream_start(BlockDriverState *bs, BlockDriverState *base,
334 c8c3080f Marcelo Tosatti
                 const char *base_id, BlockDriverCompletionFunc *cb,
335 c8c3080f Marcelo Tosatti
                 void *opaque);
336 4f1043b4 Stefan Hajnoczi
337 ea2384d3 bellard
#endif /* BLOCK_INT_H */