From aaa5a270cae3be855806ffacca93d76a5b1663b8 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 3 Oct 2025 19:13:51 -0400 Subject: np: symbol: Ensure of assigned name and ID This commit adds a lookup ID to each symbol as well as ensuring that they have a defined name even if the requested one is NULL Signed-off-by: Ian Moffett --- src/sys/include/np/symbol.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/sys/include/np/symbol.h') diff --git a/src/sys/include/np/symbol.h b/src/sys/include/np/symbol.h index 9882a46..daa3002 100644 --- a/src/sys/include/np/symbol.h +++ b/src/sys/include/np/symbol.h @@ -43,11 +43,13 @@ * * @name: Name of the symbol * @addr: Data the symbol holds + * @id: Symbol ID * @link: Queue link */ struct symbol { char *name; void *addr; + size_t id; TAILQ_ENTRY(symbol) link; }; @@ -104,4 +106,18 @@ struct symbol *symbol_alloc(struct symlist *slp, char *name, void *addr); * value on failure. */ int symbol_lookup(struct symlist *slp, char *name, struct symbol **res_p); + +/* + * Lookup a specific symbol from a symbol + * table using its ID + * + * @slp: Symbol list pointer + * @name: Symbol name + * @res_p: Result pointer is written here + * + * Returns zero on success, otherwise a less than zero + * value on failure. + */ +int symbol_lookup_id(struct symlist *slp, size_t id, struct symbol **res_p); + #endif /* !_NP_SYMBOL_H_ */ -- cgit v1.2.3