[libvirt] [PATCH v3 3/3] qemu: Build command line for ivshmem device

Martin Kletzander mkletzan at redhat.com
Sat Oct 4 08:38:05 UTC 2014


On Fri, Oct 03, 2014 at 03:36:19PM -0600, Eric Blake wrote:
>On 09/26/2014 04:43 AM, Martin Kletzander wrote:
>> This patch implements support for the ivshmem device in QEMU.
>>
>> Signed-off-by: Maxime Leroy <maxime.leroy at 6wind.com>
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>
>> +    virBufferAddLit(&buf, "ivshmem");
>> +    if (shmem->size) {
>> +        /*
>> +         * Thanks to our parsing code, we have a guarantee that the
>> +         * size is power of two and is at least a mebibyte in size.
>> +         * But because it may change inthe future, the checks are
>
>s/inthe/in the/
>
>> +         * doubled in here.
>> +         */
>> +        if (shmem->size & (shmem->size - 1)) {
>> +            virReportError(VIR_ERR_XML_ERROR, "%s",
>> +                           _("shmem size must be a power of two"));
>> +            goto error;
>> +        }
>> +        if (shmem->size < 1024 * 1024) {
>> +            virReportError(VIR_ERR_XML_ERROR, "%s",
>> +                           _("shmem size must be at least 1 MiB"));
>> +            goto error;
>> +        }
>> +        virBufferAsprintf(&buf, ",size=%llum",
>> +                          VIR_DIV_UP(shmem->size, 1024 * 1024));
>
>Similar comment as before; since you already validated sizing and
>minimum value, you could use simpler >>20 instead of making me guess
>whether rounding up is occurring.
>
>
>> @@ -9897,7 +10014,6 @@ qemuBuildChrDeviceStr(char **deviceStr,
>>      return ret;
>>  }
>>
>> -
>>  /*
>
>Spurious line deletion; you might as well restore the two lines between
>functions when doing the other touchups I've pointed out.
>

This wasn't pushed, I fixed it thanks to Levente's comment.  And in
this file the spaces are unequal, sometimes there are two lines,
sometimes one, so this would be a bigger follow-up unrelated to this
series.

All the other things are in a commit I'll push in a while.  Thanks for
the check on these.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141004/ff2242eb/attachment-0001.sig>


More information about the libvir-list mailing list