Lines Matching refs:msg_ctx

38 static int ecryptfs_acquire_free_msg_ctx(struct ecryptfs_msg_ctx **msg_ctx)  in ecryptfs_acquire_free_msg_ctx()  argument
53 *msg_ctx = list_entry(p, struct ecryptfs_msg_ctx, node); in ecryptfs_acquire_free_msg_ctx()
54 if (mutex_trylock(&(*msg_ctx)->mux)) { in ecryptfs_acquire_free_msg_ctx()
55 (*msg_ctx)->task = current; in ecryptfs_acquire_free_msg_ctx()
71 static void ecryptfs_msg_ctx_free_to_alloc(struct ecryptfs_msg_ctx *msg_ctx) in ecryptfs_msg_ctx_free_to_alloc() argument
73 list_move(&msg_ctx->node, &ecryptfs_msg_ctx_alloc_list); in ecryptfs_msg_ctx_free_to_alloc()
74 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_PENDING; in ecryptfs_msg_ctx_free_to_alloc()
75 msg_ctx->counter = ++ecryptfs_msg_counter; in ecryptfs_msg_ctx_free_to_alloc()
84 void ecryptfs_msg_ctx_alloc_to_free(struct ecryptfs_msg_ctx *msg_ctx) in ecryptfs_msg_ctx_alloc_to_free() argument
86 list_move(&(msg_ctx->node), &ecryptfs_msg_ctx_free_list); in ecryptfs_msg_ctx_alloc_to_free()
87 kfree(msg_ctx->msg); in ecryptfs_msg_ctx_alloc_to_free()
88 msg_ctx->msg = NULL; in ecryptfs_msg_ctx_alloc_to_free()
89 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_FREE; in ecryptfs_msg_ctx_alloc_to_free()
158 struct ecryptfs_msg_ctx *msg_ctx, *msg_ctx_tmp; in ecryptfs_exorcise_daemon() local
168 list_for_each_entry_safe(msg_ctx, msg_ctx_tmp, in ecryptfs_exorcise_daemon()
170 list_del(&msg_ctx->daemon_out_list); in ecryptfs_exorcise_daemon()
174 ecryptfs_msg_ctx_alloc_to_free(msg_ctx); in ecryptfs_exorcise_daemon()
209 struct ecryptfs_msg_ctx *msg_ctx; in ecryptfs_process_response() local
221 msg_ctx = &ecryptfs_msg_ctx_arr[msg->index]; in ecryptfs_process_response()
222 mutex_lock(&msg_ctx->mux); in ecryptfs_process_response()
223 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_PENDING) { in ecryptfs_process_response()
228 } else if (msg_ctx->counter != seq) { in ecryptfs_process_response()
232 msg_ctx->counter, seq); in ecryptfs_process_response()
236 msg_ctx->msg = kmemdup(msg, msg_size, GFP_KERNEL); in ecryptfs_process_response()
237 if (!msg_ctx->msg) { in ecryptfs_process_response()
241 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_DONE; in ecryptfs_process_response()
242 wake_up_process(msg_ctx->task); in ecryptfs_process_response()
245 mutex_unlock(&msg_ctx->mux); in ecryptfs_process_response()
263 struct ecryptfs_msg_ctx **msg_ctx) in ecryptfs_send_message_locked() argument
274 rc = ecryptfs_acquire_free_msg_ctx(msg_ctx); in ecryptfs_send_message_locked()
281 ecryptfs_msg_ctx_free_to_alloc(*msg_ctx); in ecryptfs_send_message_locked()
282 mutex_unlock(&(*msg_ctx)->mux); in ecryptfs_send_message_locked()
284 rc = ecryptfs_send_miscdev(data, data_len, *msg_ctx, msg_type, 0, in ecryptfs_send_message_locked()
304 struct ecryptfs_msg_ctx **msg_ctx) in ecryptfs_send_message() argument
310 msg_ctx); in ecryptfs_send_message()
326 int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx, in ecryptfs_wait_for_response() argument
335 mutex_lock(&msg_ctx->mux); in ecryptfs_wait_for_response()
336 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_DONE) { in ecryptfs_wait_for_response()
338 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()
344 *msg = msg_ctx->msg; in ecryptfs_wait_for_response()
345 msg_ctx->msg = NULL; in ecryptfs_wait_for_response()
347 ecryptfs_msg_ctx_alloc_to_free(msg_ctx); in ecryptfs_wait_for_response()
348 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()