OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright 2000, International Business Machines Corporation and others. 00003 * All Rights Reserved. 00004 * 00005 * This software has been released under the terms of the IBM Public 00006 * License. For details, see the LICENSE file in the top-level source 00007 * directory or online at http://www.openafs.org/dl/license10.html 00008 */ 00009 00010 #ifndef AFSAXCACHEH 00011 #define AFSAXCACHEH 00012 00013 /* Access cache - 00014 * The way to use this package is: 00015 * If the cache pointer is not NULL, call afs_findAxs, and if it's not 00016 * NULL, use its access field 00017 * Otherwise, 00018 * axs_Alloc a new one, 00019 * fill it in, 00020 * insert it at the head of the list. 00021 * 00022 * Of course, don't forget to axs_Free them occasionally, 00023 * 00024 * Alloc and Free need a lock on the freelist, the other guys are safe if the 00025 * parent structure is locked, but probably REQUIRE the parent to be locked... 00026 */ 00027 00028 struct axscache { 00029 afs_int32 uid; /* most frequently used field, I think */ 00030 afs_int32 axess; 00031 struct axscache *next; 00032 }; 00033 00034 /* DON'T use this with a NULL pointer! 00035 * the quick check should cover 99.9% of the cases 00036 */ 00037 #define afs_FindAxs(cachep,id) (((cachep)->uid == id) ? (cachep) : afs_SlowFindAxs(&(cachep),(id))) 00038 00039 #define axs_Front(head,pp,p) {(pp)->next = (p)->next; (p)->next= *(head);*(head)=(p);} 00040 00041 #define afs_AddAxs(cachep,id,bits) { \ 00042 struct axscache *ac; \ 00043 if ((ac = axs_Alloc())) { \ 00044 ac->uid = (id); \ 00045 ac->axess = (afs_int32)(bits); \ 00046 ac->next = (cachep); \ 00047 cachep = ac; }} 00048 00049 #endif