]> git.proxmox.com Git - mirror_qemu.git/blobdiff - block/bochs.c
block: Pass BdrvChildRole in remaining cases
[mirror_qemu.git] / block / bochs.c
index 79f95d3b507d3517da39057358e5497b0e7b9bfe..2f010ab40a1ccd3669b64aed3c10aff17435335c 100644 (file)
@@ -24,7 +24,6 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include "qemu/bswap.h"
@@ -111,8 +110,8 @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags,
         return ret;
     }
 
-    bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file,
-                               false, errp);
+    bs->file = bdrv_open_child(NULL, options, "file", bs, &child_of_bds,
+                               BDRV_CHILD_IMAGE, false, errp);
     if (!bs->file) {
         return -EINVAL;
     }
@@ -249,8 +248,8 @@ bochs_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
     QEMUIOVector local_qiov;
     int ret;
 
-    assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
-    assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
+    assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
+    assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
 
     qemu_iovec_init(&local_qiov, qiov->niov);
     qemu_co_mutex_lock(&s->lock);
@@ -298,10 +297,11 @@ static BlockDriver bdrv_bochs = {
     .instance_size     = sizeof(BDRVBochsState),
     .bdrv_probe                = bochs_probe,
     .bdrv_open         = bochs_open,
-    .bdrv_child_perm     = bdrv_format_default_perms,
+    .bdrv_child_perm     = bdrv_default_perms,
     .bdrv_refresh_limits = bochs_refresh_limits,
     .bdrv_co_preadv = bochs_co_preadv,
     .bdrv_close                = bochs_close,
+    .is_format          = true,
 };
 
 static void bdrv_bochs_init(void)