xref: /OK3568_Linux_fs/kernel/security/selinux/ss/symtab.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * A symbol table (symtab) maintains associations between symbol
4*4882a593Smuzhiyun  * strings and datum values.  The type of the datum values
5*4882a593Smuzhiyun  * is arbitrary.  The symbol table type is implemented
6*4882a593Smuzhiyun  * using the hash table type (hashtab).
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Author : Stephen Smalley, <sds@tycho.nsa.gov>
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun #ifndef _SS_SYMTAB_H_
11*4882a593Smuzhiyun #define _SS_SYMTAB_H_
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #include "hashtab.h"
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun struct symtab {
16*4882a593Smuzhiyun 	struct hashtab table;	/* hash table (keyed on a string) */
17*4882a593Smuzhiyun 	u32 nprim;		/* number of primary names in table */
18*4882a593Smuzhiyun };
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun int symtab_init(struct symtab *s, unsigned int size);
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun int symtab_insert(struct symtab *s, char *name, void *datum);
23*4882a593Smuzhiyun void *symtab_search(struct symtab *s, const char *name);
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #endif	/* _SS_SYMTAB_H_ */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun 
28