#include "dbwrap/dbwrap.h"
struct g_lock_ctx;
+struct messaging_context;
enum g_lock_type {
G_LOCK_READ = 0,
G_LOCK_WRITE = 1,
};
-/*
- * Or'ed with g_lock_type
- */
-#define G_LOCK_PENDING (2)
+struct g_lock_rec {
+ enum g_lock_type lock_type;
+ struct server_id pid;
+};
struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
struct messaging_context *msg);
+struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct g_lock_ctx *ctx,
+ const char *name,
+ 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,
enum g_lock_type lock_type, struct timeval timeout);
NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name);
-NTSTATUS g_lock_get(struct g_lock_ctx *ctx, const char *name,
- struct server_id *pid);
+
+NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, const char *name,
+ const uint8_t *buf, size_t buflen);
NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
struct timeval timeout,
int (*fn)(const char *name, void *private_data),
void *private_data);
NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, const char *name,
- int (*fn)(struct server_id pid,
- enum g_lock_type lock_type,
- void *private_data),
+ void (*fn)(const struct g_lock_rec *locks,
+ size_t num_locks,
+ const uint8_t *data,
+ size_t datalen,
+ void *private_data),
void *private_data);
#endif