]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/private.h
tdb2: TDB_ATTRIBUTE_FLOCK support
[ccan] / ccan / tdb2 / private.h
index 1309ce16c0a14c79bc67ee2192696dc4033b0c80..9cd8188c70c559c3f0e1c2a6f2845cab4571cc3c 100644 (file)
@@ -367,8 +367,8 @@ struct tdb_context {
        /* Logging function */
        void (*log_fn)(struct tdb_context *tdb,
                       enum tdb_log_level level,
-                      void *data,
-                      const char *message);
+                      const char *message,
+                      void *data);
        void *log_data;
 
        /* Hash function. */
@@ -376,6 +376,11 @@ struct tdb_context {
        void *hash_data;
        uint64_t hash_seed;
 
+       /* low level (fnctl) lock functions. */
+       int (*lock_fn)(int fd, int rw, off_t off, off_t len, bool w, void *);
+       int (*unlock_fn)(int fd, int rw, off_t off, off_t len, void *);
+       void *lock_data;
+
        /* Set if we are in a transaction. */
        struct tdb_transaction *transaction;
        
@@ -584,6 +589,10 @@ bool tdb_has_expansion_lock(struct tdb_context *tdb);
 /* If it needs recovery, grab all the locks and do it. */
 enum TDB_ERROR tdb_lock_and_recover(struct tdb_context *tdb);
 
+/* Default lock and unlock functions. */
+int tdb_fcntl_lock(int fd, int rw, off_t off, off_t len, bool waitflag, void *);
+int tdb_fcntl_unlock(int fd, int rw, off_t off, off_t len, void *);
+
 /* transaction.c: */
 enum TDB_ERROR tdb_transaction_recover(struct tdb_context *tdb);
 tdb_bool_err tdb_needs_recovery(struct tdb_context *tdb);