On 04/03/2013 11:24 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The nodedev driver currently only detects harddisk, cdrom
and floppy devices. This adds support for SD cards, which
are common storage for ARM devices, eg the Google ChromeBook
<device>
<name>block_mmcblk0_0xb1c7c08b</name>
<parent>computer</parent>
<capability type='storage'>
<block>/dev/mmcblk0</block>
<drive_type>sd</drive_type>
<serial>0xb1c7c08b</serial>
<size>15758000128</size>
<logical_block_size>512</logical_block_size>
<num_blocks>30777344</num_blocks>
</capability>
</device>
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/node_device/node_device_udev.c | 41 ++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
ACK. Potential nits below are not showstoppers, but you may want to
clean them up anyway...
+
+static int udevProcessSD(struct udev_device *device,
+ virNodeDeviceDefPtr def)
Is it worth formatting this:
static int
udevProcessSD(...)
+
/* This function exists to deal with the case in which a driver does
* not provide a device type in the usual place, but udev told us it's
* a storage device, and we can make a good guess at what kind of
@@ -1056,6 +1085,13 @@ static int udevProcessStorage(struct udev_device *device,
data->storage.drive_type = strdup("floppy");
if (!data->storage.drive_type)
goto out;
+ } else if ((udevGetIntProperty(device, "ID_DRIVE_FLASH_SD",
+ &tmp_int, 0) == PROPERTY_FOUND) &&
+ (tmp_int == 1)) {
Spurious (), but it is copying existing style in this file.
+
+ data->storage.drive_type = strdup("sd");
Another merge conflict with the VIR_STRDUP series :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org