summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-03-15 11:10:35 +0100
committerVolker Lendecke <vl@samba.org>2012-03-16 11:20:10 +0100
commit1909af434eef5473c236aa46e531818e392b80b3 (patch)
tree202a6c9779089664ae935f12dc1e0faaf06671fd
parentaf68fe7113ae0783f03732a6cda53e7ccae3220a (diff)
downloadsamba-1909af434eef5473c236aa46e531818e392b80b3.tar.gz
samba-1909af434eef5473c236aa46e531818e392b80b3.tar.bz2
samba-1909af434eef5473c236aa46e531818e392b80b3.zip
s3-dbwrap: Move "lock_order" initialization to db_open_xx
-rw-r--r--source3/lib/dbwrap/dbwrap_ctdb.c1
-rw-r--r--source3/lib/dbwrap/dbwrap_open.c6
-rw-r--r--source3/lib/dbwrap/dbwrap_tdb.c4
-rw-r--r--source3/lib/dbwrap/dbwrap_tdb.h3
4 files changed, 8 insertions, 6 deletions
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index d50f75ef5d..41adfd8243 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1505,6 +1505,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
db_path = ctdbd_dbpath(conn, db_ctdb, db_ctdb->db_id);
result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
+ result->lock_order = lock_order;
/* only pass through specific flags */
tdb_flags &= TDB_SEQNUM;
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 731529680e..06ae7c6eff 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -123,10 +123,8 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
if (result == NULL) {
result = db_open_tdb(mem_ctx, name, hash_size,
- tdb_flags, open_flags, mode);
- }
- if (result != NULL) {
- result->lock_order = lock_order;
+ tdb_flags, open_flags, mode,
+ lock_order);
}
return result;
}
diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c
index 454073a52f..46d6cdb8d1 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.c
+++ b/source3/lib/dbwrap/dbwrap_tdb.c
@@ -343,7 +343,8 @@ static int db_tdb_transaction_cancel(struct db_context *db)
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
const char *name,
int hash_size, int tdb_flags,
- int open_flags, mode_t mode)
+ int open_flags, mode_t mode,
+ enum dbwrap_lock_order lock_order)
{
struct db_context *result = NULL;
struct db_tdb_ctx *db_tdb;
@@ -361,6 +362,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
DEBUG(0, ("talloc failed\n"));
goto fail;
}
+ result->lock_order = lock_order;
db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags,
open_flags, mode, lp_ctx);
diff --git a/source3/lib/dbwrap/dbwrap_tdb.h b/source3/lib/dbwrap/dbwrap_tdb.h
index 86673d09ca..1f7a223c70 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.h
+++ b/source3/lib/dbwrap/dbwrap_tdb.h
@@ -27,7 +27,8 @@ struct db_context;
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
const char *name,
int hash_size, int tdb_flags,
- int open_flags, mode_t mode);
+ int open_flags, mode_t mode,
+ enum dbwrap_lock_order lock_order);
#endif /* __DBWRAP_TDB_H__ */