Lines Matching refs:msg_ctx
160 struct ecryptfs_msg_ctx *msg_ctx, u8 msg_type, in ecryptfs_send_miscdev() argument
173 mutex_lock(&msg_ctx->mux); in ecryptfs_send_miscdev()
174 msg_ctx->msg = msg; in ecryptfs_send_miscdev()
175 msg_ctx->msg->index = msg_ctx->index; in ecryptfs_send_miscdev()
176 msg_ctx->msg->data_len = data_size; in ecryptfs_send_miscdev()
177 msg_ctx->type = msg_type; in ecryptfs_send_miscdev()
178 memcpy(msg_ctx->msg->data, data, data_size); in ecryptfs_send_miscdev()
179 msg_ctx->msg_size = (sizeof(*msg_ctx->msg) + data_size); in ecryptfs_send_miscdev()
180 list_add_tail(&msg_ctx->daemon_out_list, &daemon->msg_ctx_out_queue); in ecryptfs_send_miscdev()
181 mutex_unlock(&msg_ctx->mux); in ecryptfs_send_miscdev()
231 struct ecryptfs_msg_ctx *msg_ctx; in ecryptfs_miscdev_read() local
272 msg_ctx = list_first_entry(&daemon->msg_ctx_out_queue, in ecryptfs_miscdev_read()
274 BUG_ON(!msg_ctx); in ecryptfs_miscdev_read()
275 mutex_lock(&msg_ctx->mux); in ecryptfs_miscdev_read()
276 if (msg_ctx->msg) { in ecryptfs_miscdev_read()
278 msg_ctx->msg_size, in ecryptfs_miscdev_read()
288 msg_ctx->msg_size = 0; in ecryptfs_miscdev_read()
291 + msg_ctx->msg_size); in ecryptfs_miscdev_read()
300 if (put_user(msg_ctx->type, buf)) in ecryptfs_miscdev_read()
302 if (put_user(cpu_to_be32(msg_ctx->counter), in ecryptfs_miscdev_read()
306 if (msg_ctx->msg) { in ecryptfs_miscdev_read()
310 if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size)) in ecryptfs_miscdev_read()
312 i += msg_ctx->msg_size; in ecryptfs_miscdev_read()
315 list_del(&msg_ctx->daemon_out_list); in ecryptfs_miscdev_read()
316 kfree(msg_ctx->msg); in ecryptfs_miscdev_read()
317 msg_ctx->msg = NULL; in ecryptfs_miscdev_read()
320 if (msg_ctx->type != ECRYPTFS_MSG_REQUEST) in ecryptfs_miscdev_read()
321 ecryptfs_msg_ctx_alloc_to_free(msg_ctx); in ecryptfs_miscdev_read()
323 mutex_unlock(&msg_ctx->mux); in ecryptfs_miscdev_read()