} while (0)
/* Connection. */
-static virConnectPtr conn = 0;
-static char *conn_string = NULL;
+static virConnectPtr conn;
+static char *conn_string;
static c_complain_t conn_complain = C_COMPLAIN_INIT_STATIC;
/* Node information required for %CPU */
static int interval = 60;
/* List of domains, if specified. */
-static ignorelist_t *il_domains = NULL;
+static ignorelist_t *il_domains;
/* List of block devices, if specified. */
-static ignorelist_t *il_block_devices = NULL;
+static ignorelist_t *il_block_devices;
/* List of network interface devices, if specified. */
-static ignorelist_t *il_interface_devices = NULL;
+static ignorelist_t *il_interface_devices;
static int ignore_device_match(ignorelist_t *, const char *domname,
const char *devpath);
};
/* BlockDeviceFormatBasename */
-_Bool blockdevice_format_basename = 0;
+static bool blockdevice_format_basename;
static enum bd_field blockdevice_format = target;
static enum if_field interface_format = if_name;
#ifdef HAVE_BLOCK_STATS_FLAGS
#define GET_BLOCK_INFO_VALUE(NAME, FIELD) \
- do { \
- if (!strcmp(param[i].field, NAME)) { \
- binfo->FIELD = param[i].value.l; \
- continue; \
- } \
- } while (0)
+ if (!strcmp(param[i].field, NAME)) { \
+ binfo->FIELD = param[i].value.l; \
+ continue; \
+ }
static int get_block_info(struct lv_block_info *binfo,
virTypedParameterPtr param, int nparams) {
(time_diff_sec * node_cpus * NANOSEC_IN_SEC);
}
- DEBUG(PLUGIN_NAME ": node_cpus=%u cpu_time_old=%llu cpu_time_new=%llu"
- "cpu_time_diff=%llu time_diff_sec=%f percent=%f",
- node_cpus, cpu_time_old, cpu_time_new, cpu_time_diff, time_diff_sec,
- percent);
+ DEBUG(PLUGIN_NAME ": node_cpus=%u cpu_time_old=%" PRIu64
+ " cpu_time_new=%" PRIu64 "cpu_time_diff=%" PRIu64
+ " time_diff_sec=%f percent=%f",
+ node_cpus, (uint64_t)cpu_time_old, (uint64_t)cpu_time_new,
+ (uint64_t)cpu_time_diff, time_diff_sec, percent);
return percent;
}
const char *type) {
char type_instance[DATA_MAX_NAME_LEN];
- 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);
}
}
char flush_type_instance[DATA_MAX_NAME_LEN];
- ssnprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
- type_instance);
+ snprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
+ type_instance);
if ((binfo->bi.rd_req != -1) && (binfo->bi.wr_req != -1))
submit_derive2("disk_ops", (derive_t)binfo->bi.rd_req,
const char *reason_str = "N/A";
#endif
- ssnprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
- reason_str);
+ snprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
+ reason_str);
int severity;
switch (state) {
unsigned char *cpu_maps, int cpu_map_len) {
for (int cpu = 0; cpu < max_cpus; ++cpu) {
char type_instance[DATA_MAX_NAME_LEN];
- _Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
+ bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu);
- ssnprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
- cpu);
+ snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu, cpu);
submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
}
}
memset(lv_ud, 0, sizeof(*lv_ud));
- ssnprintf(inst->tag, sizeof(inst->tag), "%s-%zu", PLUGIN_NAME, i);
+ snprintf(inst->tag, sizeof(inst->tag), "%s-%" PRIsz, PLUGIN_NAME, i);
inst->id = i;
user_data_t *ud = &(lv_ud->ud);
goto done;
}
- ssnprintf(xpath_str, sizeof(xpath_str), "/domain/metadata/%s:%s/text()",
- METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
+ 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) {
ERROR(PLUGIN_NAME " plugin: xmlXPathEval(%s) failed on domain %s",
ERROR(PLUGIN_NAME " plugin: malloc failed.");
return 0;
}
- ssnprintf(name, n, "%s:%s", domname, devpath);
+ snprintf(name, n, "%s:%s", domname, devpath);
r = ignorelist_match(il, name);
sfree(name);
return r;