Lines Matching refs:msg_ctx

147 			  struct ecryptfs_msg_ctx *msg_ctx, u8 msg_type,  in ecryptfs_send_miscdev()  argument
156 mutex_lock(&msg_ctx->mux); in ecryptfs_send_miscdev()
157 msg_ctx->msg = msg; in ecryptfs_send_miscdev()
158 msg_ctx->msg->index = msg_ctx->index; in ecryptfs_send_miscdev()
159 msg_ctx->msg->data_len = data_size; in ecryptfs_send_miscdev()
160 msg_ctx->type = msg_type; in ecryptfs_send_miscdev()
161 memcpy(msg_ctx->msg->data, data, data_size); in ecryptfs_send_miscdev()
162 msg_ctx->msg_size = (sizeof(*msg_ctx->msg) + data_size); in ecryptfs_send_miscdev()
163 list_add_tail(&msg_ctx->daemon_out_list, &daemon->msg_ctx_out_queue); in ecryptfs_send_miscdev()
164 mutex_unlock(&msg_ctx->mux); in ecryptfs_send_miscdev()
214 struct ecryptfs_msg_ctx *msg_ctx; in ecryptfs_miscdev_read() local
255 msg_ctx = list_first_entry(&daemon->msg_ctx_out_queue, in ecryptfs_miscdev_read()
257 BUG_ON(!msg_ctx); in ecryptfs_miscdev_read()
258 mutex_lock(&msg_ctx->mux); in ecryptfs_miscdev_read()
259 if (msg_ctx->msg) { in ecryptfs_miscdev_read()
261 msg_ctx->msg_size, in ecryptfs_miscdev_read()
271 msg_ctx->msg_size = 0; in ecryptfs_miscdev_read()
274 + msg_ctx->msg_size); in ecryptfs_miscdev_read()
283 if (put_user(msg_ctx->type, buf)) in ecryptfs_miscdev_read()
285 if (put_user(cpu_to_be32(msg_ctx->counter), in ecryptfs_miscdev_read()
289 if (msg_ctx->msg) { in ecryptfs_miscdev_read()
293 if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size)) in ecryptfs_miscdev_read()
295 i += msg_ctx->msg_size; in ecryptfs_miscdev_read()
298 list_del(&msg_ctx->daemon_out_list); in ecryptfs_miscdev_read()
299 kfree(msg_ctx->msg); in ecryptfs_miscdev_read()
300 msg_ctx->msg = NULL; in ecryptfs_miscdev_read()
303 if (msg_ctx->type != ECRYPTFS_MSG_REQUEST) in ecryptfs_miscdev_read()
304 ecryptfs_msg_ctx_alloc_to_free(msg_ctx); in ecryptfs_miscdev_read()
306 mutex_unlock(&msg_ctx->mux); in ecryptfs_miscdev_read()