]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/back-ldbm.h
Apply devel IDL fixes...
[openldap] / servers / slapd / back-ldbm / back-ldbm.h
index 95b1134d002e19d19c8a4ec0f5a79d90e149f9f2..e0816acd48ef2b6422a0028a5092522385476af2 100644 (file)
@@ -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"