block: Attach non-qdev devices as well

For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.

While there, rename BlockDriverState member peer to dev, bdrv_attach()
to bdrv_attach_dev(), bdrv_detach() to bdrv_detach_dev(), and
bdrv_get_attached() to bdrv_get_attached_dev().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster 2011-08-03 15:07:40 +02:00 committed by Kevin Wolf
parent 648fb0ea5e
commit fa879d62eb
12 changed files with 39 additions and 22 deletions

View file

@ -518,7 +518,7 @@ static int usb_msd_initfn(USBDevice *dev)
*
* The hack is probably a bad idea.
*/
bdrv_detach(bs, &s->dev.qdev);
bdrv_detach_dev(bs, &s->dev.qdev);
s->conf.bs = NULL;
if (!s->serial) {