Skip to content

Build directory search lists once instead of parsing strings#290

Open
quic-parihar wants to merge 1 commit intoqualcomm:developmentfrom
quic-parihar:path_list_update
Open

Build directory search lists once instead of parsing strings#290
quic-parihar wants to merge 1 commit 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
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.

Signed-off-by: Abhinav Parihar <parihar@qti.qualcomm.com>
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

}
}
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

}

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

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

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.

2 participants

Comments