X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=block_int.h;h=af6dff6bd6c7d54cc2fce32a224e68b38c86ffd1;hb=604457d7028ccefb9e239a1b1793aefc7e6206ee;hp=781789c9e1f9caeee2c00c1fc3aae426ca61fe0a;hpb=b0a7b120a357733d9c554a1a3b125991114a1135;p=qemu diff --git a/block_int.h b/block_int.h index 781789c..af6dff6 100644 --- a/block_int.h +++ b/block_int.h @@ -30,6 +30,12 @@ #define BLOCK_FLAG_COMPRESS 2 #define BLOCK_FLAG_COMPAT6 4 +typedef struct AIOPool { + void (*cancel)(BlockDriverAIOCB *acb); + int aiocb_size; + BlockDriverAIOCB *free_aiocb; +} AIOPool; + struct BlockDriver { const char *format_name; int instance_size; @@ -58,10 +64,6 @@ struct BlockDriver { int aiocb_size; const char *protocol_name; - int (*bdrv_pread)(BlockDriverState *bs, int64_t offset, - uint8_t *buf, int count); - int (*bdrv_pwrite)(BlockDriverState *bs, int64_t offset, - const uint8_t *buf, int count); int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset); int64_t (*bdrv_getlength)(BlockDriverState *bs); int (*bdrv_write_compressed)(BlockDriverState *bs, int64_t sector_num, @@ -84,8 +86,17 @@ struct BlockDriver { /* to control generic scsi devices */ int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf); + BlockDriverAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs, + unsigned long int req, void *buf, + BlockDriverCompletionFunc *cb, void *opaque); + + AIOPool aio_pool; + + /* new create with backing file format */ + int (*bdrv_create2)(const char *filename, int64_t total_sectors, + const char *backing_file, const char *backing_format, + int flags); - BlockDriverAIOCB *free_aiocb; struct BlockDriver *next; }; @@ -96,6 +107,7 @@ struct BlockDriverState { int removable; /* if true, the media can be removed */ int locked; /* if true, the media cannot temporarily be ejected */ int encrypted; /* if true, the media is encrypted */ + int valid_key; /* if true, a valid encryption key has been set */ int sg; /* if true, the device is a /dev/sg* */ /* event callback when inserting/removing */ void (*change_cb)(void *opaque); @@ -107,6 +119,7 @@ struct BlockDriverState { char filename[1024]; char backing_file[1024]; /* if non zero, the image is a diff of this file image */ + char backing_format[16]; /* if non-zero and backing_file exists */ int is_temporary; int media_changed; @@ -121,6 +134,9 @@ struct BlockDriverState { uint64_t rd_ops; uint64_t wr_ops; + /* Whether the disk can expand beyond total_sectors */ + int growable; + /* NOTE: the following infos are only hints for real hardware drivers. They are not used by the block driver */ int cyls, heads, secs, translation; @@ -131,6 +147,7 @@ struct BlockDriverState { }; struct BlockDriverAIOCB { + AIOPool *pool; BlockDriverState *bs; BlockDriverCompletionFunc *cb; void *opaque; @@ -139,8 +156,13 @@ struct BlockDriverAIOCB { void get_tmp_filename(char *filename, int size); +void aio_pool_init(AIOPool *pool, int aiocb_size, + void (*cancel)(BlockDriverAIOCB *acb)); + void *qemu_aio_get(BlockDriverState *bs, BlockDriverCompletionFunc *cb, void *opaque); +void *qemu_aio_get_pool(AIOPool *pool, BlockDriverState *bs, + BlockDriverCompletionFunc *cb, void *opaque); void qemu_aio_release(void *p); extern BlockDriverState *bdrv_first;