That's the only file using the helper function.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/libvirt_xenconfig.syms | 1 -
src/xenconfig/xen_common.c | 79 ++++++++++++++++++++++++++++++++++++++
src/xenconfig/xen_sxpr.c | 78 -------------------------------------
src/xenconfig/xen_sxpr.h | 2 -
4 files changed, 79 insertions(+), 81 deletions(-)
diff --git a/src/libvirt_xenconfig.syms b/src/libvirt_xenconfig.syms
index e9fab0a8d0..d5b4115c5a 100644
--- a/src/libvirt_xenconfig.syms
+++ b/src/libvirt_xenconfig.syms
@@ -3,7 +3,6 @@
#
# xenconfig/xen_sxpr.h
-xenFormatSxprChr;
xenGetDomIdFromSxpr;
xenGetDomIdFromSxprString;
xenParseSxpr;
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 059bf785bb..41dffd605d 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1260,6 +1260,85 @@ xenParseConfigCommon(virConfPtr conf,
}
+/**
+ * xenFormatSxprChr:
+ * @def: the domain config
+ * @buf: a buffer for the result S-expression
+ *
+ * Convert the character device part of the domain config into a S-expression
+ * in buf.
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+static int
+xenFormatSxprChr(virDomainChrDefPtr def,
+ virBufferPtr buf)
+{
+ const char *type = virDomainChrTypeToString(def->source->type);
+
+ if (!type) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("unexpected chr device type"));
+ return -1;
+ }
+
+ switch (def->source->type) {
+ case VIR_DOMAIN_CHR_TYPE_NULL:
+ case VIR_DOMAIN_CHR_TYPE_STDIO:
+ case VIR_DOMAIN_CHR_TYPE_VC:
+ case VIR_DOMAIN_CHR_TYPE_PTY:
+ virBufferAdd(buf, type, -1);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_FILE:
+ case VIR_DOMAIN_CHR_TYPE_PIPE:
+ virBufferAsprintf(buf, "%s:", type);
+ virBufferEscapeSexpr(buf, "%s", def->source->data.file.path);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_DEV:
+ virBufferEscapeSexpr(buf, "%s", def->source->data.file.path);
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_TCP:
+ virBufferAsprintf(buf, "%s:%s:%s%s",
+ (def->source->data.tcp.protocol
+ == VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW ?
+ "tcp" : "telnet"),
+ NULLSTR_EMPTY(def->source->data.tcp.host),
+ NULLSTR_EMPTY(def->source->data.tcp.service),
+ (def->source->data.tcp.listen ?
+ ",server,nowait" : ""));
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_UDP:
+ virBufferAsprintf(buf, "%s:%s:%s@%s:%s", type,
+ NULLSTR_EMPTY(def->source->data.udp.connectHost),
+ NULLSTR_EMPTY(def->source->data.udp.connectService),
+ NULLSTR_EMPTY(def->source->data.udp.bindHost),
+ NULLSTR_EMPTY(def->source->data.udp.bindService));
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_UNIX:
+ virBufferAsprintf(buf, "%s:", type);
+ virBufferEscapeSexpr(buf, "%s", def->source->data.nix.path);
+ if (def->source->data.nix.listen)
+ virBufferAddLit(buf, ",server,nowait");
+ break;
+
+ default:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported chr device type '%s'"), type);
+ return -1;
+ }
+
+ if (virBufferCheckError(buf) < 0)
+ return -1;
+
+ return 0;
+}
+
+
static int
xenFormatSerial(virConfValuePtr list, virDomainChrDefPtr serial)
{
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index 3a1c912963..a9a420ac3a 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1491,81 +1491,3 @@ xenParseSxprString(const char *sexpr,
return def;
}
-
-/**
- * xenFormatSxprChr:
- * @def: the domain config
- * @buf: a buffer for the result S-expression
- *
- * Convert the character device part of the domain config into a S-expression
- * in buf.
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xenFormatSxprChr(virDomainChrDefPtr def,
- virBufferPtr buf)
-{
- const char *type = virDomainChrTypeToString(def->source->type);
-
- if (!type) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("unexpected chr device type"));
- return -1;
- }
-
- switch (def->source->type) {
- case VIR_DOMAIN_CHR_TYPE_NULL:
- case VIR_DOMAIN_CHR_TYPE_STDIO:
- case VIR_DOMAIN_CHR_TYPE_VC:
- case VIR_DOMAIN_CHR_TYPE_PTY:
- virBufferAdd(buf, type, -1);
- break;
-
- case VIR_DOMAIN_CHR_TYPE_FILE:
- case VIR_DOMAIN_CHR_TYPE_PIPE:
- virBufferAsprintf(buf, "%s:", type);
- virBufferEscapeSexpr(buf, "%s", def->source->data.file.path);
- break;
-
- case VIR_DOMAIN_CHR_TYPE_DEV:
- virBufferEscapeSexpr(buf, "%s", def->source->data.file.path);
- break;
-
- case VIR_DOMAIN_CHR_TYPE_TCP:
- virBufferAsprintf(buf, "%s:%s:%s%s",
- (def->source->data.tcp.protocol
- == VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW ?
- "tcp" : "telnet"),
- NULLSTR_EMPTY(def->source->data.tcp.host),
- NULLSTR_EMPTY(def->source->data.tcp.service),
- (def->source->data.tcp.listen ?
- ",server,nowait" : ""));
- break;
-
- case VIR_DOMAIN_CHR_TYPE_UDP:
- virBufferAsprintf(buf, "%s:%s:%s@%s:%s", type,
- NULLSTR_EMPTY(def->source->data.udp.connectHost),
- NULLSTR_EMPTY(def->source->data.udp.connectService),
- NULLSTR_EMPTY(def->source->data.udp.bindHost),
- NULLSTR_EMPTY(def->source->data.udp.bindService));
- break;
-
- case VIR_DOMAIN_CHR_TYPE_UNIX:
- virBufferAsprintf(buf, "%s:", type);
- virBufferEscapeSexpr(buf, "%s", def->source->data.nix.path);
- if (def->source->data.nix.listen)
- virBufferAddLit(buf, ",server,nowait");
- break;
-
- default:
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unsupported chr device type '%s'"), type);
- return -1;
- }
-
- if (virBufferCheckError(buf) < 0)
- return -1;
-
- return 0;
-}
diff --git a/src/xenconfig/xen_sxpr.h b/src/xenconfig/xen_sxpr.h
index 7f66af6405..c888d06950 100644
--- a/src/xenconfig/xen_sxpr.h
+++ b/src/xenconfig/xen_sxpr.h
@@ -49,5 +49,3 @@ int xenParseSxprSound(virDomainDefPtr def, const char *str);
virDomainChrDefPtr xenParseSxprChar(const char *value, const char *tty);
int xenParseSxprVifRate(const char *rate, unsigned long long *kbytes_per_sec);
-
-int xenFormatSxprChr(virDomainChrDefPtr def, virBufferPtr buf);
--
2.21.0