Commit | Line | Data |
---|---|---|
53846a04 KM |
1 | /*- |
2 | * Copyright (c) 1992 Keith Muller. | |
f547d164 KB |
3 | * Copyright (c) 1992, 1993 |
4 | * The Regents of the University of California. All rights reserved. | |
53846a04 KM |
5 | * |
6 | * This code is derived from software contributed to Berkeley by | |
7 | * Keith Muller of the University of California, San Diego. | |
8 | * | |
9 | * %sccs.include.redist.c% | |
10 | * | |
f547d164 | 11 | * @(#)cache.h 8.1 (Berkeley) %G% |
53846a04 KM |
12 | */ |
13 | ||
14 | /* | |
15 | * Constants and data structures used to implement group and password file | |
16 | * caches. Traditional passwd/group cache routines perform quite poorly with | |
17 | * archives. The chances of hitting a valid lookup with an archive is quite a | |
18 | * bit worse than with files already resident on the file system. These misses | |
19 | * create a MAJOR performance cost. To adress this problem, these routines | |
20 | * cache both hits and misses. | |
21 | * | |
22 | * NOTE: name lengths must be as large as those stored in ANY PROTOCOL and | |
23 | * as stored in the passwd and group files. CACHE SIZES MUST BE PRIME | |
24 | */ | |
25 | #define UNMLEN 32 /* >= user name found in any protocol */ | |
26 | #define GNMLEN 32 /* >= group name found in any protocol */ | |
27 | #define UID_SZ 317 /* size of user_name/uid cache */ | |
28 | #define UNM_SZ 317 /* size of user_name/uid cache */ | |
29 | #define GID_SZ 251 /* size of gid cache */ | |
30 | #define GNM_SZ 317 /* size of group name cache */ | |
31 | #define VALID 1 /* entry and name are valid */ | |
32 | #define INVALID 2 /* entry valid, name NOT valid */ | |
33 | ||
34 | /* | |
35 | * Node structures used in the user, group, uid, and gid caches. | |
36 | */ | |
37 | ||
38 | typedef struct uidc { | |
39 | int valid; /* is this a valid or a miss entry */ | |
40 | char name[UNMLEN]; /* uid name */ | |
41 | uid_t uid; /* cached uid */ | |
42 | } UIDC; | |
43 | ||
44 | typedef struct gidc { | |
45 | int valid; /* is this a valid or a miss entry */ | |
46 | char name[GNMLEN]; /* gid name */ | |
47 | gid_t gid; /* cached gid */ | |
48 | } GIDC; |