mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
Use G_N_ELEMENTS instead of ARRAY_CARDINALITY
Prefer the GLib version of the macro. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d99f17a502
commit
67e72053c1
@ -634,6 +634,12 @@ sc_prohibit_attribute_macros:
|
|||||||
halt='use GLib macros: G_GNUC_<ATTRIBUTE_SUFFIX> for most' \
|
halt='use GLib macros: G_GNUC_<ATTRIBUTE_SUFFIX> for most' \
|
||||||
$(_sc_search_regexp)
|
$(_sc_search_regexp)
|
||||||
|
|
||||||
|
sc_prohibit_non_glib_macros:
|
||||||
|
@prohibit='ARRAY_CARDINALITY' \
|
||||||
|
in_vc_files='\.[ch]$$' \
|
||||||
|
halt='use GLib macros: G_N_ELEMENTS' \
|
||||||
|
$(_sc_search_regexp)
|
||||||
|
|
||||||
sc_prohibit_int_index:
|
sc_prohibit_int_index:
|
||||||
@prohibit='\<(int|unsigned)\s*\*?index\>(\s|,|;)' \
|
@prohibit='\<(int|unsigned)\s*\*?index\>(\s|,|;)' \
|
||||||
halt='use different name than 'index' for declaration' \
|
halt='use different name than 'index' for declaration' \
|
||||||
|
@ -118,7 +118,7 @@ static virAccessDriverPtr accessDrivers[] = {
|
|||||||
static virAccessDriverPtr virAccessManagerFindDriver(const char *name)
|
static virAccessDriverPtr virAccessManagerFindDriver(const char *name)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(accessDrivers); i++) {
|
for (i = 0; i < G_N_ELEMENTS(accessDrivers); i++) {
|
||||||
if (STREQ(name, accessDrivers[i]->name))
|
if (STREQ(name, accessDrivers[i]->name))
|
||||||
return accessDrivers[i];
|
return accessDrivers[i];
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
|
|||||||
#define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
|
#define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
|
||||||
do { \
|
do { \
|
||||||
unsigned int __values[] = {__VA_ARGS__}; \
|
unsigned int __values[] = {__VA_ARGS__}; \
|
||||||
size_t __nvalues = ARRAY_CARDINALITY(__values); \
|
size_t __nvalues = G_N_ELEMENTS(__values); \
|
||||||
virDomainCapsEnumSet(&(capsEnum), #capsEnum, \
|
virDomainCapsEnumSet(&(capsEnum), #capsEnum, \
|
||||||
__nvalues, __values); \
|
__nvalues, __values); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -29809,7 +29809,7 @@ virDomainNetSetModelString(virDomainNetDefPtr net,
|
|||||||
if (!model)
|
if (!model)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virDomainNetModelTypeList); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virDomainNetModelTypeList); i++) {
|
||||||
if (STRCASEEQ(virDomainNetModelTypeList[i], model)) {
|
if (STRCASEEQ(virDomainNetModelTypeList[i], model)) {
|
||||||
net->model = i;
|
net->model = i;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -309,7 +309,7 @@ static virStoragePoolTypeInfoPtr
|
|||||||
virStoragePoolTypeInfoLookup(int type)
|
virStoragePoolTypeInfoLookup(int type)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(poolTypeInfo); i++)
|
for (i = 0; i < G_N_ELEMENTS(poolTypeInfo); i++)
|
||||||
if (poolTypeInfo[i].poolType == type)
|
if (poolTypeInfo[i].poolType == type)
|
||||||
return &poolTypeInfo[i];
|
return &poolTypeInfo[i];
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
|
|||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(map); i++) {
|
for (i = 0; i < G_N_ELEMENTS(map); i++) {
|
||||||
if (flags & map[i].snap_flag) {
|
if (flags & map[i].snap_flag) {
|
||||||
flags &= ~map[i].snap_flag;
|
flags &= ~map[i].snap_flag;
|
||||||
moment_flags |= map[i].moment_flag;
|
moment_flags |= map[i].moment_flag;
|
||||||
|
@ -57,7 +57,7 @@ cpuGetSubDriver(virArch arch)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(drivers); i++) {
|
for (i = 0; i < G_N_ELEMENTS(drivers); i++) {
|
||||||
for (j = 0; j < drivers[i]->narch; j++) {
|
for (j = 0; j < drivers[i]->narch; j++) {
|
||||||
if (arch == drivers[i]->arch[j])
|
if (arch == drivers[i]->arch[j])
|
||||||
return drivers[i];
|
return drivers[i];
|
||||||
@ -76,7 +76,7 @@ cpuGetSubDriverByName(const char *name)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(drivers); i++) {
|
for (i = 0; i < G_N_ELEMENTS(drivers); i++) {
|
||||||
if (STREQ_NULLABLE(name, drivers[i]->name))
|
if (STREQ_NULLABLE(name, drivers[i]->name))
|
||||||
return drivers[i];
|
return drivers[i];
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ virCPUarmCompare(virCPUDefPtr host G_GNUC_UNUSED,
|
|||||||
struct cpuArchDriver cpuDriverArm = {
|
struct cpuArchDriver cpuDriverArm = {
|
||||||
.name = "arm",
|
.name = "arm",
|
||||||
.arch = archs,
|
.arch = archs,
|
||||||
.narch = ARRAY_CARDINALITY(archs),
|
.narch = G_N_ELEMENTS(archs),
|
||||||
.compare = virCPUarmCompare,
|
.compare = virCPUarmCompare,
|
||||||
.decode = NULL,
|
.decode = NULL,
|
||||||
.encode = NULL,
|
.encode = NULL,
|
||||||
|
@ -452,7 +452,7 @@ ppc64Compute(virCPUDefPtr host,
|
|||||||
if (cpu->arch != VIR_ARCH_NONE) {
|
if (cpu->arch != VIR_ARCH_NONE) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(archs); i++) {
|
for (i = 0; i < G_N_ELEMENTS(archs); i++) {
|
||||||
if (archs[i] == cpu->arch) {
|
if (archs[i] == cpu->arch) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -824,7 +824,7 @@ virCPUppc64DriverGetModels(char ***models)
|
|||||||
struct cpuArchDriver cpuDriverPPC64 = {
|
struct cpuArchDriver cpuDriverPPC64 = {
|
||||||
.name = "ppc64",
|
.name = "ppc64",
|
||||||
.arch = archs,
|
.arch = archs,
|
||||||
.narch = ARRAY_CARDINALITY(archs),
|
.narch = G_N_ELEMENTS(archs),
|
||||||
.compare = virCPUppc64Compare,
|
.compare = virCPUppc64Compare,
|
||||||
.decode = ppc64DriverDecode,
|
.decode = ppc64DriverDecode,
|
||||||
.encode = NULL,
|
.encode = NULL,
|
||||||
|
@ -114,7 +114,7 @@ virCPUs390ValidateFeatures(virCPUDefPtr cpu)
|
|||||||
struct cpuArchDriver cpuDriverS390 = {
|
struct cpuArchDriver cpuDriverS390 = {
|
||||||
.name = "s390",
|
.name = "s390",
|
||||||
.arch = archs,
|
.arch = archs,
|
||||||
.narch = ARRAY_CARDINALITY(archs),
|
.narch = G_N_ELEMENTS(archs),
|
||||||
.compare = virCPUs390Compare,
|
.compare = virCPUs390Compare,
|
||||||
.decode = NULL,
|
.decode = NULL,
|
||||||
.encode = NULL,
|
.encode = NULL,
|
||||||
|
@ -68,7 +68,7 @@ struct _virCPUx86Feature {
|
|||||||
{ \
|
{ \
|
||||||
.name = (char *) Name, \
|
.name = (char *) Name, \
|
||||||
.data = { \
|
.data = { \
|
||||||
.len = ARRAY_CARDINALITY(Name ## _data), \
|
.len = G_N_ELEMENTS(Name ## _data), \
|
||||||
.items = Name ## _data, \
|
.items = Name ## _data, \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ static virCPUx86FeaturePtr
|
|||||||
x86FeatureFindInternal(const char *name)
|
x86FeatureFindInternal(const char *name)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t count = ARRAY_CARDINALITY(x86_kvm_features);
|
size_t count = G_N_ELEMENTS(x86_kvm_features);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (STREQ(x86_kvm_features[i].name, name))
|
if (STREQ(x86_kvm_features[i].name, name))
|
||||||
@ -1757,7 +1757,7 @@ x86Compute(virCPUDefPtr host,
|
|||||||
if (cpu->arch != VIR_ARCH_NONE) {
|
if (cpu->arch != VIR_ARCH_NONE) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(archs); i++) {
|
for (i = 0; i < G_N_ELEMENTS(archs); i++) {
|
||||||
if (archs[i] == cpu->arch) {
|
if (archs[i] == cpu->arch) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -3422,7 +3422,7 @@ virCPUx86FeatureFilterDropMSR(const char *name,
|
|||||||
struct cpuArchDriver cpuDriverX86 = {
|
struct cpuArchDriver cpuDriverX86 = {
|
||||||
.name = "x86",
|
.name = "x86",
|
||||||
.arch = archs,
|
.arch = archs,
|
||||||
.narch = ARRAY_CARDINALITY(archs),
|
.narch = G_N_ELEMENTS(archs),
|
||||||
.compare = virCPUx86Compare,
|
.compare = virCPUx86Compare,
|
||||||
.decode = x86DecodeCPUData,
|
.decode = x86DecodeCPUData,
|
||||||
.encode = x86Encode,
|
.encode = x86Encode,
|
||||||
|
@ -547,7 +547,7 @@ ESX_VI__TEMPLATE__FREE(SharedCURL,
|
|||||||
if (item->handle)
|
if (item->handle)
|
||||||
curl_share_cleanup(item->handle);
|
curl_share_cleanup(item->handle);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(item->locks); ++i)
|
for (i = 0; i < G_N_ELEMENTS(item->locks); ++i)
|
||||||
virMutexDestroy(&item->locks[i]);
|
virMutexDestroy(&item->locks[i]);
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl)
|
|||||||
curl_share_setopt(shared->handle, CURLSHOPT_SHARE,
|
curl_share_setopt(shared->handle, CURLSHOPT_SHARE,
|
||||||
CURL_LOCK_DATA_DNS);
|
CURL_LOCK_DATA_DNS);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(shared->locks); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(shared->locks); ++i) {
|
||||||
if (virMutexInit(&shared->locks[i]) < 0) {
|
if (virMutexInit(&shared->locks[i]) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not initialize a CURL (share) mutex"));
|
_("Could not initialize a CURL (share) mutex"));
|
||||||
|
@ -91,7 +91,6 @@
|
|||||||
((a) ? !(b) || STRNEQ((a), (b)) : !!(b))
|
((a) ? !(b) || STRNEQ((a), (b)) : !!(b))
|
||||||
|
|
||||||
#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
|
#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
|
||||||
#define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array)))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G_GNUC_NO_INLINE:
|
* G_GNUC_NO_INLINE:
|
||||||
|
@ -3323,7 +3323,7 @@ virDomainMigrateUnmanagedProto2(virDomainPtr domain,
|
|||||||
unsigned long long bandwidth = 0;
|
unsigned long long bandwidth = 0;
|
||||||
|
|
||||||
if (!virTypedParamsCheck(params, nparams, compatParams,
|
if (!virTypedParamsCheck(params, nparams, compatParams,
|
||||||
ARRAY_CARDINALITY(compatParams))) {
|
G_N_ELEMENTS(compatParams))) {
|
||||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||||
_("Some parameters are not supported by migration "
|
_("Some parameters are not supported by migration "
|
||||||
"protocol 2"));
|
"protocol 2"));
|
||||||
@ -3372,7 +3372,7 @@ virDomainMigrateUnmanagedProto3(virDomainPtr domain,
|
|||||||
unsigned long long bandwidth = 0;
|
unsigned long long bandwidth = 0;
|
||||||
|
|
||||||
if (!virTypedParamsCheck(params, nparams, compatParams,
|
if (!virTypedParamsCheck(params, nparams, compatParams,
|
||||||
ARRAY_CARDINALITY(compatParams))) {
|
G_N_ELEMENTS(compatParams))) {
|
||||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||||
_("Some parameters are not supported by migration "
|
_("Some parameters are not supported by migration "
|
||||||
"protocol 3"));
|
"protocol 3"));
|
||||||
@ -3933,7 +3933,7 @@ virDomainMigrate3(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!virTypedParamsCheck(params, nparams, compatParams,
|
if (!virTypedParamsCheck(params, nparams, compatParams,
|
||||||
ARRAY_CARDINALITY(compatParams))) {
|
G_N_ELEMENTS(compatParams))) {
|
||||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||||
_("Migration APIs with extensible parameters are not "
|
_("Migration APIs with extensible parameters are not "
|
||||||
"supported but extended parameters were passed"));
|
"supported but extended parameters were passed"));
|
||||||
|
@ -1551,7 +1551,7 @@ virNodeGetCPUMap(virConnectPtr conn,
|
|||||||
* Example how to use this API:
|
* Example how to use this API:
|
||||||
*
|
*
|
||||||
* unsigned int pages[] = { 4, 2048, 1048576}
|
* unsigned int pages[] = { 4, 2048, 1048576}
|
||||||
* unsigned int npages = ARRAY_CARDINALITY(pages);
|
* unsigned int npages = G_N_ELEMENTS(pages);
|
||||||
* int startcell = 0;
|
* int startcell = 0;
|
||||||
* unsigned int cellcount = 2;
|
* unsigned int cellcount = 2;
|
||||||
*
|
*
|
||||||
|
@ -134,11 +134,11 @@ libxlCapsNodeData(virCPUDefPtr cpu, libxl_hwcap hwcap,
|
|||||||
if (!(cpudata = virCPUDataNew(cpu->arch)))
|
if (!(cpudata = virCPUDataNew(cpu->arch)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ncaps = ARRAY_CARDINALITY(cpuid);
|
ncaps = G_N_ELEMENTS(cpuid);
|
||||||
if (libxlCapsAddCPUID(cpudata, cpuid, ncaps) < 0)
|
if (libxlCapsAddCPUID(cpudata, cpuid, ncaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ncaps = ARRAY_CARDINALITY(cpuid_ver1);
|
ncaps = G_N_ELEMENTS(cpuid_ver1);
|
||||||
if (version > LIBXL_HWCAP_V0 &&
|
if (version > LIBXL_HWCAP_V0 &&
|
||||||
libxlCapsAddCPUID(cpudata, cpuid_ver1, ncaps) < 0)
|
libxlCapsAddCPUID(cpudata, cpuid_ver1, ncaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -471,7 +471,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Too many arch flavours - highly unlikely ! */
|
/* Too many arch flavours - highly unlikely ! */
|
||||||
if (i >= ARRAY_CARDINALITY(guest_archs))
|
if (i >= G_N_ELEMENTS(guest_archs))
|
||||||
continue;
|
continue;
|
||||||
/* Didn't find a match, so create a new one */
|
/* Didn't find a match, so create a new one */
|
||||||
if (i == nr_guest_archs)
|
if (i == nr_guest_archs)
|
||||||
@ -500,7 +500,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
|
|||||||
#ifdef HAVE_XEN_PVH
|
#ifdef HAVE_XEN_PVH
|
||||||
if (hvm && i == nr_guest_archs-1) {
|
if (hvm && i == nr_guest_archs-1) {
|
||||||
/* Ensure we have not exhausted the guest_archs array */
|
/* Ensure we have not exhausted the guest_archs array */
|
||||||
if (nr_guest_archs >= ARRAY_CARDINALITY(guest_archs))
|
if (nr_guest_archs >= G_N_ELEMENTS(guest_archs))
|
||||||
continue;
|
continue;
|
||||||
i = nr_guest_archs;
|
i = nr_guest_archs;
|
||||||
nr_guest_archs++;
|
nr_guest_archs++;
|
||||||
|
@ -5339,7 +5339,7 @@ libxlDiskPathToID(const char *virtpath)
|
|||||||
fmt = id = -1;
|
fmt = id = -1;
|
||||||
|
|
||||||
/* Find any disk prefixes we know about */
|
/* Find any disk prefixes we know about */
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(drive_prefix); i++) {
|
for (i = 0; i < G_N_ELEMENTS(drive_prefix); i++) {
|
||||||
if (STRPREFIX(virtpath, drive_prefix[i]) &&
|
if (STRPREFIX(virtpath, drive_prefix[i]) &&
|
||||||
!virDiskNameParse(virtpath, &disk, &partition)) {
|
!virDiskNameParse(virtpath, &disk, &partition)) {
|
||||||
fmt = i;
|
fmt = i;
|
||||||
|
@ -860,7 +860,7 @@ static void libxlTunnel3MigrationSrcFunc(void *arg)
|
|||||||
|
|
||||||
fds[0].events = POLLIN;
|
fds[0].events = POLLIN;
|
||||||
fds[0].revents = 0;
|
fds[0].revents = 0;
|
||||||
ret = poll(fds, ARRAY_CARDINALITY(fds), timeout);
|
ret = poll(fds, G_N_ELEMENTS(fds), timeout);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EAGAIN || errno == EINTR)
|
if (errno == EAGAIN || errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
@ -1138,7 +1138,7 @@ static int virConnectCredType[] = {
|
|||||||
|
|
||||||
static virConnectAuth virConnectAuthConfig = {
|
static virConnectAuth virConnectAuthConfig = {
|
||||||
.credtype = virConnectCredType,
|
.credtype = virConnectCredType,
|
||||||
.ncredtype = ARRAY_CARDINALITY(virConnectCredType),
|
.ncredtype = G_N_ELEMENTS(virConnectCredType),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* On P2P mode there is only the Perform3 phase and we need to handle
|
/* On P2P mode there is only the Perform3 phase and we need to handle
|
||||||
|
@ -250,7 +250,7 @@ xenTranslateCPUFeature(const char *feature_name, bool from_libxl)
|
|||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(translation_table); i++)
|
for (i = 0; i < G_N_ELEMENTS(translation_table); i++)
|
||||||
if (STREQ(translation_table[i][from_libxl], feature_name))
|
if (STREQ(translation_table[i][from_libxl], feature_name))
|
||||||
return translation_table[i][!from_libxl];
|
return translation_table[i][!from_libxl];
|
||||||
return feature_name;
|
return feature_name;
|
||||||
|
@ -50,7 +50,7 @@ static int virDomainLockManagerAddLease(virLockManagerPtr lock,
|
|||||||
.value = { .str = lease->lockspace },
|
.value = { .str = lease->lockspace },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
size_t nparams = ARRAY_CARDINALITY(lparams);
|
size_t nparams = G_N_ELEMENTS(lparams);
|
||||||
if (!lease->lockspace)
|
if (!lease->lockspace)
|
||||||
nparams--;
|
nparams--;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ static virLockManagerPtr virDomainLockManagerNew(virLockManagerPluginPtr plugin,
|
|||||||
|
|
||||||
if (!(lock = virLockManagerNew(virLockManagerPluginGetDriver(plugin),
|
if (!(lock = virLockManagerNew(virLockManagerPluginGetDriver(plugin),
|
||||||
VIR_LOCK_MANAGER_OBJECT_TYPE_DOMAIN,
|
VIR_LOCK_MANAGER_OBJECT_TYPE_DOMAIN,
|
||||||
ARRAY_CARDINALITY(params),
|
G_N_ELEMENTS(params),
|
||||||
params,
|
params,
|
||||||
flags)))
|
flags)))
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -314,7 +314,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(lockd->dmn = virNetDaemonNewPostExecRestart(child,
|
if (!(lockd->dmn = virNetDaemonNewPostExecRestart(child,
|
||||||
ARRAY_CARDINALITY(serverNames),
|
G_N_ELEMENTS(serverNames),
|
||||||
serverNames,
|
serverNames,
|
||||||
virLockDaemonNewServerPostExecRestart,
|
virLockDaemonNewServerPostExecRestart,
|
||||||
(void*)(intptr_t)(privileged ? 0x1 : 0x0))))
|
(void*)(intptr_t)(privileged ? 0x1 : 0x0))))
|
||||||
@ -1317,7 +1317,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virSystemdGetActivation(actmap,
|
if (virSystemdGetActivation(actmap,
|
||||||
ARRAY_CARDINALITY(actmap),
|
G_N_ELEMENTS(actmap),
|
||||||
&act) < 0) {
|
&act) < 0) {
|
||||||
ret = VIR_LOCK_DAEMON_ERR_NETWORK;
|
ret = VIR_LOCK_DAEMON_ERR_NETWORK;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -63,7 +63,7 @@ main(int argc, char **argv)
|
|||||||
};
|
};
|
||||||
virConnectAuth auth = {
|
virConnectAuth auth = {
|
||||||
.credtype = authTypes,
|
.credtype = authTypes,
|
||||||
.ncredtype = ARRAY_CARDINALITY(authTypes),
|
.ncredtype = G_N_ELEMENTS(authTypes),
|
||||||
.cb = authCallback,
|
.cb = authCallback,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ virLogDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(logd->dmn = virNetDaemonNewPostExecRestart(child,
|
if (!(logd->dmn = virNetDaemonNewPostExecRestart(child,
|
||||||
ARRAY_CARDINALITY(serverNames),
|
G_N_ELEMENTS(serverNames),
|
||||||
serverNames,
|
serverNames,
|
||||||
virLogDaemonNewServerPostExecRestart,
|
virLogDaemonNewServerPostExecRestart,
|
||||||
(void*)(intptr_t)(privileged ? 0x1 : 0x0))))
|
(void*)(intptr_t)(privileged ? 0x1 : 0x0))))
|
||||||
@ -1090,7 +1090,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virSystemdGetActivation(actmap,
|
if (virSystemdGetActivation(actmap,
|
||||||
ARRAY_CARDINALITY(actmap),
|
G_N_ELEMENTS(actmap),
|
||||||
&act) < 0) {
|
&act) < 0) {
|
||||||
ret = VIR_LOG_DAEMON_ERR_NETWORK;
|
ret = VIR_LOG_DAEMON_ERR_NETWORK;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -823,7 +823,7 @@ bool lxcIsBasicMountLocation(const char *path)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(lxcBasicMounts); i++) {
|
for (i = 0; i < G_N_ELEMENTS(lxcBasicMounts); i++) {
|
||||||
if (STREQ(path, lxcBasicMounts[i].dst))
|
if (STREQ(path, lxcBasicMounts[i].dst))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -900,7 +900,7 @@ static int lxcContainerMountBasicFS(bool userns_enabled,
|
|||||||
|
|
||||||
VIR_DEBUG("Mounting basic filesystems");
|
VIR_DEBUG("Mounting basic filesystems");
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(lxcBasicMounts); i++) {
|
for (i = 0; i < G_N_ELEMENTS(lxcBasicMounts); i++) {
|
||||||
bool bindOverReadonly;
|
bool bindOverReadonly;
|
||||||
virLXCBasicMountInfo const *mnt = &lxcBasicMounts[i];
|
virLXCBasicMountInfo const *mnt = &lxcBasicMounts[i];
|
||||||
|
|
||||||
@ -1126,7 +1126,7 @@ static int lxcContainerSetupDevices(char **ttyPaths, size_t nttyPaths)
|
|||||||
{ "/proc/self/fd", "/dev/fd" },
|
{ "/proc/self/fd", "/dev/fd" },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(links); i++) {
|
for (i = 0; i < G_N_ELEMENTS(links); i++) {
|
||||||
if (symlink(links[i].src, links[i].dst) < 0) {
|
if (symlink(links[i].src, links[i].dst) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Failed to symlink device %s to %s"),
|
_("Failed to symlink device %s to %s"),
|
||||||
|
@ -1521,7 +1521,7 @@ static int virLXCControllerPopulateDevices(virLXCControllerPtr ctrl)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Populate /dev/ with a few important bits */
|
/* Populate /dev/ with a few important bits */
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(devs); i++) {
|
for (i = 0; i < G_N_ELEMENTS(devs); i++) {
|
||||||
if (virAsprintf(&path, "/%s/%s.dev/%s",
|
if (virAsprintf(&path, "/%s/%s.dev/%s",
|
||||||
LXC_STATE_DIR, ctrl->def->name, devs[i].path) < 0)
|
LXC_STATE_DIR, ctrl->def->name, devs[i].path) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -171,7 +171,7 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm,
|
|||||||
if (!(mon->program = virNetClientProgramNew(VIR_LXC_MONITOR_PROGRAM,
|
if (!(mon->program = virNetClientProgramNew(VIR_LXC_MONITOR_PROGRAM,
|
||||||
VIR_LXC_MONITOR_PROGRAM_VERSION,
|
VIR_LXC_MONITOR_PROGRAM_VERSION,
|
||||||
virLXCMonitorEvents,
|
virLXCMonitorEvents,
|
||||||
ARRAY_CARDINALITY(virLXCMonitorEvents),
|
G_N_ELEMENTS(virLXCMonitorEvents),
|
||||||
mon)))
|
mon)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ gather_capability(LibHalContext *ctx, const char *udi,
|
|||||||
{
|
{
|
||||||
caps_tbl_entry *entry;
|
caps_tbl_entry *entry;
|
||||||
|
|
||||||
entry = bsearch(&cap_name, caps_tbl, ARRAY_CARDINALITY(caps_tbl),
|
entry = bsearch(&cap_name, caps_tbl, G_N_ELEMENTS(caps_tbl),
|
||||||
sizeof(caps_tbl[0]), cmpstringp);
|
sizeof(caps_tbl[0]), cmpstringp);
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
@ -604,7 +604,7 @@ nodeStateInitialize(bool privileged G_GNUC_UNUSED,
|
|||||||
DBusError err;
|
DBusError err;
|
||||||
|
|
||||||
/* Ensure caps_tbl is sorted by capability name */
|
/* Ensure caps_tbl is sorted by capability name */
|
||||||
qsort(caps_tbl, ARRAY_CARDINALITY(caps_tbl), sizeof(caps_tbl[0]),
|
qsort(caps_tbl, G_N_ELEMENTS(caps_tbl), sizeof(caps_tbl[0]),
|
||||||
cmpstringp);
|
cmpstringp);
|
||||||
|
|
||||||
if (VIR_ALLOC(driver) < 0)
|
if (VIR_ALLOC(driver) < 0)
|
||||||
|
@ -1425,7 +1425,7 @@ udevEnumerateAddMatches(struct udev_enumerate *udev_enumerate)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(subsystem_blacklist); i++) {
|
for (i = 0; i < G_N_ELEMENTS(subsystem_blacklist); i++) {
|
||||||
const char *s = subsystem_blacklist[i];
|
const char *s = subsystem_blacklist[i];
|
||||||
if (udev_enumerate_add_nomatch_subsystem(udev_enumerate, s) < 0) {
|
if (udev_enumerate_add_nomatch_subsystem(udev_enumerate, s) < 0) {
|
||||||
virReportSystemError(errno, "%s", _("failed to add susbsystem filter"));
|
virReportSystemError(errno, "%s", _("failed to add susbsystem filter"));
|
||||||
|
@ -1382,7 +1382,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
|||||||
virNWFilterSnoopReqLock(req);
|
virNWFilterSnoopReqLock(req);
|
||||||
|
|
||||||
if (req->binding->portdevname && req->threadkey) {
|
if (req->binding->portdevname && req->threadkey) {
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(pcapConf); i++) {
|
for (i = 0; i < G_N_ELEMENTS(pcapConf); i++) {
|
||||||
pcapConf[i].handle =
|
pcapConf[i].handle =
|
||||||
virNWFilterSnoopDHCPOpen(req->binding->portdevname,
|
virNWFilterSnoopDHCPOpen(req->binding->portdevname,
|
||||||
&req->binding->mac,
|
&req->binding->mac,
|
||||||
@ -1419,7 +1419,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
|||||||
|
|
||||||
while (!error) {
|
while (!error) {
|
||||||
if (virNWFilterSnoopAdjustPoll(pcapConf,
|
if (virNWFilterSnoopAdjustPoll(pcapConf,
|
||||||
ARRAY_CARDINALITY(pcapConf),
|
G_N_ELEMENTS(pcapConf),
|
||||||
fds, &pollTo) < 0) {
|
fds, &pollTo) < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1428,7 +1428,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
|||||||
if (pollTo < 0 || pollTo > SNOOP_POLL_MAX_TIMEOUT_MS)
|
if (pollTo < 0 || pollTo > SNOOP_POLL_MAX_TIMEOUT_MS)
|
||||||
pollTo = SNOOP_POLL_MAX_TIMEOUT_MS;
|
pollTo = SNOOP_POLL_MAX_TIMEOUT_MS;
|
||||||
|
|
||||||
n = poll(fds, ARRAY_CARDINALITY(fds), pollTo);
|
n = poll(fds, G_N_ELEMENTS(fds), pollTo);
|
||||||
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
if (errno != EAGAIN && errno != EINTR)
|
if (errno != EAGAIN && errno != EINTR)
|
||||||
@ -1445,7 +1445,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
|||||||
req->jobCompletionStatus != 0)
|
req->jobCompletionStatus != 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
for (i = 0; n > 0 && i < ARRAY_CARDINALITY(fds); i++) {
|
for (i = 0; n > 0 && i < G_N_ELEMENTS(fds); i++) {
|
||||||
if (!fds[i].revents)
|
if (!fds[i].revents)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1567,7 +1567,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
|||||||
|
|
||||||
VIR_FREE(threadkey);
|
VIR_FREE(threadkey);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(pcapConf); i++) {
|
for (i = 0; i < G_N_ELEMENTS(pcapConf); i++) {
|
||||||
if (pcapConf[i].handle)
|
if (pcapConf[i].handle)
|
||||||
pcap_close(pcapConf[i].handle);
|
pcap_close(pcapConf[i].handle);
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,7 @@ learnIPAddressThread(void *arg)
|
|||||||
pcap_freecode(&fp);
|
pcap_freecode(&fp);
|
||||||
|
|
||||||
while (req->status == 0 && vmaddr == 0) {
|
while (req->status == 0 && vmaddr == 0) {
|
||||||
int n = poll(fds, ARRAY_CARDINALITY(fds), PKT_TIMEOUT_MS);
|
int n = poll(fds, G_N_ELEMENTS(fds), PKT_TIMEOUT_MS);
|
||||||
|
|
||||||
if (threadsTerminate || req->terminate) {
|
if (threadsTerminate || req->terminate) {
|
||||||
req->status = ECANCELED;
|
req->status = ECANCELED;
|
||||||
|
@ -127,7 +127,7 @@ waitsocket(int socket_fd, LIBSSH2_SESSION * session)
|
|||||||
if (dir & LIBSSH2_SESSION_BLOCK_OUTBOUND)
|
if (dir & LIBSSH2_SESSION_BLOCK_OUTBOUND)
|
||||||
fds[0].events |= POLLOUT;
|
fds[0].events |= POLLOUT;
|
||||||
|
|
||||||
return poll(fds, ARRAY_CARDINALITY(fds), -1);
|
return poll(fds, G_N_ELEMENTS(fds), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function is the layer that manipulates the ssh channel itself
|
/* this function is the layer that manipulates the ssh channel itself
|
||||||
|
@ -264,7 +264,7 @@ qemuAgentIOProcessEvent(qemuAgentPtr mon,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(eventHandlers); i++) {
|
for (i = 0; i < G_N_ELEMENTS(eventHandlers); i++) {
|
||||||
if (STREQ(eventHandlers[i].type, type)) {
|
if (STREQ(eventHandlers[i].type, type)) {
|
||||||
virJSONValuePtr data = virJSONValueObjectGet(obj, "data");
|
virJSONValuePtr data = virJSONValueObjectGet(obj, "data");
|
||||||
VIR_DEBUG("handle %s handler=%p data=%p", type,
|
VIR_DEBUG("handle %s handler=%p data=%p", type,
|
||||||
|
@ -1313,103 +1313,103 @@ typedef int (*virQEMUCapsObjectTypePropsCB)(qemuMonitorPtr mon,
|
|||||||
|
|
||||||
static virQEMUCapsObjectTypeProps virQEMUCapsDeviceProps[] = {
|
static virQEMUCapsObjectTypeProps virQEMUCapsDeviceProps[] = {
|
||||||
{ "virtio-blk-pci", virQEMUCapsDevicePropsVirtioBlk,
|
{ "virtio-blk-pci", virQEMUCapsDevicePropsVirtioBlk,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioBlk),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioBlk),
|
||||||
-1 },
|
-1 },
|
||||||
{ "virtio-net-pci", virQEMUCapsDevicePropsVirtioNet,
|
{ "virtio-net-pci", virQEMUCapsDevicePropsVirtioNet,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioNet),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioNet),
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_NET },
|
QEMU_CAPS_DEVICE_VIRTIO_NET },
|
||||||
{ "virtio-scsi-pci", virQEMUCapsDevicePropsVirtioSCSI,
|
{ "virtio-scsi-pci", virQEMUCapsDevicePropsVirtioSCSI,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioSCSI),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioSCSI),
|
||||||
QEMU_CAPS_VIRTIO_SCSI },
|
QEMU_CAPS_VIRTIO_SCSI },
|
||||||
{ "virtio-blk-ccw", virQEMUCapsDevicePropsVirtioBlk,
|
{ "virtio-blk-ccw", virQEMUCapsDevicePropsVirtioBlk,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioBlk),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioBlk),
|
||||||
QEMU_CAPS_VIRTIO_CCW },
|
QEMU_CAPS_VIRTIO_CCW },
|
||||||
{ "virtio-net-ccw", virQEMUCapsDevicePropsVirtioNet,
|
{ "virtio-net-ccw", virQEMUCapsDevicePropsVirtioNet,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioNet),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioNet),
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_NET },
|
QEMU_CAPS_DEVICE_VIRTIO_NET },
|
||||||
{ "virtio-scsi-ccw", virQEMUCapsDevicePropsVirtioSCSI,
|
{ "virtio-scsi-ccw", virQEMUCapsDevicePropsVirtioSCSI,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioSCSI),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioSCSI),
|
||||||
QEMU_CAPS_VIRTIO_SCSI },
|
QEMU_CAPS_VIRTIO_SCSI },
|
||||||
{ "virtio-blk-s390", virQEMUCapsDevicePropsVirtioBlk,
|
{ "virtio-blk-s390", virQEMUCapsDevicePropsVirtioBlk,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioBlk),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioBlk),
|
||||||
QEMU_CAPS_VIRTIO_S390 },
|
QEMU_CAPS_VIRTIO_S390 },
|
||||||
{ "virtio-net-s390", virQEMUCapsDevicePropsVirtioNet,
|
{ "virtio-net-s390", virQEMUCapsDevicePropsVirtioNet,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioNet),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioNet),
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_NET },
|
QEMU_CAPS_DEVICE_VIRTIO_NET },
|
||||||
{ "vfio-pci", virQEMUCapsDevicePropsVfioPCI,
|
{ "vfio-pci", virQEMUCapsDevicePropsVfioPCI,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVfioPCI),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVfioPCI),
|
||||||
QEMU_CAPS_DEVICE_VFIO_PCI },
|
QEMU_CAPS_DEVICE_VFIO_PCI },
|
||||||
{ "scsi-hd", virQEMUCapsDevicePropsSCSIDisk,
|
{ "scsi-hd", virQEMUCapsDevicePropsSCSIDisk,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsSCSIDisk),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsSCSIDisk),
|
||||||
-1 },
|
-1 },
|
||||||
{ "ide-hd", virQEMUCapsDevicePropsIDEDrive,
|
{ "ide-hd", virQEMUCapsDevicePropsIDEDrive,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsIDEDrive),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsIDEDrive),
|
||||||
-1 },
|
-1 },
|
||||||
{ "PIIX4_PM", virQEMUCapsDevicePropsPiix4PM,
|
{ "PIIX4_PM", virQEMUCapsDevicePropsPiix4PM,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsPiix4PM),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsPiix4PM),
|
||||||
-1 },
|
-1 },
|
||||||
{ "usb-redir", virQEMUCapsDevicePropsUSBRedir,
|
{ "usb-redir", virQEMUCapsDevicePropsUSBRedir,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsUSBRedir),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsUSBRedir),
|
||||||
QEMU_CAPS_USB_REDIR },
|
QEMU_CAPS_USB_REDIR },
|
||||||
{ "i440FX-pcihost", virQEMUCapsDevicePropsI440FXPCIHost,
|
{ "i440FX-pcihost", virQEMUCapsDevicePropsI440FXPCIHost,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsI440FXPCIHost),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsI440FXPCIHost),
|
||||||
-1 },
|
-1 },
|
||||||
{ "q35-pcihost", virQEMUCapsDevicePropsQ35PCIHost,
|
{ "q35-pcihost", virQEMUCapsDevicePropsQ35PCIHost,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsQ35PCIHost),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsQ35PCIHost),
|
||||||
-1 },
|
-1 },
|
||||||
{ "usb-storage", virQEMUCapsDevicePropsUSBStorage,
|
{ "usb-storage", virQEMUCapsDevicePropsUSBStorage,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsUSBStorage),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsUSBStorage),
|
||||||
QEMU_CAPS_DEVICE_USB_STORAGE },
|
QEMU_CAPS_DEVICE_USB_STORAGE },
|
||||||
{ "kvm-pit", virQEMUCapsDevicePropsKVMPit,
|
{ "kvm-pit", virQEMUCapsDevicePropsKVMPit,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsKVMPit),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsKVMPit),
|
||||||
-1 },
|
-1 },
|
||||||
{ "VGA", virQEMUCapsDevicePropsVGA,
|
{ "VGA", virQEMUCapsDevicePropsVGA,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVGA),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVGA),
|
||||||
QEMU_CAPS_DEVICE_VGA },
|
QEMU_CAPS_DEVICE_VGA },
|
||||||
{ "vmware-svga", virQEMUCapsDevicePropsVmwareSvga,
|
{ "vmware-svga", virQEMUCapsDevicePropsVmwareSvga,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVmwareSvga),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVmwareSvga),
|
||||||
QEMU_CAPS_DEVICE_VMWARE_SVGA },
|
QEMU_CAPS_DEVICE_VMWARE_SVGA },
|
||||||
{ "qxl", virQEMUCapsDevicePropsQxl,
|
{ "qxl", virQEMUCapsDevicePropsQxl,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsQxl),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsQxl),
|
||||||
QEMU_CAPS_DEVICE_QXL },
|
QEMU_CAPS_DEVICE_QXL },
|
||||||
{ "virtio-gpu-pci", virQEMUCapsDevicePropsVirtioGpu,
|
{ "virtio-gpu-pci", virQEMUCapsDevicePropsVirtioGpu,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioGpu),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioGpu),
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_GPU },
|
QEMU_CAPS_DEVICE_VIRTIO_GPU },
|
||||||
{ "virtio-gpu-device", virQEMUCapsDevicePropsVirtioGpu,
|
{ "virtio-gpu-device", virQEMUCapsDevicePropsVirtioGpu,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioGpu),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioGpu),
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_GPU },
|
QEMU_CAPS_DEVICE_VIRTIO_GPU },
|
||||||
{ "ICH9-LPC", virQEMUCapsDevicePropsICH9,
|
{ "ICH9-LPC", virQEMUCapsDevicePropsICH9,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsICH9),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsICH9),
|
||||||
-1 },
|
-1 },
|
||||||
{ "virtio-balloon-pci", virQEMUCapsDevicePropsVirtioBalloon,
|
{ "virtio-balloon-pci", virQEMUCapsDevicePropsVirtioBalloon,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioBalloon),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioBalloon),
|
||||||
-1 },
|
-1 },
|
||||||
{ "virtio-balloon-ccw", virQEMUCapsDevicePropsVirtioBalloon,
|
{ "virtio-balloon-ccw", virQEMUCapsDevicePropsVirtioBalloon,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioBalloon),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioBalloon),
|
||||||
-1 },
|
-1 },
|
||||||
{ "virtio-balloon-device", virQEMUCapsDevicePropsVirtioBalloon,
|
{ "virtio-balloon-device", virQEMUCapsDevicePropsVirtioBalloon,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioBalloon),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioBalloon),
|
||||||
-1 },
|
-1 },
|
||||||
{ "nec-usb-xhci", virQEMUCapsDevicePropsUSBNECXHCI,
|
{ "nec-usb-xhci", virQEMUCapsDevicePropsUSBNECXHCI,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsUSBNECXHCI),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsUSBNECXHCI),
|
||||||
QEMU_CAPS_NEC_USB_XHCI },
|
QEMU_CAPS_NEC_USB_XHCI },
|
||||||
{ "intel-iommu", virQEMUCapsDevicePropsIntelIOMMU,
|
{ "intel-iommu", virQEMUCapsDevicePropsIntelIOMMU,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsIntelIOMMU),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsIntelIOMMU),
|
||||||
QEMU_CAPS_DEVICE_INTEL_IOMMU },
|
QEMU_CAPS_DEVICE_INTEL_IOMMU },
|
||||||
{ "spapr-pci-host-bridge", virQEMUCapsDevicePropsSpaprPCIHostBridge,
|
{ "spapr-pci-host-bridge", virQEMUCapsDevicePropsSpaprPCIHostBridge,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsSpaprPCIHostBridge),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsSpaprPCIHostBridge),
|
||||||
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE },
|
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE },
|
||||||
{ "virtio-gpu-ccw", virQEMUCapsDevicePropsVirtioGpu,
|
{ "virtio-gpu-ccw", virQEMUCapsDevicePropsVirtioGpu,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsVirtioGpu),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioGpu),
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW },
|
QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW },
|
||||||
{ "virtual-css-bridge", virQEMUCapsObjectPropsVirtualCSSBridge,
|
{ "virtual-css-bridge", virQEMUCapsObjectPropsVirtualCSSBridge,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtualCSSBridge),
|
G_N_ELEMENTS(virQEMUCapsObjectPropsVirtualCSSBridge),
|
||||||
QEMU_CAPS_CCW },
|
QEMU_CAPS_CCW },
|
||||||
{ "mch", virQEMUCapsDevicePropsMCH,
|
{ "mch", virQEMUCapsDevicePropsMCH,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsMCH),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsMCH),
|
||||||
QEMU_CAPS_DEVICE_MCH },
|
QEMU_CAPS_DEVICE_MCH },
|
||||||
{ "nvdimm", virQEMUCapsDevicePropsNVDIMM,
|
{ "nvdimm", virQEMUCapsDevicePropsNVDIMM,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDevicePropsNVDIMM),
|
G_N_ELEMENTS(virQEMUCapsDevicePropsNVDIMM),
|
||||||
QEMU_CAPS_DEVICE_NVDIMM },
|
QEMU_CAPS_DEVICE_NVDIMM },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1429,13 +1429,13 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMaxX86CPU[] = {
|
|||||||
|
|
||||||
static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
|
static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
|
||||||
{ "memory-backend-file", virQEMUCapsObjectPropsMemoryBackendFile,
|
{ "memory-backend-file", virQEMUCapsObjectPropsMemoryBackendFile,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsObjectPropsMemoryBackendFile),
|
G_N_ELEMENTS(virQEMUCapsObjectPropsMemoryBackendFile),
|
||||||
QEMU_CAPS_OBJECT_MEMORY_FILE },
|
QEMU_CAPS_OBJECT_MEMORY_FILE },
|
||||||
{ "memory-backend-memfd", virQEMUCapsObjectPropsMemoryBackendMemfd,
|
{ "memory-backend-memfd", virQEMUCapsObjectPropsMemoryBackendMemfd,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsObjectPropsMemoryBackendMemfd),
|
G_N_ELEMENTS(virQEMUCapsObjectPropsMemoryBackendMemfd),
|
||||||
QEMU_CAPS_OBJECT_MEMORY_MEMFD },
|
QEMU_CAPS_OBJECT_MEMORY_MEMFD },
|
||||||
{ "max-x86_64-cpu", virQEMUCapsObjectPropsMaxX86CPU,
|
{ "max-x86_64-cpu", virQEMUCapsObjectPropsMaxX86CPU,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsObjectPropsMaxX86CPU),
|
G_N_ELEMENTS(virQEMUCapsObjectPropsMaxX86CPU),
|
||||||
QEMU_CAPS_X86_MAX_CPU },
|
QEMU_CAPS_X86_MAX_CPU },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1452,10 +1452,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsVirt[] = {
|
|||||||
|
|
||||||
static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] = {
|
static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] = {
|
||||||
{ "pseries", virQEMUCapsMachinePropsPSeries,
|
{ "pseries", virQEMUCapsMachinePropsPSeries,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsMachinePropsPSeries),
|
G_N_ELEMENTS(virQEMUCapsMachinePropsPSeries),
|
||||||
-1 },
|
-1 },
|
||||||
{ "virt", virQEMUCapsMachinePropsVirt,
|
{ "virt", virQEMUCapsMachinePropsVirt,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsMachinePropsVirt),
|
G_N_ELEMENTS(virQEMUCapsMachinePropsVirt),
|
||||||
-1 },
|
-1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2171,7 +2171,7 @@ virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virQEMUCapsProcessStringFlags(qemuCaps,
|
virQEMUCapsProcessStringFlags(qemuCaps,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsCommands),
|
G_N_ELEMENTS(virQEMUCapsCommands),
|
||||||
virQEMUCapsCommands,
|
virQEMUCapsCommands,
|
||||||
ncommands, commands);
|
ncommands, commands);
|
||||||
virStringListFreeCount(commands, ncommands);
|
virStringListFreeCount(commands, ncommands);
|
||||||
@ -2201,7 +2201,7 @@ virQEMUCapsProbeQMPEvents(virQEMUCapsPtr qemuCaps,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virQEMUCapsProcessStringFlags(qemuCaps,
|
virQEMUCapsProcessStringFlags(qemuCaps,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsEvents),
|
G_N_ELEMENTS(virQEMUCapsEvents),
|
||||||
virQEMUCapsEvents,
|
virQEMUCapsEvents,
|
||||||
nevents, events);
|
nevents, events);
|
||||||
virStringListFreeCount(events, nevents);
|
virStringListFreeCount(events, nevents);
|
||||||
@ -2249,7 +2249,7 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps,
|
|||||||
if ((nvalues = qemuMonitorGetObjectTypes(mon, &values)) < 0)
|
if ((nvalues = qemuMonitorGetObjectTypes(mon, &values)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
virQEMUCapsProcessStringFlags(qemuCaps,
|
virQEMUCapsProcessStringFlags(qemuCaps,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsObjectTypes),
|
G_N_ELEMENTS(virQEMUCapsObjectTypes),
|
||||||
virQEMUCapsObjectTypes,
|
virQEMUCapsObjectTypes,
|
||||||
nvalues, values);
|
nvalues, values);
|
||||||
virStringListFreeCount(values, nvalues);
|
virStringListFreeCount(values, nvalues);
|
||||||
@ -2257,7 +2257,7 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps,
|
|||||||
if (virQEMUCapsProbeQMPGenericProps(qemuCaps,
|
if (virQEMUCapsProbeQMPGenericProps(qemuCaps,
|
||||||
mon,
|
mon,
|
||||||
virQEMUCapsDeviceProps,
|
virQEMUCapsDeviceProps,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsDeviceProps),
|
G_N_ELEMENTS(virQEMUCapsDeviceProps),
|
||||||
qemuMonitorGetDeviceProps) < 0)
|
qemuMonitorGetDeviceProps) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -2265,7 +2265,7 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps,
|
|||||||
virQEMUCapsProbeQMPGenericProps(qemuCaps,
|
virQEMUCapsProbeQMPGenericProps(qemuCaps,
|
||||||
mon,
|
mon,
|
||||||
virQEMUCapsObjectProps,
|
virQEMUCapsObjectProps,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsObjectProps),
|
G_N_ELEMENTS(virQEMUCapsObjectProps),
|
||||||
qemuMonitorGetObjectProps) < 0)
|
qemuMonitorGetObjectProps) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -2330,7 +2330,7 @@ static const char *preferredMachines[] =
|
|||||||
"sim", /* VIR_ARCH_XTENSA */
|
"sim", /* VIR_ARCH_XTENSA */
|
||||||
"sim", /* VIR_ARCH_XTENSAEB */
|
"sim", /* VIR_ARCH_XTENSAEB */
|
||||||
};
|
};
|
||||||
verify(ARRAY_CARDINALITY(preferredMachines) == VIR_ARCH_LAST);
|
verify(G_N_ELEMENTS(preferredMachines) == VIR_ARCH_LAST);
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2412,7 +2412,7 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
|
|||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES))
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsMachineProps); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsMachineProps); i++) {
|
||||||
virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
|
virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
|
||||||
const char *canon = virQEMUCapsGetCanonicalMachine(qemuCaps, props.type);
|
const char *canon = virQEMUCapsGetCanonicalMachine(qemuCaps, props.type);
|
||||||
VIR_AUTOFREE(char *) type = NULL;
|
VIR_AUTOFREE(char *) type = NULL;
|
||||||
@ -2717,7 +2717,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (nentries > 0) {
|
if (nentries > 0) {
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMModelsToCaps); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsTPMModelsToCaps); i++) {
|
||||||
const char *needle = virDomainTPMModelTypeToString(
|
const char *needle = virDomainTPMModelTypeToString(
|
||||||
virQEMUCapsTPMModelsToCaps[i].type);
|
virQEMUCapsTPMModelsToCaps[i].type);
|
||||||
if (virStringListHasString((const char **)entries, needle))
|
if (virStringListHasString((const char **)entries, needle))
|
||||||
@ -2731,7 +2731,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (nentries > 0) {
|
if (nentries > 0) {
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMTypesToCaps); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsTPMTypesToCaps); i++) {
|
||||||
const char *needle = virDomainTPMBackendTypeToString(
|
const char *needle = virDomainTPMBackendTypeToString(
|
||||||
virQEMUCapsTPMTypesToCaps[i].type);
|
virQEMUCapsTPMTypesToCaps[i].type);
|
||||||
if (virStringListHasString((const char **)entries, needle))
|
if (virStringListHasString((const char **)entries, needle))
|
||||||
@ -2808,7 +2808,7 @@ virQEMUCapsProbeQMPCommandLine(virQEMUCapsPtr qemuCaps,
|
|||||||
char **values;
|
char **values;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsCommandLine); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsCommandLine); i++) {
|
||||||
if ((nvalues = qemuMonitorGetCommandLineOptionParameters(mon,
|
if ((nvalues = qemuMonitorGetCommandLineOptionParameters(mon,
|
||||||
virQEMUCapsCommandLine[i].option,
|
virQEMUCapsCommandLine[i].option,
|
||||||
&values,
|
&values,
|
||||||
@ -2841,7 +2841,7 @@ virQEMUCapsProbeQMPMigrationCapabilities(virQEMUCapsPtr qemuCaps,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virQEMUCapsProcessStringFlags(qemuCaps,
|
virQEMUCapsProcessStringFlags(qemuCaps,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsMigration),
|
G_N_ELEMENTS(virQEMUCapsMigration),
|
||||||
virQEMUCapsMigration,
|
virQEMUCapsMigration,
|
||||||
ncaps, caps);
|
ncaps, caps);
|
||||||
virStringListFreeCount(caps, ncaps);
|
virStringListFreeCount(caps, ncaps);
|
||||||
@ -4155,7 +4155,7 @@ virQEMUCapsKVMSupportsNesting(void)
|
|||||||
int rc;
|
int rc;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(kmod); i++) {
|
for (i = 0; i < G_N_ELEMENTS(kmod); i++) {
|
||||||
VIR_FREE(value);
|
VIR_FREE(value);
|
||||||
rc = virFileReadValueString(&value, "/sys/module/%s/parameters/nested",
|
rc = virFileReadValueString(&value, "/sys/module/%s/parameters/nested",
|
||||||
kmod[i]);
|
kmod[i]);
|
||||||
@ -4513,7 +4513,7 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCapsPtr qemuCaps,
|
|||||||
return -1;
|
return -1;
|
||||||
schemareply = NULL;
|
schemareply = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsQMPSchemaQueries); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsQMPSchemaQueries); i++) {
|
||||||
entry = virQEMUCapsQMPSchemaQueries + i;
|
entry = virQEMUCapsQMPSchemaQueries + i;
|
||||||
|
|
||||||
if (virQEMUQAPISchemaPathExists(entry->value, schema))
|
if (virQEMUQAPISchemaPathExists(entry->value, schema))
|
||||||
@ -4521,7 +4521,7 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCapsPtr qemuCaps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* probe also for basic event support */
|
/* probe also for basic event support */
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsEvents); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsEvents); i++) {
|
||||||
entry = virQEMUCapsEvents + i;
|
entry = virQEMUCapsEvents + i;
|
||||||
|
|
||||||
if (virQEMUQAPISchemaPathExists(entry->value, schema))
|
if (virQEMUQAPISchemaPathExists(entry->value, schema))
|
||||||
@ -4816,7 +4816,7 @@ struct virQEMUCapsMachineTypeFilter {
|
|||||||
|
|
||||||
static const struct virQEMUCapsMachineTypeFilter virQEMUCapsMachineFilter[] = {
|
static const struct virQEMUCapsMachineTypeFilter virQEMUCapsMachineFilter[] = {
|
||||||
/* { "blah", virQEMUCapsMachineBLAHFilter,
|
/* { "blah", virQEMUCapsMachineBLAHFilter,
|
||||||
ARRAY_CARDINALITY(virQEMUCapsMachineBLAHFilter) }, */
|
G_N_ELEMENTS(virQEMUCapsMachineBLAHFilter) }, */
|
||||||
{ "", NULL, 0 },
|
{ "", NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4830,7 +4830,7 @@ virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
|
|||||||
if (!machineType)
|
if (!machineType)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsMachineFilter); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsMachineFilter); i++) {
|
||||||
const struct virQEMUCapsMachineTypeFilter *filter = &virQEMUCapsMachineFilter[i];
|
const struct virQEMUCapsMachineTypeFilter *filter = &virQEMUCapsMachineFilter[i];
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
@ -4977,8 +4977,8 @@ virQEMUCapsCacheLookupByArch(virFileCachePtr cache,
|
|||||||
|
|
||||||
priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(binaryFilters); i++) {
|
for (i = 0; i < G_N_ELEMENTS(binaryFilters); i++) {
|
||||||
for (j = 0; j < ARRAY_CARDINALITY(archs); j++) {
|
for (j = 0; j < G_N_ELEMENTS(archs); j++) {
|
||||||
struct virQEMUCapsSearchData data = {
|
struct virQEMUCapsSearchData data = {
|
||||||
.arch = archs[j],
|
.arch = archs[j],
|
||||||
.binaryFilter = binaryFilters[i],
|
.binaryFilter = binaryFilters[i],
|
||||||
|
@ -3234,7 +3234,7 @@ qemuBuildControllersCommandLine(virCommandPtr cmd,
|
|||||||
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
|
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(contOrder); i++) {
|
for (i = 0; i < G_N_ELEMENTS(contOrder); i++) {
|
||||||
if (qemuBuildControllersByTypeCommandLine(cmd, def, qemuCaps, contOrder[i]) < 0)
|
if (qemuBuildControllersByTypeCommandLine(cmd, def, qemuCaps, contOrder[i]) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1280,7 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
|
|||||||
VIR_STRDUP(sm->doi, doi) < 0)
|
VIR_STRDUP(sm->doi, doi) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (j = 0; j < ARRAY_CARDINALITY(virtTypes); j++) {
|
for (j = 0; j < G_N_ELEMENTS(virtTypes); j++) {
|
||||||
lbl = qemuSecurityGetBaseLabel(sec_managers[i], virtTypes[j]);
|
lbl = qemuSecurityGetBaseLabel(sec_managers[i], virtTypes[j]);
|
||||||
type = virDomainVirtTypeToString(virtTypes[j]);
|
type = virDomainVirtTypeToString(virtTypes[j]);
|
||||||
if (lbl &&
|
if (lbl &&
|
||||||
|
@ -11712,7 +11712,7 @@ ppc64VFIODeviceIsNV2Bridge(const char *device)
|
|||||||
"ibm,nvlink-speed", "memory-region"};
|
"ibm,nvlink-speed", "memory-region"};
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(nvlink2Files); i++) {
|
for (i = 0; i < G_N_ELEMENTS(nvlink2Files); i++) {
|
||||||
VIR_AUTOFREE(char *) file = NULL;
|
VIR_AUTOFREE(char *) file = NULL;
|
||||||
|
|
||||||
if ((virAsprintf(&file, "/sys/bus/pci/devices/%s/of_node/%s",
|
if ((virAsprintf(&file, "/sys/bus/pci/devices/%s/of_node/%s",
|
||||||
|
@ -3149,7 +3149,7 @@ static void qemuMigrationSrcIOFunc(void *arg)
|
|||||||
fds[0].events = fds[1].events = POLLIN;
|
fds[0].events = fds[1].events = POLLIN;
|
||||||
fds[0].revents = fds[1].revents = 0;
|
fds[0].revents = fds[1].revents = 0;
|
||||||
|
|
||||||
ret = poll(fds, ARRAY_CARDINALITY(fds), timeout);
|
ret = poll(fds, G_N_ELEMENTS(fds), timeout);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EAGAIN || errno == EINTR)
|
if (errno == EAGAIN || errno == EINTR)
|
||||||
@ -4395,7 +4395,7 @@ static int virConnectCredType[] = {
|
|||||||
|
|
||||||
static virConnectAuth virConnectAuthConfig = {
|
static virConnectAuth virConnectAuthConfig = {
|
||||||
.credtype = virConnectCredType,
|
.credtype = virConnectCredType,
|
||||||
.ncredtype = ARRAY_CARDINALITY(virConnectCredType),
|
.ncredtype = G_N_ELEMENTS(virConnectCredType),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ static const qemuMigrationParamType qemuMigrationParamTypes[] = {
|
|||||||
[QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
|
[QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
|
||||||
[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = QEMU_MIGRATION_PARAM_TYPE_INT,
|
[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = QEMU_MIGRATION_PARAM_TYPE_INT,
|
||||||
};
|
};
|
||||||
verify(ARRAY_CARDINALITY(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
|
verify(G_N_ELEMENTS(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
|
||||||
|
|
||||||
|
|
||||||
virBitmapPtr
|
virBitmapPtr
|
||||||
@ -226,7 +226,7 @@ qemuMigrationParamsGetAlwaysOnCaps(qemuMigrationParty party)
|
|||||||
if (!(caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST)))
|
if (!(caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(qemuMigrationParamsAlwaysOn); i++) {
|
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsAlwaysOn); i++) {
|
||||||
if (!(qemuMigrationParamsAlwaysOn[i].party & party))
|
if (!(qemuMigrationParamsAlwaysOn[i].party & party))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
|
|||||||
if (!(migParams = qemuMigrationParamsNew()))
|
if (!(migParams = qemuMigrationParamsNew()))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(qemuMigrationParamsFlagMap); i++) {
|
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsFlagMap); i++) {
|
||||||
qemuMigrationCapability cap = qemuMigrationParamsFlagMap[i].cap;
|
qemuMigrationCapability cap = qemuMigrationParamsFlagMap[i].cap;
|
||||||
|
|
||||||
if (qemuMigrationParamsFlagMap[i].party & party &&
|
if (qemuMigrationParamsFlagMap[i].party & party &&
|
||||||
@ -511,7 +511,7 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(qemuMigrationParamsTPMap); i++) {
|
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsTPMap); i++) {
|
||||||
const qemuMigrationParamsTPMapItem *item = &qemuMigrationParamsTPMap[i];
|
const qemuMigrationParamsTPMapItem *item = &qemuMigrationParamsTPMap[i];
|
||||||
|
|
||||||
if (!(item->party & party))
|
if (!(item->party & party))
|
||||||
@ -590,7 +590,7 @@ qemuMigrationParamsDump(qemuMigrationParamsPtr migParams,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(qemuMigrationParamsTPMap); i++) {
|
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsTPMap); i++) {
|
||||||
const qemuMigrationParamsTPMapItem *item = &qemuMigrationParamsTPMap[i];
|
const qemuMigrationParamsTPMapItem *item = &qemuMigrationParamsTPMap[i];
|
||||||
|
|
||||||
if (!(item->party & QEMU_MIGRATION_DESTINATION))
|
if (!(item->party & QEMU_MIGRATION_DESTINATION))
|
||||||
@ -1149,7 +1149,7 @@ qemuMigrationParamsCheck(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(qemuMigrationParamsAlwaysOn); i++) {
|
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsAlwaysOn); i++) {
|
||||||
cap = qemuMigrationParamsAlwaysOn[i].cap;
|
cap = qemuMigrationParamsAlwaysOn[i].cap;
|
||||||
|
|
||||||
if (qemuMigrationParamsAlwaysOn[i].party & party &&
|
if (qemuMigrationParamsAlwaysOn[i].party & party &&
|
||||||
|
@ -200,7 +200,7 @@ qemuMonitorJSONIOProcessEvent(qemuMonitorPtr mon,
|
|||||||
qemuMonitorEmitEvent(mon, type, seconds, micros, details);
|
qemuMonitorEmitEvent(mon, type, seconds, micros, details);
|
||||||
VIR_FREE(details);
|
VIR_FREE(details);
|
||||||
|
|
||||||
handler = bsearch(type, eventHandlers, ARRAY_CARDINALITY(eventHandlers),
|
handler = bsearch(type, eventHandlers, G_N_ELEMENTS(eventHandlers),
|
||||||
sizeof(eventHandlers[0]), qemuMonitorEventCompare);
|
sizeof(eventHandlers[0]), qemuMonitorEventCompare);
|
||||||
if (handler) {
|
if (handler) {
|
||||||
VIR_DEBUG("handle %s handler=%p data=%p", type,
|
VIR_DEBUG("handle %s handler=%p data=%p", type,
|
||||||
|
@ -357,7 +357,7 @@ virQEMUQAPISchemaTraverse(const char *baseName,
|
|||||||
if (!(metatype = virJSONValueObjectGetString(cur, "meta-type")))
|
if (!(metatype = virJSONValueObjectGetString(cur, "meta-type")))
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(traverseMetaType); i++) {
|
for (i = 0; i < G_N_ELEMENTS(traverseMetaType); i++) {
|
||||||
if (STREQ(metatype, traverseMetaType[i].metatype))
|
if (STREQ(metatype, traverseMetaType[i].metatype))
|
||||||
return traverseMetaType[i].func(cur, ctxt);
|
return traverseMetaType[i].func(cur, ctxt);
|
||||||
}
|
}
|
||||||
|
@ -419,7 +419,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
|||||||
return -1;
|
return -1;
|
||||||
#endif /* ! WITH_IP */
|
#endif /* ! WITH_IP */
|
||||||
|
|
||||||
if (virSystemdGetActivation(actmap, ARRAY_CARDINALITY(actmap), &act) < 0)
|
if (virSystemdGetActivation(actmap, G_N_ELEMENTS(actmap), &act) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#ifdef WITH_IP
|
#ifdef WITH_IP
|
||||||
@ -955,7 +955,7 @@ daemonUsage(const char *argv0, bool privileged)
|
|||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
fprintf(stderr, "%s\n", _("Options:"));
|
fprintf(stderr, "%s\n", _("Options:"));
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(opthelp); i++)
|
for (i = 0; i < G_N_ELEMENTS(opthelp); i++)
|
||||||
fprintf(stderr, " %-22s %s\n", opthelp[i].opts,
|
fprintf(stderr, " %-22s %s\n", opthelp[i].opts,
|
||||||
_(opthelp[i].help));
|
_(opthelp[i].help));
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -1493,7 +1493,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
|
|||||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockThreshold),
|
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockThreshold),
|
||||||
};
|
};
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
|
verify(G_N_ELEMENTS(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteRelayNetworkEventLifecycle(virConnectPtr conn,
|
remoteRelayNetworkEventLifecycle(virConnectPtr conn,
|
||||||
@ -1536,7 +1536,7 @@ static virConnectNetworkEventGenericCallback networkEventCallbacks[] = {
|
|||||||
VIR_NETWORK_EVENT_CALLBACK(remoteRelayNetworkEventLifecycle),
|
VIR_NETWORK_EVENT_CALLBACK(remoteRelayNetworkEventLifecycle),
|
||||||
};
|
};
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(networkEventCallbacks) == VIR_NETWORK_EVENT_ID_LAST);
|
verify(G_N_ELEMENTS(networkEventCallbacks) == VIR_NETWORK_EVENT_ID_LAST);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteRelayStoragePoolEventLifecycle(virConnectPtr conn,
|
remoteRelayStoragePoolEventLifecycle(virConnectPtr conn,
|
||||||
@ -1615,7 +1615,7 @@ static virConnectStoragePoolEventGenericCallback storageEventCallbacks[] = {
|
|||||||
VIR_STORAGE_POOL_EVENT_CALLBACK(remoteRelayStoragePoolEventRefresh),
|
VIR_STORAGE_POOL_EVENT_CALLBACK(remoteRelayStoragePoolEventRefresh),
|
||||||
};
|
};
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(storageEventCallbacks) == VIR_STORAGE_POOL_EVENT_ID_LAST);
|
verify(G_N_ELEMENTS(storageEventCallbacks) == VIR_STORAGE_POOL_EVENT_ID_LAST);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteRelayNodeDeviceEventLifecycle(virConnectPtr conn,
|
remoteRelayNodeDeviceEventLifecycle(virConnectPtr conn,
|
||||||
@ -1694,7 +1694,7 @@ static virConnectNodeDeviceEventGenericCallback nodeDeviceEventCallbacks[] = {
|
|||||||
VIR_NODE_DEVICE_EVENT_CALLBACK(remoteRelayNodeDeviceEventUpdate),
|
VIR_NODE_DEVICE_EVENT_CALLBACK(remoteRelayNodeDeviceEventUpdate),
|
||||||
};
|
};
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(nodeDeviceEventCallbacks) == VIR_NODE_DEVICE_EVENT_ID_LAST);
|
verify(G_N_ELEMENTS(nodeDeviceEventCallbacks) == VIR_NODE_DEVICE_EVENT_ID_LAST);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteRelaySecretEventLifecycle(virConnectPtr conn,
|
remoteRelaySecretEventLifecycle(virConnectPtr conn,
|
||||||
@ -1773,7 +1773,7 @@ static virConnectSecretEventGenericCallback secretEventCallbacks[] = {
|
|||||||
VIR_SECRET_EVENT_CALLBACK(remoteRelaySecretEventValueChanged),
|
VIR_SECRET_EVENT_CALLBACK(remoteRelaySecretEventValueChanged),
|
||||||
};
|
};
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(secretEventCallbacks) == VIR_SECRET_EVENT_ID_LAST);
|
verify(G_N_ELEMENTS(secretEventCallbacks) == VIR_SECRET_EVENT_ID_LAST);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
remoteRelayDomainQemuMonitorEvent(virConnectPtr conn,
|
remoteRelayDomainQemuMonitorEvent(virConnectPtr conn,
|
||||||
@ -2176,7 +2176,7 @@ remoteDispatchProbeURI(bool readonly,
|
|||||||
};
|
};
|
||||||
ssize_t i;
|
ssize_t i;
|
||||||
|
|
||||||
for (i = 0; i < (ssize_t) ARRAY_CARDINALITY(drivers) && !*probeduri; i++) {
|
for (i = 0; i < (ssize_t) G_N_ELEMENTS(drivers) && !*probeduri; i++) {
|
||||||
VIR_AUTOFREE(char *) daemonname = NULL;
|
VIR_AUTOFREE(char *) daemonname = NULL;
|
||||||
VIR_AUTOFREE(char *) daemonpath = NULL;
|
VIR_AUTOFREE(char *) daemonpath = NULL;
|
||||||
|
|
||||||
@ -2222,7 +2222,7 @@ remoteDispatchProbeURI(bool readonly,
|
|||||||
};
|
};
|
||||||
ssize_t i;
|
ssize_t i;
|
||||||
|
|
||||||
for (i = 0; i < (ssize_t) ARRAY_CARDINALITY(drivers) && !*probeduri; i++) {
|
for (i = 0; i < (ssize_t) G_N_ELEMENTS(drivers) && !*probeduri; i++) {
|
||||||
VIR_AUTOFREE(char *) sockname = NULL;
|
VIR_AUTOFREE(char *) sockname = NULL;
|
||||||
|
|
||||||
if (virAsprintf(&sockname, "%s/libvirt/virt%sd-%s",
|
if (virAsprintf(&sockname, "%s/libvirt/virt%sd-%s",
|
||||||
|
@ -1313,7 +1313,7 @@ doRemoteOpen(virConnectPtr conn,
|
|||||||
if (!(priv->remoteProgram = virNetClientProgramNew(REMOTE_PROGRAM,
|
if (!(priv->remoteProgram = virNetClientProgramNew(REMOTE_PROGRAM,
|
||||||
REMOTE_PROTOCOL_VERSION,
|
REMOTE_PROTOCOL_VERSION,
|
||||||
remoteEvents,
|
remoteEvents,
|
||||||
ARRAY_CARDINALITY(remoteEvents),
|
G_N_ELEMENTS(remoteEvents),
|
||||||
conn)))
|
conn)))
|
||||||
goto failed;
|
goto failed;
|
||||||
if (!(priv->lxcProgram = virNetClientProgramNew(LXC_PROGRAM,
|
if (!(priv->lxcProgram = virNetClientProgramNew(LXC_PROGRAM,
|
||||||
@ -1325,7 +1325,7 @@ doRemoteOpen(virConnectPtr conn,
|
|||||||
if (!(priv->qemuProgram = virNetClientProgramNew(QEMU_PROGRAM,
|
if (!(priv->qemuProgram = virNetClientProgramNew(QEMU_PROGRAM,
|
||||||
QEMU_PROTOCOL_VERSION,
|
QEMU_PROTOCOL_VERSION,
|
||||||
qemuEvents,
|
qemuEvents,
|
||||||
ARRAY_CARDINALITY(qemuEvents),
|
G_N_ELEMENTS(qemuEvents),
|
||||||
conn)))
|
conn)))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
@ -6596,7 +6596,7 @@ remoteDomainOpenGraphics(virDomainPtr dom,
|
|||||||
remote_domain_open_graphics_args args;
|
remote_domain_open_graphics_args args;
|
||||||
struct private_data *priv = dom->conn->privateData;
|
struct private_data *priv = dom->conn->privateData;
|
||||||
int fdin[] = { fd };
|
int fdin[] = { fd };
|
||||||
size_t fdinlen = ARRAY_CARDINALITY(fdin);
|
size_t fdinlen = G_N_ELEMENTS(fdin);
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
@ -1292,7 +1292,7 @@ elsif ($mode eq "server") {
|
|||||||
print "{ $comment\n ${name},\n $arglen,\n (xdrproc_t)$argfilter,\n $retlen,\n (xdrproc_t)$retfilter,\n true,\n $priority\n},\n";
|
print "{ $comment\n ${name},\n $arglen,\n (xdrproc_t)$argfilter,\n $retlen,\n (xdrproc_t)$retfilter,\n true,\n $priority\n},\n";
|
||||||
}
|
}
|
||||||
print "};\n";
|
print "};\n";
|
||||||
print "size_t ${structprefix}NProcs = ARRAY_CARDINALITY(${structprefix}Procs);\n";
|
print "size_t ${structprefix}NProcs = G_N_ELEMENTS(${structprefix}Procs);\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bodies for client functions ("remote_client_bodies.h").
|
# Bodies for client functions ("remote_client_bodies.h").
|
||||||
|
@ -368,7 +368,7 @@ virNetClientFindDefaultSshKey(const char *homedir, char **retPath)
|
|||||||
|
|
||||||
const char *keys[] = { "identity", "id_dsa", "id_ecdsa", "id_ed25519", "id_rsa" };
|
const char *keys[] = { "identity", "id_dsa", "id_ecdsa", "id_ed25519", "id_rsa" };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(keys); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(keys); ++i) {
|
||||||
int ret = virNetClientCheckKeyExists(homedir, keys[i], retPath);
|
int ret = virNetClientCheckKeyExists(homedir, keys[i], retPath);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -939,7 +939,7 @@ int virNetClientSetTLSSession(virNetClientPtr client,
|
|||||||
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
||||||
|
|
||||||
repoll:
|
repoll:
|
||||||
ret = poll(fds, ARRAY_CARDINALITY(fds), -1);
|
ret = poll(fds, G_N_ELEMENTS(fds), -1);
|
||||||
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
||||||
goto repoll;
|
goto repoll;
|
||||||
|
|
||||||
@ -963,7 +963,7 @@ int virNetClientSetTLSSession(virNetClientPtr client,
|
|||||||
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
||||||
|
|
||||||
repoll2:
|
repoll2:
|
||||||
ret = poll(fds, ARRAY_CARDINALITY(fds), -1);
|
ret = poll(fds, G_N_ELEMENTS(fds), -1);
|
||||||
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
||||||
goto repoll2;
|
goto repoll2;
|
||||||
|
|
||||||
@ -1682,7 +1682,7 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
|
|||||||
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
||||||
|
|
||||||
repoll:
|
repoll:
|
||||||
ret = poll(fds, ARRAY_CARDINALITY(fds), timeout);
|
ret = poll(fds, G_N_ELEMENTS(fds), timeout);
|
||||||
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
||||||
goto repoll;
|
goto repoll;
|
||||||
|
|
||||||
|
@ -1073,7 +1073,7 @@ virSecurityDACMoveImageMetadataHelper(pid_t pid G_GNUC_UNUSED,
|
|||||||
virSecurityManagerMetadataLockStatePtr state;
|
virSecurityManagerMetadataLockStatePtr state;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(state = virSecurityManagerMetadataLock(data->mgr, paths, ARRAY_CARDINALITY(paths))))
|
if (!(state = virSecurityManagerMetadataLock(data->mgr, paths, G_N_ELEMENTS(paths))))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virSecurityMoveRememberedLabel(SECURITY_DAC_NAME, data->src, data->dst);
|
ret = virSecurityMoveRememberedLabel(SECURITY_DAC_NAME, data->src, data->dst);
|
||||||
|
@ -53,7 +53,7 @@ virSecurityDriverPtr virSecurityDriverLookup(const char *name,
|
|||||||
|
|
||||||
VIR_DEBUG("name=%s", NULLSTR(name));
|
VIR_DEBUG("name=%s", NULLSTR(name));
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(security_drivers) && !drv; i++) {
|
for (i = 0; i < G_N_ELEMENTS(security_drivers) && !drv; i++) {
|
||||||
virSecurityDriverPtr tmp = security_drivers[i];
|
virSecurityDriverPtr tmp = security_drivers[i];
|
||||||
|
|
||||||
if (name &&
|
if (name &&
|
||||||
|
@ -1974,7 +1974,7 @@ virSecuritySELinuxMoveImageMetadataHelper(pid_t pid G_GNUC_UNUSED,
|
|||||||
virSecurityManagerMetadataLockStatePtr state;
|
virSecurityManagerMetadataLockStatePtr state;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(state = virSecurityManagerMetadataLock(data->mgr, paths, ARRAY_CARDINALITY(paths))))
|
if (!(state = virSecurityManagerMetadataLock(data->mgr, paths, G_N_ELEMENTS(paths))))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virSecurityMoveRememberedLabel(SECURITY_SELINUX_NAME, data->src, data->dst);
|
ret = virSecurityMoveRememberedLabel(SECURITY_SELINUX_NAME, data->src, data->dst);
|
||||||
|
@ -519,9 +519,9 @@ valid_path(const char *path, const bool readonly)
|
|||||||
"/etc/libvirt-sandbox/services/" /* for virt-sandbox service config */
|
"/etc/libvirt-sandbox/services/" /* for virt-sandbox service config */
|
||||||
};
|
};
|
||||||
|
|
||||||
const int nropaths = ARRAY_CARDINALITY(restricted);
|
const int nropaths = G_N_ELEMENTS(restricted);
|
||||||
const int nrwpaths = ARRAY_CARDINALITY(restricted_rw);
|
const int nrwpaths = G_N_ELEMENTS(restricted_rw);
|
||||||
const int nopaths = ARRAY_CARDINALITY(override);
|
const int nopaths = G_N_ELEMENTS(override);
|
||||||
|
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
vah_error(NULL, 0, _("bad pathname"));
|
vah_error(NULL, 0, _("bad pathname"));
|
||||||
|
@ -332,7 +332,7 @@ testBuildCapabilities(virConnectPtr conn)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(guest_types); i++) {
|
for (i = 0; i < G_N_ELEMENTS(guest_types); i++) {
|
||||||
if ((guest = virCapabilitiesAddGuest(caps,
|
if ((guest = virCapabilitiesAddGuest(caps,
|
||||||
guest_types[i],
|
guest_types[i],
|
||||||
VIR_ARCH_I686,
|
VIR_ARCH_I686,
|
||||||
|
@ -81,7 +81,7 @@ static const struct virArchData {
|
|||||||
{ "xtensaeb", 32, VIR_ARCH_BIG_ENDIAN },
|
{ "xtensaeb", 32, VIR_ARCH_BIG_ENDIAN },
|
||||||
};
|
};
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(virArchData) == VIR_ARCH_LAST);
|
verify(G_N_ELEMENTS(virArchData) == VIR_ARCH_LAST);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,7 +133,7 @@ void virAuditSend(virLogSourcePtr source,
|
|||||||
[VIR_AUDIT_RECORD_RESOURCE] = AUDIT_VIRT_RESOURCE,
|
[VIR_AUDIT_RECORD_RESOURCE] = AUDIT_VIRT_RESOURCE,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type >= ARRAY_CARDINALITY(record_types) || record_types[type] == 0)
|
if (type >= G_N_ELEMENTS(record_types) || record_types[type] == 0)
|
||||||
VIR_WARN("Unknown audit record type %d", type);
|
VIR_WARN("Unknown audit record type %d", type);
|
||||||
else if (audit_log_user_message(auditfd, record_types[type], str, NULL,
|
else if (audit_log_user_message(auditfd, record_types[type], str, NULL,
|
||||||
clientaddr, clienttty, success) < 0) {
|
clientaddr, clienttty, success) < 0) {
|
||||||
|
@ -555,7 +555,7 @@ virCgroupV1CpuSetInherit(virCgroupPtr parent,
|
|||||||
};
|
};
|
||||||
|
|
||||||
VIR_DEBUG("Setting up inheritance %s -> %s", parent->path, group->path);
|
VIR_DEBUG("Setting up inheritance %s -> %s", parent->path, group->path);
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(inherit_values); i++) {
|
for (i = 0; i < G_N_ELEMENTS(inherit_values); i++) {
|
||||||
VIR_AUTOFREE(char *) value = NULL;
|
VIR_AUTOFREE(char *) value = NULL;
|
||||||
|
|
||||||
if (virCgroupGetValueStr(parent,
|
if (virCgroupGetValueStr(parent,
|
||||||
@ -1065,7 +1065,7 @@ virCgroupV1GetBlkioIoServiced(virCgroupPtr group,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* sum up all entries of the same kind, from all devices */
|
/* sum up all entries of the same kind, from all devices */
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(value_names); i++) {
|
for (i = 0; i < G_N_ELEMENTS(value_names); i++) {
|
||||||
p1 = str1;
|
p1 = str1;
|
||||||
p2 = str2;
|
p2 = str2;
|
||||||
|
|
||||||
@ -1171,7 +1171,7 @@ virCgroupV1GetBlkioIoDeviceServiced(virCgroupPtr group,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(value_names); i++) {
|
for (i = 0; i < G_N_ELEMENTS(value_names); i++) {
|
||||||
if (!(p1 = strstr(p1, value_names[i]))) {
|
if (!(p1 = strstr(p1, value_names[i]))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Cannot find byte %sstats for block device '%s'"),
|
_("Cannot find byte %sstats for block device '%s'"),
|
||||||
|
@ -730,7 +730,7 @@ virCgroupV2GetBlkioIoServiced(virCgroupPtr group,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* sum up all entries of the same kind, from all devices */
|
/* sum up all entries of the same kind, from all devices */
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(value_names); i++) {
|
for (i = 0; i < G_N_ELEMENTS(value_names); i++) {
|
||||||
p1 = str1;
|
p1 = str1;
|
||||||
|
|
||||||
while ((p1 = strstr(p1, value_names[i]))) {
|
while ((p1 = strstr(p1, value_names[i]))) {
|
||||||
@ -799,7 +799,7 @@ virCgroupV2GetBlkioIoDeviceServiced(virCgroupPtr group,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(value_names); i++) {
|
for (i = 0; i < G_N_ELEMENTS(value_names); i++) {
|
||||||
if (!(p1 = strstr(p1, value_names[i]))) {
|
if (!(p1 = strstr(p1, value_names[i]))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Cannot find byte '%s' stats for block device '%s'"),
|
_("Cannot find byte '%s' stats for block device '%s'"),
|
||||||
|
@ -47,7 +47,7 @@ struct virHashInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(hashinfo) == VIR_CRYPTO_HASH_LAST);
|
verify(G_N_ELEMENTS(hashinfo) == VIR_CRYPTO_HASH_LAST);
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
virCryptoHashBuf(virCryptoHash hash,
|
virCryptoHashBuf(virCryptoHash hash,
|
||||||
|
@ -305,7 +305,7 @@ static const char virDBusBasicTypes[] = {
|
|||||||
|
|
||||||
static bool virDBusIsBasicType(char c)
|
static bool virDBusIsBasicType(char c)
|
||||||
{
|
{
|
||||||
return !!memchr(virDBusBasicTypes, c, ARRAY_CARDINALITY(virDBusBasicTypes));
|
return !!memchr(virDBusBasicTypes, c, G_N_ELEMENTS(virDBusBasicTypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -34,15 +34,15 @@ virEnumToString(const char * const *types,
|
|||||||
static const char *const name ## TypeList[] = { __VA_ARGS__ }; \
|
static const char *const name ## TypeList[] = { __VA_ARGS__ }; \
|
||||||
const char *name ## TypeToString(int type) { \
|
const char *name ## TypeToString(int type) { \
|
||||||
return virEnumToString(name ## TypeList, \
|
return virEnumToString(name ## TypeList, \
|
||||||
ARRAY_CARDINALITY(name ## TypeList), \
|
G_N_ELEMENTS(name ## TypeList), \
|
||||||
type); \
|
type); \
|
||||||
} \
|
} \
|
||||||
int name ## TypeFromString(const char *type) { \
|
int name ## TypeFromString(const char *type) { \
|
||||||
return virEnumFromString(name ## TypeList, \
|
return virEnumFromString(name ## TypeList, \
|
||||||
ARRAY_CARDINALITY(name ## TypeList), \
|
G_N_ELEMENTS(name ## TypeList), \
|
||||||
type); \
|
type); \
|
||||||
} \
|
} \
|
||||||
verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal)
|
verify(G_N_ELEMENTS(name ## TypeList) == lastVal)
|
||||||
|
|
||||||
#define VIR_ENUM_DECL(name) \
|
#define VIR_ENUM_DECL(name) \
|
||||||
const char *name ## TypeToString(int type); \
|
const char *name ## TypeToString(int type); \
|
||||||
|
@ -178,7 +178,7 @@ virFirewallValidateBackend(virFirewallBackend backend)
|
|||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(commands); i++) {
|
for (i = 0; i < G_N_ELEMENTS(commands); i++) {
|
||||||
if (!virFileIsExecutable(commands[i])) {
|
if (!virFileIsExecutable(commands[i])) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("direct firewall backend requested, but %s is not available"),
|
_("direct firewall backend requested, but %s is not available"),
|
||||||
|
@ -168,7 +168,7 @@ virHostCPUGetStatsFreeBSD(int cpuNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
param->value = 0;
|
param->value = 0;
|
||||||
for (j = 0; j < ARRAY_CARDINALITY(cpu_map[i].idx); j++)
|
for (j = 0; j < G_N_ELEMENTS(cpu_map[i].idx); j++)
|
||||||
param->value += cpu_times[offset + cpu_map[i].idx[j]] * TICK_TO_NSEC;
|
param->value += cpu_times[offset + cpu_map[i].idx[j]] * TICK_TO_NSEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,11 +144,11 @@ iptablesSetupPrivateChains(virFirewallLayer layer)
|
|||||||
bool changed = false;
|
bool changed = false;
|
||||||
iptablesGlobalChainData data[] = {
|
iptablesGlobalChainData data[] = {
|
||||||
{ layer, "filter",
|
{ layer, "filter",
|
||||||
filter_chains, ARRAY_CARDINALITY(filter_chains), &changed },
|
filter_chains, G_N_ELEMENTS(filter_chains), &changed },
|
||||||
{ layer, "nat",
|
{ layer, "nat",
|
||||||
natmangle_chains, ARRAY_CARDINALITY(natmangle_chains), &changed },
|
natmangle_chains, G_N_ELEMENTS(natmangle_chains), &changed },
|
||||||
{ layer, "mangle",
|
{ layer, "mangle",
|
||||||
natmangle_chains, ARRAY_CARDINALITY(natmangle_chains), &changed },
|
natmangle_chains, G_N_ELEMENTS(natmangle_chains), &changed },
|
||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ iptablesSetupPrivateChains(virFirewallLayer layer)
|
|||||||
|
|
||||||
virFirewallStartTransaction(fw, 0);
|
virFirewallStartTransaction(fw, 0);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(data); i++)
|
for (i = 0; i < G_N_ELEMENTS(data); i++)
|
||||||
virFirewallAddRuleFull(fw, data[i].layer,
|
virFirewallAddRuleFull(fw, data[i].layer,
|
||||||
false, iptablesPrivateChainCreate,
|
false, iptablesPrivateChainCreate,
|
||||||
&(data[i]), "--table", data[i].table,
|
&(data[i]), "--table", data[i].table,
|
||||||
|
@ -54,19 +54,19 @@ static const unsigned short *virKeymapValues[VIR_KEYCODE_SET_LAST] = {
|
|||||||
[VIR_KEYCODE_SET_QNUM] = virKeyCodeTable_qnum,
|
[VIR_KEYCODE_SET_QNUM] = virKeyCodeTable_qnum,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VIR_KEYMAP_ENTRY_MAX ARRAY_CARDINALITY(virKeyCodeTable_linux)
|
#define VIR_KEYMAP_ENTRY_MAX G_N_ELEMENTS(virKeyCodeTable_linux)
|
||||||
|
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_atset1));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset1));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_atset2));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset2));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_atset3));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset3));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_osx));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_osx));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_xtkbd));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_xtkbd));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_usb));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_usb));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_win32));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_win32));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyCodeTable_qnum));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_qnum));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyNameTable_linux));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_linux));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyNameTable_osx));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_osx));
|
||||||
verify(VIR_KEYMAP_ENTRY_MAX == ARRAY_CARDINALITY(virKeyNameTable_win32));
|
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_win32));
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virKeycodeSet,
|
VIR_ENUM_IMPL(virKeycodeSet,
|
||||||
VIR_KEYCODE_SET_LAST,
|
VIR_KEYCODE_SET_LAST,
|
||||||
|
@ -702,7 +702,7 @@ virLogStackTraceToFd(int fd)
|
|||||||
const char *msg = "Stack trace not available on this platform\n";
|
const char *msg = "Stack trace not available on this platform\n";
|
||||||
|
|
||||||
#define STRIP_DEPTH 3
|
#define STRIP_DEPTH 3
|
||||||
size = backtrace(array, ARRAY_CARDINALITY(array));
|
size = backtrace(array, G_N_ELEMENTS(array));
|
||||||
if (size) {
|
if (size) {
|
||||||
backtrace_symbols_fd(array + STRIP_DEPTH, size - STRIP_DEPTH, fd);
|
backtrace_symbols_fd(array + STRIP_DEPTH, size - STRIP_DEPTH, fd);
|
||||||
ignore_value(safewrite(fd, "\n", 1));
|
ignore_value(safewrite(fd, "\n", 1));
|
||||||
@ -1004,9 +1004,9 @@ virLogOutputToJournald(virLogSourcePtr source,
|
|||||||
struct journalState state;
|
struct journalState state;
|
||||||
|
|
||||||
state.iov = iov;
|
state.iov = iov;
|
||||||
state.iov_end = iov + ARRAY_CARDINALITY(iov);
|
state.iov_end = iov + G_N_ELEMENTS(iov);
|
||||||
state.bufs = iov_bufs;
|
state.bufs = iov_bufs;
|
||||||
state.bufs_end = iov_bufs + ARRAY_CARDINALITY(iov_bufs);
|
state.bufs_end = iov_bufs + G_N_ELEMENTS(iov_bufs);
|
||||||
|
|
||||||
journalAddString(&state, "MESSAGE", rawstr);
|
journalAddString(&state, "MESSAGE", rawstr);
|
||||||
journalAddInt(&state, "PRIORITY",
|
journalAddInt(&state, "PRIORITY",
|
||||||
|
@ -3050,7 +3050,7 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
|
|||||||
};
|
};
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(ethtool_cmds); i++) {
|
for (i = 0; i < G_N_ELEMENTS(ethtool_cmds); i++) {
|
||||||
cmd.cmd = ethtool_cmds[i].cmd;
|
cmd.cmd = ethtool_cmds[i].cmd;
|
||||||
if (virNetDevFeatureAvailable(fd, ifr, &cmd))
|
if (virNetDevFeatureAvailable(fd, ifr, &cmd))
|
||||||
ignore_value(virBitmapSetBit(bitmap, ethtool_cmds[i].feat));
|
ignore_value(virBitmapSetBit(bitmap, ethtool_cmds[i].feat));
|
||||||
@ -3059,7 +3059,7 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
|
|||||||
# if HAVE_DECL_ETHTOOL_GFLAGS
|
# if HAVE_DECL_ETHTOOL_GFLAGS
|
||||||
cmd.cmd = ETHTOOL_GFLAGS;
|
cmd.cmd = ETHTOOL_GFLAGS;
|
||||||
if (virNetDevFeatureAvailable(fd, ifr, &cmd)) {
|
if (virNetDevFeatureAvailable(fd, ifr, &cmd)) {
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(flags); i++) {
|
for (i = 0; i < G_N_ELEMENTS(flags); i++) {
|
||||||
if (cmd.data & flags[i].cmd)
|
if (cmd.data & flags[i].cmd)
|
||||||
ignore_value(virBitmapSetBit(bitmap, flags[i].feat));
|
ignore_value(virBitmapSetBit(bitmap, flags[i].feat));
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ virNetlinkSendRequest(struct nl_msg *nl_msg, uint32_t src_pid,
|
|||||||
fds[0].fd = fd;
|
fds[0].fd = fd;
|
||||||
fds[0].events = POLLIN;
|
fds[0].events = POLLIN;
|
||||||
|
|
||||||
n = poll(fds, ARRAY_CARDINALITY(fds), NETLINK_ACK_TIMEOUT_S);
|
n = poll(fds, G_N_ELEMENTS(fds), NETLINK_ACK_TIMEOUT_S);
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
|
@ -168,7 +168,7 @@ static struct virPerfEventAttr attrs[] = {
|
|||||||
.attrConfig = PERF_COUNT_SW_EMULATION_FAULTS
|
.attrConfig = PERF_COUNT_SW_EMULATION_FAULTS
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
verify(ARRAY_CARDINALITY(attrs) == VIR_PERF_EVENT_LAST);
|
verify(G_N_ELEMENTS(attrs) == VIR_PERF_EVENT_LAST);
|
||||||
typedef struct virPerfEventAttr *virPerfEventAttrPtr;
|
typedef struct virPerfEventAttr *virPerfEventAttrPtr;
|
||||||
|
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ int virProcessGetNamespaces(pid_t pid,
|
|||||||
*nfdlist = 0;
|
*nfdlist = 0;
|
||||||
*fdlist = NULL;
|
*fdlist = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(ns); i++) {
|
for (i = 0; i < G_N_ELEMENTS(ns); i++) {
|
||||||
int fd;
|
int fd;
|
||||||
VIR_AUTOFREE(char *) nsfile = NULL;
|
VIR_AUTOFREE(char *) nsfile = NULL;
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
|
|||||||
4+4+4, 8, 512, NULL, vmdk4GetBackingStore, NULL
|
4+4+4, 8, 512, NULL, vmdk4GetBackingStore, NULL
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
verify(ARRAY_CARDINALITY(fileTypeInfo) == VIR_STORAGE_FILE_LAST);
|
verify(G_N_ELEMENTS(fileTypeInfo) == VIR_STORAGE_FILE_LAST);
|
||||||
|
|
||||||
|
|
||||||
/* qcow2 compatible features in the order they appear on-disk */
|
/* qcow2 compatible features in the order they appear on-disk */
|
||||||
@ -401,7 +401,7 @@ enum qcow2CompatibleFeature {
|
|||||||
static const int qcow2CompatibleFeatureArray[] = {
|
static const int qcow2CompatibleFeatureArray[] = {
|
||||||
VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS,
|
VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS,
|
||||||
};
|
};
|
||||||
verify(ARRAY_CARDINALITY(qcow2CompatibleFeatureArray) ==
|
verify(G_N_ELEMENTS(qcow2CompatibleFeatureArray) ==
|
||||||
QCOW2_COMPATIBLE_FEATURE_LAST);
|
QCOW2_COMPATIBLE_FEATURE_LAST);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -3640,7 +3640,7 @@ virStorageSourceParseBackingJSONInternal(virStorageSourcePtr src,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(jsonParsers); i++) {
|
for (i = 0; i < G_N_ELEMENTS(jsonParsers); i++) {
|
||||||
if (STREQ(drvname, jsonParsers[i].drvname))
|
if (STREQ(drvname, jsonParsers[i].drvname))
|
||||||
return jsonParsers[i].func(src, file, jsonParsers[i].opaque);
|
return jsonParsers[i].func(src, file, jsonParsers[i].opaque);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ virTPMCreateCancelPath(const char *devpath)
|
|||||||
dev = strrchr(devpath, '/');
|
dev = strrchr(devpath, '/');
|
||||||
if (dev) {
|
if (dev) {
|
||||||
dev++;
|
dev++;
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(prefix); i++) {
|
for (i = 0; i < G_N_ELEMENTS(prefix); i++) {
|
||||||
if (virAsprintf(&path, "/sys/class/%s%s/device/cancel",
|
if (virAsprintf(&path, "/sys/class/%s%s/device/cancel",
|
||||||
prefix[i], dev) < 0)
|
prefix[i], dev) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -290,7 +290,7 @@ virTPMEmulatorInit(void)
|
|||||||
|
|
||||||
virMutexLock(&swtpm_tools_lock);
|
virMutexLock(&swtpm_tools_lock);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(prgs); i++) {
|
for (i = 0; i < G_N_ELEMENTS(prgs); i++) {
|
||||||
VIR_AUTOFREE(char *) path = NULL;
|
VIR_AUTOFREE(char *) path = NULL;
|
||||||
bool findit = *prgs[i].path == NULL;
|
bool findit = *prgs[i].path == NULL;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
@ -386,7 +386,7 @@ int virDiskNameParse(const char *name, int *disk, int *partition)
|
|||||||
static char const* const drive_prefix[] = {"fd", "hd", "vd", "sd", "xvd", "ubd"};
|
static char const* const drive_prefix[] = {"fd", "hd", "vd", "sd", "xvd", "ubd"};
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(drive_prefix); i++) {
|
for (i = 0; i < G_N_ELEMENTS(drive_prefix); i++) {
|
||||||
if (STRPREFIX(name, drive_prefix[i])) {
|
if (STRPREFIX(name, drive_prefix[i])) {
|
||||||
ptr = name + strlen(drive_prefix[i]);
|
ptr = name + strlen(drive_prefix[i]);
|
||||||
break;
|
break;
|
||||||
@ -1108,7 +1108,7 @@ virGetWin32DirectoryRoot(char **path)
|
|||||||
|
|
||||||
*path = NULL;
|
*path = NULL;
|
||||||
|
|
||||||
if (GetWindowsDirectory(windowsdir, ARRAY_CARDINALITY(windowsdir))) {
|
if (GetWindowsDirectory(windowsdir, G_N_ELEMENTS(windowsdir))) {
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
/* Usually X:\Windows, but in terminal server environments
|
/* Usually X:\Windows, but in terminal server environments
|
||||||
* might be an UNC path, AFAIK.
|
* might be an UNC path, AFAIK.
|
||||||
|
@ -205,7 +205,7 @@ VBoxCGlueInit(unsigned int *version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Try the known locations. */
|
/* Try the known locations. */
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(knownDirs); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(knownDirs); ++i) {
|
||||||
if (tryLoadOne(knownDirs[i], true, true, version) >= 0)
|
if (tryLoadOne(knownDirs[i], true, true, version) >= 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ vmwareConnectOpen(virConnectPtr conn,
|
|||||||
* the VMware hypervisor. We look this up first since we use it
|
* the VMware hypervisor. We look this up first since we use it
|
||||||
* for auto detection of the backend
|
* for auto detection of the backend
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(vmrun_candidates); i++) {
|
for (i = 0; i < G_N_ELEMENTS(vmrun_candidates); i++) {
|
||||||
vmrun = virFindFileInPath(vmrun_candidates[i]);
|
vmrun = virFindFileInPath(vmrun_candidates[i]);
|
||||||
if (vmrun == NULL)
|
if (vmrun == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
@ -122,11 +122,11 @@ vzBuildCapabilities(void)
|
|||||||
if (virCapabilitiesInitCaches(caps) < 0)
|
if (virCapabilitiesInitCaches(caps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(archs) == ARRAY_CARDINALITY(emulators));
|
verify(G_N_ELEMENTS(archs) == G_N_ELEMENTS(emulators));
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(ostypes); i++)
|
for (i = 0; i < G_N_ELEMENTS(ostypes); i++)
|
||||||
for (j = 0; j < ARRAY_CARDINALITY(archs); j++)
|
for (j = 0; j < G_N_ELEMENTS(archs); j++)
|
||||||
for (k = 0; k < ARRAY_CARDINALITY(emulators); k++)
|
for (k = 0; k < G_N_ELEMENTS(emulators); k++)
|
||||||
if (vzCapsAddGuestDomain(caps, ostypes[i], archs[j],
|
if (vzCapsAddGuestDomain(caps, ostypes[i], archs[j],
|
||||||
emulators[k], virt_types[k]) < 0)
|
emulators[k], virt_types[k]) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -219,7 +219,7 @@ int main(int argc, char **argv) {
|
|||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(buffers); i++)
|
for (i = 0; i < G_N_ELEMENTS(buffers); i++)
|
||||||
free(buffers[i]);
|
free(buffers[i]);
|
||||||
fclose(log);
|
fclose(log);
|
||||||
free(newenv);
|
free(newenv);
|
||||||
|
@ -41,7 +41,7 @@ testParseDatastorePath(const void *data G_GNUC_UNUSED)
|
|||||||
char *directoryName = NULL;
|
char *directoryName = NULL;
|
||||||
char *directoryAndFileName = NULL;
|
char *directoryAndFileName = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(paths); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(paths); ++i) {
|
||||||
VIR_FREE(datastoreName);
|
VIR_FREE(datastoreName);
|
||||||
VIR_FREE(directoryName);
|
VIR_FREE(directoryName);
|
||||||
VIR_FREE(directoryAndFileName);
|
VIR_FREE(directoryAndFileName);
|
||||||
@ -127,7 +127,7 @@ testConvertDateTimeToCalendarTime(const void *data G_GNUC_UNUSED)
|
|||||||
esxVI_DateTime dateTime;
|
esxVI_DateTime dateTime;
|
||||||
long long calendarTime;
|
long long calendarTime;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(times); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(times); ++i) {
|
||||||
dateTime.value = (char *)times[i].dateTime;
|
dateTime.value = (char *)times[i].dateTime;
|
||||||
|
|
||||||
if (esxVI_DateTime_ConvertToCalendarTime(&dateTime,
|
if (esxVI_DateTime_ConvertToCalendarTime(&dateTime,
|
||||||
@ -177,7 +177,7 @@ testEscapeDatastoreItem(const void *data G_GNUC_UNUSED)
|
|||||||
size_t i;
|
size_t i;
|
||||||
char *escaped = NULL;
|
char *escaped = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(datastoreItems); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(datastoreItems); ++i) {
|
||||||
VIR_FREE(escaped);
|
VIR_FREE(escaped);
|
||||||
|
|
||||||
escaped = esxUtil_EscapeDatastoreItem(datastoreItems[i].string);
|
escaped = esxUtil_EscapeDatastoreItem(datastoreItems[i].string);
|
||||||
@ -217,7 +217,7 @@ testConvertWindows1252ToUTF8(const void *data G_GNUC_UNUSED)
|
|||||||
size_t i;
|
size_t i;
|
||||||
char *utf8 = NULL;
|
char *utf8 = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(windows1252ToUTF8); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(windows1252ToUTF8); ++i) {
|
||||||
VIR_FREE(utf8);
|
VIR_FREE(utf8);
|
||||||
|
|
||||||
utf8 = virVMXConvertToUTF8("Windows-1252",
|
utf8 = virVMXConvertToUTF8("Windows-1252",
|
||||||
|
@ -313,7 +313,7 @@ static void testRemoveCommonRules(char *rules)
|
|||||||
size_t i;
|
size_t i;
|
||||||
char *offset = rules;
|
char *offset = rules;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(commonRules); i++) {
|
for (i = 0; i < G_N_ELEMENTS(commonRules); i++) {
|
||||||
char *tmp = strstr(offset, commonRules[i]);
|
char *tmp = strstr(offset, commonRules[i]);
|
||||||
size_t len = strlen(commonRules[i]);
|
size_t len = strlen(commonRules[i]);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
|
@ -43,7 +43,7 @@ testReadConfigParam(const void *data G_GNUC_UNUSED)
|
|||||||
if (virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir) < 0)
|
if (virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(configParams); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(configParams); ++i) {
|
||||||
if (openvzReadConfigParam(conf, configParams[i].param,
|
if (openvzReadConfigParam(conf, configParams[i].param,
|
||||||
&value) != configParams[i].ret) {
|
&value) != configParams[i].ret) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -68,7 +68,7 @@ testFWPrecedence(const void *opaque G_GNUC_UNUSED)
|
|||||||
PREFIX "/share/qemu/firmware/61-ovmf.json",
|
PREFIX "/share/qemu/firmware/61-ovmf.json",
|
||||||
PREFIX "/share/qemu/firmware/70-aavmf.json",
|
PREFIX "/share/qemu/firmware/70-aavmf.json",
|
||||||
};
|
};
|
||||||
const size_t nexpected = ARRAY_CARDINALITY(expected);
|
const size_t nexpected = G_N_ELEMENTS(expected);
|
||||||
|
|
||||||
if (VIR_STRDUP(fakehome, abs_srcdir "/qemufirmwaredata/home/user/.config") < 0)
|
if (VIR_STRDUP(fakehome, abs_srcdir "/qemufirmwaredata/home/user/.config") < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -236,7 +236,7 @@ mymain(void)
|
|||||||
do { \
|
do { \
|
||||||
unsigned int interfaces[] = {__VA_ARGS__}; \
|
unsigned int interfaces[] = {__VA_ARGS__}; \
|
||||||
struct supportedData data = {machine, arch, secure, fwlist, \
|
struct supportedData data = {machine, arch, secure, fwlist, \
|
||||||
interfaces, ARRAY_CARDINALITY(interfaces)}; \
|
interfaces, G_N_ELEMENTS(interfaces)}; \
|
||||||
if (virTestRun("QEMU FW SUPPORTED " machine " " #arch, \
|
if (virTestRun("QEMU FW SUPPORTED " machine " " #arch, \
|
||||||
testSupportedFW, &data) < 0) \
|
testSupportedFW, &data) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
|
@ -2320,7 +2320,7 @@ testQemuMonitorJSONqemuMonitorJSONSendKey(const void *opaque)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
||||||
0, keycodes, ARRAY_CARDINALITY(keycodes)) < 0)
|
0, keycodes, G_N_ELEMENTS(keycodes)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2349,7 +2349,7 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *opaque)
|
|||||||
|
|
||||||
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
||||||
31337, keycodes,
|
31337, keycodes,
|
||||||
ARRAY_CARDINALITY(keycodes)) < 0)
|
G_N_ELEMENTS(keycodes)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -66,7 +66,7 @@ testVUPrecedence(const void *opaque G_GNUC_UNUSED)
|
|||||||
SYSCONFDIR "/qemu/vhost-user/40-gpu.json",
|
SYSCONFDIR "/qemu/vhost-user/40-gpu.json",
|
||||||
PREFIX "/share/qemu/vhost-user/60-gpu.json",
|
PREFIX "/share/qemu/vhost-user/60-gpu.json",
|
||||||
};
|
};
|
||||||
const size_t nexpected = ARRAY_CARDINALITY(expected);
|
const size_t nexpected = G_N_ELEMENTS(expected);
|
||||||
|
|
||||||
if (VIR_STRDUP(fakehome, abs_srcdir "/qemuvhostuserdata/home/user/.config") < 0)
|
if (VIR_STRDUP(fakehome, abs_srcdir "/qemuvhostuserdata/home/user/.config") < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -214,7 +214,7 @@ virCommandPassFD(virCommandPtr cmd,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(testCommandPassSafeFDs); i++) {
|
for (i = 0; i < G_N_ELEMENTS(testCommandPassSafeFDs); i++) {
|
||||||
if (testCommandPassSafeFDs[i] == fd) {
|
if (testCommandPassSafeFDs[i] == fd) {
|
||||||
if (!real_virCommandPassFD)
|
if (!real_virCommandPassFD)
|
||||||
VIR_MOCK_REAL_INIT(virCommandPassFD);
|
VIR_MOCK_REAL_INIT(virCommandPassFD);
|
||||||
|
@ -316,43 +316,43 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
|
|||||||
|
|
||||||
if (ARCH_IS_X86(arch)) {
|
if (ARCH_IS_X86(arch)) {
|
||||||
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, x86Models,
|
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, x86Models,
|
||||||
ARRAY_CARDINALITY(x86Models),
|
G_N_ELEMENTS(x86Models),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
||||||
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, x86Models,
|
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, x86Models,
|
||||||
ARRAY_CARDINALITY(x86Models),
|
G_N_ELEMENTS(x86Models),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!skipLegacy) {
|
if (!skipLegacy) {
|
||||||
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM,
|
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM,
|
||||||
x86LegacyModels,
|
x86LegacyModels,
|
||||||
ARRAY_CARDINALITY(x86LegacyModels),
|
G_N_ELEMENTS(x86LegacyModels),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
||||||
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU,
|
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU,
|
||||||
x86LegacyModels,
|
x86LegacyModels,
|
||||||
ARRAY_CARDINALITY(x86LegacyModels),
|
G_N_ELEMENTS(x86LegacyModels),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (ARCH_IS_ARM(arch)) {
|
} else if (ARCH_IS_ARM(arch)) {
|
||||||
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, armModels,
|
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, armModels,
|
||||||
ARRAY_CARDINALITY(armModels),
|
G_N_ELEMENTS(armModels),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
||||||
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, armModels,
|
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, armModels,
|
||||||
ARRAY_CARDINALITY(armModels),
|
G_N_ELEMENTS(armModels),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else if (ARCH_IS_PPC64(arch)) {
|
} else if (ARCH_IS_PPC64(arch)) {
|
||||||
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, ppc64Models,
|
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, ppc64Models,
|
||||||
ARRAY_CARDINALITY(ppc64Models),
|
G_N_ELEMENTS(ppc64Models),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
|
||||||
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, ppc64Models,
|
virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, ppc64Models,
|
||||||
ARRAY_CARDINALITY(ppc64Models),
|
G_N_ELEMENTS(ppc64Models),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else if (ARCH_IS_S390(arch)) {
|
} else if (ARCH_IS_S390(arch)) {
|
||||||
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, s390xModels,
|
if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, s390xModels,
|
||||||
ARRAY_CARDINALITY(s390xModels),
|
G_N_ELEMENTS(s390xModels),
|
||||||
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1193,7 +1193,7 @@ virTestCounterReset(const char *prefix)
|
|||||||
const char
|
const char
|
||||||
*virTestCounterNext(void)
|
*virTestCounterNext(void)
|
||||||
{
|
{
|
||||||
size_t len = ARRAY_CARDINALITY(virtTestCounterStr);
|
size_t len = G_N_ELEMENTS(virtTestCounterStr);
|
||||||
|
|
||||||
/* calculate length of the rest of the string */
|
/* calculate length of the rest of the string */
|
||||||
len -= (virtTestCounterPrefixEndOffset - virtTestCounterStr);
|
len -= (virtTestCounterPrefixEndOffset - virtTestCounterStr);
|
||||||
|
@ -43,8 +43,8 @@ static virCPUDef cpuDefaultData = {
|
|||||||
.sockets = 1,
|
.sockets = 1,
|
||||||
.cores = 2,
|
.cores = 2,
|
||||||
.threads = 1,
|
.threads = 1,
|
||||||
.nfeatures = ARRAY_CARDINALITY(cpuDefaultFeatures),
|
.nfeatures = G_N_ELEMENTS(cpuDefaultFeatures),
|
||||||
.nfeatures_max = ARRAY_CARDINALITY(cpuDefaultFeatures),
|
.nfeatures_max = G_N_ELEMENTS(cpuDefaultFeatures),
|
||||||
.features = cpuDefaultFeatures,
|
.features = cpuDefaultFeatures,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ static virCPUDef cpuHaswellData = {
|
|||||||
.sockets = 1,
|
.sockets = 1,
|
||||||
.cores = 2,
|
.cores = 2,
|
||||||
.threads = 2,
|
.threads = 2,
|
||||||
.nfeatures = ARRAY_CARDINALITY(cpuHaswellFeatures),
|
.nfeatures = G_N_ELEMENTS(cpuHaswellFeatures),
|
||||||
.nfeatures_max = ARRAY_CARDINALITY(cpuHaswellFeatures),
|
.nfeatures_max = G_N_ELEMENTS(cpuHaswellFeatures),
|
||||||
.features = cpuHaswellFeatures,
|
.features = cpuHaswellFeatures,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines)
|
|||||||
};
|
};
|
||||||
|
|
||||||
machines = virCapabilitiesAllocMachines(x86_machines,
|
machines = virCapabilitiesAllocMachines(x86_machines,
|
||||||
ARRAY_CARDINALITY(x86_machines));
|
G_N_ELEMENTS(x86_machines));
|
||||||
if (machines == NULL)
|
if (machines == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
*nmachines = ARRAY_CARDINALITY(x86_machines);
|
*nmachines = G_N_ELEMENTS(x86_machines);
|
||||||
|
|
||||||
return machines;
|
return machines;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
machines = virCapabilitiesAllocMachines(x86_machines,
|
machines = virCapabilitiesAllocMachines(x86_machines,
|
||||||
ARRAY_CARDINALITY(x86_machines));
|
G_N_ELEMENTS(x86_machines));
|
||||||
if (machines == NULL) {
|
if (machines == NULL) {
|
||||||
VIR_FREE(canonical);
|
VIR_FREE(canonical);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -86,7 +86,7 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
|
|||||||
|
|
||||||
machines[1]->canonical = canonical;
|
machines[1]->canonical = canonical;
|
||||||
|
|
||||||
*nmachines = ARRAY_CARDINALITY(x86_machines);
|
*nmachines = G_N_ELEMENTS(x86_machines);
|
||||||
|
|
||||||
return machines;
|
return machines;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ static int testQemuAddRISCV32Guest(virCapsPtr caps)
|
|||||||
"sifive_e",
|
"sifive_e",
|
||||||
"virt",
|
"virt",
|
||||||
"sifive_u" };
|
"sifive_u" };
|
||||||
static const int nmachines = ARRAY_CARDINALITY(names);
|
static const int nmachines = G_N_ELEMENTS(names);
|
||||||
virCapsGuestMachinePtr *machines = NULL;
|
virCapsGuestMachinePtr *machines = NULL;
|
||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ static int testQemuAddRISCV64Guest(virCapsPtr caps)
|
|||||||
"sifive_e",
|
"sifive_e",
|
||||||
"virt",
|
"virt",
|
||||||
"sifive_u" };
|
"sifive_u" };
|
||||||
static const int nmachines = ARRAY_CARDINALITY(names);
|
static const int nmachines = G_N_ELEMENTS(names);
|
||||||
virCapsGuestMachinePtr *machines = NULL;
|
virCapsGuestMachinePtr *machines = NULL;
|
||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
|
|
||||||
@ -367,14 +367,14 @@ static int testQemuAddS390Guest(virCapsPtr caps)
|
|||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
|
|
||||||
machines = virCapabilitiesAllocMachines(s390_machines,
|
machines = virCapabilitiesAllocMachines(s390_machines,
|
||||||
ARRAY_CARDINALITY(s390_machines));
|
G_N_ELEMENTS(s390_machines));
|
||||||
if (!machines)
|
if (!machines)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_S390X,
|
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_S390X,
|
||||||
QEMUBinList[TEST_UTILS_QEMU_BIN_S390X],
|
QEMUBinList[TEST_UTILS_QEMU_BIN_S390X],
|
||||||
NULL,
|
NULL,
|
||||||
ARRAY_CARDINALITY(s390_machines),
|
G_N_ELEMENTS(s390_machines),
|
||||||
machines);
|
machines);
|
||||||
if (!guest)
|
if (!guest)
|
||||||
goto error;
|
goto error;
|
||||||
@ -388,7 +388,7 @@ static int testQemuAddS390Guest(virCapsPtr caps)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virCapabilitiesFreeMachines(machines, ARRAY_CARDINALITY(s390_machines));
|
virCapabilitiesFreeMachines(machines, G_N_ELEMENTS(s390_machines));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,14 +399,14 @@ static int testQemuAddArm6Guest(virCapsPtr caps)
|
|||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
|
|
||||||
capsmachines = virCapabilitiesAllocMachines(machines,
|
capsmachines = virCapabilitiesAllocMachines(machines,
|
||||||
ARRAY_CARDINALITY(machines));
|
G_N_ELEMENTS(machines));
|
||||||
if (!capsmachines)
|
if (!capsmachines)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV6L,
|
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV6L,
|
||||||
QEMUBinList[TEST_UTILS_QEMU_BIN_ARM],
|
QEMUBinList[TEST_UTILS_QEMU_BIN_ARM],
|
||||||
NULL,
|
NULL,
|
||||||
ARRAY_CARDINALITY(machines),
|
G_N_ELEMENTS(machines),
|
||||||
capsmachines);
|
capsmachines);
|
||||||
if (!guest)
|
if (!guest)
|
||||||
goto error;
|
goto error;
|
||||||
@ -420,7 +420,7 @@ static int testQemuAddArm6Guest(virCapsPtr caps)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines));
|
virCapabilitiesFreeMachines(capsmachines, G_N_ELEMENTS(machines));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,14 +433,14 @@ static int testQemuAddArm7Guest(virCapsPtr caps)
|
|||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
|
|
||||||
capsmachines = virCapabilitiesAllocMachines(machines,
|
capsmachines = virCapabilitiesAllocMachines(machines,
|
||||||
ARRAY_CARDINALITY(machines));
|
G_N_ELEMENTS(machines));
|
||||||
if (!capsmachines)
|
if (!capsmachines)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV7L,
|
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV7L,
|
||||||
QEMUBinList[TEST_UTILS_QEMU_BIN_ARM],
|
QEMUBinList[TEST_UTILS_QEMU_BIN_ARM],
|
||||||
NULL,
|
NULL,
|
||||||
ARRAY_CARDINALITY(machines),
|
G_N_ELEMENTS(machines),
|
||||||
capsmachines);
|
capsmachines);
|
||||||
if (!guest)
|
if (!guest)
|
||||||
goto error;
|
goto error;
|
||||||
@ -454,7 +454,7 @@ static int testQemuAddArm7Guest(virCapsPtr caps)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines));
|
virCapabilitiesFreeMachines(capsmachines, G_N_ELEMENTS(machines));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,14 +465,14 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps)
|
|||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
|
|
||||||
capsmachines = virCapabilitiesAllocMachines(machines,
|
capsmachines = virCapabilitiesAllocMachines(machines,
|
||||||
ARRAY_CARDINALITY(machines));
|
G_N_ELEMENTS(machines));
|
||||||
if (!capsmachines)
|
if (!capsmachines)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_AARCH64,
|
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_AARCH64,
|
||||||
QEMUBinList[TEST_UTILS_QEMU_BIN_AARCH64],
|
QEMUBinList[TEST_UTILS_QEMU_BIN_AARCH64],
|
||||||
NULL,
|
NULL,
|
||||||
ARRAY_CARDINALITY(machines),
|
G_N_ELEMENTS(machines),
|
||||||
capsmachines);
|
capsmachines);
|
||||||
if (!guest)
|
if (!guest)
|
||||||
goto error;
|
goto error;
|
||||||
@ -486,7 +486,7 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines));
|
virCapabilitiesFreeMachines(capsmachines, G_N_ELEMENTS(machines));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(QEMUBinList); i++) {
|
for (i = 0; i < G_N_ELEMENTS(QEMUBinList); i++) {
|
||||||
virObjectRef(tmpCaps);
|
virObjectRef(tmpCaps);
|
||||||
if (virFileCacheInsertData(cache, QEMUBinList[i], tmpCaps) < 0) {
|
if (virFileCacheInsertData(cache, QEMUBinList[i], tmpCaps) < 0) {
|
||||||
virObjectUnref(tmpCaps);
|
virObjectUnref(tmpCaps);
|
||||||
@ -884,7 +884,7 @@ testQemuGetLatestCaps(void)
|
|||||||
|
|
||||||
VIR_TEST_VERBOSE("");
|
VIR_TEST_VERBOSE("");
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(archs); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(archs); ++i) {
|
||||||
char *cap = testQemuGetLatestCapsForArch(archs[i], "xml");
|
char *cap = testQemuGetLatestCapsForArch(archs[i], "xml");
|
||||||
|
|
||||||
if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0)
|
if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0)
|
||||||
|
@ -29,7 +29,7 @@ testXLInitCaps(void)
|
|||||||
|
|
||||||
caps->host.cpu = virCPUDefCopy(&cpuDefaultData);
|
caps->host.cpu = virCPUDefCopy(&cpuDefaultData);
|
||||||
|
|
||||||
nmachines = ARRAY_CARDINALITY(x86_machines);
|
nmachines = G_N_ELEMENTS(x86_machines);
|
||||||
if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
|
if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
|
if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
|
||||||
@ -42,7 +42,7 @@ testXLInitCaps(void)
|
|||||||
if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
|
if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
|
||||||
NULL, 0, NULL) == NULL)
|
NULL, 0, NULL) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
nmachines = ARRAY_CARDINALITY(xen_machines);
|
nmachines = G_N_ELEMENTS(xen_machines);
|
||||||
if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
|
if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ testXLInitCaps(void)
|
|||||||
if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
|
if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
|
||||||
NULL, 0, NULL) == NULL)
|
NULL, 0, NULL) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
nmachines = ARRAY_CARDINALITY(pvh_machines);
|
nmachines = G_N_ELEMENTS(pvh_machines);
|
||||||
if ((machines = virCapabilitiesAllocMachines(pvh_machines, nmachines)) == NULL)
|
if ((machines = virCapabilitiesAllocMachines(pvh_machines, nmachines)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ testIndexToDiskName(const void *data G_GNUC_UNUSED)
|
|||||||
size_t i;
|
size_t i;
|
||||||
char *diskName = NULL;
|
char *diskName = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(diskNames); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(diskNames); ++i) {
|
||||||
VIR_FREE(diskName);
|
VIR_FREE(diskName);
|
||||||
|
|
||||||
diskName = virIndexToDiskName(i, "sd");
|
diskName = virIndexToDiskName(i, "sd");
|
||||||
@ -102,7 +102,7 @@ testDiskNameParse(const void *data G_GNUC_UNUSED)
|
|||||||
int partition;
|
int partition;
|
||||||
struct testDiskName *disk = NULL;
|
struct testDiskName *disk = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(diskNamesPart); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(diskNamesPart); ++i) {
|
||||||
disk = &diskNamesPart[i];
|
disk = &diskNamesPart[i];
|
||||||
if (virDiskNameParse(disk->name, &idx, &partition))
|
if (virDiskNameParse(disk->name, &idx, &partition))
|
||||||
return -1;
|
return -1;
|
||||||
@ -120,7 +120,7 @@ testDiskNameParse(const void *data G_GNUC_UNUSED)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(diskNamesInvalid); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(diskNamesInvalid); ++i) {
|
||||||
if (!virDiskNameParse(diskNamesInvalid[i], &idx, &partition)) {
|
if (!virDiskNameParse(diskNamesInvalid[i], &idx, &partition)) {
|
||||||
VIR_TEST_DEBUG("Should Fail [%s]", diskNamesInvalid[i]);
|
VIR_TEST_DEBUG("Should Fail [%s]", diskNamesInvalid[i]);
|
||||||
return -1;
|
return -1;
|
||||||
@ -161,7 +161,7 @@ testParseVersionString(const void *data G_GNUC_UNUSED)
|
|||||||
size_t i;
|
size_t i;
|
||||||
unsigned long version;
|
unsigned long version;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(versions); ++i) {
|
for (i = 0; i < G_N_ELEMENTS(versions); ++i) {
|
||||||
result = virParseVersionString(versions[i].string, &version,
|
result = virParseVersionString(versions[i].string, &version,
|
||||||
versions[i].allowMissing);
|
versions[i].allowMissing);
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ testRoundValueToPowerOfTwo(const void *data G_GNUC_UNUSED)
|
|||||||
unsigned int result;
|
unsigned int result;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(roundData); i++) {
|
for (i = 0; i < G_N_ELEMENTS(roundData); i++) {
|
||||||
result = VIR_ROUND_UP_POWER_OF_TWO(roundData[i].input);
|
result = VIR_ROUND_UP_POWER_OF_TWO(roundData[i].input);
|
||||||
if (roundData[i].output != result) {
|
if (roundData[i].output != result) {
|
||||||
VIR_TEST_DEBUG("\nInput number [%u]", roundData[i].input);
|
VIR_TEST_DEBUG("\nInput number [%u]", roundData[i].input);
|
||||||
|
@ -188,7 +188,7 @@ test4(const void *data G_GNUC_UNUSED)
|
|||||||
virBitmapPtr bitmap = NULL;
|
virBitmapPtr bitmap = NULL;
|
||||||
ssize_t i, j;
|
ssize_t i, j;
|
||||||
|
|
||||||
if (ARRAY_CARDINALITY(bitsPos) + ARRAY_CARDINALITY(bitsPosInv) != size)
|
if (G_N_ELEMENTS(bitsPos) + G_N_ELEMENTS(bitsPosInv) != size)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* 0. empty set */
|
/* 0. empty set */
|
||||||
@ -243,7 +243,7 @@ test4(const void *data G_GNUC_UNUSED)
|
|||||||
j = 0;
|
j = 0;
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
||||||
while (j < ARRAY_CARDINALITY(bitsPos)) {
|
while (j < G_N_ELEMENTS(bitsPos)) {
|
||||||
i = virBitmapNextSetBit(bitmap, i);
|
i = virBitmapNextSetBit(bitmap, i);
|
||||||
if (i != bitsPos[j++])
|
if (i != bitsPos[j++])
|
||||||
goto error;
|
goto error;
|
||||||
@ -260,7 +260,7 @@ test4(const void *data G_GNUC_UNUSED)
|
|||||||
j = 0;
|
j = 0;
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
||||||
while (j < ARRAY_CARDINALITY(bitsPosInv)) {
|
while (j < G_N_ELEMENTS(bitsPosInv)) {
|
||||||
i = virBitmapNextClearBit(bitmap, i);
|
i = virBitmapNextClearBit(bitmap, i);
|
||||||
if (i != bitsPosInv[j++])
|
if (i != bitsPosInv[j++])
|
||||||
goto error;
|
goto error;
|
||||||
@ -680,7 +680,7 @@ test13(const void *opaque G_GNUC_UNUSED)
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(strings); i++) {
|
for (i = 0; i < G_N_ELEMENTS(strings); i++) {
|
||||||
map = virBitmapNewString(strings[i]);
|
map = virBitmapNewString(strings[i]);
|
||||||
str = virBitmapToString(map, false, true);
|
str = virBitmapToString(map, false, true);
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ testCgroupGetMemoryStat(const void *args G_GNUC_UNUSED)
|
|||||||
"inactive_file",
|
"inactive_file",
|
||||||
"unevictable"
|
"unevictable"
|
||||||
};
|
};
|
||||||
unsigned long long values[ARRAY_CARDINALITY(expected_values)];
|
unsigned long long values[G_N_ELEMENTS(expected_values)];
|
||||||
|
|
||||||
if ((rv = virCgroupNewPartition("/virtualmachines", true,
|
if ((rv = virCgroupNewPartition("/virtualmachines", true,
|
||||||
(1 << VIR_CGROUP_CONTROLLER_MEMORY),
|
(1 << VIR_CGROUP_CONTROLLER_MEMORY),
|
||||||
@ -842,7 +842,7 @@ testCgroupGetMemoryStat(const void *args G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(expected_values); i++) {
|
for (i = 0; i < G_N_ELEMENTS(expected_values); i++) {
|
||||||
/* NB: virCgroupGetMemoryStat returns a KiB scaled value */
|
/* NB: virCgroupGetMemoryStat returns a KiB scaled value */
|
||||||
if ((expected_values[i] >> 10) != values[i]) {
|
if ((expected_values[i] >> 10) != values[i]) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -879,7 +879,7 @@ static int testCgroupGetBlkioIoServiced(const void *args G_GNUC_UNUSED)
|
|||||||
"requests read",
|
"requests read",
|
||||||
"requests written"
|
"requests written"
|
||||||
};
|
};
|
||||||
long long values[ARRAY_CARDINALITY(expected_values)];
|
long long values[G_N_ELEMENTS(expected_values)];
|
||||||
|
|
||||||
if ((rv = virCgroupNewPartition("/virtualmachines", true,
|
if ((rv = virCgroupNewPartition("/virtualmachines", true,
|
||||||
(1 << VIR_CGROUP_CONTROLLER_BLKIO),
|
(1 << VIR_CGROUP_CONTROLLER_BLKIO),
|
||||||
@ -895,7 +895,7 @@ static int testCgroupGetBlkioIoServiced(const void *args G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(expected_values); i++) {
|
for (i = 0; i < G_N_ELEMENTS(expected_values); i++) {
|
||||||
if (expected_values[i] != values[i]) {
|
if (expected_values[i] != values[i]) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Wrong value for %s from virCgroupBlkioIoServiced (expected %lld)\n",
|
"Wrong value for %s from virCgroupBlkioIoServiced (expected %lld)\n",
|
||||||
@ -934,7 +934,7 @@ static int testCgroupGetBlkioIoDeviceServiced(const void *args G_GNUC_UNUSED)
|
|||||||
"requests read",
|
"requests read",
|
||||||
"requests written"
|
"requests written"
|
||||||
};
|
};
|
||||||
long long values[ARRAY_CARDINALITY(expected_values0)];
|
long long values[G_N_ELEMENTS(expected_values0)];
|
||||||
|
|
||||||
if ((rv = virCgroupNewPartition("/virtualmachines", true,
|
if ((rv = virCgroupNewPartition("/virtualmachines", true,
|
||||||
(1 << VIR_CGROUP_CONTROLLER_BLKIO),
|
(1 << VIR_CGROUP_CONTROLLER_BLKIO),
|
||||||
@ -951,7 +951,7 @@ static int testCgroupGetBlkioIoDeviceServiced(const void *args G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(expected_values0); i++) {
|
for (i = 0; i < G_N_ELEMENTS(expected_values0); i++) {
|
||||||
if (expected_values0[i] != values[i]) {
|
if (expected_values0[i] != values[i]) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Wrong value for %s from virCgroupGetBlkioIoDeviceServiced (expected %lld)\n",
|
"Wrong value for %s from virCgroupGetBlkioIoDeviceServiced (expected %lld)\n",
|
||||||
@ -968,7 +968,7 @@ static int testCgroupGetBlkioIoDeviceServiced(const void *args G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(expected_values1); i++) {
|
for (i = 0; i < G_N_ELEMENTS(expected_values1); i++) {
|
||||||
if (expected_values1[i] != values[i]) {
|
if (expected_values1[i] != values[i]) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Wrong value for %s from virCgroupGetBlkioIoDeviceServiced (expected %lld)\n",
|
"Wrong value for %s from virCgroupGetBlkioIoDeviceServiced (expected %lld)\n",
|
||||||
|
@ -376,7 +376,7 @@ mymain(void)
|
|||||||
# define DO_TEST_MOUNT_SUBTREE(name, path, prefix, mounts, rev) \
|
# define DO_TEST_MOUNT_SUBTREE(name, path, prefix, mounts, rev) \
|
||||||
do { \
|
do { \
|
||||||
struct testFileGetMountSubtreeData data = { \
|
struct testFileGetMountSubtreeData data = { \
|
||||||
path, prefix, mounts, ARRAY_CARDINALITY(mounts), rev \
|
path, prefix, mounts, G_N_ELEMENTS(mounts), rev \
|
||||||
}; \
|
}; \
|
||||||
if (virTestRun(name, testFileGetMountSubtree, &data) < 0) \
|
if (virTestRun(name, testFileGetMountSubtree, &data) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
|
@ -991,7 +991,7 @@ testFirewallQueryCallback(virFirewallPtr fw,
|
|||||||
"--jump", "REJECT", NULL);
|
"--jump", "REJECT", NULL);
|
||||||
|
|
||||||
for (i = 0; lines[i] != NULL; i++) {
|
for (i = 0; lines[i] != NULL; i++) {
|
||||||
if (expectedLineNum >= ARRAY_CARDINALITY(expectedLines)) {
|
if (expectedLineNum >= G_N_ELEMENTS(expectedLines)) {
|
||||||
expectedLineError = true;
|
expectedLineError = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ testHashInit(int size)
|
|||||||
/* entries are added in reverse order so that they will be linked in
|
/* entries are added in reverse order so that they will be linked in
|
||||||
* collision list in the same order as in the uuids array
|
* collision list in the same order as in the uuids array
|
||||||
*/
|
*/
|
||||||
for (i = ARRAY_CARDINALITY(uuids) - 1; i >= 0; i--) {
|
for (i = G_N_ELEMENTS(uuids) - 1; i >= 0; i--) {
|
||||||
ssize_t oldsize = virHashTableSize(hash);
|
ssize_t oldsize = virHashTableSize(hash);
|
||||||
if (virHashAddEntry(hash, uuids[i], (void *) uuids[i]) < 0) {
|
if (virHashAddEntry(hash, uuids[i], (void *) uuids[i]) < 0) {
|
||||||
virHashFree(hash);
|
virHashFree(hash);
|
||||||
@ -39,7 +39,7 @@ testHashInit(int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(uuids); i++) {
|
for (i = 0; i < G_N_ELEMENTS(uuids); i++) {
|
||||||
if (!virHashLookup(hash, uuids[i])) {
|
if (!virHashLookup(hash, uuids[i])) {
|
||||||
VIR_TEST_VERBOSE("\nentry \"%s\" could not be found", uuids[i]);
|
VIR_TEST_VERBOSE("\nentry \"%s\" could not be found", uuids[i]);
|
||||||
virHashFree(hash);
|
virHashFree(hash);
|
||||||
@ -98,7 +98,7 @@ testHashGrow(const void *data)
|
|||||||
if (!(hash = testHashInit(info->count)))
|
if (!(hash = testHashInit(info->count)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (testHashCheckCount(hash, ARRAY_CARDINALITY(uuids)) < 0)
|
if (testHashCheckCount(hash, G_N_ELEMENTS(uuids)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -112,7 +112,7 @@ testHashGrow(const void *data)
|
|||||||
static int
|
static int
|
||||||
testHashUpdate(const void *data G_GNUC_UNUSED)
|
testHashUpdate(const void *data G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
int count = ARRAY_CARDINALITY(uuids) + ARRAY_CARDINALITY(uuids_new);
|
int count = G_N_ELEMENTS(uuids) + G_N_ELEMENTS(uuids_new);
|
||||||
virHashTablePtr hash;
|
virHashTablePtr hash;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -120,7 +120,7 @@ testHashUpdate(const void *data G_GNUC_UNUSED)
|
|||||||
if (!(hash = testHashInit(0)))
|
if (!(hash = testHashInit(0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(uuids_subset); i++) {
|
for (i = 0; i < G_N_ELEMENTS(uuids_subset); i++) {
|
||||||
if (virHashUpdateEntry(hash, uuids_subset[i], (void *) 1) < 0) {
|
if (virHashUpdateEntry(hash, uuids_subset[i], (void *) 1) < 0) {
|
||||||
VIR_TEST_VERBOSE("\nentry \"%s\" could not be updated",
|
VIR_TEST_VERBOSE("\nentry \"%s\" could not be updated",
|
||||||
uuids_subset[i]);
|
uuids_subset[i]);
|
||||||
@ -128,7 +128,7 @@ testHashUpdate(const void *data G_GNUC_UNUSED)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(uuids_new); i++) {
|
for (i = 0; i < G_N_ELEMENTS(uuids_new); i++) {
|
||||||
if (virHashUpdateEntry(hash, uuids_new[i], (void *) 1) < 0) {
|
if (virHashUpdateEntry(hash, uuids_new[i], (void *) 1) < 0) {
|
||||||
VIR_TEST_VERBOSE("\nnew entry \"%s\" could not be updated",
|
VIR_TEST_VERBOSE("\nnew entry \"%s\" could not be updated",
|
||||||
uuids_new[i]);
|
uuids_new[i]);
|
||||||
@ -150,7 +150,7 @@ testHashUpdate(const void *data G_GNUC_UNUSED)
|
|||||||
static int
|
static int
|
||||||
testHashRemove(const void *data G_GNUC_UNUSED)
|
testHashRemove(const void *data G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
int count = ARRAY_CARDINALITY(uuids) - ARRAY_CARDINALITY(uuids_subset);
|
int count = G_N_ELEMENTS(uuids) - G_N_ELEMENTS(uuids_subset);
|
||||||
virHashTablePtr hash;
|
virHashTablePtr hash;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -158,7 +158,7 @@ testHashRemove(const void *data G_GNUC_UNUSED)
|
|||||||
if (!(hash = testHashInit(0)))
|
if (!(hash = testHashInit(0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(uuids_subset); i++) {
|
for (i = 0; i < G_N_ELEMENTS(uuids_subset); i++) {
|
||||||
if (virHashRemoveEntry(hash, uuids_subset[i]) < 0) {
|
if (virHashRemoveEntry(hash, uuids_subset[i]) < 0) {
|
||||||
VIR_TEST_VERBOSE("\nentry \"%s\" could not be removed",
|
VIR_TEST_VERBOSE("\nentry \"%s\" could not be removed",
|
||||||
uuids_subset[i]);
|
uuids_subset[i]);
|
||||||
@ -178,7 +178,7 @@ testHashRemove(const void *data G_GNUC_UNUSED)
|
|||||||
|
|
||||||
|
|
||||||
const int testHashCountRemoveForEachSome =
|
const int testHashCountRemoveForEachSome =
|
||||||
ARRAY_CARDINALITY(uuids) - ARRAY_CARDINALITY(uuids_subset);
|
G_N_ELEMENTS(uuids) - G_N_ELEMENTS(uuids_subset);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testHashRemoveForEachSome(void *payload G_GNUC_UNUSED,
|
testHashRemoveForEachSome(void *payload G_GNUC_UNUSED,
|
||||||
@ -188,7 +188,7 @@ testHashRemoveForEachSome(void *payload G_GNUC_UNUSED,
|
|||||||
virHashTablePtr hash = data;
|
virHashTablePtr hash = data;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(uuids_subset); i++) {
|
for (i = 0; i < G_N_ELEMENTS(uuids_subset); i++) {
|
||||||
if (STREQ(uuids_subset[i], name)) {
|
if (STREQ(uuids_subset[i], name)) {
|
||||||
if (virHashRemoveEntry(hash, name) < 0) {
|
if (virHashRemoveEntry(hash, name) < 0) {
|
||||||
VIR_TEST_VERBOSE("\nentry \"%s\" could not be removed",
|
VIR_TEST_VERBOSE("\nentry \"%s\" could not be removed",
|
||||||
@ -244,7 +244,7 @@ testHashRemoveForEach(const void *data)
|
|||||||
static int
|
static int
|
||||||
testHashSteal(const void *data G_GNUC_UNUSED)
|
testHashSteal(const void *data G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
int count = ARRAY_CARDINALITY(uuids) - ARRAY_CARDINALITY(uuids_subset);
|
int count = G_N_ELEMENTS(uuids) - G_N_ELEMENTS(uuids_subset);
|
||||||
virHashTablePtr hash;
|
virHashTablePtr hash;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -252,7 +252,7 @@ testHashSteal(const void *data G_GNUC_UNUSED)
|
|||||||
if (!(hash = testHashInit(0)))
|
if (!(hash = testHashInit(0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(uuids_subset); i++) {
|
for (i = 0; i < G_N_ELEMENTS(uuids_subset); i++) {
|
||||||
if (!virHashSteal(hash, uuids_subset[i])) {
|
if (!virHashSteal(hash, uuids_subset[i])) {
|
||||||
VIR_TEST_VERBOSE("\nentry \"%s\" could not be stolen",
|
VIR_TEST_VERBOSE("\nentry \"%s\" could not be stolen",
|
||||||
uuids_subset[i]);
|
uuids_subset[i]);
|
||||||
@ -280,7 +280,7 @@ testHashRemoveSetIter(const void *payload G_GNUC_UNUSED,
|
|||||||
bool rem = false;
|
bool rem = false;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(uuids_subset); i++) {
|
for (i = 0; i < G_N_ELEMENTS(uuids_subset); i++) {
|
||||||
if (STREQ(uuids_subset[i], name)) {
|
if (STREQ(uuids_subset[i], name)) {
|
||||||
rem = true;
|
rem = true;
|
||||||
break;
|
break;
|
||||||
@ -318,7 +318,7 @@ testHashRemoveSet(const void *data G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testHashCheckCount(hash, ARRAY_CARDINALITY(uuids) - count) < 0)
|
if (testHashCheckCount(hash, G_N_ELEMENTS(uuids) - count) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -329,7 +329,7 @@ testHashRemoveSet(const void *data G_GNUC_UNUSED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const int testSearchIndex = ARRAY_CARDINALITY(uuids_subset) / 2;
|
const int testSearchIndex = G_N_ELEMENTS(uuids_subset) / 2;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testHashSearchIter(const void *payload G_GNUC_UNUSED,
|
testHashSearchIter(const void *payload G_GNUC_UNUSED,
|
||||||
@ -357,7 +357,7 @@ testHashSearch(const void *data G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testHashCheckCount(hash, ARRAY_CARDINALITY(uuids)) < 0)
|
if (testHashCheckCount(hash, G_N_ELEMENTS(uuids)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -260,7 +260,7 @@ mymain(void)
|
|||||||
if (virInitialize() < 0)
|
if (virInitialize() < 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(nodeData); i++)
|
for (i = 0; i < G_N_ELEMENTS(nodeData); i++)
|
||||||
if (virTestRun(nodeData[i].testName, linuxTestHostCPU, &nodeData[i]) != 0)
|
if (virTestRun(nodeData[i].testName, linuxTestHostCPU, &nodeData[i]) != 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ mymain(void)
|
|||||||
.fake_cmd_output = "iscsiadm_sendtargets",
|
.fake_cmd_output = "iscsiadm_sendtargets",
|
||||||
.portal = "10.20.30.40:3260,1",
|
.portal = "10.20.30.40:3260,1",
|
||||||
.expected_targets = targets,
|
.expected_targets = targets,
|
||||||
.nexpected = ARRAY_CARDINALITY(targets),
|
.nexpected = G_N_ELEMENTS(targets),
|
||||||
};
|
};
|
||||||
if (virTestRun("ISCSI scan targets", testISCSIScanTargets, &infoTargets) < 0)
|
if (virTestRun("ISCSI scan targets", testISCSIScanTargets, &infoTargets) < 0)
|
||||||
rv = -1;
|
rv = -1;
|
||||||
|
@ -61,7 +61,7 @@ static int testMessageHeaderEncode(const void *args G_GNUC_UNUSED)
|
|||||||
if (virNetMessageEncodeHeader(msg) < 0)
|
if (virNetMessageEncodeHeader(msg) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (ARRAY_CARDINALITY(expect) != msg->bufferOffset) {
|
if (G_N_ELEMENTS(expect) != msg->bufferOffset) {
|
||||||
VIR_DEBUG("Expect message offset %zu got %zu",
|
VIR_DEBUG("Expect message offset %zu got %zu",
|
||||||
sizeof(expect), msg->bufferOffset);
|
sizeof(expect), msg->bufferOffset);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -253,7 +253,7 @@ static int testMessagePayloadEncode(const void *args G_GNUC_UNUSED)
|
|||||||
if (virNetMessageEncodePayload(msg, (xdrproc_t)xdr_virNetMessageError, &err) < 0)
|
if (virNetMessageEncodePayload(msg, (xdrproc_t)xdr_virNetMessageError, &err) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (ARRAY_CARDINALITY(expect) != msg->bufferLength) {
|
if (G_N_ELEMENTS(expect) != msg->bufferLength) {
|
||||||
VIR_DEBUG("Expect message length %zu got %zu",
|
VIR_DEBUG("Expect message length %zu got %zu",
|
||||||
sizeof(expect), msg->bufferLength);
|
sizeof(expect), msg->bufferLength);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -495,7 +495,7 @@ static int testMessagePayloadStreamEncode(const void *args G_GNUC_UNUSED)
|
|||||||
if (virNetMessageEncodePayloadRaw(msg, stream, strlen(stream)) < 0)
|
if (virNetMessageEncodePayloadRaw(msg, stream, strlen(stream)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (ARRAY_CARDINALITY(expect) != msg->bufferLength) {
|
if (G_N_ELEMENTS(expect) != msg->bufferLength) {
|
||||||
VIR_DEBUG("Expect message length %zu got %zu",
|
VIR_DEBUG("Expect message length %zu got %zu",
|
||||||
sizeof(expect), msg->bufferLength);
|
sizeof(expect), msg->bufferLength);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -562,7 +562,7 @@ mymain(void)
|
|||||||
|
|
||||||
testTLSWriteCertChain("cacertchain-ctx.pem",
|
testTLSWriteCertChain("cacertchain-ctx.pem",
|
||||||
certchain,
|
certchain,
|
||||||
ARRAY_CARDINALITY(certchain));
|
G_N_ELEMENTS(certchain));
|
||||||
|
|
||||||
DO_CTX_TEST(true, "cacertchain-ctx.pem", servercertlevel3areq.filename, false);
|
DO_CTX_TEST(true, "cacertchain-ctx.pem", servercertlevel3areq.filename, false);
|
||||||
DO_CTX_TEST(false, "cacertchain-ctx.pem", clientcertlevel2breq.filename, false);
|
DO_CTX_TEST(false, "cacertchain-ctx.pem", clientcertlevel2breq.filename, false);
|
||||||
|
@ -456,7 +456,7 @@ mymain(void)
|
|||||||
|
|
||||||
testTLSWriteCertChain("cacertchain-sess.pem",
|
testTLSWriteCertChain("cacertchain-sess.pem",
|
||||||
certchain,
|
certchain,
|
||||||
ARRAY_CARDINALITY(certchain));
|
G_N_ELEMENTS(certchain));
|
||||||
|
|
||||||
DO_SESS_TEST("cacertchain-sess.pem", servercertlevel3areq.filename, clientcertlevel2breq.filename,
|
DO_SESS_TEST("cacertchain-sess.pem", servercertlevel3areq.filename, clientcertlevel2breq.filename,
|
||||||
false, false, "libvirt.org", NULL);
|
false, false, "libvirt.org", NULL);
|
||||||
|
@ -130,7 +130,7 @@ virNumaGetPages(int node,
|
|||||||
size_t *npages)
|
size_t *npages)
|
||||||
{
|
{
|
||||||
const int pages_def[] = { 4, 2 * 1024, 1 * 1024 * 1024};
|
const int pages_def[] = { 4, 2 * 1024, 1 * 1024 * 1024};
|
||||||
const int npages_def = ARRAY_CARDINALITY(pages_def);
|
const int npages_def = G_N_ELEMENTS(pages_def);
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
if (pages_size)
|
if (pages_size)
|
||||||
|
@ -91,7 +91,7 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
|
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
|
||||||
size_t i, nDev = ARRAY_CARDINALITY(dev);
|
size_t i, nDev = G_N_ELEMENTS(dev);
|
||||||
virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
|
virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
|
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
|
||||||
size_t i, nDev = ARRAY_CARDINALITY(dev);
|
size_t i, nDev = G_N_ELEMENTS(dev);
|
||||||
virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
|
virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
|
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
|
||||||
size_t i, nDev = ARRAY_CARDINALITY(dev);
|
size_t i, nDev = G_N_ELEMENTS(dev);
|
||||||
virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
|
virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ VIR_MOCK_WRAP_RET_ARGS(dbus_connection_send_with_reply_and_block,
|
|||||||
is_authorized = 0;
|
is_authorized = 0;
|
||||||
is_challenge = 0;
|
is_challenge = 0;
|
||||||
retdetails = retdetailscancelled;
|
retdetails = retdetailscancelled;
|
||||||
retdetailslen = ARRAY_CARDINALITY(retdetailscancelled) / 2;
|
retdetailslen = G_N_ELEMENTS(retdetailscancelled) / 2;
|
||||||
} else if (STREQ(actionid, "org.libvirt.test.details")) {
|
} else if (STREQ(actionid, "org.libvirt.test.details")) {
|
||||||
size_t i;
|
size_t i;
|
||||||
is_authorized = 0;
|
is_authorized = 0;
|
||||||
|
@ -85,7 +85,7 @@ static int testRotatingFileReaderAssertBufferContent(const char *buf,
|
|||||||
char bytes[] = { FILEBYTE, FILEBYTE0, FILEBYTE1 };
|
char bytes[] = { FILEBYTE, FILEBYTE0, FILEBYTE1 };
|
||||||
size_t total = 0;
|
size_t total = 0;
|
||||||
|
|
||||||
if (nregions > ARRAY_CARDINALITY(bytes)) {
|
if (nregions > G_N_ELEMENTS(bytes)) {
|
||||||
fprintf(stderr, "Too many regions %zu\n", nregions);
|
fprintf(stderr, "Too many regions %zu\n", nregions);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -573,7 +573,7 @@ static int testRotatingFileReaderOne(const void *data G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
||||||
ARRAY_CARDINALITY(regions),
|
G_N_ELEMENTS(regions),
|
||||||
regions) < 0)
|
regions) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -605,7 +605,7 @@ static int testRotatingFileReaderAll(const void *data G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
||||||
ARRAY_CARDINALITY(regions),
|
G_N_ELEMENTS(regions),
|
||||||
regions) < 0)
|
regions) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -637,7 +637,7 @@ static int testRotatingFileReaderPartial(const void *data G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
||||||
ARRAY_CARDINALITY(regions),
|
G_N_ELEMENTS(regions),
|
||||||
regions) < 0)
|
regions) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ static int testRotatingFileReaderSeek(const void *data G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
if (testRotatingFileReaderAssertBufferContent(buf, got,
|
||||||
ARRAY_CARDINALITY(regions),
|
G_N_ELEMENTS(regions),
|
||||||
regions) < 0)
|
regions) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user