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