Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * A symbol table (symtab) maintains associations between symbol |
| 4 | * strings and datum values. The type of the datum values |
| 5 | * is arbitrary. The symbol table type is implemented |
| 6 | * using the hash table type (hashtab). |
| 7 | * |
Stephen Smalley | 7efbb60 | 2017-08-17 13:32:36 -0400 | [diff] [blame] | 8 | * Author : Stephen Smalley, <sds@tycho.nsa.gov> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | */ |
| 10 | #ifndef _SS_SYMTAB_H_ |
| 11 | #define _SS_SYMTAB_H_ |
| 12 | |
| 13 | #include "hashtab.h" |
| 14 | |
| 15 | struct symtab { |
Ondrej Mosnacek | 03414a4 | 2020-04-28 14:55:12 +0200 | [diff] [blame] | 16 | struct hashtab table; /* hash table (keyed on a string) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | u32 nprim; /* number of primary names in table */ |
| 18 | }; |
| 19 | |
| 20 | int symtab_init(struct symtab *s, unsigned int size); |
| 21 | |
Ondrej Mosnacek | 237389e | 2020-07-08 13:24:45 +0200 | [diff] [blame] | 22 | int symtab_insert(struct symtab *s, char *name, void *datum); |
| 23 | void *symtab_search(struct symtab *s, const char *name); |
| 24 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #endif /* _SS_SYMTAB_H_ */ |
| 26 | |
| 27 | |