static int tdb_dump_chain(struct tdb_context *tdb, int i)
{
+ struct tdb_chainwalk_ctx chainwalk;
tdb_off_t rec_ptr, top;
if (i == -1) {
if (tdb_ofs_read(tdb, top, &rec_ptr) == -1)
return tdb_unlock(tdb, i, F_WRLCK);
+ tdb_chainwalk_init(&chainwalk, rec_ptr);
+
if (rec_ptr)
printf("hash=%d\n", i);
while (rec_ptr) {
+ bool ok;
rec_ptr = tdb_dump_record(tdb, i, rec_ptr);
+ ok = tdb_chainwalk_check(tdb, &chainwalk, rec_ptr);
+ if (!ok) {
+ printf("circular hash chain %d\n", i);
+ break;
+ }
}
return tdb_unlock(tdb, i, F_WRLCK);