summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-03-21 00:52:34 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:22:16 -0400
commite5e32021c23f3726d68ee756e8e3de48b3214063 (patch)
treec2a04ab91bd3d21637ce4c3629d4685e27b64274 /src/db/sysdb.c
parentaacf8781c61e928c74fcc89f02225374b283b872 (diff)
downloadsssd-e5e32021c23f3726d68ee756e8e3de48b3214063.tar.gz
sssd-e5e32021c23f3726d68ee756e8e3de48b3214063.tar.xz
sssd-e5e32021c23f3726d68ee756e8e3de48b3214063.zip
sysdb: remove remaining traces of sysdb_handle
Diffstat (limited to 'src/db/sysdb.c')
-rw-r--r--src/db/sysdb.c193
1 files changed, 0 insertions, 193 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 22051da37..1d86c4b34 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -63,16 +63,6 @@ struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx)
return ctx->ldb;
}
-struct ldb_context *sysdb_handle_get_ldb(struct sysdb_handle *handle)
-{
- return handle->ctx->ldb;
-}
-
-struct sysdb_ctx *sysdb_handle_get_ctx(struct sysdb_handle *handle)
-{
- return handle->ctx;
-}
-
struct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *memctx)
{
return talloc_zero(memctx, struct sysdb_attrs);
@@ -418,117 +408,6 @@ int sysdb_error_to_errno(int ldberr)
}
}
-/* =Internal-Operations-Queue============================================= */
-
-static void sysdb_run_operation(struct tevent_context *ev,
- struct tevent_timer *te,
- struct timeval tv, void *pvt)
-{
- struct sysdb_handle *handle = talloc_get_type(pvt, struct sysdb_handle);
-
- tevent_req_done(handle->subreq);
-}
-
-static void sysdb_schedule_operation(struct sysdb_handle *handle)
-{
- struct timeval tv = { 0, 0 };
- struct tevent_timer *te;
-
- te = tevent_add_timer(handle->ctx->ev, handle, tv,
- sysdb_run_operation, handle);
- if (!te) {
- DEBUG(1, ("Failed to add critical timer to run next handle!\n"));
- }
-}
-
-static int sysdb_handle_destructor(void *mem)
-{
- struct sysdb_handle *handle = talloc_get_type(mem, struct sysdb_handle);
- bool start_next = false;
- int ret;
-
- /* if this was the current op start next */
- if (handle->ctx->queue == handle) {
- start_next = true;
- }
-
- DLIST_REMOVE(handle->ctx->queue, handle);
-
- if (start_next && handle->ctx->queue) {
- /* run next */
- sysdb_schedule_operation(handle->ctx->queue);
- }
-
- if (handle->transaction_active) {
- ret = ldb_transaction_cancel(handle->ctx->ldb);
- if (ret != LDB_SUCCESS) {
- DEBUG(1, ("Failed to cancel ldb transaction! (%d)\n", ret));
- }
- /* FIXME: abort() ? */
- handle->transaction_active = false;
- }
-
- return 0;
-}
-
-struct sysdb_get_handle_state {
- struct tevent_context *ev;
- struct sysdb_ctx *ctx;
-
- struct sysdb_handle *handle;
-};
-
-struct tevent_req *sysdb_get_handle_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct sysdb_ctx *ctx)
-{
- struct tevent_req *req;
- struct sysdb_get_handle_state *state;
- struct sysdb_handle *handle;
-
- req = tevent_req_create(mem_ctx, &state, struct sysdb_get_handle_state);
- if (!req) return NULL;
-
- state->ev = ev;
- state->ctx = ctx;
-
- handle = talloc_zero(state, struct sysdb_handle);
- if (!handle) {
- talloc_zfree(req);
- return NULL;
- }
-
- handle->ctx = ctx;
- handle->subreq = req;
-
- talloc_set_destructor((TALLOC_CTX *)handle, sysdb_handle_destructor);
-
- DLIST_ADD_END(ctx->queue, handle, struct sysdb_handle *);
-
- if (ctx->queue == handle) {
- /* this is the first in the queue, schedule an immediate run */
- sysdb_schedule_operation(handle);
- }
-
- state->handle = handle;
-
- return req;
-}
-
-static int sysdb_get_handle_recv(struct tevent_req *req, TALLOC_CTX *memctx,
- struct sysdb_handle **handle)
-{
- struct sysdb_get_handle_state *state = tevent_req_data(req,
- struct sysdb_get_handle_state);
-
- TEVENT_REQ_RETURN_ON_ERROR(req);
-
- *handle = talloc_steal(memctx, state->handle);
- if (!*handle) return ENOMEM;
-
- return EOK;
-}
-
/* =Transactions========================================================== */
int sysdb_transaction_start(struct sysdb_ctx *ctx)
@@ -564,78 +443,6 @@ int sysdb_transaction_cancel(struct sysdb_ctx *ctx)
return sysdb_error_to_errno(ret);
}
-/* =Operations============================================================ */
-
-struct sysdb_operation_state {
- struct tevent_context *ev;
- struct sysdb_ctx *ctx;
-
- struct sysdb_handle *handle;
-};
-
-static void sysdb_operation_process(struct tevent_req *subreq);
-
-struct tevent_req *sysdb_operation_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct sysdb_ctx *ctx)
-{
- struct tevent_req *req, *subreq;
- struct sysdb_operation_state *state;
-
- req = tevent_req_create(mem_ctx, &state, struct sysdb_operation_state);
- if (!req) return NULL;
-
- state->ev = ev;
- state->ctx = ctx;
-
- subreq = sysdb_get_handle_send(state, ev, ctx);
- if (!subreq) {
- talloc_zfree(req);
- return NULL;
- }
-
- tevent_req_set_callback(subreq, sysdb_operation_process, req);
-
- return req;
-}
-
-static void sysdb_operation_process(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(subreq,
- struct tevent_req);
- struct sysdb_operation_state *state = tevent_req_data(req,
- struct sysdb_operation_state);
- int ret;
-
- ret = sysdb_get_handle_recv(subreq, state, &state->handle);
- talloc_zfree(subreq);
- if (ret) {
- tevent_req_error(req, ret);
- return;
- }
-
- tevent_req_done(req);
-}
-
-int sysdb_operation_recv(struct tevent_req *req, TALLOC_CTX *memctx,
- struct sysdb_handle **handle)
-{
- struct sysdb_operation_state *state = tevent_req_data(req,
- struct sysdb_operation_state);
-
- TEVENT_REQ_RETURN_ON_ERROR(req);
-
- *handle = talloc_steal(memctx, state->handle);
- if (!*handle) return ENOMEM;
-
- return EOK;
-}
-
-void sysdb_operation_done(struct sysdb_handle *handle)
-{
- talloc_free(handle);
-}
-
/* =Initialization======================================================== */
static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,