mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
dbwrap: Clarify db_open_watched API
Point out in the API that "backend" talloc_moves into the watched database. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Aug 17 21:29:15 CEST 2018 on sn-devel-144
This commit is contained in:
parent
22be863ba3
commit
14f9e6f833
@ -738,7 +738,7 @@ static size_t dbwrap_watched_id(struct db_context *db, uint8_t *id,
|
||||
}
|
||||
|
||||
struct db_context *db_open_watched(TALLOC_CTX *mem_ctx,
|
||||
struct db_context *backend,
|
||||
struct db_context **backend,
|
||||
struct messaging_context *msg)
|
||||
{
|
||||
struct db_context *db;
|
||||
@ -757,9 +757,9 @@ struct db_context *db_open_watched(TALLOC_CTX *mem_ctx,
|
||||
|
||||
ctx->msg = msg;
|
||||
|
||||
db->lock_order = backend->lock_order;
|
||||
backend->lock_order = DBWRAP_LOCK_ORDER_NONE;
|
||||
ctx->backend = talloc_move(ctx, &backend);
|
||||
ctx->backend = talloc_move(ctx, backend);
|
||||
db->lock_order = ctx->backend->lock_order;
|
||||
ctx->backend->lock_order = DBWRAP_LOCK_ORDER_NONE;
|
||||
|
||||
db->fetch_locked = dbwrap_watched_fetch_locked;
|
||||
db->do_locked = dbwrap_watched_do_locked;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "messages.h"
|
||||
|
||||
struct db_context *db_open_watched(TALLOC_CTX *mem_ctx,
|
||||
struct db_context *backend,
|
||||
struct db_context **backend,
|
||||
struct messaging_context *msg);
|
||||
struct tevent_req *dbwrap_watched_watch_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
|
@ -172,7 +172,7 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result->db = db_open_watched(result, backend, msg);
|
||||
result->db = db_open_watched(result, &backend, msg);
|
||||
if (result->db == NULL) {
|
||||
DBG_WARNING("db_open_watched failed\n");
|
||||
TALLOC_FREE(result);
|
||||
|
@ -86,7 +86,7 @@ static bool locking_init_internal(bool read_only)
|
||||
return False;
|
||||
}
|
||||
|
||||
lock_db = db_open_watched(NULL, backend, server_messaging_context());
|
||||
lock_db = db_open_watched(NULL, &backend, server_messaging_context());
|
||||
if (lock_db == NULL) {
|
||||
DBG_ERR("db_open_watched failed\n");
|
||||
TALLOC_FREE(backend);
|
||||
|
@ -89,7 +89,7 @@ NTSTATUS smbXsrv_session_global_init(struct messaging_context *msg_ctx)
|
||||
return status;
|
||||
}
|
||||
|
||||
db_ctx = db_open_watched(NULL, backend, server_messaging_context());
|
||||
db_ctx = db_open_watched(NULL, &backend, server_messaging_context());
|
||||
if (db_ctx == NULL) {
|
||||
TALLOC_FREE(backend);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
|
@ -97,7 +97,7 @@ bool run_dbwrap_do_locked1(int dummy)
|
||||
return false;
|
||||
}
|
||||
|
||||
db = db_open_watched(talloc_tos(), backend, msg);
|
||||
db = db_open_watched(talloc_tos(), &backend, msg);
|
||||
if (db == NULL) {
|
||||
fprintf(stderr, "db_open_watched failed: %s\n",
|
||||
strerror(errno));
|
||||
|
@ -56,7 +56,7 @@ bool run_dbwrap_watch1(int dummy)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
db = db_open_watched(ev, backend, msg);
|
||||
db = db_open_watched(ev, &backend, msg);
|
||||
|
||||
rec = dbwrap_fetch_locked(db, db, key);
|
||||
if (rec == NULL) {
|
||||
@ -153,7 +153,7 @@ bool run_dbwrap_watch2(int dummy)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
db = db_open_watched(ev, backend, msg);
|
||||
db = db_open_watched(ev, &backend, msg);
|
||||
if (db == NULL) {
|
||||
fprintf(stderr, "db_open_watched failed\n");
|
||||
goto fail;
|
||||
|
Loading…
Reference in New Issue
Block a user