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);
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);
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,
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;
};
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;
}
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));
.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",
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;
}
#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,
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;