diff options
author | Christoph Hellwig <hch@lst.de> | 2009-05-25 12:37:32 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-05-27 09:46:03 -0500 |
commit | c16b5a2ca0b186de618654a576bdad9cdd2d1ab2 (patch) | |
tree | 8c793602c179ad2d5adbce65bc6583340a12cd92 /block/curl.c | |
parent | ad53089b0d0b4bc0731d978e5713365e1a91ba74 (diff) | |
download | qemu-c16b5a2ca0b186de618654a576bdad9cdd2d1ab2.zip qemu-c16b5a2ca0b186de618654a576bdad9cdd2d1ab2.tar.gz qemu-c16b5a2ca0b186de618654a576bdad9cdd2d1ab2.tar.bz2 |
fully split aio_pool from BlockDriver
Now that we have a separate aio pool structure we can remove those
aio pool details from BlockDriver.
Every driver supporting AIO now needs to declare a static AIOPool
with the aiocb size and the cancellation method. This cleans up the
current code considerably and will make it cleaner and more obvious
to support two different aio implementations behind a single
BlockDriver.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/curl.c')
-rw-r--r-- | block/curl.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/block/curl.c b/block/curl.c index 5d1487d..e1a553f 100644 --- a/block/curl.c +++ b/block/curl.c @@ -349,6 +349,16 @@ out_noclean: return -EINVAL; } +static void curl_aio_cancel(BlockDriverAIOCB *blockacb) +{ + // Do we have to implement canceling? Seems to work without... +} + +static AIOPool curl_aio_pool = { + .aiocb_size = sizeof(CURLAIOCB), + .cancel = curl_aio_cancel, +}; + static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) @@ -359,7 +369,7 @@ static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, size_t end; CURLState *state; - acb = qemu_aio_get(bs, cb, opaque); + acb = qemu_aio_get(&curl_aio_pool, bs, cb, opaque); if (!acb) return NULL; @@ -406,11 +416,6 @@ static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, return &acb->common; } -static void curl_aio_cancel(BlockDriverAIOCB *blockacb) -{ - // Do we have to implement canceling? Seems to work without... -} - static void curl_close(BlockDriverState *bs) { BDRVCURLState *s = bs->opaque; @@ -450,9 +455,7 @@ static BlockDriver bdrv_http = { .bdrv_close = curl_close, .bdrv_getlength = curl_getlength, - .aiocb_size = sizeof(CURLAIOCB), .bdrv_aio_readv = curl_aio_readv, - .bdrv_aio_cancel = curl_aio_cancel, }; static BlockDriver bdrv_https = { @@ -464,9 +467,7 @@ static BlockDriver bdrv_https = { .bdrv_close = curl_close, .bdrv_getlength = curl_getlength, - .aiocb_size = sizeof(CURLAIOCB), .bdrv_aio_readv = curl_aio_readv, - .bdrv_aio_cancel = curl_aio_cancel, }; static BlockDriver bdrv_ftp = { @@ -478,9 +479,7 @@ static BlockDriver bdrv_ftp = { .bdrv_close = curl_close, .bdrv_getlength = curl_getlength, - .aiocb_size = sizeof(CURLAIOCB), .bdrv_aio_readv = curl_aio_readv, - .bdrv_aio_cancel = curl_aio_cancel, }; static BlockDriver bdrv_ftps = { @@ -492,9 +491,7 @@ static BlockDriver bdrv_ftps = { .bdrv_close = curl_close, .bdrv_getlength = curl_getlength, - .aiocb_size = sizeof(CURLAIOCB), .bdrv_aio_readv = curl_aio_readv, - .bdrv_aio_cancel = curl_aio_cancel, }; static BlockDriver bdrv_tftp = { @@ -506,9 +503,7 @@ static BlockDriver bdrv_tftp = { .bdrv_close = curl_close, .bdrv_getlength = curl_getlength, - .aiocb_size = sizeof(CURLAIOCB), .bdrv_aio_readv = curl_aio_readv, - .bdrv_aio_cancel = curl_aio_cancel, }; static void curl_block_init(void) |