-cfg_num_sections(struct cfg_file *cfg, const char *sectionname, size_t length)
-{
- int i;
- int num_sections = 0;
- for (i = 0; i < cfg->num_sections; i++) {
- if (strncmp(cfg->sections[i]->name, sectionname, length) == 0)
- num_sections++;
- }
- return num_sections;
-}
-
-int
-cfg_sections(struct cfg_file *cfg, char *sections[], int max_sections)
-{
- int i;
- for (i = 0; i < cfg->num_sections && i < max_sections; i++) {
- snprintf(sections[i], CFG_NAME_LEN, "%s", cfg->sections[i]->name);
- }
- return i;
-}
-
-static const struct cfg_section *
-_get_section(struct cfg_file *cfg, const char *sectionname)
-{
- int i;
- for (i = 0; i < cfg->num_sections; i++) {
- if (strncmp(cfg->sections[i]->name, sectionname,
- sizeof(cfg->sections[0]->name)) == 0)
- return cfg->sections[i];
- }
- return NULL;
-}
-
-int
-cfg_has_section(struct cfg_file *cfg, const char *sectionname)
-{
- return (_get_section(cfg, sectionname) != NULL);
-}
-
-int
-cfg_section_num_entries(struct cfg_file *cfg, const char *sectionname)
-{
- const struct cfg_section *s = _get_section(cfg, sectionname);
- if (s == NULL)
- return -1;
- return s->num_entries;
-}
-
-
-int
-cfg_section_entries(struct cfg_file *cfg, const char *sectionname,
- struct cfg_entry *entries, int max_entries)
-{
- int i;
- const struct cfg_section *sect = _get_section(cfg, sectionname);
- if (sect == NULL)
- return -1;
- for (i = 0; i < max_entries && i < sect->num_entries; i++)
- entries[i] = *sect->entries[i];
- return i;
-}
-
-const char *
-cfg_get_entry(struct cfg_file *cfg, const char *sectionname,
- const char *entryname)
-{
- int i;
- const struct cfg_section *sect = _get_section(cfg, sectionname);
- if (sect == NULL)
- return NULL;
- for (i = 0; i < sect->num_entries; i++)
- if (strncmp(sect->entries[i]->name, entryname, CFG_NAME_LEN) == 0)
- return sect->entries[i]->value;
- return NULL;
-}
-
-int
-cfg_has_entry(struct cfg_file *cfg, const char *sectionname,
- const char *entryname)
-{
- return (cfg_get_entry(cfg, sectionname, entryname) != NULL);
-}
-
-
-int
-cfg_load_port(struct cfg_file *cfg, struct rte_sched_port_params *port_params)