Skip to content

Build directory search lists once instead of parsing strings#290

Open
quic-parihar wants to merge 3 commits intoqualcomm:developmentfrom
quic-parihar:path_list_update
Open

Build directory search lists once instead of parsing strings#290
quic-parihar wants to merge 3 commits intoqualcomm:developmentfrom
quic-parihar:path_list_update

Conversation

@quic-parihar
Copy link
Contributor

Convert ADSP library and AVS search paths from concatenated env/config strings into persistent QList-backed directory lists built at init time. This removes repeated parsing of ';'-delimited path strings on every fopen call and avoids reconstructing combined search paths for each lookup.

The new logic initializes two global directory lists (library and AVS) during apps_std_init(). Paths from environment variables and config files are parsed once and stored as individual nodes. All file lookup APIs are updated to walk these lists directly instead of reparsing a flat string.

This improves efficiency, reduces string and handling complexity. Legacy behavior is preserved for custom environment variables that do not match the standard ADSP_* and DSP_* path names.

Also update open_shell() to use the global list instead of constructing a temporary ";"-delimited directory list.

@quic-parihar quic-parihar force-pushed the path_list_update branch 3 times, most recently from 337158e to 89d3060 Compare February 5, 2026 06:10
@quic-parihar quic-parihar marked this pull request as ready for review February 10, 2026 06:51
FARF(RUNTIME_RPC_LOW, "Entering %s", __func__);

pthread_mutex_lock(&global_dirlist_mt);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many empty lines in this function

#define DELIM ";"

/**
* Helper function to add a path to a global directory list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function header is not proper

};

/**
* @brief Try to open a file from the global directory list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow the standard commenting guideline

/**
* @brief Structure to hold a single directory path in the global list
*/
struct dir_path_node {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is used only in apps_std_imp.c, better to move this there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acked

}
}
if (nErr) {
absNameLen = strlen(VENDOR_DOM_LOCATION) + shell_absNameLen + 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be VENDOR_DSP_LOCATION instead of VENDOR_DOM_LOCATION

Copy link
Contributor Author

@quic-parihar quic-parihar Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it will be VENDOR_DOM_LOCATION, abs name is carrying vendor DSP + subsystem name

}

if (path_len > 0) {
strncpy(single_path, path_start, path_len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can path_len become >=PATH_MAX?

@@ -5,6 +5,7 @@
#define __APPS_STD_INTERNAL_H__

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be split into multiple commits

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes will do that

use_avs_list = 1;
}

if (use_global_list) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is confusing, you check for use_global_list and then pass use_avs_list to the function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing avs specific things altogether. We didn't find any use for them

Convert ADSP library search paths from concatenated env/config
strings into persistent QList-backed directory lists built at init
time. This removes repeated parsing of ';' delimited path strings on
every fopen call and avoids reconstructing combined search paths for
each lookup.

The new logic initializes global directory list during apps_std_init().
Paths from environment variables and config files are parsed once and
stored as individual nodes. All file lookup APIs are updated to walk
this list directly instead of reparsing a flat string.

This improves efficiency, reduces string and handling complexity.
Legacy behavior is preserved for custom environment variables that do
not match the standard ADSP_* and DSP_* path names.

Also update open_shell() to use the global list instead of constructing
a temporary ";" delimited directory list.

Signed-off-by: Abhinav Parihar <parihar@qti.qualcomm.com>
Previously, while parsing DSP library paths from the config YAML, we
only prefixed CONFIG_BASE_DIR (/usr/share/qcom) to the first path.
This caused subsequent relative paths to be left unresolved, leading
to incomplete search coverage and potential library load failures.

Update the parsing logic to:
- Iterate over all semicolon-separated entries in dsp_lib_paths.
- Prefix CONFIG_BASE_DIR to every relative path

Signed-off-by: Abhinav Parihar <parihar@qti.qualcomm.com>
This patch removes Windows-style CRLF line terminators and converts the
file to Unix-style LF line endings. No functional changes are made; this
only normalizes formatting to match the project's coding conventions.

Signed-off-by: Abhinav Parihar <parihar@qti.qualcomm.com>
@quic-vkatoch
Copy link
Contributor

Fixes: #270

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants