On Wed, Nov 04, 2009 at 04:22:00PM +0000, Matthew Booth wrote:
Note that, on its own, this patch will generate a warning about an
unused static
function.
That says this patch should be squashed with the next one
---
src/qemu/qemu_conf.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2981b51..a9f6885 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1411,6 +1411,74 @@ qemuBuildHostNetStr(virConnectPtr conn,
return 0;
}
+/* This function outputs a -chardev command line option which describes only the
+ * host side of the character device */
+static void qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev,
+ const char *const id,
+ virBufferPtr buf)
+{
+ bool telnet;
+ switch(dev->type) {
+ case VIR_DOMAIN_CHR_TYPE_NULL:
+ virBufferVSprintf(buf, "null,id=%s", id);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_VC:
+ virBufferVSprintf(buf, "vc,id=%s", id);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_PTY:
+ virBufferVSprintf(buf, "pty,id=%s", id);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_DEV:
+ virBufferVSprintf(buf, "tty,id=%s,path=%s", id,
dev->data.file.path);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_FILE:
+ virBufferVSprintf(buf, "file,id=%s,path=%s", id,
dev->data.file.path);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_PIPE:
+ virBufferVSprintf(buf, "pipe,id=%s,path=%s", id,
dev->data.file.path);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_STDIO:
+ virBufferVSprintf(buf, "stdio,id=%s", id);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_UDP:
+ virBufferVSprintf(buf,
+
"udp,id=%s,host=%s,port=%s,localaddr=%s,localport=%s",
+ id,
+ dev->data.udp.connectHost,
+ dev->data.udp.connectService,
+ dev->data.udp.bindHost,
+ dev->data.udp.bindService);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_TCP:
+ telnet = dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
+ virBufferVSprintf(buf,
+ "socket,id=%s,host=%s,port=%s%s%s",
+ id,
+ dev->data.tcp.host,
+ dev->data.tcp.service,
+ telnet ? ",telnet" : "",
+ dev->data.tcp.listen ? ",server,nowait" :
"");
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_UNIX:
+ virBufferVSprintf(buf,
+ "socket,id=%s,path=%s%s",
+ id,
+ dev->data.nix.path,
+ dev->data.nix.listen ? ",server,nowait" :
"");
+ break;
+ }
+}
+
+/* This function outputs an all-in-one character device command line option */
static int qemudBuildCommandLineChrDevStr(virDomainChrDefPtr dev,
char *buf,
int buflen)
--
ACK
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|