[Libvirt-cim] [PATCH v2 1/2] Add SDL graphic device support

Chip Vincent cvincent at linux.vnet.ibm.com
Fri Jul 22 00:43:18 UTC 2011


Disregard previous email. Hit send on wrong email.

Not pushed yet since still under review.

On 07/21/2011 02:08 PM, Eduardo Lima (Etrunko) wrote:
> On 07/20/2011 09:17 AM, Wayne Xia wrote:
>> # HG changeset patch
>> # User Wayne Xia <xiawenc at linux.vnet.ibm.com>
>> # Date 1311156234 -28800
>> # Node ID 0c52e4f6c421cc2e168197a82a9333d4ce369655
>> # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41
>> made the graphic structure as union
>>
>> These change were made to allow SDL device properties added more
>> clearly, the graphic_device structure now contains a union
>>
>
> Tried to apply your patch, without success. Are you sure you are in sync
> with latest tip? Especially now that Chip pushed some changes I
> submitted which would very likely conflict with this patch.
>
> Anyway, There is only a small indentation issue below...
>
>> Signed-off-by: Wayne Xia (Wayne) <xiawenc at linux.vnet.ibm.com>
>>
>> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.c
>> --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300
>> +++ b/libxkutil/device_parsing.c Wed Jul 20 18:03:54 2011 +0800
>> @@ -91,10 +91,10 @@
>> static void cleanup_graphics_device(struct graphics_device *dev)
>> {
>> free(dev->type);
>> - free(dev->port);
>> - free(dev->host);
>> - free(dev->keymap);
>> - free(dev->passwd);
>> + free(dev->dev.vnc.port);
>> + free(dev->dev.vnc.host);
>> + free(dev->dev.vnc.keymap);
>> + free(dev->dev.vnc.passwd);
>> }
>>
>> static void cleanup_input_device(struct input_device *dev)
>> @@ -522,12 +522,12 @@
>> CU_DEBUG("graphics device type = %s", gdev->type);
>>
>> if (STREQC(gdev->type, "vnc")) {
>> - gdev->port = get_attr_value(node, "port");
>> - gdev->host = get_attr_value(node, "listen");
>> - gdev->keymap = get_attr_value(node, "keymap");
>> - gdev->passwd = get_attr_value(node, "passwd");
>> + gdev->dev.vnc.port = get_attr_value(node, "port");
>> + gdev->dev.vnc.host = get_attr_value(node, "listen");
>> + gdev->dev.vnc.keymap = get_attr_value(node, "keymap");
>> + gdev->dev.vnc.passwd = get_attr_value(node, "passwd");
>>
>> - if (gdev->port == NULL || gdev->host == NULL)
>> + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL)
>> goto err;
>> }
>> else if (STREQC(gdev->type, "pty")) {
>> @@ -542,9 +542,9 @@
>> for (child = node->children; child != NULL;
>> child = child->next) {
>> if (XSTREQ(child->name, "source"))
>> - gdev->host = get_attr_value(child, "path");
>> + gdev->dev.vnc.host = get_attr_value(child, "path");
>> else if (XSTREQ(child->name, "target"))
>> - gdev->port = get_attr_value(child, "port");
>> + gdev->dev.vnc.port = get_attr_value(child, "port");
>> }
>> }
>> else {
>> @@ -557,7 +557,7 @@
>> if (STREQC(gdev->type, "vnc"))
>> ret = asprintf(&vdev->id, "%s", gdev->type);
>> else
>> - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port);
>> + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port);
>>
>> if (ret == -1) {
>> CU_DEBUG("Failed to create graphics is string");
>> @@ -798,9 +798,10 @@
>> DUP_FIELD(dev, _dev, dev.emu.path);
>> } else if (dev->type == CIM_RES_TYPE_GRAPHICS) {
>> DUP_FIELD(dev, _dev, dev.graphics.type);
>> - DUP_FIELD(dev, _dev, dev.graphics.port);
>> - DUP_FIELD(dev, _dev, dev.graphics.host);
>> - DUP_FIELD(dev, _dev, dev.graphics.keymap);
>> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host);
>> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port);
>> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap);
>> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd);
>> } else if (dev->type == CIM_RES_TYPE_INPUT) {
>> DUP_FIELD(dev, _dev, dev.input.type);
>> DUP_FIELD(dev, _dev, dev.input.bus);
>> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.h
>> --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300
>> +++ b/libxkutil/device_parsing.h Wed Jul 20 18:03:54 2011 +0800
>> @@ -83,14 +83,28 @@
>> char *path;
>> };
>>
>> -struct graphics_device {
>> - char *type;
>> +//vnc_device must be larger or equal than sdl_device
>> +struct vnc_device {
>> char *port;
>> char *host;
>> char *keymap;
>> char *passwd;
>> };
>>
>> +struct sdl_device {
>> + char *display;
>> + char *xauth;
>> + char *fullscreen;
>> +};
>> +
>> +struct graphics_device {
>> + char *type;
>> + union {
>> + struct vnc_device vnc;
>> + struct sdl_device sdl;
>> + } dev;
>> +};
>> +
>> struct input_device {
>> char *type;
>> char *bus;
>> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xml_parse_test.c
>> --- a/libxkutil/xml_parse_test.c Mon Jul 18 11:13:40 2011 -0300
>> +++ b/libxkutil/xml_parse_test.c Wed Jul 20 18:03:54 2011 +0800
>> @@ -116,7 +116,7 @@
>> FILE *d)
>> {
>> print_value(d, "Graphics Type", dev->dev.graphics.type);
>> - print_value(d, "Graphics Port", dev->dev.graphics.port);
>> + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port);
>> }
>>
>> static void print_devices(struct domain *dominfo,
>> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xmlgen.c
>> --- a/libxkutil/xmlgen.c Mon Jul 18 11:13:40 2011 -0300
>> +++ b/libxkutil/xmlgen.c Wed Jul 20 18:03:54 2011 +0800
>> @@ -424,22 +424,22 @@
>> if (STREQC(dev->type, "sdl"))
>> return NULL;
>>
>> - if (dev->port) {
>> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port);
>> - if (STREQC(dev->port, "-1"))
>> + if (dev->dev.vnc.port) {
>> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port);
>> + if (STREQC(dev->dev.vnc.port, "-1"))
>> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes");
>> else
>> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no");
>> }
>>
>> - if (dev->host)
>> - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host);
>> + if (dev->dev.vnc.host)
>> + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host);
>>
>> - if (dev->passwd)
>> - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd);
>> + if (dev->dev.vnc.passwd)
>> + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd);
>>
>> - if (dev->keymap)
>> - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap);
>> + if (dev->dev.vnc.keymap)
>> + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap);
>>
>> return NULL;
>> }
>> @@ -460,15 +460,15 @@
>> if (tmp == NULL)
>> return XML_ERROR;
>>
>> - if(dev->host)
>> - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host);
>> + if(dev->dev.vnc.host)
>> + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host);
>>
>> tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL);
>> if (tmp == NULL)
>> return XML_ERROR;
>>
>> - if(dev->port)
>> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port);
>> + if(dev->dev.vnc.port)
>> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port);
>>
>> return NULL;
>> }
>> diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_ComputerSystem.c
>> --- a/src/Virt_ComputerSystem.c Mon Jul 18 11:13:40 2011 -0300
>> +++ b/src/Virt_ComputerSystem.c Wed Jul 20 18:03:54 2011 +0800
>> @@ -104,7 +104,7 @@
>> "Virtual System (Console on %s://%s:%s)",
>> domain->dev_graphics[0].dev.graphics.type,
>> host,
>> - domain->dev_graphics[0].dev.graphics.port);
>> + domain->dev_graphics[0].dev.graphics.dev.vnc.port);
>
> Which is here, I don't know why the reply screwed all the indentation
> up, but you can find it on your original message.
>
> Best regards,
>

-- 
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list