#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 \
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];
bool convert;
};
+struct tdb_file {
+ /* Single list of all TDBs, to detect multiple opens. */
+ struct tdb_file *next;
+
+ /* The file descriptor. */
+ int fd;
+
+ /* Lock information */
+ struct tdb_lock_type allrecord_lock;
+ size_t num_lockrecs;
+ struct tdb_lock_type *lockrecs;
+
+ /* Identity of this file. */
+ dev_t device;
+ ino_t inode;
+};
+
struct tdb_context {
/* Filename of the database. */
const char *name;
/* Are we accessing directly? (debugging check). */
int direct_access;
- /* Open file descriptor (undefined for TDB_INTERNAL). */
- int fd;
-
/* How much space has been mapped (<= current file size) */
tdb_len_t map_size;
/* IO methods: changes for transactions. */
const struct tdb_methods *methods;
- /* Lock information */
- struct tdb_lock_type allrecord_lock;
- size_t num_lockrecs;
- struct tdb_lock_type *lockrecs;
-
struct tdb_attribute_stats *stats;
/* Direct access information */
struct tdb_access_hdr *access;
- /* Single list of all TDBs, to avoid multiple opens. */
- struct tdb_context *next;
- dev_t device;
- ino_t inode;
+ /* The actual file information */
+ struct tdb_file *file;
};
struct tdb_methods {
} while (0)
/* lock.c: */
-void tdb_lock_init(struct tdb_context *tdb);
-
/* Lock/unlock a range of hashes. */
enum TDB_ERROR tdb_lock_hashes(struct tdb_context *tdb,
tdb_off_t hash_lock, tdb_len_t hash_range,