diff options
author | 2009-11-13 16:05:27 +0100 | |
---|---|---|
committer | 2009-11-13 16:05:27 +0100 | |
commit | da82b03fb09138390049e8c796d6084ae6b521b4 (patch) | |
tree | b53c7f9ad049cde929841c757a469fe41aa02200 | |
parent | Small indentation cleanup of domain schema (diff) | |
download | libvirt-da82b03fb09138390049e8c796d6084ae6b521b4.tar.gz libvirt-da82b03fb09138390049e8c796d6084ae6b521b4.tar.bz2 libvirt-da82b03fb09138390049e8c796d6084ae6b521b4.zip |
Small guestfwd code cleanup
* src/qemu/qemu_conf.c: Remove and inline qemudBuildCommandLineChrDevTargetStr
-rw-r--r-- | src/qemu/qemu_conf.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 62b42fe9e..c807688e0 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1495,29 +1495,6 @@ static void qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev, } } -static int qemudBuildCommandLineChrDevTargetStr(virDomainChrDefPtr dev, - const char *const id, - virBufferPtr buf) -{ - int ret = 0; - const char *addr = NULL; - - int port; - switch (dev->targetType) { - case VIR_DOMAIN_CHR_TARGET_TYPE_GUESTFWD: - addr = virSocketFormatAddr(dev->target.addr); - port = virSocketGetPort(dev->target.addr); - - virBufferVSprintf(buf, "user,guestfwd=tcp:%s:%i-chardev:%s", - addr, port, id); - - VIR_FREE(addr); - break; - } - - return ret; -} - static void qemudBuildCommandLineChrDevStr(virDomainChrDefPtr dev, virBufferPtr buf) { @@ -2205,7 +2182,14 @@ int qemudBuildCommandLine(virConnectPtr conn, ADD_ARG_LIT("-chardev"); ADD_ARG(virBufferContentAndReset(&buf)); - qemudBuildCommandLineChrDevTargetStr(channel, id, &buf); + const char *addr = virSocketFormatAddr(channel->target.addr); + int port = virSocketGetPort(channel->target.addr); + + virBufferVSprintf(&buf, "user,guestfwd=tcp:%s:%i-chardev:%s", + addr, port, id); + + VIR_FREE(addr); + if (virBufferError(&buf)) goto error; |