summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2012-06-29 11:19:40 +0200
committerGuido Günther <agx@sigxcpu.org>2012-06-29 11:19:40 +0200
commit505f873d6f609a476c8cc6e52da31f7717e3e98e (patch)
treecafc3c75ed2e50f344ddfe84aa48043709196bd1 /src
parent9deae39bc818603d8cfe8dd4061159f8b2985bd4 (diff)
New upstream version 0.9.13~rc2
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile.in14
-rw-r--r--src/conf/domain_event.c6
-rw-r--r--src/cpu/cpu.c2
-rw-r--r--src/cpu/cpu_s390.c77
-rw-r--r--src/cpu/cpu_s390.h31
-rw-r--r--src/libvirt.c6
-rw-r--r--src/locking/lock_driver_sanlock.c2
-rw-r--r--src/nodeinfo.c11
-rw-r--r--src/qemu/qemu_capabilities.c5
-rw-r--r--src/qemu/qemu_driver.c3
-rw-r--r--src/qemu/qemu_process.c21
-rw-r--r--src/storage/storage_backend_rbd.c2
-rw-r--r--src/storage/storage_driver.c15
-rw-r--r--src/util/sysinfo.c155
15 files changed, 339 insertions, 12 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e40909bbb..2309984ed 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -566,6 +566,7 @@ CPU_SOURCES = \
cpu/cpu.h cpu/cpu.c \
cpu/cpu_generic.h cpu/cpu_generic.c \
cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \
+ cpu/cpu_s390.h cpu/cpu_s390.c \
cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \
cpu/cpu_powerpc.c
diff --git a/src/Makefile.in b/src/Makefile.in
index f0d673b8e..9f48cf613 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -581,8 +581,8 @@ libvirt_conf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(LDFLAGS) -o $@
libvirt_cpu_la_LIBADD =
am__objects_18 = libvirt_cpu_la-cpu.lo libvirt_cpu_la-cpu_generic.lo \
- libvirt_cpu_la-cpu_x86.lo libvirt_cpu_la-cpu_map.lo \
- libvirt_cpu_la-cpu_powerpc.lo
+ libvirt_cpu_la-cpu_x86.lo libvirt_cpu_la-cpu_s390.lo \
+ libvirt_cpu_la-cpu_map.lo libvirt_cpu_la-cpu_powerpc.lo
am_libvirt_cpu_la_OBJECTS = $(am__objects_18)
libvirt_cpu_la_OBJECTS = $(am_libvirt_cpu_la_OBJECTS)
libvirt_cpu_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@@ -3255,6 +3255,7 @@ CPU_SOURCES = \
cpu/cpu.h cpu/cpu.c \
cpu/cpu_generic.h cpu/cpu_generic.c \
cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \
+ cpu/cpu_s390.h cpu/cpu_s390.c \
cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \
cpu/cpu_powerpc.c
@@ -4007,6 +4008,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_cpu_la-cpu_generic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_cpu_la-cpu_map.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_cpu_la-cpu_powerpc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_cpu_la-cpu_s390.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_cpu_la-cpu_x86.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_driver_esx_la-esx_device_monitor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_driver_esx_la-esx_driver.Plo@am__quote@
@@ -4594,6 +4596,14 @@ libvirt_cpu_la-cpu_x86.lo: cpu/cpu_x86.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_cpu_la_CFLAGS) $(CFLAGS) -c -o libvirt_cpu_la-cpu_x86.lo `test -f 'cpu/cpu_x86.c' || echo '$(srcdir)/'`cpu/cpu_x86.c
+libvirt_cpu_la-cpu_s390.lo: cpu/cpu_s390.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_cpu_la_CFLAGS) $(CFLAGS) -MT libvirt_cpu_la-cpu_s390.lo -MD -MP -MF $(DEPDIR)/libvirt_cpu_la-cpu_s390.Tpo -c -o libvirt_cpu_la-cpu_s390.lo `test -f 'cpu/cpu_s390.c' || echo '$(srcdir)/'`cpu/cpu_s390.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvirt_cpu_la-cpu_s390.Tpo $(DEPDIR)/libvirt_cpu_la-cpu_s390.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpu/cpu_s390.c' object='libvirt_cpu_la-cpu_s390.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_cpu_la_CFLAGS) $(CFLAGS) -c -o libvirt_cpu_la-cpu_s390.lo `test -f 'cpu/cpu_s390.c' || echo '$(srcdir)/'`cpu/cpu_s390.c
+
libvirt_cpu_la-cpu_map.lo: cpu/cpu_map.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_cpu_la_CFLAGS) $(CFLAGS) -MT libvirt_cpu_la-cpu_map.lo -MD -MP -MF $(DEPDIR)/libvirt_cpu_la-cpu_map.Tpo -c -o libvirt_cpu_la-cpu_map.lo `test -f 'cpu/cpu_map.c' || echo '$(srcdir)/'`cpu/cpu_map.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvirt_cpu_la-cpu_map.Tpo $(DEPDIR)/libvirt_cpu_la-cpu_map.Plo
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 4ecc41350..3cfd940c6 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -363,7 +363,11 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
for (i = 0 ; i < cbList->count ; i++) {
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
cbList->callbacks[i]->eventID == eventID &&
- cbList->callbacks[i]->conn == conn) {
+ cbList->callbacks[i]->conn == conn &&
+ ((dom && cbList->callbacks[i]->dom &&
+ memcmp(cbList->callbacks[i]->dom->uuid,
+ dom->uuid, VIR_UUID_BUFLEN) == 0) ||
+ (!dom && !cbList->callbacks[i]->dom))) {
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("event callback already tracked"));
return -1;
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index b8ccd24df..70a1da5c4 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -29,6 +29,7 @@
#include "cpu.h"
#include "cpu_x86.h"
#include "cpu_powerpc.h"
+#include "cpu_s390.h"
#include "cpu_generic.h"
@@ -38,6 +39,7 @@
static struct cpuArchDriver *drivers[] = {
&cpuDriverX86,
&cpuDriverPowerPC,
+ &cpuDriverS390,
/* generic driver must always be the last one */
&cpuDriverGeneric
};
diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c
new file mode 100644
index 000000000..eb2acef8c
--- /dev/null
+++ b/src/cpu/cpu_s390.c
@@ -0,0 +1,77 @@
+/*
+ * cpu_s390.c: CPU driver for s390(x) CPUs
+ *
+ * Copyright IBM Corp. 2012
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Thang Pham <thang.pham@us.ibm.com>
+ */
+
+#include <config.h>
+
+#include "memory.h"
+#include "cpu.h"
+
+
+#define VIR_FROM_THIS VIR_FROM_CPU
+
+static const char *archs[] = { "s390", "s390x" };
+
+static union cpuData *
+s390NodeData(void)
+{
+ union cpuData *data;
+
+ if (VIR_ALLOC(data) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ return data;
+}
+
+
+static int
+s390Decode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
+ const union cpuData *data ATTRIBUTE_UNUSED,
+ const char **models ATTRIBUTE_UNUSED,
+ unsigned int nmodels ATTRIBUTE_UNUSED,
+ const char *preferred ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static void
+s390DataFree(union cpuData *data)
+{
+ VIR_FREE(data);
+}
+
+struct cpuArchDriver cpuDriverS390 = {
+ .name = "s390",
+ .arch = archs,
+ .narch = ARRAY_CARDINALITY(archs),
+ .compare = NULL,
+ .decode = s390Decode,
+ .encode = NULL,
+ .free = s390DataFree,
+ .nodeData = s390NodeData,
+ .guestData = NULL,
+ .baseline = NULL,
+ .update = NULL,
+ .hasFeature = NULL,
+};
diff --git a/src/cpu/cpu_s390.h b/src/cpu/cpu_s390.h
new file mode 100644
index 000000000..4f28cf9ec
--- /dev/null
+++ b/src/cpu/cpu_s390.h
@@ -0,0 +1,31 @@
+/*
+ * cpu_s390.h: CPU driver for s390(x) CPUs
+ *
+ * Copyright IBM Corp. 2012
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Thang Pham <thang.pham@us.ibm.com>
+ */
+
+#ifndef __VIR_CPU_S390X_H__
+# define __VIR_CPU_S390X_H__
+
+# include "cpu.h"
+
+extern struct cpuArchDriver cpuDriverS390;
+
+#endif /* __VIR_CPU_S390X_H__ */
diff --git a/src/libvirt.c b/src/libvirt.c
index 0aa50cb6e..db6ba15e1 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2127,11 +2127,11 @@ error:
* Destroy the domain object. The running instance is shutdown if not down
* already and all resources used by it are given back to the hypervisor. This
* does not free the associated virDomainPtr object.
- * This function may require privileged access
+ * This function may require privileged access.
*
* virDomainDestroy first requests that a guest terminate
* (e.g. SIGTERM), then waits for it to comply. After a reasonable
- * timeout, if the guest still exists, virDomainDestory will
+ * timeout, if the guest still exists, virDomainDestroy will
* forcefully terminate the guest (e.g. SIGKILL) if necessary (which
* may produce undesirable results, for example unflushed disk cache
* in the guest). To avoid this possibility, it's recommended to
@@ -12169,7 +12169,7 @@ error:
/**
* virStoragePoolGetXMLDesc:
* @pool: pointer to storage pool
- * @flags: bitwise-OR of virDomainXMLFlags
+ * @flags: bitwise-OR of virStorageXMLFlags
*
* Fetch an XML document describing all aspects of the
* storage pool. This is suitable for later feeding back
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 9668ca960..26bdde834 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -60,7 +60,7 @@
* too old to provide that define, and probably the functionality too
*/
#ifndef SANLK_RES_SHARED
-#define SANLK_RES_SHARED 0x4
+# define SANLK_RES_SHARED 0x4
#endif
typedef struct _virLockManagerSanlockDriver virLockManagerSanlockDriver;
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index f7d0cc622..819f9541b 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -315,6 +315,11 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
* and parsed in next iteration, because it is not in expected
* format and thus lead to error. */
}
+# elif defined(__s390__) || \
+ defined(__s390x__)
+ /* s390x has no realistic value for CPU speed,
+ * assign a value of zero to signify this */
+ nodeinfo->mhz = 0;
# else
# warning Parser for /proc/cpuinfo needs to be adapted for your architecture
# endif
@@ -350,7 +355,13 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
nodeinfo->cpus++;
/* Parse core */
+# if defined(__s390__) || \
+ defined(__s390x__)
+ /* logical cpu is equivalent to a core on s390 */
+ core = cpu;
+# else
core = virNodeGetCpuValue(sysfs_cpudir, cpu, "topology/core_id", false);
+# endif
if (!CPU_ISSET(core, &core_mask)) {
CPU_SET(core, &core_mask);
nodeinfo->cores++;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 578daebdb..1e12a3995 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1514,6 +1514,11 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIBUS);
}
+ /* S390 and probably other archs do not support no-acpi -
+ maybe the qemu option parsing should be re-thought. */
+ if (STRPREFIX(arch, "s390"))
+ qemuCapsClear(flags, QEMU_CAPS_NO_ACPI);
+
/* qemuCapsExtractDeviceStr will only set additional flags if qemu
* understands the 0.13.0+ notion of "-device driver,". */
if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) &&
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2177c3096..2f934040e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2037,7 +2037,8 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
/* Lack of balloon support is a fatal error */
if (r == 0) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot set memory of an active domain"));
+ _("Unable to change memory of active domain without "
+ "the balloon device and guest OS balloon driver"));
goto endjob;
}
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1df363757..c5140c3c9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3429,6 +3429,27 @@ int qemuProcessStart(virConnectPtr conn,
vm->def->graphics[0]->data.spice.tlsPort = tlsPort;
}
}
+
+ if (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
+ vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ virDomainGraphicsDefPtr graphics = vm->def->graphics[0];
+ if (graphics->nListens == 0) {
+ if (VIR_EXPAND_N(graphics->listens, graphics->nListens, 1) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ graphics->listens[0].type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
+ if (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
+ graphics->listens[0].address = strdup(driver->vncListen);
+ else
+ graphics->listens[0].address = strdup(driver->spiceListen);
+ if (!graphics->listens[0].address) {
+ VIR_SHRINK_N(graphics->listens, graphics->nListens, 1);
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
+ }
}
if (virFileMakePath(driver->logDir) < 0) {
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 3e7464c5c..7615dcc37 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -237,7 +237,7 @@ static int volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
vol->type = VIR_STORAGE_VOL_NETWORK;
VIR_FREE(vol->target.path);
- if (virAsprintf(&vol->target.path, "rbd:%s/%s",
+ if (virAsprintf(&vol->target.path, "%s/%s",
pool->def->source.name,
vol->name) == -1) {
virReportOOMError();
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 88f380906..fbc630d2b 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -794,6 +794,10 @@ storagePoolDestroy(virStoragePoolPtr obj) {
if (pool->configFile == NULL) {
virStoragePoolObjRemove(&driver->pools, pool);
pool = NULL;
+ } else if (pool->newDef) {
+ virStoragePoolDefFree(pool->def);
+ pool->def = pool->newDef;
+ pool->newDef = NULL;
}
ret = 0;
@@ -804,7 +808,6 @@ cleanup:
return ret;
}
-
static int
storagePoolDelete(virStoragePoolPtr obj,
unsigned int flags) {
@@ -957,9 +960,10 @@ storagePoolGetXMLDesc(virStoragePoolPtr obj,
{
virStorageDriverStatePtr driver = obj->conn->storagePrivateData;
virStoragePoolObjPtr pool;
+ virStoragePoolDefPtr def;
char *ret = NULL;
- virCheckFlags(0, NULL);
+ virCheckFlags(VIR_STORAGE_XML_INACTIVE, NULL);
storageDriverLock(driver);
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
@@ -971,7 +975,12 @@ storagePoolGetXMLDesc(virStoragePoolPtr obj,
goto cleanup;
}
- ret = virStoragePoolDefFormat(pool->def);
+ if ((flags & VIR_STORAGE_XML_INACTIVE) && pool->newDef)
+ def = pool->newDef;
+ else
+ def = pool->def;
+
+ ret = virStoragePoolDefFormat(def);
cleanup:
if (pool)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index 78efc3299..20482db3c 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -44,6 +44,7 @@
__FUNCTION__, __LINE__, __VA_ARGS__)
#define SYSINFO_SMBIOS_DECODER "dmidecode"
+#define SYSINFO "/proc/sysinfo"
#define CPUINFO "/proc/cpuinfo"
VIR_ENUM_IMPL(virSysinfo, VIR_SYSINFO_LAST,
@@ -241,6 +242,160 @@ no_memory:
return NULL;
}
+#elif defined(__s390__) || defined(__s390x__)
+
+static int
+virSysinfoParseSystem(const char *base, virSysinfoDefPtr ret)
+{
+ char *cur, *eol = NULL;
+ const char *property;
+
+ /* Return if Manufacturer field is not found */
+ if ((cur = strstr(base, "Manufacturer")) == NULL)
+ return 0;
+
+ base = cur;
+ if ((cur = strstr(base, "Manufacturer")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol) && ((property = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&property);
+ ret->system_manufacturer = (char *) property;
+ }
+ if ((cur = strstr(base, "Type")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol) && ((property = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&property);
+ ret->system_family = (char *) property;
+ }
+ if ((cur = strstr(base, "Sequence Code")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol) && ((property = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&property);
+ ret->system_serial = (char *) property;
+ }
+
+ return 0;
+
+no_memory:
+ return -1;
+}
+
+static int
+virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
+{
+ char *cur, *eol, *tmp_base;
+ char *manufacturer;
+ const char *tmp;
+ virSysinfoProcessorDefPtr processor;
+
+ if ((cur = strstr(base, "vendor_id")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol) && ((tmp = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&tmp);
+ manufacturer = (char *) tmp;
+ }
+
+ /* Find processor N: line and gather the processor manufacturer, version,
+ * serial number, and family */
+ while ((tmp_base = strstr(base, "processor ")) != NULL) {
+ base = tmp_base;
+ eol = strchr(base, '\n');
+ cur = strchr(base, ':') + 1;
+
+ if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) {
+ goto no_memory;
+ }
+
+ processor = &ret->processor[ret->nprocessor - 1];
+
+ /* Set the processor manufacturer */
+ processor->processor_manufacturer = manufacturer;
+
+ if ((cur = strstr(base, "version =")) != NULL) {
+ cur += sizeof("version =");
+ eol = strchr(cur, ',');
+ if ((eol) &&
+ ((processor->processor_version = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ }
+ if ((cur = strstr(base, "identification =")) != NULL) {
+ cur += sizeof("identification =");
+ eol = strchr(cur, ',');
+ if ((eol) &&
+ ((processor->processor_serial_number = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ }
+ if ((cur = strstr(base, "machine =")) != NULL) {
+ cur += sizeof("machine =");
+ eol = strchr(cur, '\n');
+ if ((eol) &&
+ ((processor->processor_family = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ }
+
+ base = cur;
+ }
+
+ return 0;
+
+no_memory:
+ return -1;
+}
+
+/* virSysinfoRead for s390x
+ * Gathers sysinfo data from /proc/sysinfo and /proc/cpuinfo */
+virSysinfoDefPtr
+virSysinfoRead(void) {
+ virSysinfoDefPtr ret = NULL;
+ char *outbuf = NULL;
+
+ if (VIR_ALLOC(ret) < 0)
+ goto no_memory;
+
+ /* Gather info from /proc/cpuinfo */
+ if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
+ virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to open %s"), CPUINFO);
+ return NULL;
+ }
+
+ ret->nprocessor = 0;
+ ret->processor = NULL;
+ if (virSysinfoParseProcessor(outbuf, ret) < 0)
+ goto no_memory;
+
+ /* Free buffer before reading next file */
+ VIR_FREE(outbuf);
+
+ /* Gather info from /proc/sysinfo */
+ if (virFileReadAll(SYSINFO, 4096, &outbuf) < 0) {
+ virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to open %s"), SYSINFO);
+ return NULL;
+ }
+
+ if (virSysinfoParseSystem(outbuf, ret) < 0)
+ goto no_memory;
+
+ return ret;
+
+no_memory:
+ VIR_FREE(outbuf);
+ return NULL;
+}
+
#elif defined(WIN32) || \
!(defined(__x86_64__) || \
defined(__i386__) || \