Commit b2555a86 authored by Rusty Russell's avatar Rusty Russell

tdb2: unify tdb1_wipe into tdb_wipe.

Switch on the TDB_VERSION1 flag.
parent 57359c26
......@@ -681,6 +681,7 @@ enum TDB_ERROR tdb1_parse_record(struct tdb_context *tdb, TDB_DATA key,
void *private_data);
void tdb1_increment_seqnum_nonblock(struct tdb_context *tdb);
int tdb1_get_seqnum(struct tdb_context *tdb);
int tdb1_wipe_all(struct tdb_context *tdb);
/* tdb1_transaction.c: */
int tdb1_transaction_start(struct tdb_context *tdb);
......
......@@ -42,8 +42,6 @@ uint64_t tdb1_incompatible_hash(const void *key, size_t len, uint64_t seed, void
/* @} ******************************************************************/
/* wipe and repack */
int tdb1_wipe_all(struct tdb_context *tdb);
int tdb1_repack(struct tdb_context *tdb);
extern TDB_DATA tdb1_null;
......
......@@ -115,6 +115,12 @@ enum TDB_ERROR tdb_wipe_all(struct tdb_context *tdb)
enum TDB_ERROR ecode;
int64_t count;
if (tdb->flags & TDB_VERSION1) {
if (tdb1_wipe_all(tdb) == -1)
return tdb->last_error;
return TDB_SUCCESS;
}
ecode = tdb_allrecord_lock(tdb, F_WRLCK, TDB_LOCK_WAIT, false);
if (ecode != TDB_SUCCESS)
return tdb->last_error = ecode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment