llext: remove llext list scanning from shell.c

The llext list should be internal to llext.c, remove its scanning
from shell.c, export a function for that instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2023-11-21 17:22:40 +01:00 committed by Anas Nashif
commit ee4540c46c
3 changed files with 69 additions and 24 deletions

View file

@ -72,6 +72,26 @@ struct llext *llext_by_name(const char *name)
return NULL;
}
int llext_iterate(int (*fn)(struct llext *ext, void *arg), void *arg)
{
sys_snode_t *node;
unsigned int i;
int ret = 0;
for (node = sys_slist_peek_head(&_llext_list), i = 0;
node;
node = sys_slist_peek_next(node), i++) {
struct llext *ext = CONTAINER_OF(node, struct llext, _llext_list);
ret = fn(ext, arg);
if (ret) {
break;
}
}
return ret;
}
const void * const llext_find_sym(const struct llext_symtable *sym_table, const char *sym_name)
{
if (sym_table == NULL) {