[SCM] Samba Shared Repository - branch master updated

Rusty Russell rusty at samba.org
Thu Mar 29 05:13:02 MDT 2012


The branch, master has been updated
       via  593e731 lib/tdb: Update ABI
       via  3fdeaa3 lib/tdb: Add/expose lock functions to support CTDB
      from  f74ae32 cast: make sure suncc sees a constant.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 593e731097bc6f2fd50034f5e3ddac017894e584
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 27 09:44:59 2012 +1100

    lib/tdb: Update ABI
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User: Rusty Russell <rusty at rustcorp.com.au>
    Autobuild-Date: Thu Mar 29 13:12:46 CEST 2012 on sn-devel-104

commit 3fdeaa3992bb0599613e20d8e3248c478897531f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 27 09:44:33 2012 +1100

    lib/tdb: Add/expose lock functions to support CTDB
    
    This patch adds two lock functions used by CTDB to perform asynchronous
    locking. These functions do not actually perform any fcntl operations,
    but only increment internal counters.
    
     - tdb_transaction_write_lock_mark()
     - tdb_transaction_write_lock_unmark()
    
    It also exposes two internal functions
     - tdb_lock_nonblock()
     - tdb_unlock()
    
    These functions are NOT exposed in include/tdb.h to prevent any further
    uses of these functions. If you ever need to use these functions, consider
    using tdb2.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 lib/tdb/ABI/{tdb-1.2.9.sigs => tdb-1.2.10.sigs} |    4 ++++
 lib/tdb/common/lock.c                           |   18 ++++++++++++++++--
 lib/tdb/wscript                                 |    2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)
 copy lib/tdb/ABI/{tdb-1.2.9.sigs => tdb-1.2.10.sigs} (93%)


Changeset truncated at 500 lines:

diff --git a/lib/tdb/ABI/tdb-1.2.9.sigs b/lib/tdb/ABI/tdb-1.2.10.sigs
similarity index 93%
copy from lib/tdb/ABI/tdb-1.2.9.sigs
copy to lib/tdb/ABI/tdb-1.2.10.sigs
index 9e4149b..61f6c19 100644
--- a/lib/tdb/ABI/tdb-1.2.9.sigs
+++ b/lib/tdb/ABI/tdb-1.2.10.sigs
@@ -25,6 +25,7 @@ tdb_get_seqnum: int (struct tdb_context *)
 tdb_hash_size: int (struct tdb_context *)
 tdb_increment_seqnum_nonblock: void (struct tdb_context *)
 tdb_jenkins_hash: unsigned int (TDB_DATA *)
+tdb_lock_nonblock: int (struct tdb_context *, int, int)
 tdb_lockall: int (struct tdb_context *)
 tdb_lockall_mark: int (struct tdb_context *)
 tdb_lockall_nonblock: int (struct tdb_context *)
@@ -54,8 +55,11 @@ tdb_transaction_commit: int (struct tdb_context *)
 tdb_transaction_prepare_commit: int (struct tdb_context *)
 tdb_transaction_start: int (struct tdb_context *)
 tdb_transaction_start_nonblock: int (struct tdb_context *)
+tdb_transaction_write_lock_mark: int (struct tdb_context *)
+tdb_transaction_write_lock_unmark: int (struct tdb_context *)
 tdb_traverse: int (struct tdb_context *, tdb_traverse_func, void *)
 tdb_traverse_read: int (struct tdb_context *, tdb_traverse_func, void *)
+tdb_unlock: int (struct tdb_context *, int, int)
 tdb_unlockall: int (struct tdb_context *)
 tdb_unlockall_read: int (struct tdb_context *)
 tdb_validate_freelist: int (struct tdb_context *, int *)
diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c
index c6a2485..88a52e9 100644
--- a/lib/tdb/common/lock.c
+++ b/lib/tdb/common/lock.c
@@ -380,7 +380,7 @@ int tdb_lock(struct tdb_context *tdb, int list, int ltype)
 }
 
 /* lock a list in the database. list -1 is the alloc list. non-blocking lock */
-int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype)
+_PUBLIC_ int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype)
 {
 	return tdb_lock_list(tdb, list, ltype, TDB_LOCK_NOWAIT);
 }
@@ -445,7 +445,7 @@ int tdb_nest_unlock(struct tdb_context *tdb, uint32_t offset, int ltype,
 	return ret;
 }
 
-int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
+_PUBLIC_ int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
 {
 	/* a global lock allows us to avoid per chain locks */
 	if (tdb->allrecord_lock.count &&
@@ -859,3 +859,17 @@ void tdb_release_transaction_locks(struct tdb_context *tdb)
 		SAFE_FREE(tdb->lockrecs);
 	}
 }
+
+/* Following functions are added specifically to support CTDB. */
+
+/* Don't do actual fcntl locking, just mark tdb locked */
+_PUBLIC_ int tdb_transaction_write_lock_mark(struct tdb_context *tdb)
+{
+	return tdb_transaction_lock(tdb, F_WRLCK, TDB_LOCK_MARK_ONLY);
+}
+
+/* Don't do actual fcntl unlocking, just mark tdb unlocked */
+_PUBLIC_ int tdb_transaction_write_lock_unmark(struct tdb_context *tdb)
+{
+	return tdb_nest_unlock(tdb, TRANSACTION_LOCK, F_WRLCK, true);
+}
diff --git a/lib/tdb/wscript b/lib/tdb/wscript
index 871c5c4..d475204 100644
--- a/lib/tdb/wscript
+++ b/lib/tdb/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'tdb'
-VERSION = '1.2.9'
+VERSION = '1.2.10'
 
 blddir = 'bin'
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list