Configuration file parser. More...
Functions | |
struct spdk_conf * | spdk_conf_allocate (void) |
Allocate a configuration struct used for the initialization of SPDK app. | |
void | spdk_conf_free (struct spdk_conf *cp) |
Free the configuration struct. | |
int | spdk_conf_read (struct spdk_conf *cp, const char *file) |
Read configuration file for spdk_conf struct. | |
struct spdk_conf_section * | spdk_conf_find_section (struct spdk_conf *cp, const char *name) |
Find the specified section of the configuration. | |
struct spdk_conf_section * | spdk_conf_first_section (struct spdk_conf *cp) |
Get the first section of the configuration. | |
struct spdk_conf_section * | spdk_conf_next_section (struct spdk_conf_section *sp) |
Get the next section of the configuration. | |
bool | spdk_conf_section_match_prefix (const struct spdk_conf_section *sp, const char *name_prefix) |
Match prefix of the name of section. | |
const char * | spdk_conf_section_get_name (const struct spdk_conf_section *sp) |
Get the name of the section. | |
int | spdk_conf_section_get_num (const struct spdk_conf_section *sp) |
Get the number of the section. | |
char * | spdk_conf_section_get_nmval (struct spdk_conf_section *sp, const char *key, int idx1, int idx2) |
Get the value of the item with name 'key' in the section. | |
char * | spdk_conf_section_get_nval (struct spdk_conf_section *sp, const char *key, int idx) |
Get the first value of the item with name 'key' in the section. | |
char * | spdk_conf_section_get_val (struct spdk_conf_section *sp, const char *key) |
Get the first value of the first item with name 'key' in the section. | |
int | spdk_conf_section_get_intval (struct spdk_conf_section *sp, const char *key) |
Get the first value of the first item with name 'key' in the section. | |
bool | spdk_conf_section_get_boolval (struct spdk_conf_section *sp, const char *key, bool default_val) |
Get the bool value of the item with name 'key' in the section. | |
void | spdk_conf_set_as_default (struct spdk_conf *cp) |
Set the configuration as the default. | |
void | spdk_conf_disable_sections_merge (struct spdk_conf *cp) |
Disable sections merging during 'spdk_conf_read()'. | |
Configuration file parser.
struct spdk_conf * spdk_conf_allocate | ( | void | ) |
Allocate a configuration struct used for the initialization of SPDK app.
void spdk_conf_disable_sections_merge | ( | struct spdk_conf * | cp | ) |
Disable sections merging during 'spdk_conf_read()'.
cp | Configuration to be read |
struct spdk_conf_section * spdk_conf_find_section | ( | struct spdk_conf * | cp, |
const char * | name ) |
Find the specified section of the configuration.
cp | Configuration struct used for the initialization of SPDK app. |
name | Name of section to find. |
struct spdk_conf_section * spdk_conf_first_section | ( | struct spdk_conf * | cp | ) |
Get the first section of the configuration.
cp | Configuration struct used for the initialization of SPDK app. |
void spdk_conf_free | ( | struct spdk_conf * | cp | ) |
Free the configuration struct.
cp | Configuration struct to free. |
struct spdk_conf_section * spdk_conf_next_section | ( | struct spdk_conf_section * | sp | ) |
Get the next section of the configuration.
sp | The current section of the configuration. |
int spdk_conf_read | ( | struct spdk_conf * | cp, |
const char * | file ) |
Read configuration file for spdk_conf struct.
cp | Configuration struct used for the initialization of SPDK app. |
file | File to read that is created by user to configure SPDK app. |
bool spdk_conf_section_get_boolval | ( | struct spdk_conf_section * | sp, |
const char * | key, | ||
bool | default_val ) |
Get the bool value of the item with name 'key' in the section.
This is used to check whether the service is enabled.
sp | The section of the configuration. |
key | Name of item. |
default_val | Default value. |
int spdk_conf_section_get_intval | ( | struct spdk_conf_section * | sp, |
const char * | key ) |
Get the first value of the first item with name 'key' in the section.
sp | The section of the configuration. |
key | Name of item. |
const char * spdk_conf_section_get_name | ( | const struct spdk_conf_section * | sp | ) |
Get the name of the section.
sp | The section of the configuration. |
char * spdk_conf_section_get_nmval | ( | struct spdk_conf_section * | sp, |
const char * | key, | ||
int | idx1, | ||
int | idx2 ) |
Get the value of the item with name 'key' in the section.
If key appears multiple times, idx1 will control which version to retrieve. Indices will start from the top of the configuration file at 0 and increment by one for each new appearance. If the configuration key contains multiple whitespace delimited values, idx2 controls which value is returned. The index begins at 0.
sp | The section of the configuration. |
key | Name of item. |
idx1 | The index into the item list for the key. |
idx2 | The index into the value list for the item. |
int spdk_conf_section_get_num | ( | const struct spdk_conf_section * | sp | ) |
Get the number of the section.
sp | The section of the configuration. |
char * spdk_conf_section_get_nval | ( | struct spdk_conf_section * | sp, |
const char * | key, | ||
int | idx ) |
Get the first value of the item with name 'key' in the section.
sp | The section of the configuration. |
key | Name of item. |
idx | The index into the value list for the item. |
char * spdk_conf_section_get_val | ( | struct spdk_conf_section * | sp, |
const char * | key ) |
Get the first value of the first item with name 'key' in the section.
sp | The section of the configuration. |
key | Name of item. |
bool spdk_conf_section_match_prefix | ( | const struct spdk_conf_section * | sp, |
const char * | name_prefix ) |
Match prefix of the name of section.
sp | The section of the configuration. |
name_prefix | Prefix name to match. |
void spdk_conf_set_as_default | ( | struct spdk_conf * | cp | ) |
Set the configuration as the default.
cp | Configuration to set. |