diff options
author | Volker Lendecke <vl@samba.org> | 2019-10-10 13:40:44 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-11-06 20:36:34 +0000 |
commit | 8febbc2bcd2a136281ad9b4b90537028b6d5c4e2 (patch) | |
tree | 4fa5f3be2141064430baf4a061bddca2d77b8aa5 /source3 | |
parent | 9dd65d1f991722bf6686ae21e4607192fc2bf327 (diff) | |
download | samba-8febbc2bcd2a136281ad9b4b90537028b6d5c4e2.tar.gz |
lib: Remove g_lock_do()
This puts too much logic into this lowlevel infrastructure module,
given the two minor external users.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/g_lock.h | 4 | ||||
-rw-r--r-- | source3/lib/g_lock.c | 64 |
2 files changed, 0 insertions, 68 deletions
diff --git a/source3/include/g_lock.h b/source3/include/g_lock.h index c3e3a509b80..782a2e9d160 100644 --- a/source3/include/g_lock.h +++ b/source3/include/g_lock.h @@ -51,10 +51,6 @@ NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, TDB_DATA key); NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, TDB_DATA key, const uint8_t *buf, size_t buflen); -NTSTATUS g_lock_do(TDB_DATA key, enum g_lock_type lock_type, - struct timeval timeout, - void (*fn)(void *private_data), void *private_data); - int g_lock_locks(struct g_lock_ctx *ctx, int (*fn)(TDB_DATA key, void *private_data), void *private_data); diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index 5940c51c1d3..43cb123661e 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -750,67 +750,3 @@ NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, TDB_DATA key, } return NT_STATUS_OK; } - -static bool g_lock_init_all(TALLOC_CTX *mem_ctx, - struct tevent_context **pev, - struct messaging_context **pmsg, - struct g_lock_ctx **pg_ctx) -{ - struct tevent_context *ev = NULL; - struct messaging_context *msg = NULL; - struct g_lock_ctx *g_ctx = NULL; - - ev = samba_tevent_context_init(mem_ctx); - if (ev == NULL) { - d_fprintf(stderr, "ERROR: could not init event context\n"); - goto fail; - } - msg = messaging_init(mem_ctx, ev); - if (msg == NULL) { - d_fprintf(stderr, "ERROR: could not init messaging context\n"); - goto fail; - } - g_ctx = g_lock_ctx_init(mem_ctx, msg); - if (g_ctx == NULL) { - d_fprintf(stderr, "ERROR: could not init g_lock context\n"); - goto fail; - } - - *pev = ev; - *pmsg = msg; - *pg_ctx = g_ctx; - return true; -fail: - TALLOC_FREE(g_ctx); - TALLOC_FREE(msg); - TALLOC_FREE(ev); - return false; -} - -NTSTATUS g_lock_do(TDB_DATA key, enum g_lock_type lock_type, - struct timeval timeout, - void (*fn)(void *private_data), void *private_data) -{ - struct tevent_context *ev = NULL; - struct messaging_context *msg = NULL; - struct g_lock_ctx *g_ctx = NULL; - NTSTATUS status; - - if (!g_lock_init_all(talloc_tos(), &ev, &msg, &g_ctx)) { - status = NT_STATUS_ACCESS_DENIED; - goto done; - } - - status = g_lock_lock(g_ctx, key, lock_type, timeout); - if (!NT_STATUS_IS_OK(status)) { - goto done; - } - fn(private_data); - g_lock_unlock(g_ctx, key); - -done: - TALLOC_FREE(g_ctx); - TALLOC_FREE(msg); - TALLOC_FREE(ev); - return status; -} |