1/* 2 * $Id: ad_private.h,v 1.6 2008-12-03 18:35:44 didg Exp $ 3 */ 4 5#ifndef LIBATALK_ADOUBLE_AD_PRIVATE_H 6#define LIBATALK_ADOUBLE_AD_PRIVATE_H 1 7 8#include <atalk/adouble.h> 9 10#ifndef MAP_FAILED 11#define MAP_FAILED ((void *) -1) 12#endif /* ! MAP_FAILED */ 13 14/* this is so that we can keep lists of fds referencing the same file 15 * around. that way, we can honor locks created by the same process 16 * with the same file. */ 17 18#define adf_lock_init(a) do { \ 19 (a)->adf_lockmax = (a)->adf_lockcount = 0; \ 20 (a)->adf_excl = 0;(a)->adf_lock = NULL; \ 21} while (0) 22 23#define adf_lock_free(a) do { \ 24 int i;\ 25 if (!(a)->adf_lock) \ 26 break; \ 27 for (i = 0; i < (a)->adf_lockcount; i++) {\ 28 adf_lock_t *lock = (a)->adf_lock + i;\ 29 if (--(*lock->refcount) < 1)free(lock->refcount); \ 30 }\ 31 free((a)->adf_lock); \ 32 adf_lock_init(a); \ 33} while (0) 34 35#endif /* libatalk/adouble/ad_private.h */ 36