Lines Matching refs:ini
60 static const char *getstring(struct ini *ini, const char *sec_name, in getstring() argument
65 return iniparser_getstring(ini->dict, full_key, NULL); in getstring()
68 static int lookup_flow(struct ini *ini, const char *name) in lookup_flow() argument
73 FOR_ARRAY_ELEMENT(&ini->flows, i, flow) { in lookup_flow()
81 static int lookup_or_add_flow(struct ini *ini, const char *name) in lookup_or_add_flow() argument
84 int i = lookup_flow(ini, name); in lookup_or_add_flow()
87 i = ARRAY_COUNT(&ini->flows); in lookup_or_add_flow()
88 flow = ARRAY_APPEND_ZERO(&ini->flows); in lookup_or_add_flow()
93 static int parse_ports(struct ini *ini, const char *sec_name, in parse_ports() argument
105 str = getstring(ini, sec_name, key); in parse_ports()
109 str = getstring(ini, sec_name, key); in parse_ports()
122 p->flow_id = lookup_or_add_flow(ini, str); in parse_ports()
142 static int parse_plugin_section(struct ini *ini, const char *sec_name, in parse_plugin_section() argument
146 p->library = getstring(ini, sec_name, "library"); in parse_plugin_section()
147 p->label = getstring(ini, sec_name, "label"); in parse_plugin_section()
148 p->purpose = getstring(ini, sec_name, "purpose"); in parse_plugin_section()
150 getstring(ini, sec_name, "disable")); in parse_plugin_section()
158 if (parse_ports(ini, sec_name, p) < 0) { in parse_plugin_section()
166 static void fill_flow_info(struct ini *ini) in fill_flow_info() argument
175 FOR_ARRAY_ELEMENT(&ini->plugins, i, plugin) { in fill_flow_info()
180 flow = ARRAY_ELEMENT(&ini->flows, flow_id); in fill_flow_info()
196 struct ini *cras_dsp_ini_create(const char *ini_filename) in cras_dsp_ini_create()
198 struct ini *ini; in cras_dsp_ini_create() local
204 ini = calloc(1, sizeof(struct ini)); in cras_dsp_ini_create()
205 if (!ini) { in cras_dsp_ini_create()
215 ini->dict = dict; in cras_dsp_ini_create()
221 plugin = ARRAY_APPEND_ZERO(&ini->plugins); in cras_dsp_ini_create()
222 if (parse_plugin_section(ini, sec_name, plugin) < 0) in cras_dsp_ini_create()
227 fill_flow_info(ini); in cras_dsp_ini_create()
229 return ini; in cras_dsp_ini_create()
231 cras_dsp_ini_free(ini); in cras_dsp_ini_create()
235 void cras_dsp_ini_free(struct ini *ini) in cras_dsp_ini_free() argument
241 FOR_ARRAY_ELEMENT(&ini->plugins, i, p) { in cras_dsp_ini_free()
245 ARRAY_FREE(&ini->plugins); in cras_dsp_ini_free()
246 ARRAY_FREE(&ini->flows); in cras_dsp_ini_free()
248 if (ini->dict) { in cras_dsp_ini_free()
249 iniparser_freedict(ini->dict); in cras_dsp_ini_free()
250 ini->dict = NULL; in cras_dsp_ini_free()
253 free(ini); in cras_dsp_ini_free()