xenGetDomIdFromSxpr;
xenGetDomIdFromSxprString;
xenParseSxprChar;
-xenParseSxprSound;
xenParseSxprVifRate;
# xenconfig/xen_xm.h
}
+/**
+ * xenParseSxprSound:
+ * @def: the domain config
+ * @str: comma separated list of sound models
+ *
+ * This parses out sound devices from the domain S-expression
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
+static int
+xenParseSxprSound(virDomainDefPtr def,
+ const char *str)
+{
+ if (STREQ(str, "all")) {
+ size_t i;
+
+ /*
+ * Special compatibility code for Xen with a bogus
+ * sound=all in config.
+ *
+ * NB deliberately, don't include all possible
+ * sound models anymore, just the 2 that were
+ * historically present in Xen's QEMU.
+ *
+ * ie just es1370 + sb16.
+ *
+ * Hence use of MODEL_ES1370 + 1, instead of MODEL_LAST
+ */
+
+ if (VIR_ALLOC_N(def->sounds,
+ VIR_DOMAIN_SOUND_MODEL_ES1370 + 1) < 0)
+ return -1;
+
+
+ for (i = 0; i < (VIR_DOMAIN_SOUND_MODEL_ES1370 + 1); i++) {
+ virDomainSoundDefPtr sound;
+ if (VIR_ALLOC(sound) < 0)
+ return -1;
+ sound->model = i;
+ def->sounds[def->nsounds++] = sound;
+ }
+ } else {
+ char model[10];
+ const char *offset = str, *offset2;
+
+ do {
+ int len;
+ virDomainSoundDefPtr sound;
+ offset2 = strchr(offset, ',');
+ if (offset2)
+ len = (offset2 - offset);
+ else
+ len = strlen(offset);
+ if (virStrncpy(model, offset, len, sizeof(model)) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Sound model %s too big for destination"),
+ offset);
+ return -1;
+ }
+
+ if (VIR_ALLOC(sound) < 0)
+ return -1;
+
+ if ((sound->model = virDomainSoundModelTypeFromString(model)) < 0) {
+ VIR_FREE(sound);
+ return -1;
+ }
+
+ if (VIR_APPEND_ELEMENT(def->sounds, def->nsounds, sound) < 0) {
+ virDomainSoundDefFree(sound);
+ return -1;
+ }
+
+ offset = offset2 ? offset2 + 1 : NULL;
+ } while (offset);
+ }
+
+ return 0;
+}
+
+
static int
xenParseEmulatedDevices(virConfPtr conf, virDomainDefPtr def)
{
VIR_FREE(trate);
return ret;
}
-
-
-/**
- * xenParseSxprSound:
- * @def: the domain config
- * @str: comma separated list of sound models
- *
- * This parses out sound devices from the domain S-expression
- *
- * Returns 0 if successful or -1 if failed.
- */
-int
-xenParseSxprSound(virDomainDefPtr def,
- const char *str)
-{
- if (STREQ(str, "all")) {
- size_t i;
-
- /*
- * Special compatibility code for Xen with a bogus
- * sound=all in config.
- *
- * NB deliberately, don't include all possible
- * sound models anymore, just the 2 that were
- * historically present in Xen's QEMU.
- *
- * ie just es1370 + sb16.
- *
- * Hence use of MODEL_ES1370 + 1, instead of MODEL_LAST
- */
-
- if (VIR_ALLOC_N(def->sounds,
- VIR_DOMAIN_SOUND_MODEL_ES1370 + 1) < 0)
- return -1;
-
-
- for (i = 0; i < (VIR_DOMAIN_SOUND_MODEL_ES1370 + 1); i++) {
- virDomainSoundDefPtr sound;
- if (VIR_ALLOC(sound) < 0)
- return -1;
- sound->model = i;
- def->sounds[def->nsounds++] = sound;
- }
- } else {
- char model[10];
- const char *offset = str, *offset2;
-
- do {
- int len;
- virDomainSoundDefPtr sound;
- offset2 = strchr(offset, ',');
- if (offset2)
- len = (offset2 - offset);
- else
- len = strlen(offset);
- if (virStrncpy(model, offset, len, sizeof(model)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Sound model %s too big for destination"),
- offset);
- return -1;
- }
-
- if (VIR_ALLOC(sound) < 0)
- return -1;
-
- if ((sound->model = virDomainSoundModelTypeFromString(model)) < 0) {
- VIR_FREE(sound);
- return -1;
- }
-
- if (VIR_APPEND_ELEMENT(def->sounds, def->nsounds, sound) < 0) {
- virDomainSoundDefFree(sound);
- return -1;
- }
-
- offset = offset2 ? offset2 + 1 : NULL;
- } while (offset);
- }
-
- return 0;
-}
int xenGetDomIdFromSxprString(const char *sexpr, int *id);
int xenGetDomIdFromSxpr(const struct sexpr *root, int *id);
-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);