]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/private.h
tdb2: move mmap into struct tdb_file
[ccan] / ccan / tdb2 / private.h
index 9ae5bed2e6bc6cb8c397d32d1f7f6f6ef8574930..762cdd12442a06ab7370fd3c631d8389b80923dd 100644 (file)
@@ -319,7 +319,13 @@ struct tdb_file {
        /* Single list of all TDBs, to detect multiple opens. */
        struct tdb_file *next;
 
-       /* The file descriptor. */
+       /* Mmap (if any), or malloc (for TDB_INTERNAL). */
+       void *map_ptr;
+
+       /* How much space has been mapped (<= current file size) */
+       tdb_len_t map_size;
+
+       /* The file descriptor (-1 for TDB_INTERNAL). */
        int fd;
 
        /* Lock information */
@@ -336,15 +342,9 @@ struct tdb_context {
        /* Filename of the database. */
        const char *name;
 
-       /* Mmap (if any), or malloc (for TDB_INTERNAL). */
-       void *map_ptr;
-
        /* Are we accessing directly? (debugging check). */
        int direct_access;
 
-       /* How much space has been mapped (<= current file size) */
-       tdb_len_t map_size;
-
        /* Operating read-only? (Opened O_RDONLY, or in traverse_read) */
        bool read_only;
 
@@ -474,7 +474,7 @@ void tdb_io_init(struct tdb_context *tdb);
 void *tdb_convert(const struct tdb_context *tdb, void *buf, tdb_len_t size);
 
 /* Unmap and try to map the tdb. */
-void tdb_munmap(struct tdb_context *tdb);
+void tdb_munmap(struct tdb_file *file);
 void tdb_mmap(struct tdb_context *tdb);
 
 /* Either alloc a copy, or give direct access.  Release frees or noop. */