]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/private.h
tdb2: feature support.
[ccan] / ccan / tdb2 / private.h
index 236aa3696d6b4c30efe7e974b53500b51c2f7832..8e7df501b716a139c77e8de2ff673fe1afa55266 100644 (file)
@@ -18,8 +18,7 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#define _XOPEN_SOURCE 500
-#define _FILE_OFFSET_BITS 64
+#include "config.h"
 #include <stdint.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <stdlib.h>
@@ -33,7 +32,6 @@
 #include <stdio.h>
 #include <utime.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <utime.h>
 #include <unistd.h>
-#include "config.h"
 #include <ccan/tdb2/tdb2.h>
 #include <ccan/likely/likely.h>
 #include <ccan/compiler/compiler.h>
 #include <ccan/tdb2/tdb2.h>
 #include <ccan/likely/likely.h>
 #include <ccan/compiler/compiler.h>
@@ -118,6 +116,9 @@ typedef int tdb_bool_err;
 #define TDB_OFF_HASH_EXTRA_BIT 57
 #define TDB_OFF_UPPER_STEAL_SUBHASH_BIT 56
 
 #define TDB_OFF_HASH_EXTRA_BIT 57
 #define TDB_OFF_UPPER_STEAL_SUBHASH_BIT 56
 
+/* Additional features we understand.  Currently: none. */
+#define TDB_FEATURE_MASK ((uint64_t)0)
+
 /* The bit number where we store the extra hash bits. */
 /* Convenience mask to get actual offset. */
 #define TDB_OFF_MASK \
 /* The bit number where we store the extra hash bits. */
 /* Convenience mask to get actual offset. */
 #define TDB_OFF_MASK \
@@ -242,7 +243,10 @@ struct tdb_header {
        tdb_off_t free_table; /* (First) free table. */
        tdb_off_t recovery; /* Transaction recovery area. */
 
        tdb_off_t free_table; /* (First) free table. */
        tdb_off_t recovery; /* Transaction recovery area. */
 
-       tdb_off_t reserved[26];
+       uint64_t features_used; /* Features all writers understand */
+       uint64_t features_offered; /* Features offered */
+
+       tdb_off_t reserved[24];
 
        /* Top level hash table. */
        tdb_off_t hashtable[1ULL << TDB_TOPLEVEL_HASH_BITS];
 
        /* Top level hash table. */
        tdb_off_t hashtable[1ULL << TDB_TOPLEVEL_HASH_BITS];
@@ -453,7 +457,7 @@ unsigned int size_to_bucket(tdb_len_t data_len);
 tdb_off_t bucket_off(tdb_off_t ftable_off, unsigned bucket);
 
 /* Used by tdb_summary */
 tdb_off_t bucket_off(tdb_off_t ftable_off, unsigned bucket);
 
 /* Used by tdb_summary */
-size_t dead_space(struct tdb_context *tdb, tdb_off_t off);
+tdb_off_t dead_space(struct tdb_context *tdb, tdb_off_t off);
 
 /* io.c: */
 /* Initialize tdb->methods. */
 
 /* io.c: */
 /* Initialize tdb->methods. */
@@ -560,8 +564,8 @@ bool tdb_has_expansion_lock(struct tdb_context *tdb);
 enum TDB_ERROR tdb_lock_and_recover(struct tdb_context *tdb);
 
 /* transaction.c: */
 enum TDB_ERROR tdb_lock_and_recover(struct tdb_context *tdb);
 
 /* transaction.c: */
-int tdb_transaction_recover(struct tdb_context *tdb);
-bool tdb_needs_recovery(struct tdb_context *tdb);
+enum TDB_ERROR tdb_transaction_recover(struct tdb_context *tdb);
+tdb_bool_err tdb_needs_recovery(struct tdb_context *tdb);
 
 /* tdb.c: */
 enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb,
 
 /* tdb.c: */
 enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb,