[libvirt] [PATCH v4 04/20] domain: add rendernode attribute on <accel>

Ján Tomko jtomko at redhat.com
Wed Sep 18 15:26:29 UTC 2019


On Fri, Sep 13, 2019 at 04:50:41PM +0400, marcandre.lureau at redhat.com wrote:
>From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
>vhost-user-gpu helper takes --render-node option to specify on which
>GPU should the renderning be done.
>
>Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
>---
> docs/formatdomain.html.in                 |  6 ++++++
> docs/schemas/domaincommon.rng             |  5 +++++
> src/conf/domain_conf.c                    | 17 ++++++++++++++++-
> src/conf/domain_conf.h                    |  1 +
> tests/qemuxml2argvdata/virtio-options.xml |  2 +-
> 5 files changed, 29 insertions(+), 2 deletions(-)
>
>@@ -15378,6 +15387,8 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
>         def->accel2d = val;
>     }
>
>+    VIR_STEAL_PTR(def->rendernode, rendernode);

virFileSanitizePath should be called on user-provided paths

>+
>  cleanup:
>     return def;
> }
>@@ -26535,6 +26546,10 @@ virDomainVideoAccelDefFormat(virBufferPtr buf,
>         virBufferAsprintf(buf, " accel2d='%s'",
>                           virTristateBoolTypeToString(def->accel2d));
>     }
>+    if (def->rendernode) {
>+        virBufferAsprintf(buf, " rendernode='%s'",
>+                          def->rendernode);
>+    }

And user-provided string should be escaped for XML by
virBufferEscapeString (which is a no-op if the argument is NULL, so you
can drop the if as well)

>     virBufferAddLit(buf, "/>\n");
> }
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190918/8f5106b9/attachment-0001.sig>


More information about the libvir-list mailing list