[libvirt] [PATCH v3 1/3] docs, conf, schema: add support for shmem device

Eric Blake eblake at redhat.com
Fri Oct 3 21:21:54 UTC 2014


On 09/26/2014 04:43 AM, Martin Kletzander wrote:
> This patch adds parsing/formatting code as well as documentation for
> shared memory devices.  This will currently be only accessible in QEMU
> using it's ivshmem device, but is designed as generic as possible to
> allow future expansion for other hypervisors.
> 

> 
>  static int
> +virDomainShmemDefFormat(virBufferPtr buf,
> +                        virDomainShmemDefPtr def,
> +                        unsigned int flags)
> +{
> +    virBufferAsprintf(buf, "<shmem name='%s'", def->name);
> +

Need to use virBufferEscape, to protect against the user naming their
memory something that conflicts with XML.


> +
> +    if (def->size)
> +        virBufferAsprintf(buf, "<size unit='M'>%llu</size>\n",
> +                          VIR_DIV_UP(def->size, 1024 * 1024));

I thought the docs said this already had to be a multiple of a megabyte.
 If that's true, then it might be simpler to just report 'def->size >>
20', rather than having me scratch my head at why we need to round the
result to the next higher boundary.

-- 
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: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141003/2f532c63/attachment-0001.sig>


More information about the libvir-list mailing list