qcacmn: Add support for section parsing in ini

Add support for section parsing in ini, such that we could
read specific section of the file and update the ini values
instead of redundant values or updating the same in the
scripts based on the config

Change-Id: Ibdb08a04d709746c04c3e7c47ee3bb4a7ce85346
CRs-Fixed: 3107545
This commit is contained in:
Surya Prakash Raajen
2022-01-30 16:30:35 +05:30
committed by Madan Koyyalamudi
parent 0101390bcd
commit edf9fd0441
4 changed files with 206 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -59,5 +60,33 @@ QDF_STATUS
qdf_ini_parse(const char *ini_path, void *context,
qdf_ini_item_cb item_cb, qdf_ini_section_cb section_cb);
/**
* qdf_ini_section_parse() - parse a section from ini file
* @ini_path: The full file path of the ini file to parse
* @context: The caller supplied context to pass into callbacks
* @item_cb: Ini item (key/value pair) handler callback function
* Return QDF_STATUS_SUCCESS to continue parsing, else to abort
* @section_name: Ini section name to be parsed from file
* Return QDF_STATUS_SUCCESS to continue parsing, else to abort
*
* The *.ini file format is a simple format consisting of a list of key/value
* pairs (items), separated by an '=' character. Comments are initiated with
* a '#' character. Sections are also supported, using '[' and ']' around the
* section name. e.g.
*
* # comments are started with a '#' character
* # items are key/value string pairs, separated by the '=' character
* someKey1=someValue1
* someKey2=someValue2 # this is also a comment
*
* # section headers are enclosed in square brackets
* [some section header] # new section begins
* someKey3=someValue3
*
* Return: QDF_STATUS
*/
QDF_STATUS qdf_ini_section_parse(const char *ini_path, void *context,
qdf_ini_item_cb item_cb,
const char *section_name);
#endif /* __QDF_PARSE_H */