]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/private.h
tdb2: tdb_error()
[ccan] / ccan / tdb2 / private.h
index 4e7fc8ffeccaba5e2ab13348cf02a23bcbbb15bf..63354a43dd829c52f82d0a933783f6c67ce8782b 100644 (file)
@@ -246,7 +246,9 @@ struct tdb_header {
        uint64_t features_used; /* Features all writers understand */
        uint64_t features_offered; /* Features offered */
 
-       tdb_off_t reserved[24];
+       uint64_t seqnum; /* Sequence number for TDB_SEQNUM */
+
+       tdb_off_t reserved[23];
 
        /* Top level hash table. */
        tdb_off_t hashtable[1ULL << TDB_TOPLEVEL_HASH_BITS];
@@ -388,6 +390,9 @@ struct tdb_context {
        /* Direct access information */
        struct tdb_access_hdr *access;
 
+       /* Last error we returned. */
+       enum TDB_ERROR last_error;
+
        /* The actual file information */
        struct tdb_file *file;
 };
@@ -523,6 +528,9 @@ enum TDB_ERROR tdb_write_convert(struct tdb_context *tdb, tdb_off_t off,
 enum TDB_ERROR tdb_read_convert(struct tdb_context *tdb, tdb_off_t off,
                                void *rec, size_t len);
 
+/* Bump the seqnum (caller checks for tdb->flags & TDB_SEQNUM) */
+void tdb_inc_seqnum(struct tdb_context *tdb);
+
 /* Adds a stat, if it's in range. */
 void add_stat_(struct tdb_context *tdb, uint64_t *stat, size_t val);
 #define add_stat(tdb, statname, val)                                   \