]> git.ipfire.org Git - thirdparty/util-linux.git/blob - include/idcache.h
Merge branch 'PR/lscpu-caches-sep' of github.com:karelzak/util-linux-work
[thirdparty/util-linux.git] / include / idcache.h
1 /*
2 * No copyright is claimed. This code is in the public domain; do with
3 * it what you wish.
4 */
5 #ifndef UTIL_LINUX_IDCACHE_H
6 #define UTIL_LINUX_IDCACHE_H
7
8 #include <sys/types.h>
9 #include <pwd.h>
10
11 #define IDCACHE_FLAGS_NAMELEN (1 << 1)
12
13 struct identry {
14 unsigned long int id;
15 char *name;
16 struct identry *next;
17 };
18
19 struct idcache {
20 struct identry *ent; /* first entry */
21 int width; /* name width */
22 };
23
24
25 extern struct idcache *new_idcache(void);
26 extern void add_gid(struct idcache *cache, unsigned long int id);
27 extern void add_uid(struct idcache *cache, unsigned long int id);
28
29 extern void free_idcache(struct idcache *ic);
30 extern struct identry *get_id(struct idcache *ic, unsigned long int id);
31
32 #endif /* UTIL_LINUX_IDCACHE_H */