summaryrefslogtreecommitdiffstats
path: root/src/db
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
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')
-rw-r--r--src/db/sysdb.c193
-rw-r--r--src/db/sysdb.h3
-rw-r--r--src/db/sysdb_private.h26
3 files changed, 0 insertions, 222 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,
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 87a5ec56b..65e72141f 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -147,7 +147,6 @@
struct confdb_ctx;
struct sysdb_ctx_list;
struct sysdb_ctx;
-struct sysdb_handle;
struct sysdb_attrs {
int num;
@@ -212,8 +211,6 @@ char *sysdb_group_strdn(TALLOC_CTX *memctx,
struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx);
-struct ldb_context *sysdb_handle_get_ldb(struct sysdb_handle *handle);
-struct sysdb_ctx *sysdb_handle_get_ctx(struct sysdb_handle *handle);
int compare_ldb_dn_comp_num(const void *m1, const void *m2);
diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
index 270cf360e..e5494bd62 100644
--- a/src/db/sysdb_private.h
+++ b/src/db/sysdb_private.h
@@ -61,16 +61,6 @@
#include "db/sysdb.h"
-struct sysdb_handle {
- struct sysdb_handle *prev;
- struct sysdb_handle *next;
-
- struct sysdb_ctx *ctx;
- struct tevent_req *subreq;
-
- bool transaction_active;
-};
-
struct sysdb_ctx {
struct tevent_context *ev;
@@ -79,8 +69,6 @@ struct sysdb_ctx {
struct ldb_context *ldb;
char *ldb_file;
-
- struct sysdb_handle *queue;
};
struct sysdb_ctx_list {
@@ -90,18 +78,4 @@ struct sysdb_ctx_list {
char *db_path;
};
-/* An operation blocks the transaction queue as well, but does not
- * start a transaction, normally useful only for search type calls.
- * do *NOT* call within a transaction you'll deadlock sysdb.
- * Also make sure to free the handle as soon as the operation is
- * finished to avoid stalling or potentially deadlocking sysdb */
-
-struct tevent_req *sysdb_operation_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct sysdb_ctx *ctx);
-int sysdb_operation_recv(struct tevent_req *req, TALLOC_CTX *memctx,
- struct sysdb_handle **handle);
-
-void sysdb_operation_done(struct sysdb_handle *handle);
-
#endif /* __INT_SYS_DB_H__ */