Home | History | Annotate | Download | only in src

Lines Matching refs:handle

3 #include <semanage/handle.h>
9 static int assert_init(semanage_handle_t * handle, dbase_config_t * dconfig)
14 ERR(handle,
24 static int enter_ro(semanage_handle_t * handle, dbase_config_t * dconfig)
27 if (assert_init(handle, dconfig) < 0)
30 if (!handle->is_in_transaction &&
31 handle->conf->store_type == SEMANAGE_CON_DIRECT) {
33 if (semanage_get_active_lock(handle) < 0) {
34 ERR(handle, "could not get the active lock");
39 if (dconfig->dtable->cache(handle, dconfig->dbase) < 0)
45 ERR(handle, "could not enter read-only section");
49 static inline int exit_ro(semanage_handle_t * handle)
52 int commit_num = handle->funcs->get_serial(handle);
54 if (!handle->is_in_transaction &&
55 handle->conf->store_type == SEMANAGE_CON_DIRECT)
56 semanage_release_active_lock(handle);
61 static int enter_rw(semanage_handle_t * handle, dbase_config_t * dconfig)
64 if (assert_init(handle, dconfig) < 0)
67 if (!handle->is_in_transaction) {
68 ERR(handle, "this operation requires a transaction");
72 if (dconfig->dtable->cache(handle, dconfig->dbase) < 0)
78 ERR(handle, "could not enter read-write section");
82 int dbase_modify(semanage_handle_t * handle,
87 if (enter_rw(handle, dconfig) < 0)
90 if (dconfig->dtable->modify(handle, dconfig->dbase, key, data) < 0)
96 int dbase_set(semanage_handle_t * handle,
101 if (enter_rw(handle, dconfig) < 0)
104 if (dconfig->dtable->set(handle, dconfig->dbase, key, data) < 0)
110 int dbase_del(semanage_handle_t * handle,
114 if (enter_rw(handle, dconfig) < 0)
117 if (dconfig->dtable->del(handle, dconfig->dbase, key) < 0)
123 int dbase_query(semanage_handle_t * handle,
128 if (enter_ro(handle, dconfig) < 0)
131 if (dconfig->dtable->query(handle, dconfig->dbase, key, response) < 0) {
132 exit_ro(handle);
136 return exit_ro(handle);
139 int dbase_exists(semanage_handle_t * handle,
144 if (enter_ro(handle, dconfig) < 0)
147 if (dconfig->dtable->exists(handle, dconfig->dbase, key, response) < 0) {
148 exit_ro(handle);
152 return exit_ro(handle);
155 int dbase_count(semanage_handle_t * handle,
159 if (enter_ro(handle, dconfig) < 0)
162 if (dconfig->dtable->count(handle, dconfig->dbase, response) < 0) {
163 exit_ro(handle);
167 return exit_ro(handle);
170 int dbase_iterate(semanage_handle_t * handle,
176 if (enter_ro(handle, dconfig) < 0)
179 if (dconfig->dtable->iterate(handle, dconfig->dbase, fn, fn_arg) < 0) {
180 exit_ro(handle);
184 return exit_ro(handle);
187 int dbase_list(semanage_handle_t * handle,
192 if (enter_ro(handle, dconfig) < 0)
195 if (dconfig->dtable->list(handle, dconfig->dbase, records, count) < 0) {
196 exit_ro(handle);
200 return exit_ro(handle);