Lines Matching refs:dbuf
2754 TDB_DATA key, dbuf; in tdb_traverse_internal() local
2781 dbuf.dptr = key.dptr + rec.key_len; in tdb_traverse_internal()
2782 dbuf.dsize = rec.data_len; in tdb_traverse_internal()
2790 if (fn && fn(tdb, key, dbuf, private_data)) { in tdb_traverse_internal()
3148 static int tdb_update_hash(struct tdb_context *tdb, TDB_DATA key, u32 hash, TDB_DATA dbuf) in tdb_update_hash() argument
3158 if (rec.rec_len < key.dsize + dbuf.dsize + sizeof(tdb_off_t)) { in tdb_update_hash()
3164 dbuf.dptr, dbuf.dsize) == -1) in tdb_update_hash()
3167 if (dbuf.dsize != rec.data_len) { in tdb_update_hash()
3169 rec.data_len = dbuf.dsize; in tdb_update_hash()
3452 int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) in tdb_store() argument
3478 if (tdb_update_hash(tdb, key, hash, dbuf) == 0) { in tdb_store()
3500 if (!(p = (char *)malloc(key.dsize + dbuf.dsize))) { in tdb_store()
3506 if (dbuf.dsize) in tdb_store()
3507 memcpy(p+key.dsize, dbuf.dptr, dbuf.dsize); in tdb_store()
3518 key.dsize + dbuf.dsize + sizeof(tdb_off_t)); in tdb_store()
3522 rec.data_len = dbuf.dsize; in tdb_store()
3528 p, key.dsize + dbuf.dsize) == -1) { in tdb_store()
3552 rec_ptr = tdb_allocate(tdb, key.dsize + dbuf.dsize, &rec); in tdb_store()
3565 rec.data_len = dbuf.dsize; in tdb_store()
3571 || tdb->methods->tdb_write(tdb, rec_ptr+sizeof(rec), p, key.dsize+dbuf.dsize)==-1 in tdb_store()
3594 TDB_DATA dbuf; in tdb_append() local
3602 dbuf = tdb_fetch(tdb, key); in tdb_append()
3604 if (dbuf.dptr == NULL) { in tdb_append()
3605 dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize); in tdb_append()
3607 unsigned char *new_dptr = (unsigned char *)realloc(dbuf.dptr, in tdb_append()
3608 dbuf.dsize + new_dbuf.dsize); in tdb_append()
3610 free(dbuf.dptr); in tdb_append()
3612 dbuf.dptr = new_dptr; in tdb_append()
3615 if (dbuf.dptr == NULL) { in tdb_append()
3620 memcpy(dbuf.dptr + dbuf.dsize, new_dbuf.dptr, new_dbuf.dsize); in tdb_append()
3621 dbuf.dsize += new_dbuf.dsize; in tdb_append()
3623 ret = tdb_store(tdb, key, dbuf, 0); in tdb_append()
3627 SAFE_FREE(dbuf.dptr); in tdb_append()