1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

dbwrap: Add "msg_ctx" to db_open_ctdb

Another step towards making ctdbd_conn.c independent of messages.c. No call to
ctdb_conn_msg_ctx() anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2016-04-24 17:37:07 +02:00 committed by Ralph Boehme
parent 3fe3226daa
commit 46be182ccb
5 changed files with 12 additions and 4 deletions

View File

@ -64,6 +64,7 @@ bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn, pid_t pid
}
struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
struct ctdbd_connection *conn,
const char *name,
int hash_size, int tdb_flags,

View File

@ -1578,6 +1578,7 @@ static size_t db_ctdb_id(struct db_context *db, uint8_t *id, size_t idlen)
}
struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
struct ctdbd_connection *conn,
const char *name,
int hash_size, int tdb_flags,
@ -1703,8 +1704,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
}
if (result->persistent) {
db_ctdb->lock_ctx = g_lock_ctx_init(
db_ctdb, ctdb_conn_msg_ctx(db_ctdb->conn));
db_ctdb->lock_ctx = g_lock_ctx_init(db_ctdb, msg_ctx);
if (db_ctdb->lock_ctx == NULL) {
DEBUG(0, ("g_lock_ctx_init failed\n"));
TALLOC_FREE(result);

View File

@ -29,6 +29,7 @@ struct db_context;
struct ctdbd_connection;
struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
struct ctdbd_connection *conn,
const char *name,
int hash_size, int tdb_flags,

View File

@ -144,6 +144,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
}
/* allow ctdb for individual databases to be disabled */
if (lp_parm_bool(-1, "ctdb", partname, True)) {
struct messaging_context *msg_ctx;
struct ctdbd_connection *conn;
conn = messaging_ctdbd_connection();
@ -152,7 +153,9 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
errno = EIO;
return NULL;
}
result = db_open_ctdb(mem_ctx, conn, partname,
msg_ctx = server_messaging_context();
result = db_open_ctdb(mem_ctx, msg_ctx, conn, partname,
hash_size,
tdb_flags, open_flags, mode,
lock_order, dbwrap_flags);

View File

@ -31,15 +31,18 @@ bool run_local_dbwrap_ctdb(int dummy)
bool ret = false;
NTSTATUS status;
uint32_t val;
struct messaging_context *msg_ctx;
struct ctdbd_connection *conn;
msg_ctx = server_messaging_context();
conn = messaging_ctdbd_connection();
if (conn == NULL) {
fprintf(stderr, "no ctdbd connection\n");
goto fail;
}
db = db_open_ctdb(talloc_tos(), conn, "torture.tdb", 0, TDB_DEFAULT,
db = db_open_ctdb(talloc_tos(), msg_ctx, conn, "torture.tdb",
0, TDB_DEFAULT,
O_RDWR, 0755, DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) {
perror("db_open_ctdb failed");