summaryrefslogtreecommitdiff
path: root/src/sys/include/np
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-03 19:13:51 -0400
committerIan Moffett <ian@osmora.org>2025-10-03 19:15:43 -0400
commitaaa5a270cae3be855806ffacca93d76a5b1663b8 (patch)
tree79687662d88bb1400bcbb5e243f04aff20c79ede /src/sys/include/np
parent39bd29f7dea6426db6fa78b4f18aae9aa76d8bc4 (diff)
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 <ian@osmora.org>
Diffstat (limited to 'src/sys/include/np')
-rw-r--r--src/sys/include/np/symbol.h16
1 files changed, 16 insertions, 0 deletions
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_ */