X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldbm%2Fback-ldbm.h;h=e0816acd48ef2b6422a0028a5092522385476af2;hb=ebc746bf35bff61e92869a63f8a21c6f6527bed5;hp=95b1134d002e19d19c8a4ec0f5a79d90e149f9f2;hpb=eb82000f3fb01baa7db2b1578e450dae23fcfec1;p=openldap diff --git a/servers/slapd/back-ldbm/back-ldbm.h b/servers/slapd/back-ldbm/back-ldbm.h index 95b1134d00..e0816acd48 100644 --- a/servers/slapd/back-ldbm/back-ldbm.h +++ b/servers/slapd/back-ldbm/back-ldbm.h @@ -47,16 +47,26 @@ LDAP_BEGIN_DECL * the list is terminated by an id of NOID. * b_ids a list of the actual ids themselves */ -typedef struct block { - ID b_nmax; /* max number of ids in this list */ -#define ALLIDSBLOCK 0 /* == 0 => this is an allid block */ - ID b_nids; /* current number of ids used */ -#define INDBLOCK 0 /* == 0 => this is an indirect blk */ - ID b_ids[1]; /* the ids - actually bigger */ -} Block, IDList; -#define ALLIDS( idl ) ((idl)->b_nmax == ALLIDSBLOCK) -#define INDIRECT_BLOCK( idl ) ((idl)->b_nids == INDBLOCK) +typedef ID ID_BLOCK; + +#define ID_BLOCK_NMAX_OFFSET 0 +#define ID_BLOCK_NIDS_OFFSET 1 +#define ID_BLOCK_IDS_OFFSET 2 + +/* all ID_BLOCK macros operate on a pointer to a ID_BLOCK */ + +#define ID_BLOCK_NMAX(b) ((b)[ID_BLOCK_NMAX_OFFSET]) +#define ID_BLOCK_NIDS(b) ((b)[ID_BLOCK_NIDS_OFFSET]) +#define ID_BLOCK_ID(b, n) ((b)[ID_BLOCK_IDS_OFFSET+(n)]) + +#define ID_BLOCK_NOID(b, n) (ID_BLOCK_ID((b),(n)) == NOID) + +#define ID_BLOCK_ALLIDS_VALUE 0 +#define ID_BLOCK_ALLIDS(b) (ID_BLOCK_NMAX(b) == ID_BLOCK_ALLIDS_VALUE) + +#define ID_BLOCK_INDIRECT_VALUE 0 +#define ID_BLOCK_INDIRECT(b) (ID_BLOCK_NIDS(b) == ID_BLOCK_INDIRECT_VALUE) /* for the in-core cache of entries */ struct cache { @@ -66,7 +76,7 @@ struct cache { Avlnode *c_idtree; Entry *c_lruhead; /* lru - add accessed entries here */ Entry *c_lrutail; /* lru - rem lru entries from here */ - pthread_mutex_t c_mutex; + ldap_pvt_thread_mutex_t c_mutex; }; /* for the cache of open index files */ @@ -112,9 +122,9 @@ struct ldbminfo { ID li_nextid_wrote; #endif char *li_nextid_file; - pthread_mutex_t li_root_mutex; - pthread_mutex_t li_add_mutex; - pthread_mutex_t li_nextid_mutex; + ldap_pvt_thread_mutex_t li_root_mutex; + ldap_pvt_thread_mutex_t li_add_mutex; + ldap_pvt_thread_mutex_t li_nextid_mutex; int li_mode; char *li_directory; struct cache li_cache; @@ -122,8 +132,8 @@ struct ldbminfo { int li_dbcachesize; int li_dbcachewsync; struct dbcache li_dbcache[MAXDBCACHE]; - pthread_mutex_t li_dbcache_mutex; - pthread_cond_t li_dbcache_cv; + ldap_pvt_thread_mutex_t li_dbcache_mutex; + ldap_pvt_thread_cond_t li_dbcache_cv; }; #include "proto-back-ldbm.h"