mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
lib: Make g_lock_lock_send use TDB_DATA
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
c7d0e6f39b
commit
3bc87a20e9
@ -765,7 +765,7 @@ struct tevent_req *netlogon_creds_cli_lock_send(TALLOC_CTX *mem_ctx,
|
||||
|
||||
subreq = g_lock_lock_send(state, ev,
|
||||
context->db.g_ctx,
|
||||
context->db.key_name,
|
||||
string_term_tdb_data(context->db.key_name),
|
||||
G_LOCK_WRITE);
|
||||
if (tevent_req_nomem(subreq, req)) {
|
||||
return tevent_req_post(req, ev);
|
||||
@ -978,7 +978,7 @@ struct tevent_req *netlogon_creds_cli_lck_send(
|
||||
|
||||
subreq = g_lock_lock_send(state, ev,
|
||||
context->db.g_ctx,
|
||||
context->db.key_name,
|
||||
string_term_tdb_data(context->db.key_name),
|
||||
gtype);
|
||||
if (tevent_req_nomem(subreq, req)) {
|
||||
return tevent_req_post(req, ev);
|
||||
|
@ -41,7 +41,7 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct g_lock_ctx *ctx,
|
||||
const char *name,
|
||||
TDB_DATA key,
|
||||
enum g_lock_type type);
|
||||
NTSTATUS g_lock_lock_recv(struct tevent_req *req);
|
||||
NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
|
||||
|
@ -311,7 +311,7 @@ done:
|
||||
struct g_lock_lock_state {
|
||||
struct tevent_context *ev;
|
||||
struct g_lock_ctx *ctx;
|
||||
const char *name;
|
||||
TDB_DATA key;
|
||||
enum g_lock_type type;
|
||||
};
|
||||
|
||||
@ -343,7 +343,7 @@ static void g_lock_lock_fn(struct db_record *rec, void *private_data)
|
||||
struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct g_lock_ctx *ctx,
|
||||
const char *name,
|
||||
TDB_DATA key,
|
||||
enum g_lock_type type)
|
||||
{
|
||||
struct tevent_req *req;
|
||||
@ -357,15 +357,14 @@ struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
state->ev = ev;
|
||||
state->ctx = ctx;
|
||||
state->name = name;
|
||||
state->key = key;
|
||||
state->type = type;
|
||||
|
||||
fn_state = (struct g_lock_lock_fn_state) {
|
||||
.state = state, .self = messaging_server_id(ctx->msg)
|
||||
};
|
||||
|
||||
status = dbwrap_do_locked(ctx->db, string_term_tdb_data(name),
|
||||
g_lock_lock_fn, &fn_state);
|
||||
status = dbwrap_do_locked(ctx->db, key, g_lock_lock_fn, &fn_state);
|
||||
if (tevent_req_nterror(req, status)) {
|
||||
DBG_DEBUG("dbwrap_do_locked failed: %s\n",
|
||||
nt_errstr(status));
|
||||
@ -418,8 +417,7 @@ static void g_lock_lock_retry(struct tevent_req *subreq)
|
||||
.state = state, .self = messaging_server_id(state->ctx->msg)
|
||||
};
|
||||
|
||||
status = dbwrap_do_locked(state->ctx->db,
|
||||
string_term_tdb_data(state->name),
|
||||
status = dbwrap_do_locked(state->ctx->db, state->key,
|
||||
g_lock_lock_fn, &fn_state);
|
||||
if (tevent_req_nterror(req, status)) {
|
||||
DBG_DEBUG("dbwrap_do_locked failed: %s\n",
|
||||
@ -467,7 +465,8 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
|
||||
if (ev == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
req = g_lock_lock_send(frame, ev, ctx, name, type);
|
||||
req = g_lock_lock_send(frame, ev, ctx, string_term_tdb_data(name),
|
||||
type);
|
||||
if (req == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "messages.h"
|
||||
#include "lib/util/server_id.h"
|
||||
#include "lib/util/sys_rw.h"
|
||||
#include "lib/util/util_tdb.h"
|
||||
|
||||
static bool get_g_lock_ctx(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context **ev,
|
||||
@ -504,7 +505,8 @@ bool run_g_lock4(int dummy)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
req = g_lock_lock_send(ev, ev, ctx, lockname, G_LOCK_WRITE);
|
||||
req = g_lock_lock_send(ev, ev, ctx, string_term_tdb_data(lockname),
|
||||
G_LOCK_WRITE);
|
||||
if (req == NULL) {
|
||||
fprintf(stderr, "g_lock_lock send failed\n");
|
||||
goto fail;
|
||||
|
Loading…
Reference in New Issue
Block a user