ntdb: enhancement to allow direct access to the ntdb map during expansion.
[kai/samba-autobuild/.git] / lib / ntdb / private.h
index 90b782d303b7bb1decb09728acf07914e0051bc9..5efd2e0d92818d78620edf7f7551b5539a6da644 100644 (file)
@@ -301,6 +301,14 @@ struct ntdb_access_hdr {
        bool convert;
 };
 
+/* mmaps we are keeping around because they are still direct accessed */
+struct ntdb_old_mmap {
+       struct ntdb_old_mmap *next;
+
+       void *map_ptr;
+       ntdb_len_t map_size;
+};
+
 struct ntdb_file {
        /* How many are sharing us? */
        unsigned int refcnt;
@@ -314,6 +322,12 @@ struct ntdb_file {
        /* The file descriptor (-1 for NTDB_INTERNAL). */
        int fd;
 
+       /* How many are accessing directly? */
+       unsigned int direct_count;
+
+       /* Old maps, still direct accessed. */
+       struct ntdb_old_mmap *old_mmaps;
+
        /* Lock information */
        pid_t locker;
        struct ntdb_lock allrecord_lock;
@@ -429,7 +443,7 @@ void ntdb_io_init(struct ntdb_context *ntdb);
 void *ntdb_convert(const struct ntdb_context *ntdb, void *buf, ntdb_len_t size);
 
 /* Unmap and try to map the ntdb. */
-void ntdb_munmap(struct ntdb_file *file);
+enum NTDB_ERROR ntdb_munmap(struct ntdb_context *ntdb);
 enum NTDB_ERROR ntdb_mmap(struct ntdb_context *ntdb);
 
 /* Either alloc a copy, or give direct access.  Release frees or noop. */
@@ -576,9 +590,6 @@ struct ntdb_context {
        enum NTDB_ERROR (*openhook)(int fd, void *data);
        void *openhook_data;
 
-       /* Are we accessing directly? (debugging check). */
-       int direct_access;
-
        /* Set if we are in a transaction. */
        struct ntdb_transaction *transaction;