[libvirt] [PATCH] Add support for SD cards in nodedev driver

Eric Blake eblake at redhat.com
Wed Apr 3 21:58:29 UTC 2013


On 04/03/2013 11:24 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at 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 at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130403/0ee486e6/attachment-0001.sig>


More information about the libvir-list mailing list