157115Smuller /*- 257115Smuller * Copyright (c) 1992 Keith Muller. 3*60676Sbostic * Copyright (c) 1992, 1993 4*60676Sbostic * The Regents of the University of California. All rights reserved. 557115Smuller * 657115Smuller * This code is derived from software contributed to Berkeley by 757115Smuller * Keith Muller of the University of California, San Diego. 857115Smuller * 957115Smuller * %sccs.include.redist.c% 1057115Smuller * 11*60676Sbostic * @(#)cache.h 8.1 (Berkeley) 05/31/93 1257115Smuller */ 1357115Smuller 1457115Smuller /* 1557115Smuller * Constants and data structures used to implement group and password file 1657115Smuller * caches. Traditional passwd/group cache routines perform quite poorly with 1757115Smuller * archives. The chances of hitting a valid lookup with an archive is quite a 1857115Smuller * bit worse than with files already resident on the file system. These misses 1957115Smuller * create a MAJOR performance cost. To adress this problem, these routines 2057115Smuller * cache both hits and misses. 2157115Smuller * 2257115Smuller * NOTE: name lengths must be as large as those stored in ANY PROTOCOL and 2357115Smuller * as stored in the passwd and group files. CACHE SIZES MUST BE PRIME 2457115Smuller */ 2557115Smuller #define UNMLEN 32 /* >= user name found in any protocol */ 2657115Smuller #define GNMLEN 32 /* >= group name found in any protocol */ 2757115Smuller #define UID_SZ 317 /* size of user_name/uid cache */ 2857115Smuller #define UNM_SZ 317 /* size of user_name/uid cache */ 2957115Smuller #define GID_SZ 251 /* size of gid cache */ 3057115Smuller #define GNM_SZ 317 /* size of group name cache */ 3157115Smuller #define VALID 1 /* entry and name are valid */ 3257115Smuller #define INVALID 2 /* entry valid, name NOT valid */ 3357115Smuller 3457115Smuller /* 3557115Smuller * Node structures used in the user, group, uid, and gid caches. 3657115Smuller */ 3757115Smuller 3857115Smuller typedef struct uidc { 3957115Smuller int valid; /* is this a valid or a miss entry */ 4057115Smuller char name[UNMLEN]; /* uid name */ 4157115Smuller uid_t uid; /* cached uid */ 4257115Smuller } UIDC; 4357115Smuller 4457115Smuller typedef struct gidc { 4557115Smuller int valid; /* is this a valid or a miss entry */ 4657115Smuller char name[GNMLEN]; /* gid name */ 4757115Smuller gid_t gid; /* cached gid */ 4857115Smuller } GIDC; 49