[Libvirt-cim] [PATCH 2 of 2] (#5) add sdl frame buffer support
Chip Vincent
cvincent at linux.vnet.ibm.com
Thu Aug 18 02:15:25 UTC 2011
+1 and pushed.
On 08/11/2011 11:00 PM, Wayne Xia wrote:
> # HG changeset patch
> # User Wayne Xia<xiawenc at linux.vnet.ibm.com>
> # Date 1311670971 -28800
> # Node ID 80f69bdadfe2ffe057873f4c0f6c8d6a0ef60816
> # Parent 03cc267a3d534f19eb489be3c430ea5de8787ccc
> (#5) add sdl frame buffer support.
>
> Now libvirt still supports sdl frame buffer, and it may take three
> parameters: display,xauth,fullscreen. This patch enable the libvirt-cim
> to accept these configuration and pass them in XML define to let
> libvirt know about it. Exposed interface could be found in the file
> ResourceAllocationSettingData.mof.
> This Patch also fix some memory leak problem.
>
> #5 fixed the memory leak problem in Virt_VirtualSystemManagementService.c.
>
> Signed-off-by: Wayne Xia (Wayne)<xiawenc at linux.vnet.ibm.com>
>
> diff -r 03cc267a3d53 -r 80f69bdadfe2 libxkutil/device_parsing.c
> --- a/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800
> +++ b/libxkutil/device_parsing.c Tue Jul 26 17:02:51 2011 +0800
> @@ -555,6 +555,11 @@
> if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL)
> goto err;
> }
> + else if (STREQC(gdev->type, "sdl")) {
> + gdev->dev.sdl.display = get_attr_value(node, "display");
> + gdev->dev.sdl.xauth = get_attr_value(node, "xauth");
> + gdev->dev.sdl.fullscreen = get_attr_value(node, "fullscreen");
> + }
> else if (STREQC(gdev->type, "pty")) {
> if (node->name == NULL)
> goto err;
> diff -r 03cc267a3d53 -r 80f69bdadfe2 libxkutil/xmlgen.c
> --- a/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800
> +++ b/libxkutil/xmlgen.c Tue Jul 26 17:02:51 2011 +0800
> @@ -421,8 +421,21 @@
>
> xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type);
>
> - if (STREQC(dev->type, "sdl"))
> - return NULL;
> + if (STREQC(dev->type, "sdl")) {
> + if (dev->dev.sdl.display) {
> + xmlNewProp(tmp, BAD_CAST "display",
> + BAD_CAST dev->dev.sdl.display);
> + }
> + if (dev->dev.sdl.xauth) {
> + xmlNewProp(tmp, BAD_CAST "xauth",
> + BAD_CAST dev->dev.sdl.xauth);
> + }
> + if (dev->dev.sdl.fullscreen) {
> + xmlNewProp(tmp, BAD_CAST "fullscreen",
> + BAD_CAST dev->dev.sdl.fullscreen);
> + }
> + return NULL;
> + }
>
> if (dev->dev.vnc.port) {
> xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port);
> diff -r 03cc267a3d53 -r 80f69bdadfe2 schema/ResourceAllocationSettingData.mof
> --- a/schema/ResourceAllocationSettingData.mof Mon Jul 25 19:39:08 2011 +0800
> +++ b/schema/ResourceAllocationSettingData.mof Tue Jul 26 17:02:51 2011 +0800
> @@ -219,7 +219,9 @@
> [Description ("If ResourceSubType is 'vnc', this is a VNC Address. "
> "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType "
> "is 'console', this is a character device path in "
> - "path:port format (e.g., '/dev/pts/3:0'\)")]
> + "path:port format (e.g., '/dev/pts/3:0'\) "
> + "if ResourceSubType is 'sdl', this is a combination of its params as "
> + "xauth:display (e.g., '/root/.Xauthority::0'\)")]
> string Address;
>
> [Description ("Keyboard keymapping")]
> @@ -228,7 +230,8 @@
> [Description ("VNC password")]
> string Password;
>
> - [Description ("Is IPv6 only addressing is to be used")]
> + [Description ("Is IPv6 only addressing is to be used."
> + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")]
> boolean IsIPv6Only;
> };
>
> diff -r 03cc267a3d53 -r 80f69bdadfe2 src/Virt_VirtualSystemManagementService.c
> --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800
> +++ b/src/Virt_VirtualSystemManagementService.c Tue Jul 26 17:02:51 2011 +0800
> @@ -1057,6 +1057,58 @@
> CU_DEBUG("Exiting parse_console_address, ip is %s, port is %s",
> *path, *port);
>
> + free(tmp_path);
> + free(tmp_port);
> +
> + return ret;
> +}
> +
> +static int parse_sdl_address(const char *id,
> + char **display,
> + char **xauth)
> +{
> + int ret;
> + char *tmp_display = NULL;
> + char *tmp_xauth = NULL;
> +
> + CU_DEBUG("Entering parse_sdl_address, address is %s", id);
> +
> + ret = sscanf(id, "%a[^:]:%as",&tmp_xauth,&tmp_display);
> +
> + if (ret<= 0) {
> + ret = sscanf(id, ":%as",&tmp_display);
> + if (ret<= 0) {
> + if (STREQC(id, ":")) {
> + /* do nothing, it is empty */
> + }
> + else {
> + ret = 0;
> + goto out;
> + }
> + }
> + }
> +
> + if (display) {
> + if (tmp_display == NULL)
> + *display = NULL;
> + else
> + *display = strdup(tmp_display);
> + }
> + if (xauth) {
> + if (tmp_xauth == NULL)
> + *xauth = NULL;
> + else
> + *xauth = strdup(tmp_xauth);
> + }
> + ret = 1;
> +
> + out:
> + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s",
> + *display, *xauth);
> +
> + free(tmp_display);
> + free(tmp_xauth);
> +
> return ret;
> }
>
> @@ -1094,6 +1146,9 @@
> CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s",
> *ip, *port);
>
> + free(tmp_ip);
> + free(tmp_port);
> +
> return ret;
> }
>
> @@ -1163,6 +1218,30 @@
> msg = "GraphicsRASD field Address not valid";
> goto out;
> }
> + }
> + else if (STREQC(dev->dev.graphics.type, "sdl")) {
> + if (cu_get_str_prop(inst, "Address",&val) != CMPI_RC_OK) {
> + CU_DEBUG("sdl graphics Address empty, using default");
> + dev->dev.graphics.dev.sdl.display = NULL;
> + dev->dev.graphics.dev.sdl.xauth = NULL;
> + }
> + else {
> + ret = parse_sdl_address(val,
> +&dev->dev.graphics.dev.sdl.display,
> +&dev->dev.graphics.dev.sdl.xauth);
> + if (ret != 1) {
> + msg = "GraphicsRASD sdl Address not valid";
> + goto out;
> + }
> + }
> + dev->dev.graphics.dev.sdl.fullscreen = NULL;
> + if (cu_get_bool_prop(inst, "IsIPV6Only",&ipv6) ==
> + CMPI_RC_OK) {
> + if (ipv6)
> + dev->dev.graphics.dev.sdl.fullscreen = strdup("yes");
> + else
> + dev->dev.graphics.dev.sdl.fullscreen = strdup("no");
> + }
> } else {
> CU_DEBUG("Unsupported graphics type %s",
> dev->dev.graphics.type);
> @@ -1171,7 +1250,8 @@
> }
>
> free(dev->id);
> - if (STREQC(dev->dev.graphics.type, "vnc"))
> + if ((STREQC(dev->dev.graphics.type, "vnc"))||
> + (STREQC(dev->dev.graphics.type, "sdl")))
> ret = asprintf(&dev->id, "%s", dev->dev.graphics.type);
> else
> ret = asprintf(&dev->id, "%s:%s",
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list