diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-15 15:51:35 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-15 15:51:35 +0000 |
commit | 03ff3ca30f29f422ebfd10d2bee1393efb4d4f7a (patch) | |
tree | a910207407d9f3b1de0c0cd95299c7fe72065675 /block.c | |
parent | d9cf15784f68935a25c5ece051ba595fccbc8f6c (diff) |
Use common objects for qemu-img and qemu-nbd
Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the
code. It's ugly and causes us to have to build multiple object files for
linking against qemu and the tools.
This patch introduces a new file, qemu-tool.c which contains enough for
qemu-img, qemu-nbd, and QEMU to all share the same objects.
This also required getting qemu-nbd to be a bit more Windows friendly. I also
changed the Windows block-raw to use normal IO instead of overlapping IO since
we don't actually do AIO yet on Windows. I changed the various #if 0's to
#if WIN32_AIO to make it easier for someone to eventually fix AIO on Windows.
After this patch, there are no longer any #ifdef's related to qemu-img and
qemu-nbd.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5226 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 32 |
1 files changed, 0 insertions, 32 deletions
@@ -22,9 +22,7 @@ * THE SOFTWARE. */ #include "qemu-common.h" -#ifndef QEMU_IMG #include "console.h" -#endif #include "block_int.h" #ifdef _BSD @@ -922,7 +920,6 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, return bs->drv->bdrv_is_allocated(bs, sector_num, nb_sectors, pnum); } -#ifndef QEMU_IMG void bdrv_info(void) { BlockDriverState *bs; @@ -980,7 +977,6 @@ void bdrv_info_stats (void) bs->rd_ops, bs->wr_ops); } } -#endif void bdrv_get_backing_filename(BlockDriverState *bs, char *filename, int filename_size) @@ -1203,31 +1199,6 @@ void bdrv_aio_cancel(BlockDriverAIOCB *acb) /**************************************************************/ /* async block device emulation */ -#ifdef QEMU_IMG -static BlockDriverAIOCB *bdrv_aio_read_em(BlockDriverState *bs, - int64_t sector_num, uint8_t *buf, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - int ret; - ret = bdrv_read(bs, sector_num, buf, nb_sectors); - cb(opaque, ret); - return NULL; -} - -static BlockDriverAIOCB *bdrv_aio_write_em(BlockDriverState *bs, - int64_t sector_num, const uint8_t *buf, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - int ret; - ret = bdrv_write(bs, sector_num, buf, nb_sectors); - cb(opaque, ret); - return NULL; -} - -static void bdrv_aio_cancel_em(BlockDriverAIOCB *acb) -{ -} -#else static void bdrv_aio_bh_cb(void *opaque) { BlockDriverAIOCBSync *acb = opaque; @@ -1273,7 +1244,6 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb) qemu_bh_cancel(acb->bh); qemu_aio_release(acb); } -#endif /* !QEMU_IMG */ /**************************************************************/ /* sync block device emulation */ @@ -1337,9 +1307,7 @@ void bdrv_init(void) bdrv_register(&bdrv_vvfat); bdrv_register(&bdrv_qcow2); bdrv_register(&bdrv_parallels); -#ifndef _WIN32 bdrv_register(&bdrv_nbd); -#endif qemu_aio_init(); } |