return;
}
- if (tdb_brlock(tdb, TDB_SEQNUM_OFS, F_WRLCK, F_SETLKW, 1, 1) != 0) {
+ if (tdb_brlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1,
+ TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
return;
}
tdb_increment_seqnum_nonblock(tdb);
- tdb_brlock(tdb, TDB_SEQNUM_OFS, F_UNLCK, F_SETLKW, 1, 1);
+ tdb_brunlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1);
}
static int tdb_key_compare(TDB_DATA key, TDB_DATA data, void *private_data)
* then the TDB_DATA will have zero length but
* a non-zero pointer
*/
-static TDB_DATA do_tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
+static TDB_DATA _tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
{
tdb_off_t rec_ptr;
struct list_struct rec;
TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
{
- TDB_DATA ret = do_tdb_fetch(tdb, key);
+ TDB_DATA ret = _tdb_fetch(tdb, key);
tdb_trace_1rec_retrec(tdb, "tdb_fetch", key, ret);
return ret;
return 0;
}
-static int _tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
- int flag, uint32_t hash)
+static int _tdb_store(struct tdb_context *tdb, TDB_DATA key,
+ TDB_DATA dbuf, int flag, uint32_t hash)
{
struct list_struct rec;
tdb_off_t rec_ptr;
if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1)
return -1;
- dbuf = do_tdb_fetch(tdb, key);
+ dbuf = _tdb_fetch(tdb, key);
if (dbuf.dptr == NULL) {
dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize);