]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb/check.c
tdb2: fix tdb_summary reports
[ccan] / ccan / tdb / check.c
index 955f255484a720a08a07a9e33a1fde6b0036b49c..4fbbb92c5a4ae62902d14b7ccffa697df0ccbde8 100644 (file)
@@ -40,7 +40,7 @@ static bool tdb_check_header(struct tdb_context *tdb, tdb_off_t *recovery)
        if (hdr.version != TDB_VERSION)
                goto corrupt;
 
-       if (hdr.rwlocks != 0)
+       if (hdr.rwlocks != 0 && hdr.rwlocks != TDB_HASH_RWLOCK_MAGIC)
                goto corrupt;
 
        tdb_header_hash(tdb, &h1, &h2);
@@ -309,7 +309,7 @@ static bool tdb_check_free_record(struct tdb_context *tdb,
 }
 
 /* Slow, but should be very rare. */
-static size_t dead_space(struct tdb_context *tdb, tdb_off_t off)
+size_t tdb_dead_space(struct tdb_context *tdb, tdb_off_t off)
 {
        size_t len;
 
@@ -407,7 +407,7 @@ int tdb_check(struct tdb_context *tdb,
                                found_recovery = true;
                                break;
                        }
-                       dead = dead_space(tdb, off);
+                       dead = tdb_dead_space(tdb, off);
                        if (dead < sizeof(rec))
                                goto corrupt;