ret = virDomainGetCPUStats(dom, param, nparams, -1, 1, 0); // total stats.
if (ret < 0) {
ret = virDomainGetCPUStats(dom, param, nparams, -1, 1, 0); // total stats.
if (ret < 0) {
- ssnprintf(type_instance, sizeof(type_instance), "%d", vcpu_nr);
+ snprintf(type_instance, sizeof(type_instance), "%d", vcpu_nr);
submit(dom, type, type_instance, &(value_t){.derive = value}, 1);
}
submit(dom, type, type_instance, &(value_t){.derive = value}, 1);
}
- ssnprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
+ snprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
- ssnprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
+ snprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
static int lv_domain_block_info(virDomainPtr dom, const char *path,
struct lv_block_info *binfo) {
#ifdef HAVE_BLOCK_STATS_FLAGS
static int lv_domain_block_info(virDomainPtr dom, const char *path,
struct lv_block_info *binfo) {
#ifdef HAVE_BLOCK_STATS_FLAGS
- int rc = -1;
- int ret = virDomainBlockStatsFlags(dom, path, NULL, &nparams, 0);
- if (ret < 0 || nparams == 0) {
+ if (virDomainBlockStatsFlags(dom, path, NULL, &nparams, 0) < 0 ||
+ nparams <= 0) {
- ret = virDomainBlockStatsFlags(dom, path, params, &nparams, 0);
- if (ret < 0) {
+
+ int rc = -1;
+ if (virDomainBlockStatsFlags(dom, path, params, &nparams, 0) < 0) {
- rc = get_block_info(binfo, params, nparams);
-
-done:
- virTypedParamsFree(params, nparams);
+ virTypedParamsClear(params, nparams);
+ sfree(params);
return rc;
#else
return virDomainBlockStats(dom, path, &(binfo->bi), sizeof(binfo->bi));
return rc;
#else
return virDomainBlockStats(dom, path, &(binfo->bi), sizeof(binfo->bi));
char type_instance[DATA_MAX_NAME_LEN];
_Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
char type_instance[DATA_MAX_NAME_LEN];
_Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
- ssnprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
+ snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
cpu);
submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
}
cpu);
submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
}
- ssnprintf(inst->tag, sizeof(inst->tag), "%s-%zu", PLUGIN_NAME, i);
+ snprintf(inst->tag, sizeof(inst->tag), "%s-%zu", PLUGIN_NAME, i);
- ssnprintf(xpath_str, sizeof(xpath_str), "/domain/metadata/%s:%s/text()",
+ snprintf(xpath_str, sizeof(xpath_str), "/domain/metadata/%s:%s/text()",
METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
xpath_obj = xmlXPathEvalExpression((xmlChar *)xpath_str, xpath_ctx);
if (xpath_obj == NULL) {
METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
xpath_obj = xmlXPathEvalExpression((xmlChar *)xpath_str, xpath_ctx);
if (xpath_obj == NULL) {
-# if LIBVIR_CHECK_VERSION(0,10,2)
-# define HAVE_LIST_ALL_DOMAINS 1
-# endif
+#if LIBVIR_CHECK_VERSION(0, 10, 2)
+#define HAVE_LIST_ALL_DOMAINS 1
+#endif
- n = virConnectListAllDomains (conn, &domains, VIR_CONNECT_LIST_DOMAINS_ACTIVE);
+ n = virConnectListAllDomains(conn, &domains,
+ VIR_CONNECT_LIST_DOMAINS_ACTIVE);
- ssnprintf(name, n, "%s:%s", domname, devpath);
+ snprintf(name, n, "%s:%s", domname, devpath);