|
From: | Gerd Hoffmann |
Subject: | Re: [Qemu-devel] [PATCH 3/4] SCSI-Hotdel: Implement drive_hot_del |
Date: | Wed, 30 Sep 2009 21:04:50 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3 |
On 09/30/09 17:45, Wolfgang Mauerer wrote:
Gerd Hoffmann wrote:Hi,+ dinfo = drive_get(type, bus, unit); + if (!dinfo) { + monitor_printf(mon, "Trying to remove non-existent device\n"); + return; + }No. Just don't do this silly if/bus/unit parsing. At very minimum use drive_get_by_id() here, then have something like 'drive_del $id'. IMHO much better would be to go qdev instead though. We should have generic device_add + device_del monitor commands which work for any device, pretty much like the -device command line switch.That makes sense, but I'd nevertheless prefer to stick with the more traditional approach right now, replacing the bus/unit parsing with an ID-based variant.
Have a look at the "qdev: bus management updates." patch series posted a few days ago. It adds device_add+device_del.
However, is there any standard way to get from an instance of DriveInfo to the corresponding instance of SCSIDevice respectively SCSIDeviceInfo?
No. It is linked the other way around: The device has a reference to the DriveInfo. Which is one of the reasons why I think drive_del isn't that a great idea.
cheers, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |