DPDK_HELPER_TRACE(phc->shm_name);
- ssnprintf(phc->eal_config.coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
- ssnprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
- ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
- DPDK_DEFAULT_RTE_CONFIG);
+ snprintf(phc->eal_config.coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
+ snprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
- snprintf(phc->eal_config.process_type, DATA_MAX_NAME_LEN, "%s", "secondary");
+ snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
+ DPDK_DEFAULT_RTE_CONFIG);
}
int dpdk_helper_eal_config_set(dpdk_helper_ctx_t *phc, dpdk_eal_config_t *ec) {
status = cf_util_get_string_buffer(child, phc->eal_config.socket_memory,
sizeof(phc->eal_config.socket_memory));
DEBUG("dpdk_common: EAL:Socket memory %s", phc->eal_config.socket_memory);
- } else if (strcasecmp("ProcessType", child->key) == 0) {
- status = cf_util_get_string_buffer(child, phc->eal_config.process_type,
- sizeof(phc->eal_config.process_type));
- DEBUG("dpdk_common: EAL:Process type %s", phc->eal_config.process_type);
- } else if ((strcasecmp("FilePrefix", child->key) == 0) &&
- (child->values[0].type == OCONFIG_TYPE_STRING)) {
- snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
- "/var/run/.%s_config", child->values[0].value.string);
- DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
+ } else if (strcasecmp("FilePrefix", child->key) == 0) {
+ char prefix[DATA_MAX_NAME_LEN];
+
+ status = cf_util_get_string_buffer(child, prefix, sizeof(prefix));
+ if (status == 0) {
- ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
++ snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
+ "/var/run/.%s_config", prefix);
+ DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
+ }
} else {
ERROR("dpdk_common: Invalid '%s' configuration option", child->key);
status = -EINVAL;
BSON_APPEND_UTF8(ret, "type_instance", vl->type_instance);
BSON_APPEND_ARRAY_BEGIN(ret, "values", &subarray); /* {{{ */
- for (int i = 0; i < ds->ds_num; i++) {
+ for (size_t i = 0; i < ds->ds_num; i++) {
char key[16];
- ssnprintf(key, sizeof(key), "%zu", i);
- snprintf(key, sizeof(key), "%i", i);
++ snprintf(key, sizeof(key), "%zu", i);
if (ds->ds[i].type == DS_TYPE_GAUGE)
BSON_APPEND_DOUBLE(&subarray, key, vl->values[i].gauge);
bson_append_array_end(ret, &subarray); /* }}} values */
BSON_APPEND_ARRAY_BEGIN(ret, "dstypes", &subarray); /* {{{ */
- for (int i = 0; i < ds->ds_num; i++) {
+ for (size_t i = 0; i < ds->ds_num; i++) {
char key[16];
- ssnprintf(key, sizeof(key), "%zu", i);
- snprintf(key, sizeof(key), "%i", i);
++ snprintf(key, sizeof(key), "%zu", i);
if (store_rates)
BSON_APPEND_UTF8(&subarray, key, "gauge");
bson_append_array_end(ret, &subarray); /* }}} dstypes */
BSON_APPEND_ARRAY_BEGIN(ret, "dsnames", &subarray); /* {{{ */
- for (int i = 0; i < ds->ds_num; i++) {
+ for (size_t i = 0; i < ds->ds_num; i++) {
char key[16];
- ssnprintf(key, sizeof(key), "%zu", i);
- snprintf(key, sizeof(key), "%i", i);
++ snprintf(key, sizeof(key), "%zu", i);
BSON_APPEND_UTF8(&subarray, key, ds->ds[i].name);
}
bson_append_array_end(ret, &subarray); /* }}} dsnames */