nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 00003 * 00004 * Copyright (C) 2012, The Linux Box Corporation 00005 * Contributor : Matt Benjamin <matt@linuxbox.com> 00006 * 00007 * Some portions Copyright CEA/DAM/DIF (2008) 00008 * contributeur : Philippe DENIEL philippe.deniel@cea.fr 00009 * Thomas LEIBOVICI thomas.leibovici@cea.fr 00010 * 00011 * 00012 * This program is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 3 of the License, or (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Lesser General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00025 * 00026 * ------------- 00027 */ 00028 00043 #ifndef _GENERIC_WEAKREF_H 00044 #define _GENERIC_WEAKREF_H 00045 00046 00047 typedef struct gweakref_ 00048 { 00049 void *ptr; 00050 uint64_t gen; 00051 } gweakref_t; 00052 00053 typedef struct gweakref_table_ gweakref_table_t; 00054 00055 gweakref_table_t *gweakref_init(uint32_t npart, uint32_t cache_sz); 00056 gweakref_t gweakref_insert(gweakref_table_t *wt, void *obj); 00057 void *gweakref_lookup(gweakref_table_t *wt, gweakref_t *ref); 00058 void *gweakref_lookupex(gweakref_table_t *wt, gweakref_t *ref, 00059 pthread_rwlock_t **lock); 00060 void gweakref_delete(gweakref_table_t *wt, gweakref_t *ref); 00061 void gweakref_destroy(gweakref_table_t *wt); 00062 00063 #endif /* _GENERIC_WEAKREF_H */