Skip to content

Commit 7629818

Browse files
philmdmdroth
authored andcommitted
hw/block/fdc: Extract blk_create_empty_drive()
We are going to re-use this code in the next commit, so extract it as a new blk_create_empty_drive() function. Inspired-by: Hanna Reitz <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-id: [email protected] Signed-off-by: John Snow <[email protected]> (cherry picked from commit b154791) Signed-off-by: Michael Roth <[email protected]>
1 parent 4658dfc commit 7629818

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hw/block/fdc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
} while (0)
6262

6363

64+
/* Anonymous BlockBackend for empty drive */
65+
static BlockBackend *blk_create_empty_drive(void)
66+
{
67+
return blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
68+
}
69+
6470
/********************************************************/
6571
/* qdev floppy bus */
6672

@@ -486,8 +492,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp)
486492
}
487493

488494
if (!dev->conf.blk) {
489-
/* Anonymous BlockBackend for an empty drive */
490-
dev->conf.blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
495+
dev->conf.blk = blk_create_empty_drive();
491496
ret = blk_attach_dev(dev->conf.blk, qdev);
492497
assert(ret == 0);
493498

0 commit comments

Comments
 (0)