Merge 1.8.0~pre4 packaging into master
[pkg-k5-afs_openafs.git] / src / afs / afs_axscache.h
blobc307eff7e15d057d7f1b466cb76be16bd0b7fccd
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #ifndef AFSAXCACHEH
11 #define AFSAXCACHEH
13 /* Access cache -
14 * The way to use this package is:
15 * If the cache pointer is not NULL, call afs_findAxs, and if it's not
16 * NULL, use its access field
17 * Otherwise,
18 * axs_Alloc a new one,
19 * fill it in,
20 * insert it at the head of the list.
22 * Of course, don't forget to axs_Free them occasionally,
24 * Alloc and Free need a lock on the freelist, the other guys are safe if the
25 * parent structure is locked, but probably REQUIRE the parent to be locked...
28 struct axscache {
29 afs_int32 uid; /* most frequently used field, I think */
30 afs_int32 axess;
31 struct axscache *next;
34 /* DON'T use this with a NULL pointer!
35 * the quick check should cover 99.9% of the cases
37 #define afs_FindAxs(cachep,id) (((cachep)->uid == id) ? (cachep) : afs_SlowFindAxs(&(cachep),(id)))
39 #define axs_Front(head,pp,p) {(pp)->next = (p)->next; (p)->next= *(head);*(head)=(p);}
41 #define afs_AddAxs(cachep,id,bits) { \
42 struct axscache *ac; \
43 if ((ac = axs_Alloc())) { \
44 ac->uid = (id); \
45 ac->axess = (afs_int32)(bits); \
46 ac->next = (cachep); \
47 cachep = ac; }}
49 #endif