Lines Matching refs:msg_ctx

51 static int ecryptfs_acquire_free_msg_ctx(struct ecryptfs_msg_ctx **msg_ctx)  in ecryptfs_acquire_free_msg_ctx()  argument
66 *msg_ctx = list_entry(p, struct ecryptfs_msg_ctx, node); in ecryptfs_acquire_free_msg_ctx()
67 if (mutex_trylock(&(*msg_ctx)->mux)) { in ecryptfs_acquire_free_msg_ctx()
68 (*msg_ctx)->task = current; in ecryptfs_acquire_free_msg_ctx()
84 static void ecryptfs_msg_ctx_free_to_alloc(struct ecryptfs_msg_ctx *msg_ctx) in ecryptfs_msg_ctx_free_to_alloc() argument
86 list_move(&msg_ctx->node, &ecryptfs_msg_ctx_alloc_list); in ecryptfs_msg_ctx_free_to_alloc()
87 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_PENDING; in ecryptfs_msg_ctx_free_to_alloc()
88 msg_ctx->counter = ++ecryptfs_msg_counter; in ecryptfs_msg_ctx_free_to_alloc()
97 void ecryptfs_msg_ctx_alloc_to_free(struct ecryptfs_msg_ctx *msg_ctx) in ecryptfs_msg_ctx_alloc_to_free() argument
99 list_move(&(msg_ctx->node), &ecryptfs_msg_ctx_free_list); in ecryptfs_msg_ctx_alloc_to_free()
100 kfree(msg_ctx->msg); in ecryptfs_msg_ctx_alloc_to_free()
101 msg_ctx->msg = NULL; in ecryptfs_msg_ctx_alloc_to_free()
102 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_FREE; in ecryptfs_msg_ctx_alloc_to_free()
173 struct ecryptfs_msg_ctx *msg_ctx, *msg_ctx_tmp; in ecryptfs_exorcise_daemon() local
183 list_for_each_entry_safe(msg_ctx, msg_ctx_tmp, in ecryptfs_exorcise_daemon()
185 list_del(&msg_ctx->daemon_out_list); in ecryptfs_exorcise_daemon()
189 ecryptfs_msg_ctx_alloc_to_free(msg_ctx); in ecryptfs_exorcise_daemon()
223 struct ecryptfs_msg_ctx *msg_ctx; in ecryptfs_process_response() local
235 msg_ctx = &ecryptfs_msg_ctx_arr[msg->index]; in ecryptfs_process_response()
236 mutex_lock(&msg_ctx->mux); in ecryptfs_process_response()
237 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_PENDING) { in ecryptfs_process_response()
242 } else if (msg_ctx->counter != seq) { in ecryptfs_process_response()
246 msg_ctx->counter, seq); in ecryptfs_process_response()
250 msg_ctx->msg = kmemdup(msg, msg_size, GFP_KERNEL); in ecryptfs_process_response()
251 if (!msg_ctx->msg) { in ecryptfs_process_response()
257 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_DONE; in ecryptfs_process_response()
258 wake_up_process(msg_ctx->task); in ecryptfs_process_response()
261 mutex_unlock(&msg_ctx->mux); in ecryptfs_process_response()
278 struct ecryptfs_msg_ctx **msg_ctx) in ecryptfs_send_message_locked() argument
289 rc = ecryptfs_acquire_free_msg_ctx(msg_ctx); in ecryptfs_send_message_locked()
296 ecryptfs_msg_ctx_free_to_alloc(*msg_ctx); in ecryptfs_send_message_locked()
297 mutex_unlock(&(*msg_ctx)->mux); in ecryptfs_send_message_locked()
299 rc = ecryptfs_send_miscdev(data, data_len, *msg_ctx, msg_type, 0, in ecryptfs_send_message_locked()
319 struct ecryptfs_msg_ctx **msg_ctx) in ecryptfs_send_message() argument
325 msg_ctx); in ecryptfs_send_message()
341 int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx, in ecryptfs_wait_for_response() argument
350 mutex_lock(&msg_ctx->mux); in ecryptfs_wait_for_response()
351 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_DONE) { in ecryptfs_wait_for_response()
353 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()
359 *msg = msg_ctx->msg; in ecryptfs_wait_for_response()
360 msg_ctx->msg = NULL; in ecryptfs_wait_for_response()
362 ecryptfs_msg_ctx_alloc_to_free(msg_ctx); in ecryptfs_wait_for_response()
363 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()