From bdd46e4513c7157a67408fcbd1e24b822cdbb960 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Sep 2011 07:38:13 +0930 Subject: tdb2: make tdb1 use same low-level lock functions. This means they will use the TDB_ATTRIBUTE_FLOCK functions, and get automatic reopen support. Signed-off-by: Rusty Russell (Imported from CCAN commit fbad02b680b6cbc33ae305ae1cbcdead4eedc7b1) --- lib/tdb2/private.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'lib/tdb2/private.h') diff --git a/lib/tdb2/private.h b/lib/tdb2/private.h index 52dad3dc5d..5d16de179f 100644 --- a/lib/tdb2/private.h +++ b/lib/tdb2/private.h @@ -557,7 +557,7 @@ bool tdb_has_hash_locks(struct tdb_context *tdb); enum TDB_ERROR tdb_allrecord_lock(struct tdb_context *tdb, int ltype, enum tdb_lock_flags flags, bool upgradable); void tdb_allrecord_unlock(struct tdb_context *tdb, int ltype); -enum TDB_ERROR tdb_allrecord_upgrade(struct tdb_context *tdb); +enum TDB_ERROR tdb_allrecord_upgrade(struct tdb_context *tdb, off_t start); /* Serialize db open. */ enum TDB_ERROR tdb_lock_open(struct tdb_context *tdb, @@ -573,6 +573,25 @@ 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); +/* Byte-range lock wrappers for TDB1 to access. */ +enum TDB_ERROR tdb_brlock(struct tdb_context *tdb, + int rw_type, tdb_off_t offset, tdb_off_t len, + enum tdb_lock_flags flags); + +enum TDB_ERROR tdb_brunlock(struct tdb_context *tdb, + int rw_type, tdb_off_t offset, size_t len); + +enum TDB_ERROR tdb_nest_lock(struct tdb_context *tdb, + tdb_off_t offset, int ltype, + enum tdb_lock_flags flags); + +enum TDB_ERROR tdb_nest_unlock(struct tdb_context *tdb, + tdb_off_t off, int ltype); + +enum TDB_ERROR tdb_lock_gradual(struct tdb_context *tdb, + int ltype, enum tdb_lock_flags flags, + tdb_off_t off, tdb_off_t len); + /* 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 *); -- cgit