]> git.sur5r.net Git - openldap/commitdiff
Quick and dirty BDB 4.6.18 support. Expect this to change again soon.
authorHoward Chu <hyc@openldap.org>
Tue, 24 Jul 2007 14:02:37 +0000 (14:02 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 24 Jul 2007 14:02:37 +0000 (14:02 +0000)
servers/slapd/back-bdb/back-bdb.h
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/id2entry.c
servers/slapd/back-bdb/idl.c
servers/slapd/back-bdb/tools.c

index d564bfedfcba079672592a1336a5332e17da88bf..bf3c6ab825f44ed0ea2e834ae52991329f64c731 100644 (file)
@@ -275,6 +275,21 @@ struct bdb_op_info {
 
 #endif
 
+/* 4.6.18 redefines cursor->locker */
+#if DB_VERSION_FULL >= 0x04060012
+
+struct __db_locker {
+       u_int32_t       id;
+};
+
+#define CURSOR_SETLOCKER(cursor, id) \
+       __lock_getlocker(cursor->dbp->dbenv->lk_handle, id, 0, &cursor->locker)
+#define        CURSOR_GETLOCKER(cursor)        cursor->locker->id
+#else
+#define CURSOR_SETLOCKER(cursor, id)   cursor->locker = id
+#define CURSOR_GETLOCKER(cursor)       cursor->locker
+#endif
+
 #ifndef DB_BUFFER_SMALL
 #define DB_BUFFER_SMALL                        ENOMEM
 #endif
index 07acfeb2d51d04522d208135f04e8855fbbf2dc2..2a64cb5c96d8a180146d6b9b14556ffe1010e542 100644 (file)
@@ -738,7 +738,7 @@ hdb_dn2id_parent(
        rc = db->cursor( db, txn, &cursor, bdb->bi_db_opflags );
        if ( rc ) return rc;
        if ( !txn && locker ) {
-               cursor->locker = locker;
+               CURSOR_SETLOCKER(cursor, locker);
        }
 
        data.ulen = sizeof(diskNode) + (SLAP_LDAPDN_MAXLEN * 2);
index d7d4c9bb2d50b9c767da471d68167af0ddf6c13a..e66357cb100adfcf99a20d2ebb584f0d8028e137 100644 (file)
@@ -121,8 +121,9 @@ int bdb_id2entry(
        if ( rc ) return rc;
 
        /* Use our own locker if needed */
-       if ( !tid && locker )
-               cursor->locker = locker;
+       if ( !tid && locker ) {
+               CURSOR_SETLOCKER( cursor, locker );
+       }
 
        /* Get the nattrs / nvals counts first */
        data.ulen = data.dlen = sizeof(buf);
index c84486d79040e2ddc2a5aa79cd3351680f0eff5d..8f52540bd1ab3f695a80a2cb1f50c4b155b2c889 100644 (file)
@@ -559,7 +559,7 @@ bdb_idl_fetch_key(
                                "cursor failed: %s (%d)\n", db_strerror(rc), rc, 0 );
                        return rc;
                }
-               cursor->locker = locker;
+               CURSOR_SETLOCKER( cursor, locker );
        } else {
                cursor = *saved_cursor;
        }
index 7bf5725a8968003e4db241dc61928890de601105..e95ca1659434d2ce0b342426727c7766c9144f51 100644 (file)
@@ -319,7 +319,7 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
                        op.o_tmpmemctx = NULL;
                        op.o_tmpmfuncs = &ch_mfuncs;
 
-                       rc = bdb_cache_find_parent( &op, NULL, cursor->locker, id, &ei );
+                       rc = bdb_cache_find_parent( &op, NULL, CURSOR_GETLOCKER(cursor), id, &ei );
                        if ( rc == LDAP_SUCCESS ) {
                                bdb_cache_entryinfo_unlock( ei );
                                e->e_private = ei;