llext: add llext_peek()

The only way so far to access extension images is via a memory
buffer. Since this, supposedly, will also be a rather common method,
it makes sense to add a method to access extension data quickly by
obtaining a pointer instead of copying data into local buffers. Add a
llext_peek() method for that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2023-09-27 17:40:16 +02:00 committed by Carles Cufí
commit ce4cdac3c0
4 changed files with 32 additions and 2 deletions

View file

@ -31,6 +31,15 @@ static inline int llext_seek(struct llext_loader *l, size_t pos)
return l->seek(l, pos);
}
static inline void *llext_peek(struct llext_loader *l, size_t pos)
{
if (l->peek) {
return l->peek(l, pos);
}
return NULL;
}
static sys_slist_t _llext_list = SYS_SLIST_STATIC_INIT(&_llext_list);
sys_slist_t *llext_list(void)