On 05.10.2016 11:26, Kevin Wolf wrote: > Almost all block devices are qdevified by now. This allows us to go back > from the BlockBackend to the DeviceState. xen_disk is the last device > that is missing. We'll remember in the BlockBackend if a xen_disk is > attached and can then disable any features that require going from a BB > to the DeviceState. > > While at it, clearly mark the function used by xen_disk as legacy even > in its name, not just in TODO comments. > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > block/block-backend.c | 26 +++++++++++++++++++------- > hw/block/xen_disk.c | 2 +- > include/sysemu/block-backend.h | 4 ++-- > 3 files changed, 22 insertions(+), 10 deletions(-) > > diff --git a/block/block-backend.c b/block/block-backend.c > index 911254a..39c5613 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c
[...] > @@ -507,32 +508,38 @@ void blk_insert_bs(BlockBackend *blk, BlockDriverState > *bs) > } > } > > -/* > - * Attach device model @dev to @blk. > - * Return 0 on success, -EBUSY when a device model is attached already. > - */ > -int blk_attach_dev(BlockBackend *blk, void *dev) > -/* TODO change to DeviceState *dev when all users are qdevified */ > +static int blk_do_attach_dev(BlockBackend *blk, void *dev) > { > if (blk->dev) { > return -EBUSY; > } > blk_ref(blk); > blk->dev = dev; > + blk->legacy_dev = false; > blk_iostatus_reset(blk); > return 0; > } > > /* > * Attach device model @dev to @blk. > + * Return 0 on success, -EBUSY when a device model is attached already. > + */ > +int blk_attach_dev(BlockBackend *blk, DeviceState *dev) > +{ > + return blk_do_attach_dev(blk, dev); > +} > + > +/* > + * Attach device model @dev to @blk. > * @blk must not have a device model attached already. > * TODO qdevified devices don't use this, remove when devices are qdevified > */ > -void blk_attach_dev_nofail(BlockBackend *blk, void *dev) > +void blk_attach_dev_legacy(BlockBackend *blk, void *dev) > { > if (blk_attach_dev(blk, dev) < 0) { I'd make this a blk_do_attach_dev(), but it's not syntactically wrong, so the choice is up to you. Thus, either way: Reviewed-by: Max Reitz <mre...@redhat.com> > abort(); > } > + blk->legacy_dev = true; > } > > /*
signature.asc
Description: OpenPGP digital signature