• Home
  • Raw
  • Download

Lines Matching refs:rec_ptr

284 static int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec);
2441 static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, tdb_len_t length, tdb_off_t rec_ptr, in tdb_allocate_ofs() argument
2456 newrec_ptr = rec_ptr + sizeof(*rec) + length; in tdb_allocate_ofs()
2474 if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { in tdb_allocate_ofs()
2482 if (update_tailer(tdb, rec_ptr, rec) == -1) { in tdb_allocate_ofs()
2493 return rec_ptr; in tdb_allocate_ofs()
2504 tdb_off_t rec_ptr, last_ptr, newrec_ptr; in tdb_allocate() local
2506 tdb_off_t rec_ptr, last_ptr; in tdb_allocate() member
2520 if (tdb_ofs_read(tdb, FREELIST_TOP, &rec_ptr) == -1) in tdb_allocate()
2523 bestfit.rec_ptr = 0; in tdb_allocate()
2532 while (rec_ptr) { in tdb_allocate()
2533 if (tdb_rec_free_read(tdb, rec_ptr, rec) == -1) { in tdb_allocate()
2538 if (bestfit.rec_ptr == 0 || in tdb_allocate()
2541 bestfit.rec_ptr = rec_ptr; in tdb_allocate()
2553 last_ptr = rec_ptr; in tdb_allocate()
2554 rec_ptr = rec->next; in tdb_allocate()
2557 if (bestfit.rec_ptr != 0) { in tdb_allocate()
2558 if (tdb_rec_free_read(tdb, bestfit.rec_ptr, rec) == -1) { in tdb_allocate()
2562 newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, rec, bestfit.last_ptr); in tdb_allocate()
2586 static int seen_insert(struct tdb_context *mem_tdb, tdb_off_t rec_ptr) in seen_insert() argument
2591 key.dptr = (unsigned char *)&rec_ptr; in seen_insert()
2592 key.dsize = sizeof(rec_ptr); in seen_insert()
2600 tdb_off_t rec_ptr, last_ptr; in tdb_validate_freelist() local
2625 if (tdb_ofs_read(tdb, FREELIST_TOP, &rec_ptr) == -1) { in tdb_validate_freelist()
2629 while (rec_ptr) { in tdb_validate_freelist()
2635 if (seen_insert(mem_tdb, rec_ptr)) { in tdb_validate_freelist()
2640 if (tdb_rec_free_read(tdb, rec_ptr, &rec) == -1) { in tdb_validate_freelist()
2645 last_ptr = rec_ptr; in tdb_validate_freelist()
2646 rec_ptr = rec.next; in tdb_validate_freelist()
3000 tdb_off_t rec_ptr, top; in tdb_dump_chain() local
3007 if (tdb_ofs_read(tdb, top, &rec_ptr) == -1) in tdb_dump_chain()
3010 if (rec_ptr) in tdb_dump_chain()
3013 while (rec_ptr) { in tdb_dump_chain()
3014 rec_ptr = tdb_dump_record(tdb, i, rec_ptr); in tdb_dump_chain()
3034 tdb_off_t offset, rec_ptr; in tdb_printfreelist() local
3043 if (tdb_ofs_read(tdb, offset, &rec_ptr) == -1) { in tdb_printfreelist()
3048 printf("freelist top=[0x%08x]\n", rec_ptr ); in tdb_printfreelist()
3049 while (rec_ptr) { in tdb_printfreelist()
3050 if (tdb->methods->tdb_read(tdb, rec_ptr, (char *)&rec, in tdb_printfreelist()
3063 rec_ptr, rec.rec_len, rec.rec_len, rec_ptr + rec.rec_len); in tdb_printfreelist()
3067 rec_ptr = rec.next; in tdb_printfreelist()
3128 tdb_off_t rec_ptr; in tdb_find() local
3131 if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) in tdb_find()
3135 while (rec_ptr) { in tdb_find()
3136 if (tdb_rec_read(tdb, rec_ptr, r) == -1) in tdb_find()
3141 && tdb_parse_data(tdb, key, rec_ptr + sizeof(*r), in tdb_find()
3144 return rec_ptr; in tdb_find()
3146 rec_ptr = r->next; in tdb_find()
3155 u32 rec_ptr; in tdb_find_lock_hash() local
3159 if (!(rec_ptr = tdb_find(tdb, key, hash, rec))) in tdb_find_lock_hash()
3161 return rec_ptr; in tdb_find_lock_hash()
3172 tdb_off_t rec_ptr; in tdb_update_hash() local
3175 if (!(rec_ptr = tdb_find(tdb, key, hash, &rec))) in tdb_update_hash()
3184 if (tdb->methods->tdb_write(tdb, rec_ptr + sizeof(rec) + rec.key_len, in tdb_update_hash()
3191 return tdb_rec_write(tdb, rec_ptr, &rec); in tdb_update_hash()
3205 tdb_off_t rec_ptr; in tdb_fetch() local
3212 if (!(rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) in tdb_fetch()
3215 ret.dptr = tdb_alloc_read(tdb, rec_ptr + sizeof(rec) + rec.key_len, in tdb_fetch()
3243 tdb_off_t rec_ptr; in tdb_parse_record() local
3251 if (!(rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) { in tdb_parse_record()
3255 ret = tdb_parse_data(tdb, key, rec_ptr + sizeof(rec) + rec.key_len, in tdb_parse_record()
3286 int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct*rec) in tdb_do_delete() argument
3293 if (tdb_write_lock_record(tdb, rec_ptr) == -1) { in tdb_do_delete()
3296 return tdb_rec_write(tdb, rec_ptr, rec); in tdb_do_delete()
3298 if (tdb_write_unlock_record(tdb, rec_ptr) != 0) in tdb_do_delete()
3304 for (last_ptr = 0; i != rec_ptr; last_ptr = i, i = lastrec.next) in tdb_do_delete()
3315 if (tdb_free(tdb, rec_ptr, rec) == -1) in tdb_do_delete()
3323 tdb_off_t rec_ptr; in tdb_count_dead() local
3327 if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) in tdb_count_dead()
3330 while (rec_ptr) { in tdb_count_dead()
3331 if (tdb_rec_read(tdb, rec_ptr, &rec) == -1) in tdb_count_dead()
3337 rec_ptr = rec.next; in tdb_count_dead()
3349 tdb_off_t rec_ptr; in tdb_purge_dead() local
3356 if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) in tdb_purge_dead()
3359 while (rec_ptr) { in tdb_purge_dead()
3362 if (tdb_rec_read(tdb, rec_ptr, &rec) == -1) { in tdb_purge_dead()
3369 && tdb_do_delete(tdb, rec_ptr, &rec) == -1) { in tdb_purge_dead()
3372 rec_ptr = next; in tdb_purge_dead()
3383 tdb_off_t rec_ptr; in tdb_delete_hash() local
3405 if (!(rec_ptr = tdb_find(tdb, key, hash, &rec))) { in tdb_delete_hash()
3414 ret = tdb_rec_write(tdb, rec_ptr, &rec); in tdb_delete_hash()
3417 if (!(rec_ptr = tdb_find_lock_hash(tdb, key, hash, F_WRLCK, in tdb_delete_hash()
3421 ret = tdb_do_delete(tdb, rec_ptr, &rec); in tdb_delete_hash()
3445 tdb_off_t rec_ptr; in tdb_find_dead() local
3448 if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) in tdb_find_dead()
3452 while (rec_ptr) { in tdb_find_dead()
3453 if (tdb_rec_read(tdb, rec_ptr, r) == -1) in tdb_find_dead()
3461 return rec_ptr; in tdb_find_dead()
3463 rec_ptr = r->next; in tdb_find_dead()
3477 tdb_off_t rec_ptr; in tdb_store() local
3537 rec_ptr = tdb_find_dead( in tdb_store()
3541 if (rec_ptr != 0) { in tdb_store()
3546 if (tdb_rec_write(tdb, rec_ptr, &rec) == -1 in tdb_store()
3548 tdb, rec_ptr + sizeof(rec), in tdb_store()
3573 rec_ptr = tdb_allocate(tdb, key.dsize + dbuf.dsize, &rec); in tdb_store()
3577 if (rec_ptr == 0) { in tdb_store()
3591 if (tdb_rec_write(tdb, rec_ptr, &rec) == -1 in tdb_store()
3592 || tdb->methods->tdb_write(tdb, rec_ptr+sizeof(rec), p, key.dsize+dbuf.dsize)==-1 in tdb_store()
3593 || tdb_ofs_write(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) { in tdb_store()