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()
208 struct ecryptfs_msg_ctx *msg_ctx; in ecryptfs_process_response() local
220 msg_ctx = &ecryptfs_msg_ctx_arr[msg->index]; in ecryptfs_process_response()
221 mutex_lock(&msg_ctx->mux); in ecryptfs_process_response()
222 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_PENDING) { in ecryptfs_process_response()
227 } else if (msg_ctx->counter != seq) { in ecryptfs_process_response()
231 msg_ctx->counter, seq); in ecryptfs_process_response()
235 msg_ctx->msg = kmemdup(msg, msg_size, GFP_KERNEL); in ecryptfs_process_response()
236 if (!msg_ctx->msg) { in ecryptfs_process_response()
240 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_DONE; in ecryptfs_process_response()
241 wake_up_process(msg_ctx->task); in ecryptfs_process_response()
244 mutex_unlock(&msg_ctx->mux); in ecryptfs_process_response()
261 struct ecryptfs_msg_ctx **msg_ctx) in ecryptfs_send_message_locked() argument
272 rc = ecryptfs_acquire_free_msg_ctx(msg_ctx); in ecryptfs_send_message_locked()
279 ecryptfs_msg_ctx_free_to_alloc(*msg_ctx); in ecryptfs_send_message_locked()
280 mutex_unlock(&(*msg_ctx)->mux); in ecryptfs_send_message_locked()
282 rc = ecryptfs_send_miscdev(data, data_len, *msg_ctx, msg_type, 0, in ecryptfs_send_message_locked()
302 struct ecryptfs_msg_ctx **msg_ctx) in ecryptfs_send_message() argument
308 msg_ctx); in ecryptfs_send_message()
324 int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx, in ecryptfs_wait_for_response() argument
333 mutex_lock(&msg_ctx->mux); in ecryptfs_wait_for_response()
334 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_DONE) { in ecryptfs_wait_for_response()
336 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()
342 *msg = msg_ctx->msg; in ecryptfs_wait_for_response()
343 msg_ctx->msg = NULL; in ecryptfs_wait_for_response()
345 ecryptfs_msg_ctx_alloc_to_free(msg_ctx); in ecryptfs_wait_for_response()
346 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()