[libvirt] [PATCH] conf: Prevent crash of libvirtd without channel target name
by Alex Jia
* src/conf/domain_conf.c (virDomainChannelDefCheckABIStability): avoid crashing libvirtd due
to derefing a NULL pointer.
For details, please see bug:
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=808371
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/conf/domain_conf.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 24e10e6..4caef6f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9597,10 +9597,10 @@ static bool virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
switch (src->targetType) {
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
- if (STRNEQ(src->target.name, dst->target.name)) {
+ if (STRNEQ_NULLABLE(src->target.name, dst->target.name)) {
virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target channel name %s does not match source %s"),
- dst->target.name, src->target.name);
+ NULLSTR(dst->target.name), NULLSTR(src->target.name));
goto cleanup;
}
break;
--
1.7.1
12 years, 7 months
[libvirt] [PATCH] build: silence recent syntax check violations
by Eric Blake
An upstream gnulib bug meant that some of our syntax checks
weren't being run. Fix up our offenders before we upgrade to
a newer gnulib.
* src/util/virnetdevtap.c (virNetDevTapCreate): Use flags.
* tests/lxcxml2xmltest.c (mymain): Strip useless ().
---
The gnulib bug was here:
https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00194.html
I tested this by temporarily using the fixed gnulib maint.mk.
Pushing under the trivial rule. I can't call it a build breaker,
because it won't break the build without a gnulib update.
I'm reluctant to update the .gnulib submodule this late in the
game without some review, as we've had bad luck with a submodule
update after the rc1 build in previous releases, so I'm saving
that for another day. Besides, I'm waiting for a review of a
patch that fixes ssize_t for mingw, and it isn't worth a gnulib
update without that fix.
src/util/virnetdevtap.c | 7 +++++--
tests/lxcxml2xmltest.c | 4 ++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 0b3ac46..717b6ac 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -129,12 +129,14 @@ virNetDevProbeVnetHdr(int tapfd)
*/
int virNetDevTapCreate(char **ifname,
int *tapfd,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
int fd;
struct ifreq ifr;
int ret = -1;
+ virCheckFlags(VIR_NETDEV_TAP_CREATE_VNET_HDR, -1);
+
if ((fd = open("/dev/net/tun", O_RDWR)) < 0) {
virReportSystemError(errno, "%s",
_("Unable to open /dev/net/tun, is tun module loaded?"));
@@ -237,8 +239,9 @@ cleanup:
#else /* ! TUNSETIFF */
int virNetDevTapCreate(char **ifname ATTRIBUTE_UNUSED,
int *tapfd ATTRIBUTE_UNUSED,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
+ virCheckFlags(0, -1);
virReportSystemError(ENOSYS, "%s",
_("Unable to create TAP devices on this platform"));
return -1;
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index 558bd01..6a87939 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -99,7 +99,7 @@ mymain(void)
int ret = 0;
if ((caps = testLXCCapsInit()) == NULL)
- return (EXIT_FAILURE);
+ return EXIT_FAILURE;
# define DO_TEST_FULL(name, is_different, inactive) \
do { \
@@ -124,7 +124,7 @@ mymain(void)
virCapabilitiesFree(caps);
- return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
+ return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)
--
1.7.7.6
12 years, 7 months
[libvirt] [PATCH] build: avoid 'devname' for BSD
by Eric Blake
Commit 21b5daa1 was the last time we cleaned this up.
* tools/virt-host-validate-common.c (virHostValidateDevice):
Rename local variable.
---
Pushing under the build-breaker rule.
I considered adding a syntax-check rule to catch this, but we use
'devname' in enough other places where the name pollution was not
happening as to make writing a rule difficult.
tools/virt-host-validate-common.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index bd118be..066343c 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -113,13 +113,13 @@ void virHostMsgFail(virHostValidateLevel level,
int virHostValidateDevice(const char *hvname,
- const char *devname,
+ const char *dev_name,
virHostValidateLevel level,
const char *hint)
{
- virHostMsgCheck(hvname, "for device %s", devname);
+ virHostMsgCheck(hvname, "for device %s", dev_name);
- if (access(devname, R_OK|W_OK) < 0) {
+ if (access(dev_name, R_OK|W_OK) < 0) {
virHostMsgFail(level, hint);
return -1;
}
--
1.7.7.6
12 years, 7 months
[libvirt] [PATCH] Consistent style for usage of sizeof operator
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The code is splattered with a mix of
sizeof foo
sizeof (foo)
sizeof(foo)
Standardize on sizeof(foo) and add a syntax check rule to
enforce it
---
cfg.mk | 4 +
daemon/libvirtd.c | 2 +-
daemon/remote.c | 32 ++++----
examples/domain-events/events-c/event-test.c | 2 +-
src/esx/esx_driver.c | 14 ++--
src/esx/esx_storage_driver.c | 14 ++--
src/esx/esx_util.c | 2 +-
src/esx/esx_vi.c | 2 +-
src/esx/esx_vi_types.c | 2 +-
src/hyperv/hyperv_driver.c | 6 +-
src/internal.h | 4 +-
src/libvirt.c | 10 ++-
src/libxl/libxl_driver.c | 8 +-
src/lxc/lxc_container.c | 2 +-
src/lxc/lxc_driver.c | 4 +-
src/node_device/node_device_udev.c | 2 +-
src/nodeinfo.c | 4 +-
src/qemu/qemu_agent.c | 2 +-
src/qemu/qemu_driver.c | 20 +++---
src/qemu/qemu_hotplug.c | 6 +-
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_monitor_json.c | 2 +-
src/qemu/qemu_monitor_text.c | 2 +-
src/qemu/qemu_process.c | 16 ++--
src/remote/remote_driver.c | 96 +++++++++++++-------------
src/rpc/gendispatch.pl | 8 +-
src/rpc/virnetclient.c | 2 +-
src/rpc/virnetsaslcontext.c | 2 +-
src/rpc/virnetsocket.c | 12 ++--
src/security/virt-aa-helper.c | 6 +-
src/storage/storage_backend_iscsi.c | 4 +-
src/storage/storage_driver.c | 2 +-
src/uml/uml_driver.c | 14 ++--
src/util/buf.h | 2 +-
src/util/command.c | 2 +-
src/util/ebtables.c | 2 +-
src/util/memory.h | 4 +-
src/util/pci.c | 2 +-
src/util/stats_linux.c | 2 +-
src/util/storage_file.c | 2 +-
src/util/util.c | 4 +-
src/util/uuid.c | 2 +-
src/util/viraudit.c | 2 +-
src/util/virauth.c | 4 +-
src/util/virnetdevmacvlan.c | 4 +-
src/util/virpidfile.c | 2 +-
src/util/virterror.c | 2 +-
src/vbox/vbox_MSCOMGlue.c | 4 +-
src/vbox/vbox_tmpl.c | 8 +-
src/xen/block_stats.c | 6 +-
src/xen/xen_hypervisor.c | 22 +++---
src/xen/xend_internal.c | 6 +-
src/xenapi/xenapi_utils.c | 2 +-
tests/sexpr2xmltest.c | 2 +-
tests/virnetsockettest.c | 2 +-
tools/virsh.c | 14 ++--
56 files changed, 209 insertions(+), 203 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 2cb066e..9a32ce1 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -813,3 +813,7 @@ exclude_file_name_regexp--sc_trailing_blank = \.(fig|gif|ico|png)$$
exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
+
+exclude_file_name_regexp--sc_size_of_brackets = cfg.mk
+
+exclude_file_name_regexp--sc_const_long_option = tools/virt-host-validate.c
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 44fb363..af07e84 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1441,7 +1441,7 @@ int main(int argc, char **argv) {
if ((statuswrite = daemonForkIntoBackground(argv[0])) < 0) {
VIR_ERROR(_("Failed to fork as daemon: %s"),
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
goto cleanup;
}
}
diff --git a/daemon/remote.c b/daemon/remote.c
index 4fd676d..b71ffa2 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -132,7 +132,7 @@ static int remoteRelayDomainEventLifecycle(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain lifecycle event %d %d", event, detail);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.event = event;
data.detail = detail;
@@ -157,7 +157,7 @@ static int remoteRelayDomainEventReboot(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain reboot event %s %d", dom->name, dom->id);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@@ -182,7 +182,7 @@ static int remoteRelayDomainEventRTCChange(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain rtc change event %s %d %lld", dom->name, dom->id, offset);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.offset = offset;
@@ -208,7 +208,7 @@ static int remoteRelayDomainEventWatchdog(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain watchdog event %s %d %d", dom->name, dom->id, action);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.action = action;
@@ -236,7 +236,7 @@ static int remoteRelayDomainEventIOError(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain io error %s %d %s %s %d", dom->name, dom->id, srcPath, devAlias, action);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
data.srcPath = strdup(srcPath);
if (data.srcPath == NULL)
goto mem_error;
@@ -277,7 +277,7 @@ static int remoteRelayDomainEventIOErrorReason(virConnectPtr conn ATTRIBUTE_UNUS
dom->name, dom->id, srcPath, devAlias, action, reason);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
data.srcPath = strdup(srcPath);
if (data.srcPath == NULL)
goto mem_error;
@@ -333,7 +333,7 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
}
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
data.phase = phase;
data.local.family = local->family;
data.remote.family = remote->family;
@@ -409,7 +409,7 @@ static int remoteRelayDomainEventBlockJob(virConnectPtr conn ATTRIBUTE_UNUSED,
dom->name, dom->id, path, type, status);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
data.path = strdup(path);
if (data.path == NULL)
goto mem_error;
@@ -443,7 +443,7 @@ static int remoteRelayDomainEventControlError(virConnectPtr conn ATTRIBUTE_UNUSE
VIR_DEBUG("Relaying domain control error %s %d", dom->name, dom->id);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@@ -473,7 +473,7 @@ static int remoteRelayDomainEventDiskChange(virConnectPtr conn ATTRIBUTE_UNUSED,
dom->name, dom->id, oldSrcPath, newSrcPath, devAlias, reason);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
if (oldSrcPath &&
((VIR_ALLOC(oldSrcPath_p) < 0) ||
!(*oldSrcPath_p = strdup(oldSrcPath))))
@@ -521,7 +521,7 @@ static int remoteRelayDomainEventTrayChange(virConnectPtr conn ATTRIBUTE_UNUSED,
dom->name, dom->id, devAlias, reason);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
if (!(data.devAlias = strdup(devAlias))) {
virReportOOMError();
@@ -550,7 +550,7 @@ static int remoteRelayDomainEventPMWakeup(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain %s %d system pmwakeup", dom->name, dom->id);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@@ -572,7 +572,7 @@ static int remoteRelayDomainEventPMSuspend(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain %s %d system pmsuspend", dom->name, dom->id);
/* build return data */
- memset(&data, 0, sizeof data);
+ memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@@ -1357,7 +1357,7 @@ remoteDispatchNodeGetSecurityModel(virNetServerPtr server ATTRIBUTE_UNUSED,
goto cleanup;
}
- memset(&secmodel, 0, sizeof secmodel);
+ memset(&secmodel, 0, sizeof(secmodel));
if (virNodeGetSecurityModel(priv->conn, &secmodel) < 0)
goto cleanup;
@@ -2710,7 +2710,7 @@ remoteDispatchAuthPolkit(virNetServerPtr server,
if (!(pkaction = polkit_action_new())) {
char ebuf[1024];
VIR_ERROR(_("Failed to create polkit action %s"),
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
polkit_caller_unref(pkcaller);
goto authfail;
}
@@ -2721,7 +2721,7 @@ remoteDispatchAuthPolkit(virNetServerPtr server,
char ebuf[1024];
VIR_ERROR(_("Failed to create polkit context %s"),
(pkerr ? polkit_error_get_error_message(pkerr)
- : virStrerror(errno, ebuf, sizeof ebuf)));
+ : virStrerror(errno, ebuf, sizeof(ebuf))));
if (pkerr)
polkit_error_free(pkerr);
polkit_caller_unref(pkcaller);
diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c
index 5a6ef1d..c54778f 100644
--- a/examples/domain-events/events-c/event-test.c
+++ b/examples/domain-events/events-c/event-test.c
@@ -393,7 +393,7 @@ int main(int argc, char **argv)
int callback12ret = -1;
struct sigaction action_stop;
- memset(&action_stop, 0, sizeof action_stop);
+ memset(&action_stop, 0, sizeof(action_stop));
action_stop.sa_handler = stop;
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 6962832..dff8aa6 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1360,7 +1360,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
int32_t numaInfo_numNodes = 0;
char *ptr = NULL;
- memset(nodeinfo, 0, sizeof (*nodeinfo));
+ memset(nodeinfo, 0, sizeof(*nodeinfo));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@@ -2286,7 +2286,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
esxVI_Long *value = NULL;
#endif
- memset(info, 0, sizeof (*info));
+ memset(info, 0, sizeof(*info));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@@ -2763,7 +2763,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
/* Flags checked by virDomainDefFormat */
- memset(&data, 0, sizeof (data));
+ memset(&data, 0, sizeof(data));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@@ -2870,7 +2870,7 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
virCheckFlags(0, NULL);
- memset(&data, 0, sizeof (data));
+ memset(&data, 0, sizeof(data));
if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
@@ -2913,7 +2913,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
virCheckFlags(0, NULL);
- memset(&data, 0, sizeof (data));
+ memset(&data, 0, sizeof(data));
if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
@@ -3137,7 +3137,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
char *taskInfoErrorMessage = NULL;
virDomainPtr domain = NULL;
- memset(&data, 0, sizeof (data));
+ memset(&data, 0, sizeof(data));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@@ -4344,7 +4344,7 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virCheckFlags(0, NULL);
- memset(&def, 0, sizeof (def));
+ memset(&def, 0, sizeof(def));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index 96ef59a..adf1edb 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -407,7 +407,7 @@ esxStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_Boolean accessible = esxVI_Boolean_Undefined;
- memset(info, 0, sizeof (*info));
+ memset(info, 0, sizeof(*info));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@@ -479,7 +479,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
virCheckFlags(0, NULL);
- memset(&def, 0, sizeof (def));
+ memset(&def, 0, sizeof(def));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@@ -977,7 +977,7 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc,
virCheckFlags(0, NULL);
- memset(&poolDef, 0, sizeof (poolDef));
+ memset(&poolDef, 0, sizeof(poolDef));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@@ -1205,7 +1205,7 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
virCheckFlags(0, NULL);
- memset(&poolDef, 0, sizeof (poolDef));
+ memset(&poolDef, 0, sizeof(poolDef));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@@ -1483,7 +1483,7 @@ esxStorageVolumeGetInfo(virStorageVolPtr volume, virStorageVolInfoPtr info)
esxVI_FileInfo *fileInfo = NULL;
esxVI_VmDiskFileInfo *vmDiskFileInfo = NULL;
- memset(info, 0, sizeof (*info));
+ memset(info, 0, sizeof(*info));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@@ -1538,8 +1538,8 @@ esxStorageVolumeGetXMLDesc(virStorageVolPtr volume, unsigned int flags)
virCheckFlags(0, NULL);
- memset(&pool, 0, sizeof (pool));
- memset(&def, 0, sizeof (def));
+ memset(&pool, 0, sizeof(pool));
+ memset(&def, 0, sizeof(def));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index a08ca19..478f60b 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -339,7 +339,7 @@ esxUtil_ResolveHostname(const char *hostname,
struct addrinfo *result = NULL;
int errcode;
- memset(&hints, 0, sizeof (hints));
+ memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_INET;
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 6004aac..42e0976 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -4089,7 +4089,7 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo,
const char *name[4] = { "eax", "ebx", "ecx", "edx" };
int r, i, o;
- memset(parsedHostCpuIdInfo, 0, sizeof (*parsedHostCpuIdInfo));
+ memset(parsedHostCpuIdInfo, 0, sizeof(*parsedHostCpuIdInfo));
parsedHostCpuIdInfo->level = hostCpuIdInfo->level->value;
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 2332fde..bcc310f 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -43,7 +43,7 @@
int \
esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \
{ \
- if (esxVI_Alloc((void **)ptrptr, sizeof (esxVI_##__type)) < 0) { \
+ if (esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##__type)) < 0) { \
return -1; \
} \
\
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 05fce4f..3b15292 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -286,7 +286,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
Win32_Processor *processor = NULL;
char *tmp;
- memset(info, 0, sizeof (*info));
+ memset(info, 0, sizeof(*info));
virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);
@@ -341,7 +341,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
/* Fill struct */
if (virStrncpy(info->model, processorList->data->Name,
- sizeof (info->model) - 1, sizeof (info->model)) == NULL) {
+ sizeof(info->model) - 1, sizeof(info->model)) == NULL) {
HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
_("CPU model %s too long for destination"),
processorList->data->Name);
@@ -679,7 +679,7 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
Msvm_ProcessorSettingData *processorSettingData = NULL;
Msvm_MemorySettingData *memorySettingData = NULL;
- memset(info, 0, sizeof (*info));
+ memset(info, 0, sizeof(*info));
virUUIDFormat(domain->uuid, uuid_string);
diff --git a/src/internal.h b/src/internal.h
index 3408541..ef81cda 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -83,7 +83,7 @@
# define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
-# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
+# define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array)))
/* C99 uses __func__. __FUNCTION__ is legacy. */
# ifndef __GNUC__
@@ -205,7 +205,7 @@
* Use this when passing possibly-NULL strings to printf-a-likes.
*/
# define NULLSTR(s) \
- ((void)verify_true(sizeof *(s) == sizeof (char)), \
+ ((void)verify_true(sizeof(*(s)) == sizeof(char)), \
(s) ? (s) : "(null)")
/**
diff --git a/src/libvirt.c b/src/libvirt.c
index 53b485a..8bca16d 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -45,6 +45,8 @@
#include "virrandom.h"
#include "viruri.h"
+#include <ctype.h>
+
#ifndef WITH_DRIVER_MODULES
# ifdef WITH_TEST
# include "test/test_driver.h"
@@ -7165,7 +7167,7 @@ virDomainBlockStats(virDomainPtr dom, const char *disk,
virDispatchError(NULL);
return -1;
}
- if (!disk || !stats || size > sizeof stats2) {
+ if (!disk || !stats || size > sizeof(stats2)) {
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
@@ -7305,7 +7307,7 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path,
virDispatchError(NULL);
return -1;
}
- if (!path || !stats || size > sizeof stats2) {
+ if (!path || !stats || size > sizeof(stats2)) {
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
@@ -18625,13 +18627,13 @@ error:
*
* getting total stats: set start_cpu as -1, ncpus 1
* virDomainGetCPUStats(dom, NULL, 0, -1, 1, 0) => nparams
- * params = calloc(nparams, sizeof (virTypedParameter))
+ * params = calloc(nparams, sizeof(virTypedParameter))
* virDomainGetCPUStats(dom, params, nparams, -1, 1, 0) => total stats.
*
* getting per-cpu stats:
* virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0) => ncpus
* virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0) => nparams
- * params = calloc(ncpus * nparams, sizeof (virTypedParameter))
+ * params = calloc(ncpus * nparams, sizeof(virTypedParameter))
* virDomainGetCPUStats(dom, params, nparams, 0, ncpus, 0) => per-cpu stats
*
* Returns -1 on failure, or the number of statistics that were
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index fb18948..45bf1f8 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -895,22 +895,22 @@ libxlStartup(int privileged) {
if (virFileMakePath(libxl_driver->logDir) < 0) {
VIR_ERROR(_("Failed to create log dir '%s': %s"),
- libxl_driver->logDir, virStrerror(errno, ebuf, sizeof ebuf));
+ libxl_driver->logDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(libxl_driver->stateDir) < 0) {
VIR_ERROR(_("Failed to create state dir '%s': %s"),
- libxl_driver->stateDir, virStrerror(errno, ebuf, sizeof ebuf));
+ libxl_driver->stateDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(libxl_driver->libDir) < 0) {
VIR_ERROR(_("Failed to create lib dir '%s': %s"),
- libxl_driver->libDir, virStrerror(errno, ebuf, sizeof ebuf));
+ libxl_driver->libDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(libxl_driver->saveDir) < 0) {
VIR_ERROR(_("Failed to create save dir '%s': %s"),
- libxl_driver->saveDir, virStrerror(errno, ebuf, sizeof ebuf));
+ libxl_driver->saveDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 0755b3c..9bb6218 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1517,7 +1517,7 @@ int lxcContainerAvailable(int features)
if (cpid < 0) {
char ebuf[1024] ATTRIBUTE_UNUSED;
VIR_DEBUG("clone call returned %s, container support is not enabled",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
return -1;
} else if (virPidWait(cpid, NULL) < 0) {
return -1;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 3ead648..909b8e8 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1897,7 +1897,7 @@ static int lxcVmStart(virConnectPtr conn,
if (safewrite(logfd, timestamp, strlen(timestamp)) < 0 ||
safewrite(logfd, START_POSTFIX, strlen(START_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);
@@ -1905,7 +1905,7 @@ static int lxcVmStart(virConnectPtr conn,
virCommandWriteArgLog(cmd, logfd);
if ((pos = lseek(logfd, 0, SEEK_END)) < 0)
VIR_WARN("Unable to seek to end of logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 9112c96..438c2eb 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1623,7 +1623,7 @@ static int udevDeviceMonitorStartup(int privileged)
if (errno != ENOENT && (privileged || errno != EACCES)) {
char ebuf[256];
VIR_ERROR(_("Failed to initialize libpciaccess: %s"),
- virStrerror(pciret, ebuf, sizeof ebuf));
+ virStrerror(pciret, ebuf, sizeof(ebuf)));
ret = -1;
goto out;
}
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 61a5925..26f8dc1 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -803,9 +803,9 @@ nodeCapsInitNUMA(virCapsPtr caps)
return 0;
int mask_n_bytes = max_n_cpus / 8;
- if (VIR_ALLOC_N(mask, mask_n_bytes / sizeof *mask) < 0)
+ if (VIR_ALLOC_N(mask, mask_n_bytes / sizeof(*mask)) < 0)
goto cleanup;
- if (VIR_ALLOC_N(allonesmask, mask_n_bytes / sizeof *mask) < 0)
+ if (VIR_ALLOC_N(allonesmask, mask_n_bytes / sizeof(*mask)) < 0)
goto cleanup;
memset(allonesmask, 0xff, mask_n_bytes);
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index a17d025..79704bc 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -866,7 +866,7 @@ qemuAgentCommand(qemuAgentPtr mon,
*reply = NULL;
- memset(&msg, 0, sizeof msg);
+ memset(&msg, 0, sizeof(msg));
if (!(cmdstr = virJSONValueToString(cmd))) {
virReportOOMError();
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0d3b0bd..7e6d59c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -550,32 +550,32 @@ qemudStartup(int privileged) {
if (virFileMakePath(qemu_driver->stateDir) < 0) {
VIR_ERROR(_("Failed to create state dir '%s': %s"),
- qemu_driver->stateDir, virStrerror(errno, ebuf, sizeof ebuf));
+ qemu_driver->stateDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->libDir) < 0) {
VIR_ERROR(_("Failed to create lib dir '%s': %s"),
- qemu_driver->libDir, virStrerror(errno, ebuf, sizeof ebuf));
+ qemu_driver->libDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->cacheDir) < 0) {
VIR_ERROR(_("Failed to create cache dir '%s': %s"),
- qemu_driver->cacheDir, virStrerror(errno, ebuf, sizeof ebuf));
+ qemu_driver->cacheDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->saveDir) < 0) {
VIR_ERROR(_("Failed to create save dir '%s': %s"),
- qemu_driver->saveDir, virStrerror(errno, ebuf, sizeof ebuf));
+ qemu_driver->saveDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->snapshotDir) < 0) {
VIR_ERROR(_("Failed to create save dir '%s': %s"),
- qemu_driver->snapshotDir, virStrerror(errno, ebuf, sizeof ebuf));
+ qemu_driver->snapshotDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->autoDumpPath) < 0) {
VIR_ERROR(_("Failed to create dump dir '%s': %s"),
- qemu_driver->autoDumpPath, virStrerror(errno, ebuf, sizeof ebuf));
+ qemu_driver->autoDumpPath, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
@@ -4591,7 +4591,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
virDomainActualNetDefFree(net->data.network.actual);
- memset(net, 0, sizeof *net);
+ memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = NULL;
@@ -4602,7 +4602,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
* case, the best we can do is NULL everything out.
*/
virDomainActualNetDefFree(net->data.network.actual);
- memset(net, 0, sizeof *net);
+ memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = NULL;
@@ -4613,7 +4613,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
VIR_FREE(net->data.direct.linkdev);
VIR_FREE(net->data.direct.virtPortProfile);
- memset(net, 0, sizeof *net);
+ memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = NULL;
@@ -4624,7 +4624,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
char *brname = net->data.bridge.brname;
char *ipaddr = net->data.bridge.ipaddr;
- memset(net, 0, sizeof *net);
+ memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = script;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 38163ba..55ec547 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2241,11 +2241,11 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
if (auth->expires) {
time_t lifetime = auth->validTo - now;
if (lifetime <= 0)
- snprintf(expire_time, sizeof (expire_time), "now");
+ snprintf(expire_time, sizeof(expire_time), "now");
else
- snprintf(expire_time, sizeof (expire_time), "%lu", (long unsigned)auth->validTo);
+ snprintf(expire_time, sizeof(expire_time), "%lu", (long unsigned)auth->validTo);
} else {
- snprintf(expire_time, sizeof (expire_time), "never");
+ snprintf(expire_time, sizeof(expire_time), "never");
}
ret = qemuMonitorExpirePassword(priv->mon, type, expire_time);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 49a260d..ff6f273 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1522,7 +1522,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
VIR_DEBUG("Generated uri_out=%s", *uri_out);
/* QEMU will be started with -incoming tcp:0.0.0.0:port */
- snprintf(migrateFrom, sizeof (migrateFrom), "tcp:0.0.0.0:%d", this_port);
+ snprintf(migrateFrom, sizeof(migrateFrom), "tcp:0.0.0.0:%d", this_port);
ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
cookieout, cookieoutlen, dname, dom_xml,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8c028b9..7093e1d 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -214,7 +214,7 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
*reply = NULL;
- memset(&msg, 0, sizeof msg);
+ memset(&msg, 0, sizeof(msg));
exe = virJSONValueObjectGet(cmd, "execute");
if (exe) {
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 30a0416..9e2991b 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -226,7 +226,7 @@ qemuMonitorTextCommandWithHandler(qemuMonitorPtr mon,
*reply = NULL;
- memset(&msg, 0, sizeof msg);
+ memset(&msg, 0, sizeof(msg));
if (virAsprintf(&msg.txBuffer, "%s\r", cmd) < 0) {
virReportOOMError();
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 060e091..7725563 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1598,7 +1598,7 @@ closelog:
if (VIR_CLOSE(logfd) < 0) {
char ebuf[1024];
VIR_WARN("Unable to close logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(buf);
@@ -3523,7 +3523,7 @@ int qemuProcessStart(virConnectPtr conn,
if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
safewrite(logfile, START_POSTFIX, strlen(START_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);
@@ -3535,7 +3535,7 @@ int qemuProcessStart(virConnectPtr conn,
if ((pos = lseek(logfile, 0, SEEK_END)) < 0)
VIR_WARN("Unable to seek to end of logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
VIR_DEBUG("Clear emulator capabilities: %d",
driver->clearEmulatorCapabilities);
@@ -3794,7 +3794,7 @@ qemuProcessKill(struct qemud_driver *driver,
char ebuf[1024];
VIR_WARN("Failed to terminate process %d with SIG%s: %s",
vm->pid, signame,
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
goto cleanup;
}
ret = 0;
@@ -3864,7 +3864,7 @@ void qemuProcessStop(struct qemud_driver *driver,
/* To not break the normal domain shutdown process, skip the
* timestamp log writing if failed on opening log file. */
VIR_WARN("Unable to open logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
} else {
if ((timestamp = virTimeStringNow()) == NULL) {
virReportOOMError();
@@ -3873,7 +3873,7 @@ void qemuProcessStop(struct qemud_driver *driver,
safewrite(logfile, SHUTDOWN_POSTFIX,
strlen(SHUTDOWN_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);
@@ -3881,7 +3881,7 @@ void qemuProcessStop(struct qemud_driver *driver,
if (VIR_CLOSE(logfile) < 0)
VIR_WARN("Unable to close logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
}
/* This method is routinely used in clean up paths. Disable error
@@ -4160,7 +4160,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
safewrite(logfile, ATTACH_POSTFIX, strlen(ATTACH_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 30ca6a5..7ebc916 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -719,7 +719,7 @@ doRemoteOpen (virConnectPtr conn,
remote_get_uri_ret uriret;
VIR_DEBUG("Trying to query remote URI");
- memset (&uriret, 0, sizeof uriret);
+ memset (&uriret, 0, sizeof(uriret));
if (call (conn, priv, 0,
REMOTE_PROC_GET_URI,
(xdrproc_t) xdr_void, (char *) NULL,
@@ -974,7 +974,7 @@ remoteType (virConnectPtr conn)
goto done;
}
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_GET_TYPE,
(xdrproc_t) xdr_void, (char *) NULL,
(xdrproc_t) xdr_remote_get_type_ret, (char *) &ret) == -1)
@@ -995,7 +995,7 @@ static int remoteIsSecure(virConnectPtr conn)
remote_is_secure_ret ret;
remoteDriverLock(priv);
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_IS_SECURE,
(xdrproc_t) xdr_void, (char *) NULL,
(xdrproc_t) xdr_remote_is_secure_ret, (char *) &ret) == -1)
@@ -1024,7 +1024,7 @@ static int remoteIsEncrypted(virConnectPtr conn)
remote_is_secure_ret ret;
remoteDriverLock(priv);
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_IS_SECURE,
(xdrproc_t) xdr_void, (char *) NULL,
(xdrproc_t) xdr_remote_is_secure_ret, (char *) &ret) == -1)
@@ -1066,7 +1066,7 @@ remoteNodeGetCPUStats (virConnectPtr conn,
args.cpuNum = cpuNum;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_CPU_STATS,
(xdrproc_t) xdr_remote_node_get_cpu_stats_args,
(char *) &args,
@@ -1132,7 +1132,7 @@ remoteNodeGetMemoryStats (virConnectPtr conn,
args.cellNum = cellNum;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_MEMORY_STATS,
(xdrproc_t) xdr_remote_node_get_memory_stats_args, (char *) &args,
(xdrproc_t) xdr_remote_node_get_memory_stats_ret, (char *) &ret) == -1)
@@ -1202,7 +1202,7 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn,
args.startCell = startCell;
args.maxcells = maxCells;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY,
(xdrproc_t) xdr_remote_node_get_cells_free_memory_args, (char *)&args,
(xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *)&ret) == -1)
@@ -1239,7 +1239,7 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids)
}
args.maxids = maxids;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_LIST_DOMAINS,
(xdrproc_t) xdr_remote_list_domains_args, (char *) &args,
(xdrproc_t) xdr_remote_list_domains_ret, (char *) &ret) == -1)
@@ -1481,7 +1481,7 @@ remoteDomainBlockStatsFlags(virDomainPtr domain,
args.path = (char *) path;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS,
(xdrproc_t) xdr_remote_domain_block_stats_flags_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_block_stats_flags_ret, (char *) &ret) == -1)
@@ -1541,7 +1541,7 @@ remoteDomainGetMemoryParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_memory_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret) == -1)
@@ -1589,7 +1589,7 @@ remoteDomainGetNumaParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_numa_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, (char *) &ret) == -1)
@@ -1637,7 +1637,7 @@ remoteDomainGetBlkioParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_blkio_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret) == -1)
@@ -1704,7 +1704,7 @@ remoteDomainGetVcpuPinInfo (virDomainPtr domain,
args.maplen = maplen;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO,
(xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_args,
@@ -1775,7 +1775,7 @@ remoteDomainGetVcpus (virDomainPtr domain,
args.maxinfo = maxinfo;
args.maplen = maplen;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS,
(xdrproc_t) xdr_remote_domain_get_vcpus_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret) == -1)
@@ -1794,7 +1794,7 @@ remoteDomainGetVcpus (virDomainPtr domain,
goto cleanup;
}
- memset (info, 0, sizeof (virVcpuInfo) * maxinfo);
+ memset (info, 0, sizeof(virVcpuInfo) * maxinfo);
memset (cpumaps, 0, maxinfo * maplen);
for (i = 0; i < ret.info.info_len; ++i) {
@@ -1828,8 +1828,8 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel)
remoteDriverLock(priv);
make_nonnull_domain (&args.dom, domain);
- memset (&ret, 0, sizeof ret);
- memset (seclabel, 0, sizeof (*seclabel));
+ memset (&ret, 0, sizeof(ret));
+ memset (seclabel, 0, sizeof(*seclabel));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL,
(xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args,
@@ -1838,9 +1838,9 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel)
}
if (ret.label.label_val != NULL) {
- if (strlen (ret.label.label_val) >= sizeof seclabel->label) {
+ if (strlen (ret.label.label_val) >= sizeof(seclabel->label)) {
remoteError(VIR_ERR_RPC, _("security label exceeds maximum: %zu"),
- sizeof seclabel->label - 1);
+ sizeof(seclabel->label) - 1);
goto cleanup;
}
strcpy (seclabel->label, ret.label.label_val);
@@ -1873,7 +1873,7 @@ remoteDomainGetState(virDomainPtr domain,
make_nonnull_domain(&args.dom, domain);
args.flags = flags;
- memset(&ret, 0, sizeof ret);
+ memset(&ret, 0, sizeof(ret));
if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_STATE,
(xdrproc_t) xdr_remote_domain_get_state_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_state_ret, (char *) &ret) == -1)
@@ -1899,8 +1899,8 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
remoteDriverLock(priv);
- memset (&ret, 0, sizeof ret);
- memset (secmodel, 0, sizeof (*secmodel));
+ memset (&ret, 0, sizeof(ret));
+ memset (secmodel, 0, sizeof(*secmodel));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL,
(xdrproc_t) xdr_void, NULL,
@@ -1909,18 +1909,18 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
}
if (ret.model.model_val != NULL) {
- if (strlen (ret.model.model_val) >= sizeof secmodel->model) {
+ if (strlen (ret.model.model_val) >= sizeof(secmodel->model)) {
remoteError(VIR_ERR_RPC, _("security model exceeds maximum: %zu"),
- sizeof secmodel->model - 1);
+ sizeof(secmodel->model) - 1);
goto cleanup;
}
strcpy (secmodel->model, ret.model.model_val);
}
if (ret.doi.doi_val != NULL) {
- if (strlen (ret.doi.doi_val) >= sizeof secmodel->doi) {
+ if (strlen (ret.doi.doi_val) >= sizeof(secmodel->doi)) {
remoteError(VIR_ERR_RPC, _("security doi exceeds maximum: %zu"),
- sizeof secmodel->doi - 1);
+ sizeof(secmodel->doi) - 1);
goto cleanup;
}
strcpy (secmodel->doi, ret.doi.doi_val);
@@ -1955,7 +1955,7 @@ remoteDomainMigratePrepare (virConnectPtr dconn,
args.dname = dname == NULL ? NULL : (char **) &dname;
args.resource = resource;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE,
(xdrproc_t) xdr_remote_domain_migrate_prepare_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_migrate_prepare_ret, (char *) &ret) == -1)
@@ -1997,7 +1997,7 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn,
args.resource = resource;
args.dom_xml = (char *) dom_xml;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2,
(xdrproc_t) xdr_remote_domain_migrate_prepare2_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_migrate_prepare2_ret, (char *) &ret) == -1)
@@ -2058,7 +2058,7 @@ remoteDomainCreate (virDomainPtr domain)
* it returned.
*/
memcpy (args2.uuid, domain->uuid, VIR_UUID_BUFLEN);
- memset (&ret2, 0, sizeof ret2);
+ memset (&ret2, 0, sizeof(ret)2);
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID,
(xdrproc_t) xdr_remote_domain_lookup_by_uuid_args, (char *) &args2,
(xdrproc_t) xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2) == -1)
@@ -2086,7 +2086,7 @@ remoteDomainGetSchedulerType (virDomainPtr domain, int *nparams)
make_nonnull_domain (&args.dom, domain);
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE,
(xdrproc_t) xdr_remote_domain_get_scheduler_type_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_scheduler_type_ret, (char *) &ret) == -1)
@@ -2125,7 +2125,7 @@ remoteDomainMemoryStats (virDomainPtr domain,
}
args.maxStats = nr_stats;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_STATS,
(xdrproc_t) xdr_remote_domain_memory_stats_args,
@@ -2174,7 +2174,7 @@ remoteDomainBlockPeek (virDomainPtr domain,
args.size = size;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_PEEK,
(xdrproc_t) xdr_remote_domain_block_peek_args,
(char *) &args,
@@ -2225,7 +2225,7 @@ remoteDomainMemoryPeek (virDomainPtr domain,
args.size = size;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_PEEK,
(xdrproc_t) xdr_remote_domain_memory_peek_args,
(char *) &args,
@@ -2569,7 +2569,7 @@ remoteFindStoragePoolSources (virConnectPtr conn,
args.srcSpec = srcSpec ? (char **)&srcSpec : (char **)&emptyString;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_FIND_STORAGE_POOL_SOURCES,
(xdrproc_t) xdr_remote_find_storage_pool_sources_args, (char *) &args,
(xdrproc_t) xdr_remote_find_storage_pool_sources_ret, (char *) &ret) == -1)
@@ -2700,7 +2700,7 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv,
struct remote_auth_list_ret ret;
int err, type = REMOTE_AUTH_NONE;
- memset(&ret, 0, sizeof ret);
+ memset(&ret, 0, sizeof(ret));
err = call (conn, priv, 0,
REMOTE_PROC_AUTH_LIST,
(xdrproc_t) xdr_void, (char *) NULL,
@@ -3160,7 +3160,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
goto cleanup;
/* First call is to inquire about supported mechanisms in the server */
- memset (&iret, 0, sizeof iret);
+ memset (&iret, 0, sizeof(iret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_INIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_sasl_init_ret, (char *) &iret) != 0)
@@ -3206,7 +3206,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
goto cleanup;
}
/* NB, distinction of NULL vs "" is *critical* in SASL */
- memset(&sargs, 0, sizeof sargs);
+ memset(&sargs, 0, sizeof(sargs));
sargs.nil = clientout ? 0 : 1;
sargs.data.data_val = (char*)clientout;
sargs.data.data_len = clientoutlen;
@@ -3215,7 +3215,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
mech, clientoutlen, clientout);
/* Now send the initial auth data to the server */
- memset (&sret, 0, sizeof sret);
+ memset (&sret, 0, sizeof(sret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_START,
(xdrproc_t) xdr_remote_auth_sasl_start_args, (char *) &sargs,
(xdrproc_t) xdr_remote_auth_sasl_start_ret, (char *) &sret) != 0)
@@ -3260,14 +3260,14 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
/* Not done, prepare to talk with the server for another iteration */
/* NB, distinction of NULL vs "" is *critical* in SASL */
- memset(&pargs, 0, sizeof pargs);
+ memset(&pargs, 0, sizeof(pargs));
pargs.nil = clientout ? 0 : 1;
pargs.data.data_val = (char*)clientout;
pargs.data.data_len = clientoutlen;
VIR_DEBUG("Server step with %zu bytes %p",
clientoutlen, clientout);
- memset (&pret, 0, sizeof pret);
+ memset (&pret, 0, sizeof(pret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_STEP,
(xdrproc_t) xdr_remote_auth_sasl_step_args, (char *) &pargs,
(xdrproc_t) xdr_remote_auth_sasl_step_ret, (char *) &pret) != 0)
@@ -3328,7 +3328,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv,
remote_auth_polkit_ret ret;
VIR_DEBUG("Client initialize PolicyKit-1 authentication");
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) {
@@ -3358,7 +3358,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv,
VIR_DEBUG("Client initialize PolicyKit-0 authentication");
/* Check auth first and if it succeeds we are done. */
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) == 0)
@@ -3389,7 +3389,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv,
return -1;
}
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) {
@@ -3859,7 +3859,7 @@ remoteSecretGetValue (virSecretPtr secret, size_t *value_size,
make_nonnull_secret (&args.secret, secret);
args.flags = flags;
- memset (&ret, 0, sizeof (ret));
+ memset (&ret, 0, sizeof(ret));
if (call (secret->conn, priv, 0, REMOTE_PROC_SECRET_GET_VALUE,
(xdrproc_t) xdr_remote_secret_get_value_args, (char *) &args,
(xdrproc_t) xdr_remote_secret_get_value_ret, (char *) &ret) == -1)
@@ -4209,7 +4209,7 @@ remoteQemuDomainMonitorCommand (virDomainPtr domain, const char *cmd,
args.cmd = (char *)cmd;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_MONITOR_COMMAND,
(xdrproc_t) xdr_qemu_monitor_command_args, (char *) &args,
(xdrproc_t) xdr_qemu_monitor_command_ret, (char *) &ret) == -1)
@@ -4315,7 +4315,7 @@ remoteDomainMigratePrepare3(virConnectPtr dconn,
args.resource = resource;
args.dom_xml = (char *) dom_xml;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3,
(xdrproc_t) xdr_remote_domain_migrate_prepare3_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_migrate_prepare3_ret, (char *) &ret) == -1)
@@ -4673,7 +4673,7 @@ remoteDomainGetDiskErrors(virDomainPtr dom,
args.maxerrors = maxerrors;
args.flags = flags;
- memset(&ret, 0, sizeof ret);
+ memset(&ret, 0, sizeof(ret));
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_DISK_ERRORS,
(xdrproc_t) xdr_remote_domain_get_disk_errors_args,
@@ -4773,7 +4773,7 @@ remoteDomainGetInterfaceParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
- memset (&ret, 0, sizeof ret);
+ memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_interface_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, (char *) &ret) == -1)
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index ef369b9..f161ee0 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -518,7 +518,7 @@ elsif ($opt_b) {
die "legacy [u]long hyper arrays aren't supported";
}
- push(@ret_list, "memcpy(ret->$3, tmp.$3, sizeof ret->$3);");
+ push(@ret_list, "memcpy(ret->$3, tmp.$3, sizeof(ret->$3));");
} elsif ($ret_member =~ m/^(unsigned )?(char|short|int|hyper) (\S+);/) {
push(@ret_list, "ret->$3 = tmp.$3;");
} else {
@@ -731,7 +731,7 @@ elsif ($opt_b) {
# have a 'Struct' suffix on the actual struct name
# and take the struct size as additional argument
$struct_name .= "Struct";
- splice(@args_list, $call->{ret_offset} + 1, 0, ("sizeof tmp"));
+ splice(@args_list, $call->{ret_offset} + 1, 0, ("sizeof(tmp)"));
}
push(@vars_list, "vir$struct_name tmp");
@@ -1213,7 +1213,7 @@ elsif ($opt_k) {
die "legacy [u]long hyper arrays aren't supported";
}
- push(@ret_list, "memcpy(result->$3, ret.$3, sizeof result->$3);");
+ push(@ret_list, "memcpy(result->$3, ret.$3, sizeof(result->$3));");
} elsif ($ret_member =~ m/<\S+>;/ or $ret_member =~ m/\[\S+\];/) {
# just make all other array types fail
die "unhandled type for multi-return-value for " .
@@ -1465,7 +1465,7 @@ elsif ($opt_k) {
if ($rettype ne "void") {
print "\n";
- print " memset(&ret, 0, sizeof ret);\n";
+ print " memset(&ret, 0, sizeof(ret));\n";
}
my $callflags = "0";
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 99ab800..33b7701 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1469,7 +1469,7 @@ static void virNetClientIOUpdateCallback(virNetClientPtr client,
* which come from the user). It does however free any intermediate
* results, eg. the error structure if there is one.
*
- * NB(2). Make sure to memset (&ret, 0, sizeof ret) before calling,
+ * NB(2). Make sure to memset (&ret, 0, sizeof(ret)) before calling,
* else Bad Things will happen in the XDR code.
*
* NB(3) You must have the client lock before calling this
diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c
index d4e7bf2..8db0e15 100644
--- a/src/rpc/virnetsaslcontext.c
+++ b/src/rpc/virnetsaslcontext.c
@@ -364,7 +364,7 @@ int virNetSASLSessionSecProps(virNetSASLSessionPtr sasl,
minSSF, maxSSF, allowAnonymous, sasl->maxbufsize);
virMutexLock(&sasl->lock);
- memset(&secprops, 0, sizeof secprops);
+ memset(&secprops, 0, sizeof(secprops));
secprops.min_ssf = minSSF;
secprops.max_ssf = maxSSF;
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index af3f9ac..fa16d31 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -203,7 +203,7 @@ int virNetSocketNewListenTCP(const char *nodename,
*retsocks = NULL;
*nretsocks = 0;
- memset(&hints, 0, sizeof hints);
+ memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
@@ -228,7 +228,7 @@ int virNetSocketNewListenTCP(const char *nodename,
}
int opt = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) < 0) {
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
virReportSystemError(errno, "%s", _("Unable to enable port reuse"));
goto error;
}
@@ -244,7 +244,7 @@ int virNetSocketNewListenTCP(const char *nodename,
* we force it to only listen on IPv6
*/
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
- (void*)&on, sizeof on) < 0) {
+ (void*)&on, sizeof(on)) < 0) {
virReportSystemError(errno, "%s",
_("Unable to force bind to IPv6 only"));
goto error;
@@ -400,7 +400,7 @@ int virNetSocketNewConnectTCP(const char *nodename,
memset(&localAddr, 0, sizeof(localAddr));
memset(&remoteAddr, 0, sizeof(remoteAddr));
- memset(&hints, 0, sizeof hints);
+ memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
@@ -422,7 +422,7 @@ int virNetSocketNewConnectTCP(const char *nodename,
goto error;
}
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt);
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
if (connect(fd, runp->ai_addr, runp->ai_addrlen) >= 0)
break;
@@ -830,7 +830,7 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
pid_t *pid)
{
struct ucred cr;
- socklen_t cr_len = sizeof (cr);
+ socklen_t cr_len = sizeof(cr);
virMutexLock(&sock->lock);
if (getsockopt(sock->fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) < 0) {
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 3c9e541..a5cb85c 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -577,14 +577,14 @@ valid_path(const char *path, const bool readonly)
}
}
- opaths = sizeof(override)/sizeof *(override);
+ opaths = sizeof(override)/sizeof(*(override));
- npaths = sizeof(restricted)/sizeof *(restricted);
+ npaths = sizeof(restricted)/sizeof(*(restricted));
if (array_starts_with(path, restricted, npaths) == 0 &&
array_starts_with(path, override, opaths) != 0)
return 1;
- npaths = sizeof(restricted_rw)/sizeof *(restricted_rw);
+ npaths = sizeof(restricted_rw)/sizeof(*(restricted_rw));
if (!readonly) {
if (array_starts_with(path, restricted_rw, npaths) == 0)
return 1;
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 6ebc6e1..f04473d 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -55,7 +55,7 @@ virStorageBackendISCSITargetIP(const char *hostname,
struct addrinfo *result = NULL;
int ret;
- memset(&hints, 0, sizeof hints);
+ memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
@@ -207,7 +207,7 @@ virStorageBackendIQNFound(const char *initiatoriqn,
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to open stream for file descriptor "
"when reading output from '%s': '%s'"),
- ISCSIADM, virStrerror(errno, ebuf, sizeof ebuf));
+ ISCSIADM, virStrerror(errno, ebuf, sizeof(ebuf)));
ret = IQN_ERROR;
goto out;
}
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 66811ce..f23ec7e 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -652,7 +652,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
char ebuf[1024];
VIR_ERROR(_("Failed to delete autostart link '%s': %s"),
- pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf));
+ pool->autostartLink, virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(pool->configFile);
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index d86652c..f2d0368 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -472,7 +472,7 @@ umlStartup(int privileged)
if (virFileMakePath(uml_driver->monitorDir) < 0) {
char ebuf[1024];
VIR_ERROR(_("Failed to create monitor directory %s: %s"),
- uml_driver->monitorDir, virStrerror(errno, ebuf, sizeof ebuf));
+ uml_driver->monitorDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
@@ -788,7 +788,7 @@ static int umlMonitorAddress(const struct uml_driver *driver,
return -1;
}
- memset(addr, 0, sizeof *addr);
+ memset(addr, 0, sizeof(*addr));
addr->sun_family = AF_UNIX;
if (virStrcpyStatic(addr->sun_path, sockname) == NULL) {
umlReportError(VIR_ERR_INTERNAL_ERROR,
@@ -826,11 +826,11 @@ restat:
return -1;
}
- memset(addr.sun_path, 0, sizeof addr.sun_path);
+ memset(addr.sun_path, 0, sizeof(addr.sun_path));
snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1,
"libvirt-uml-%u", vm->pid);
VIR_DEBUG("Reply address for monitor is '%s'", addr.sun_path+1);
- if (bind(priv->monitor, (struct sockaddr *)&addr, sizeof addr) < 0) {
+ if (bind(priv->monitor, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
virReportSystemError(errno,
"%s", _("cannot bind socket"));
VIR_FORCE_CLOSE(priv->monitor);
@@ -896,8 +896,8 @@ static int umlMonitorCommand(const struct uml_driver *driver,
return -1;
}
- if (sendto(priv->monitor, &req, sizeof req, 0,
- (struct sockaddr *)&addr, sizeof addr) != (sizeof req)) {
+ if (sendto(priv->monitor, &req, sizeof(req), 0,
+ (struct sockaddr *)&addr, sizeof(addr)) != sizeof(req)) {
virReportSystemError(errno,
_("cannot send command %s"),
cmd);
@@ -907,7 +907,7 @@ static int umlMonitorCommand(const struct uml_driver *driver,
do {
ssize_t nbytes;
addrlen = sizeof(addr);
- nbytes = recvfrom(priv->monitor, &res, sizeof res, 0,
+ nbytes = recvfrom(priv->monitor, &res, sizeof(res), 0,
(struct sockaddr *)&addr, &addrlen);
if (nbytes < 0) {
if (errno == EAGAIN || errno == EINTR)
diff --git a/src/util/buf.h b/src/util/buf.h
index 6648b23..d6bc8f3 100644
--- a/src/util/buf.h
+++ b/src/util/buf.h
@@ -59,7 +59,7 @@ void virBufferEscapeShell(virBufferPtr buf, const char *str);
void virBufferURIEncodeString(virBufferPtr buf, const char *str);
# define virBufferAddLit(buf_, literal_string_) \
- virBufferAdd(buf_, "" literal_string_ "", sizeof literal_string_ - 1)
+ virBufferAdd(buf_, "" literal_string_ "", sizeof(literal_string_) - 1)
void virBufferAdjustIndent(virBufferPtr buf, int indent);
int virBufferGetIndent(const virBufferPtr buf, bool dynamic);
diff --git a/src/util/command.c b/src/util/command.c
index b752b2a..2837450 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -1594,7 +1594,7 @@ virCommandWriteArgLog(virCommandPtr cmd, int logfd)
if (ioError) {
char ebuf[1024];
VIR_WARN("Unable to write command %s args to logfile: %s",
- cmd->args[0], virStrerror(ioError, ebuf, sizeof ebuf));
+ cmd->args[0], virStrerror(ioError, ebuf, sizeof(ebuf)));
}
}
diff --git a/src/util/ebtables.c b/src/util/ebtables.c
index d1afff0..dcb3eb9 100644
--- a/src/util/ebtables.c
+++ b/src/util/ebtables.c
@@ -114,7 +114,7 @@ ebtRulesRemove(ebtRules *rules,
memmove(&rules->rules[i],
&rules->rules[i+1],
- (rules->nrules - i - 1) * sizeof (ebtRule));
+ (rules->nrules - i - 1) * sizeof(ebtRule));
rules->nrules--;
diff --git a/src/util/memory.h b/src/util/memory.h
index d77a295..9b6da39 100644
--- a/src/util/memory.h
+++ b/src/util/memory.h
@@ -35,12 +35,12 @@
calculations, so the conservative dividend to use here is
SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
However, malloc (SIZE_MAX) fails on all known hosts where
- sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
+ sizeof(ptrdiff_t) <= sizeof(size_t), so do not bother to test for
exactly-SIZE_MAX allocations on such hosts; this avoids a test and
branch when S is known to be 1. */
# ifndef xalloc_oversized
# define xalloc_oversized(n, s) \
- ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
+ ((size_t) (sizeof(ptrdiff_t) <= sizeof(size_t) ? -1 : -2) / (s) < (n))
# endif
diff --git a/src/util/pci.c b/src/util/pci.c
index 7beeaee..b3be405 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -863,7 +863,7 @@ recheck:
virRun(stubprobe, NULL) < 0) {
char ebuf[1024];
VIR_WARN("failed to load pci-stub or pciback drivers: %s",
- virStrerror(errno, ebuf, sizeof ebuf));
+ virStrerror(errno, ebuf, sizeof(ebuf)));
return NULL;
}
diff --git a/src/util/stats_linux.c b/src/util/stats_linux.c
index 72318e3..725a2d0 100644
--- a/src/util/stats_linux.c
+++ b/src/util/stats_linux.c
@@ -57,7 +57,7 @@ linuxDomainInterfaceStats(const char *path,
path_len = strlen (path);
- while (fgets (line, sizeof line, fp)) {
+ while (fgets (line, sizeof(line), fp)) {
long long dummy;
long long rx_bytes;
long long rx_packets;
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index cd1c142..530071e 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -833,7 +833,7 @@ virStorageFileGetMetadataFromFD(const char *path,
int ret = -1;
struct stat sb;
- memset(meta, 0, sizeof (*meta));
+ memset(meta, 0, sizeof(*meta));
if (fstat(fd, &sb) < 0) {
virReportSystemError(errno,
diff --git a/src/util/util.c b/src/util/util.c
index d91ab4f..81d9e3a 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -83,8 +83,8 @@
# define NSIG 32
#endif
-verify(sizeof(gid_t) <= sizeof (unsigned int) &&
- sizeof(uid_t) <= sizeof (unsigned int));
+verify(sizeof(gid_t) <= sizeof(unsigned int) &&
+ sizeof(uid_t) <= sizeof(unsigned int));
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/uuid.c b/src/util/uuid.c
index a84fd94..d9ff348 100644
--- a/src/util/uuid.c
+++ b/src/util/uuid.c
@@ -108,7 +108,7 @@ virUUIDGenerate(unsigned char *uuid)
char ebuf[1024];
VIR_WARN("Falling back to pseudorandom UUID,"
" failed to generate random bytes: %s",
- virStrerror(err, ebuf, sizeof ebuf));
+ virStrerror(err, ebuf, sizeof(ebuf)));
err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
}
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index d0f9cc4..df58edf 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -129,7 +129,7 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func,
clientaddr, clienttty, success) < 0) {
char ebuf[1024];
VIR_WARN("Failed to send audit message %s: %s",
- NULLSTR(str), virStrerror(errno, ebuf, sizeof ebuf));
+ NULLSTR(str), virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(str);
}
diff --git a/src/util/virauth.c b/src/util/virauth.c
index 940686f..c59c55a 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -164,7 +164,7 @@ virAuthGetUsername(virConnectPtr conn,
if (ret != NULL)
return ret;
- memset(&cred, 0, sizeof (virConnectCredential));
+ memset(&cred, 0, sizeof(virConnectCredential));
if (defaultUsername != NULL) {
if (virAsprintf(&prompt, _("Enter username for %s [%s]"), hostname,
@@ -220,7 +220,7 @@ virAuthGetPassword(virConnectPtr conn,
if (ret != NULL)
return ret;
- memset(&cred, 0, sizeof (virConnectCredential));
+ memset(&cred, 0, sizeof(virConnectCredential));
if (virAsprintf(&prompt, _("Enter %s's password for %s"), username,
hostname) < 0) {
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 37891b4..17ea883 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -555,11 +555,11 @@ virNetDevMacVLanVPortProfileCallback(unsigned char *msg,
/* DEBUG end */
/* Parse netlink message assume a setlink with vfports */
- memcpy(&ifinfo, NLMSG_DATA(hdr), sizeof ifinfo);
+ memcpy(&ifinfo, NLMSG_DATA(hdr), sizeof(ifinfo));
VIR_DEBUG("family:%#x type:%#x index:%d flags:%#x change:%#x",
ifinfo.ifi_family, ifinfo.ifi_type, ifinfo.ifi_index,
ifinfo.ifi_flags, ifinfo.ifi_change);
- if (nlmsg_parse(hdr, sizeof ifinfo,
+ if (nlmsg_parse(hdr, sizeof(ifinfo),
(struct nlattr **)&tb, IFLA_MAX, NULL)) {
VIR_DEBUG("error parsing request...");
return;
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 83083c0..1934341 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -367,7 +367,7 @@ int virPidFileAcquirePath(const char *path,
if (stat(path, &a) < 0) {
char ebuf[1024] ATTRIBUTE_UNUSED;
VIR_DEBUG("Pid file '%s' disappeared: %s",
- path, virStrerror(errno, ebuf, sizeof ebuf));
+ path, virStrerror(errno, ebuf, sizeof(ebuf)));
VIR_FORCE_CLOSE(fd);
/* Someone else must be racing with us, so try agin */
continue;
diff --git a/src/util/virterror.c b/src/util/virterror.c
index d41bf37..ff9a36f 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -1355,7 +1355,7 @@ void virReportSystemErrorFull(int domcode,
va_end(args);
size_t len = strlen(errnoDetail);
- if (0 <= n && n + 2 + len < sizeof (msgDetailBuf)) {
+ if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
char *p = msgDetailBuf + n;
stpcpy (stpcpy (p, ": "), errnoDetail);
msgDetail = msgDetailBuf;
diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index 31e14a1..b07d6a7 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -621,7 +621,7 @@ vboxComUninitialize(void)
static VBOXXPCOMC_v1 vboxXPCOMC_v1 = {
- sizeof (VBOXXPCOMC_v1), /* cb */
+ sizeof(VBOXXPCOMC_v1), /* cb */
0x00010000U, /* uVersion */
vboxGetVersion, /* pfnGetVersion */
vboxComInitialize_v1, /* pfnComInitialize */
@@ -635,7 +635,7 @@ static VBOXXPCOMC_v1 vboxXPCOMC_v1 = {
};
static VBOXXPCOMC_v2 vboxXPCOMC_v2 = {
- sizeof (VBOXXPCOMC_v2), /* cb */
+ sizeof(VBOXXPCOMC_v2), /* cb */
0x00020000U, /* uVersion */
vboxGetVersion, /* pfnGetVersion */
vboxComInitialize_v2, /* pfnComInitialize */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 7769b0c..68e3b05 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -381,7 +381,7 @@ vboxIIDFromUUID_v2_x_WIN32(vboxGlobalData *data, vboxIID_v2_x_WIN32 *iid,
static bool
vboxIIDIsEqual_v2_x_WIN32(vboxIID_v2_x_WIN32 *iid1, vboxIID_v2_x_WIN32 *iid2)
{
- return memcmp(&iid1->value, &iid2->value, sizeof (GUID)) == 0;
+ return memcmp(&iid1->value, &iid2->value, sizeof(GUID)) == 0;
}
static void
@@ -392,7 +392,7 @@ vboxIIDFromArrayItem_v2_x_WIN32(vboxGlobalData *data, vboxIID_v2_x_WIN32 *iid,
vboxIIDUnalloc_v2_x_WIN32(data, iid);
- memcpy(&iid->value, &items[idx], sizeof (GUID));
+ memcpy(&iid->value, &items[idx], sizeof(GUID));
}
# define vboxIIDUnalloc(iid) vboxIIDUnalloc_v2_x_WIN32(data, iid)
@@ -454,7 +454,7 @@ vboxIIDFromUUID_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid,
static bool
vboxIIDIsEqual_v2_x(vboxIID_v2_x *iid1, vboxIID_v2_x *iid2)
{
- return memcmp(iid1->value, iid2->value, sizeof (nsID)) == 0;
+ return memcmp(iid1->value, iid2->value, sizeof(nsID)) == 0;
}
static void
@@ -465,7 +465,7 @@ vboxIIDFromArrayItem_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid,
iid->value = &iid->backing;
- memcpy(iid->value, array->items[idx], sizeof (nsID));
+ memcpy(iid->value, array->items[idx], sizeof(nsID));
}
# define vboxIIDUnalloc(iid) vboxIIDUnalloc_v2_x(data, iid)
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 0bb8098..50ace86 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -76,7 +76,7 @@ read_stat (const char *path)
return -1;
/* read, but don't bail out before closing */
- i = fread (str, 1, sizeof str - 1, fp);
+ i = fread (str, 1, sizeof(str) - 1, fp);
if (VIR_FCLOSE(fp) != 0 /* disk error */
|| i < 1) /* ensure we read at least one byte */
@@ -136,9 +136,9 @@ check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
* xenstore, etc.
*/
if (!priv->xshandle) return 1;
- snprintf (s, sizeof s, "/local/domain/0/backend/vbd/%d/%d/state",
+ snprintf (s, sizeof(s), "/local/domain/0/backend/vbd/%d/%d/state",
domid, device);
- s[sizeof s - 1] = '\0';
+ s[sizeof(s) - 1] = '\0';
rs = xs_read (priv->xshandle, 0, s, &len);
if (!rs) return 1;
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index eb8b67e..0dae8d9 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -566,7 +566,7 @@ struct xen_v2s3_getdomaininfolistop {
uint32_t max_domains;
#ifdef __BIG_ENDIAN__
struct {
- int __pad[(sizeof (long long) - sizeof (struct xen_v2d5_getdomaininfo *)) / sizeof (int)];
+ int __pad[(sizeof(long long) - sizeof(struct xen_v2d5_getdomaininfo *)) / sizeof(int)];
struct xen_v2d5_getdomaininfo *v;
} buffer;
#else
@@ -681,7 +681,7 @@ typedef struct xen_v2_setvcpumap xen_v2_setvcpumap;
struct xen_v2d5_cpumap {
#ifdef __BIG_ENDIAN__
struct {
- int __pad[(sizeof (long long) - sizeof (uint8_t *)) / sizeof (int)];
+ int __pad[(sizeof(long long) - sizeof(uint8_t *)) / sizeof(int)];
uint8_t *v;
} bitmap;
#else
@@ -1996,7 +1996,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
errcode = regcomp (&flags_hvm_rec, flags_hvm_re, REG_EXTENDED);
if (errcode != 0) {
char error[100];
- regerror (errcode, &flags_hvm_rec, error, sizeof error);
+ regerror (errcode, &flags_hvm_rec, error, sizeof(error));
regfree (&flags_hvm_rec);
virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
in_init = 0;
@@ -2005,7 +2005,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
errcode = regcomp (&flags_pae_rec, flags_pae_re, REG_EXTENDED);
if (errcode != 0) {
char error[100];
- regerror (errcode, &flags_pae_rec, error, sizeof error);
+ regerror (errcode, &flags_pae_rec, error, sizeof(error));
regfree (&flags_pae_rec);
regfree (&flags_hvm_rec);
virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
@@ -2015,7 +2015,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
errcode = regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
if (errcode != 0) {
char error[100];
- regerror (errcode, &xen_cap_rec, error, sizeof error);
+ regerror (errcode, &xen_cap_rec, error, sizeof(error));
regfree (&xen_cap_rec);
regfree (&flags_pae_rec);
regfree (&flags_hvm_rec);
@@ -2470,7 +2470,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int *longmode)
*hvm = "";
if (STREQLEN((const char *)®s.r_ebx, "AuthcAMDenti", 12)) {
- if (pread(fd, ®s, sizeof (regs), 0x80000001) == sizeof (regs)) {
+ if (pread(fd, ®s, sizeof(regs), 0x80000001) == sizeof(regs)) {
/* Read secure virtual machine bit (bit 2 of ECX feature ID) */
if ((regs.r_ecx >> 2) & 1) {
*hvm = "svm";
@@ -2479,7 +2479,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int *longmode)
*pae = 1;
}
} else if (STREQLEN((const char *)®s.r_ebx, "GenuntelineI", 12)) {
- if (pread(fd, ®s, sizeof (regs), 0x00000001) == sizeof (regs)) {
+ if (pread(fd, ®s, sizeof(regs), 0x00000001) == sizeof(regs)) {
/* Read VMXE feature bit (bit 5 of ECX feature ID) */
if ((regs.r_ecx >> 5) & 1)
*hvm = "vmx";
@@ -2591,7 +2591,7 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
* architectures and non-Linux. (XXX)
*/
if (cpuinfo) {
- while (fgets (line, sizeof line, cpuinfo)) {
+ while (fgets (line, sizeof(line), cpuinfo)) {
if (regexec (&flags_hvm_rec, line, sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
&& subs[0].rm_so != -1) {
if (virStrncpy(hvm_type,
@@ -2629,16 +2629,16 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
*/
/* Expecting one line in this file - ignore any more. */
- if ((capabilities) && (fgets (line, sizeof line, capabilities))) {
+ if ((capabilities) && (fgets (line, sizeof(line), capabilities))) {
/* Split the line into tokens. strtok_r is OK here because we "own"
* this buffer. Parse out the features from each token.
*/
for (str = line, nr_guest_archs = 0;
- nr_guest_archs < sizeof guest_archs / sizeof guest_archs[0]
+ nr_guest_archs < sizeof(guest_archs) / sizeof(guest_archs[0])
&& (token = strtok_r (str, " ", &saveptr)) != NULL;
str = NULL) {
- if (regexec (&xen_cap_rec, token, sizeof subs / sizeof subs[0],
+ if (regexec (&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
subs, 0) == 0) {
int hvm = STRPREFIX(&token[subs[1].rm_so], "hvm");
const char *model;
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 831c3d4..6526af4 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -671,7 +671,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
memset(&priv->addr, 0, sizeof(priv->addr));
/* http://people.redhat.com/drepper/userapi-ipv6.html */
- memset (&hints, 0, sizeof hints);
+ memset (&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG;
@@ -3249,7 +3249,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
return -1;
}
if (uriptr->port)
- snprintf (port, sizeof port, "%d", uriptr->port);
+ snprintf (port, sizeof(port), "%d", uriptr->port);
virURIFree (uriptr);
}
else if ((p = strrchr (uri, ':')) != NULL) { /* "hostname:port" */
@@ -3260,7 +3260,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
"%s", _("xenDaemonDomainMigrate: invalid port number"));
return -1;
}
- snprintf (port, sizeof port, "%d", port_nr);
+ snprintf (port, sizeof(port), "%d", port_nr);
/* Get the hostname. */
n = p - uri; /* n = Length of hostname in bytes. */
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 516cf8f..3471b6a 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -60,7 +60,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
virConnectCredential cred;
char *prompt;
- memset(&cred, 0, sizeof (virConnectCredential));
+ memset(&cred, 0, sizeof(virConnectCredential));
if (virAsprintf(&prompt, "Enter %s password for %s", username,
hostname) < 0) {
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index 57379b7..37e3749 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -39,7 +39,7 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
if (virtTestLoadFile(sexpr, &sexprData) < 0)
goto fail;
- memset(&priv, 0, sizeof priv);
+ memset(&priv, 0, sizeof(priv));
/* Many puppies died to bring you this code. */
priv.xendConfigVersion = xendConfigVersion;
priv.caps = caps;
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index f0d1968..204113e 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -54,7 +54,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
int i;
int ret = -1;
- memset(&hints, 0, sizeof hints);
+ memset(&hints, 0, sizeof(hints));
*hasIPv4 = *hasIPv6 = false;
*freePort = 0;
diff --git a/tools/virsh.c b/tools/virsh.c
index 8ee25c3..810fdd7 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1485,7 +1485,7 @@ cmdDomblkstat (vshControl *ctl, const vshCmd *cmd)
last_error = NULL;
if (virDomainBlockStats(dom, device, &stats,
- sizeof stats) == -1) {
+ sizeof(stats)) == -1) {
vshError(ctl, _("Failed to get block stats %s %s"),
name, device);
goto cleanup;
@@ -1597,7 +1597,7 @@ cmdDomIfstat (vshControl *ctl, const vshCmd *cmd)
return false;
}
- if (virDomainInterfaceStats (dom, device, &stats, sizeof stats) == -1) {
+ if (virDomainInterfaceStats (dom, device, &stats, sizeof(stats)) == -1) {
vshError(ctl, _("Failed to get interface stats %s %s"), name, device);
virDomainFree(dom);
return false;
@@ -4578,7 +4578,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
has_managed_save ? _("yes") : _("no"));
/* Security model and label information */
- memset(&secmodel, 0, sizeof secmodel);
+ memset(&secmodel, 0, sizeof(secmodel));
if (virNodeGetSecurityModel(ctl->conn, &secmodel) == -1) {
if (last_error->code != VIR_ERR_NO_SUPPORT) {
virDomainFree(dom);
@@ -13045,7 +13045,7 @@ cmdNodeListDevices (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
virNodeDeviceFree(dev);
}
for (i = 0 ; i < num_devices ; i++) {
- memset(indentBuf, '\0', sizeof indentBuf);
+ memset(indentBuf, '\0', sizeof(indentBuf));
if (parents[i] == NULL)
cmdNodeListDevicesPrint(ctl,
devices,
@@ -16501,7 +16501,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
if (tree) {
char indentBuf[INDENT_BUFLEN];
for (i = 0 ; i < actual ; i++) {
- memset(indentBuf, '\0', sizeof indentBuf);
+ memset(indentBuf, '\0', sizeof(indentBuf));
if (ctl->useSnapshotOld ? STREQ(names[i], from) : !parents[i])
cmdNodeListDevicesPrint(ctl,
names,
@@ -19615,7 +19615,7 @@ vshReadlineDeinit (vshControl *ctl)
if (mkdir(ctl->historydir, 0755) < 0 && errno != EEXIST) {
char ebuf[1024];
vshError(ctl, _("Failed to create '%s': %s"),
- ctl->historydir, virStrerror(errno, ebuf, sizeof ebuf));
+ ctl->historydir, virStrerror(errno, ebuf, sizeof(ebuf)));
} else
write_history(ctl->historyfile);
}
@@ -19653,7 +19653,7 @@ vshReadline (vshControl *ctl, const char *prompt)
int len;
fputs (prompt, stdout);
- r = fgets (line, sizeof line, stdin);
+ r = fgets (line, sizeof(line), stdin);
if (r == NULL) return NULL; /* EOF */
/* Chomp trailing \n */
--
1.7.7.6
12 years, 8 months
[libvirt] [PATCH] libvirt: Fix build err
by ailvpeng25@gmail.com
From: Zhou Peng <ailvpeng25(a)gmail.com>
virNetDevMacVLanRestartWithVPortProfile is omitted in src/libvirt_private.syms,
which causes link err.
---
src/libvirt_private.syms | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c50940b..97fec2f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1288,6 +1288,7 @@ virNetDevMacVLanCreate;
virNetDevMacVLanDelete;
virNetDevMacVLanCreateWithVPortProfile;
virNetDevMacVLanDeleteWithVPortProfile;
+virNetDevMacVLanRestartWithVPortProfile;
# virnetdevopenvswitch.h
--
1.7.7.6
12 years, 8 months
Re: [libvirt] Java API for libvirit
by Eric Blake
[please keep the list in the loop, avoid html mail, and avoid top-posting]
On 03/29/2012 08:04 AM, Yaniv Hadad wrote:
> Hi Eric.
> Did you use it already ??
No, I have not personally used the Java bindings. Which is why keeping
the list in the loop is a wise idea; you're more likely to reach someone
that has.
> What do you mean have not had active maintenance in a while ?
The last commit to libvirt-java.git was in Feb 2011, so it's lagging
libvirt.git by a few releases.
> Which scope of information may I get ?
Ultimately, if someone were to contribute patches to bring the bindings
up-to-date, then you could use Java to access everything that libvirt
provides to other language bindings, such as C, python, and perl.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
12 years, 8 months
[libvirt] [test-API PATCH] log_output: Fix whitespace in log output XSL
by Peter Krempa
The XSL file that converts the log xml into a html file contains some
strange whitespace characters that output in the HTML as squares.
This patch fixes the whitespace and reformats the indetation to two
spaces as used in libvirt XML files.
*log.css: -make test name field wider
*log.xsl: -fix whitespace and indentation
-remove '@' from test headers
---
log.css | 2 +-
log.xsl | 341 +++++++++++++++++++++++++++++++--------------------------------
2 files changed, 170 insertions(+), 173 deletions(-)
diff --git a/log.css b/log.css
index d5fe3e6..84f3ea6 100644
--- a/log.css
+++ b/log.css
@@ -75,7 +75,7 @@ table td{
}
.li-tit{
- width:150px;
+ width:250px;
}
.statu-list{
diff --git a/log.xsl b/log.xsl
index 4ebf030..84ad5fa 100644
--- a/log.xsl
+++ b/log.xsl
@@ -1,179 +1,176 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:output method="html" indent="yes" />
+<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
- <head>
- <title>Libvirt testing log</title>
- <link rel="stylesheet" href="log.css" type="text/css" media="screen" />
- <script language="javascript">
- <![CDATA[
- var xmlDOc;
- var xslDoc;
- var active_result;
- var active_div_id;
-
-
- function init(logname) {
- var xmlDoc;
- var xslDoc;
-
- active_result = "TOTAL";
- expand_last_div();
- }
-
- function expand_last_div() {
- divs = document.getElementsByTagName('div');
- last_div = divs[divs.length - 1];
- last_div.style.display = "block";
- active_div_id = last_div.attributes['id'].value;
- }
-
- function on_result_clicked(div_id, result){
- if (result == active_result && active_div_id == div_id)
- return;
-
- active_result = result;
- active_div_id = div_id;
-
- var table = document.getElementById(div_id + "tb");
- var trs = table.childNodes[1].childNodes;
-
- if (result == "TOTAL") {
- for (var i = 0; i < trs.length; i++) {
- trs[i].style.display = "table-row";
- }
-
- return;
- }
-
- for (var i = 0; i < trs.length; i++) {
- var cels = trs[i].childNodes;
- var is_result = false;
-
- for (var j = 0; j < cels.length; j++) {
-
- if(cels[j].innerHTML == result) {
- is_result = true;
- trs[i].style.display = "table-row";
- break;
- }
- }
-
- if (!is_result) {
- trs[i].style.display = "none";
- }
- }
- }
-
- function fold_unfold(id) {
- div = document.getElementById(id);
-
- if (div.style.display == "block") {
- div.style.display = "none";
- } else {
- div.style.display = "block";
- }
-
- /* fold all other divs */
- /*
- divs = document.getElementsByTagName('div');
- for (var i = 0; i < divs.length; i++) {
- if (divs[i].attributes['id'].value == id) {
- continue;
- } else {
- divs[i].style.display = "none";
- }
- }
- */
- }
- ]]>
- </script>
- </head>
- <body onload="init()">
- <!--<H1>Libvirt testing report</H1>-->
- <center><img src="icon.png" alt=""/></center>
- <xsl:for-each select="log/testrun">
- <xsl:variable name="div_id" select="@name"/>
- <h2><b><a href="#{$div_id}" onclick="fold_unfold({$div_id})">Testrun@<xsl:value-of select="@name"/></a></b></h2>
- <DIV id="{$div_id}" style="display: none;">
- <table border="0" class="statu-list" cellspan="0" cellspacing="0">
- <tr>
- <th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'TOTAL')">Total</a></th>
- <th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'PASS')">PASS</a></th>
- <th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'FAIL')">FAIL</a></th>
- <!--<th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'SKIP')">SKIP</a></th>-->
- <th>Start</th>
- <th>End</th>
- </tr>
- <tr>
- <td><xsl:value-of select="total"/></td>
- <td><xsl:value-of select="pass"/></td>
- <td><xsl:value-of select="fail"/></td>
- <!--<td><xsl:value-of select="skip"/></td>-->
- <td><xsl:value-of select="start_time"/></td>
- <td><xsl:value-of select="end_time"/></td>
- </tr>
- </table>
-
- <table id="{$div_id}tb" class="list" cellspan="0" cellspacing="0">
- <thead>
- <tr>
- <th width="5%">No.</th>
- <th width="5%">Result</th>
- <th width="12%">Start</th>
- <th width="12%">End</th>
- <th width="66%">Test Procedure</th>
- </tr>
- </thead>
-
- <tbody>
- <xsl:for-each select="test">
- <tr>
- <td>
- <xsl:variable name="link" select="path"/>
- <a href="{$link}"><xsl:value-of select="@id"/> </a>
- </td>
- <xsl:choose>
- <xsl:when test="result = 'PASS'">
- <td class="pass"><xsl:value-of select="result"/></td>
- </xsl:when>
- <xsl:when test="result = 'FAIL'">
- <td class="fail"><xsl:value-of select="result"/></td>
- </xsl:when>
- <xsl:otherwise>
- <td></td>
- </xsl:otherwise>
- </xsl:choose>
- <td><xsl:value-of select="start_time"/></td>
- <td><xsl:value-of select="end_time"/></td>
- <td>
- <table class="pro" cellspacing="1" cellspan="0" >
- <xsl:for-each select="test_procedure">
- <tr>
- <td class="li-tit">
- <xsl:value-of select="action/@name"/><br/>
- </td>
- <td>
- <xsl:for-each select="action/arg">
- <span>
- <xsl:value-of select="@name"/>
- <xsl:text>=</xsl:text>
- <xsl:value-of select="."/>
- </span>
- </xsl:for-each>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </td>
- </tr>
- </xsl:for-each>
- </tbody>
- </table>
- </DIV>
- </xsl:for-each>
- </body>
+ <head>
+ <title>Libvirt testing log</title>
+ <link rel="stylesheet" href="log.css" type="text/css" media="screen" />
+ <script language="javascript">
+ <![CDATA[
+ var xmlDOc;
+ var xslDoc;
+ var active_result;
+ var active_div_id;
+
+ function init(logname) {
+ var xmlDoc;
+ var xslDoc;
+
+ active_result = "TOTAL";
+ expand_last_div();
+ }
+
+ function expand_last_div() {
+ divs = document.getElementsByTagName('div');
+ last_div = divs[divs.length - 1];
+ last_div.style.display = "block";
+ active_div_id = last_div.attributes['id'].value;
+ }
+
+ function on_result_clicked(div_id, result){
+ if (result== active_result && active_div_id == div_id)
+ return;
+
+ active_result = result;
+ active_div_id = div_id;
+
+ var table = document.getElementById(div_id + "tb");
+ var trs = table.childNodes[1].childNodes;
+
+ if (result == "TOTAL") {
+ for (var i = 0; i < trs.length; i++) {
+ trs[i].style.display = "table-row";
+ }
+
+ return;
+ }
+
+ for (var i = 0; i < trs.length; i++) {
+ var cels = trs[i].childNodes;
+ var is_result = false;
+
+ for (var j = 0; j < cels.length; j++) {
+ if(cels[j].innerHTML == result) {
+ is_result = true;
+ trs[i].style.display = "table-row";
+ break;
+ }
+ }
+
+ if (!is_result) {
+ trs[i].style.display = "none";
+ }
+ }
+ }
+
+ function fold_unfold(id) {
+ div = document.getElementById(id);
+
+ if (div.style.display == "block") {
+ div.style.display = "none";
+ } else {
+ div.style.display = "block";
+ }
+
+ /* fold all other divs */
+ /*
+ divs = document.getElementsByTagName('div');
+ for (var i = 0; i < divs.length; i++) {
+ if (divs[i].attributes['id'].value == id) {
+ continue;
+ } else {
+ divs[i].style.display = "none";
+ }
+ }
+ */
+ }
+ ]]>
+ </script>
+ </head>
+ <body onload="init()">
+ <!--<H1>Libvirt testing report</H1>-->
+ <center><img src="icon.png" alt=""/></center>
+ <xsl:for-each select="log/testrun">
+ <xsl:variable name="div_id" select="@name"/>
+ <h2><b><a href="#{$div_id}" onclick="fold_unfold({$div_id})">Testrun <xsl:value-of select="@name"/></a></b></h2>
+ <DIV id="{$div_id}" style="display: none;">
+ <table border="0" class="statu-list" cellspan="0" cellspacing="0">
+ <tr>
+ <th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'TOTAL')">Total</a></th>
+ <th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'PASS')">PASS</a></th>
+ <th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'FAIL')">FAIL</a></th>
+ <!--<th><a href="#{$div_id}" onclick="on_result_clicked({$div_id}, 'SKIP')">SKIP</a></th>-->
+ <th>Start</th>
+ <th>End</th>
+ </tr>
+ <tr>
+ <td><xsl:value-of select="total"/></td>
+ <td><xsl:value-of select="pass"/></td>
+ <td><xsl:value-of select="fail"/></td>
+ <!--<td><xsl:value-of select="skip"/></td>-->
+ <td><xsl:value-of select="start_time"/></td>
+ <td><xsl:value-of select="end_time"/></td>
+ </tr>
+ </table>
+
+ <table id="{$div_id}tb" class="list" cellspan="0" cellspacing="0">
+ <thead>
+ <tr>
+ <th width="5%">No.</th>
+ <th width="5%">Result</th>
+ <th width="12%">Start</th>
+ <th width="12%">End</th>
+ <th width="66%">Test Procedure</th>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:for-each select="test">
+ <tr>
+ <td>
+ <xsl:variable name="link" select="path"/>
+ <a href="{$link}"><xsl:value-of select="@id"/> </a>
+ </td>
+ <xsl:choose>
+ <xsl:when test="result = 'PASS'">
+ <td class="pass"><xsl:value-of select="result"/></td>
+ </xsl:when>
+ <xsl:when test="result = 'FAIL'">
+ <td class="fail"><xsl:value-of select="result"/></td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td></td>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td><xsl:value-of select="start_time"/></td>
+ <td><xsl:value-of select="end_time"/></td>
+ <td>
+ <table class="pro" cellspacing="1" cellspan="0" >
+ <xsl:for-each select="test_procedure">
+ <tr>
+ <td class="li-tit">
+ <xsl:value-of select="action/@name"/>
+ </td>
+ <td>
+ <xsl:for-each select="action/arg">
+ <span>
+ <xsl:value-of select="@name"/>
+ <xsl:text>=</xsl:text>
+ <xsl:value-of select="."/>
+ </span>
+ </xsl:for-each>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </DIV>
+ </xsl:for-each>
+ </body>
</html>
</xsl:template>
</xsl:stylesheet>
--
1.7.3.4
12 years, 8 months
[libvirt] Java API for libvirit
by Yaniv Hadad
Hello,
Recently I found it useful to use your product for cross platform
Hyperviscous in target to investigate guests and hosts os\state\version..
details .
I am develop under Web-sphere environment.
For saying the truth I didn't find any Java API for this target
May you help me with this goal ??
What is your suggestion ?
Many Thanks
Yaniv.
(Embedded image moved to file:
pic63134.jpg)
Yaniv Hadad ,
(Embedded image moved to file: pic57918.jpg)+972 4
8296594 (Embedded image moved to file:
pic19510.jpg)+972 50-40-78-908
12 years, 8 months