Lines Matching refs:daemon

31 	struct ecryptfs_daemon *daemon = file->private_data;
34 mutex_lock(&daemon->mux);
35 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
37 "daemon\n", __func__);
40 if (daemon->flags & ECRYPTFS_DAEMON_IN_READ)
42 if (daemon->flags & ECRYPTFS_DAEMON_IN_POLL)
44 daemon->flags |= ECRYPTFS_DAEMON_IN_POLL;
45 mutex_unlock(&daemon->mux);
46 poll_wait(file, &daemon->wait, pt);
47 mutex_lock(&daemon->mux);
48 if (!list_empty(&daemon->msg_ctx_out_queue))
51 daemon->flags &= ~ECRYPTFS_DAEMON_IN_POLL;
52 mutex_unlock(&daemon->mux);
66 struct ecryptfs_daemon *daemon = NULL;
70 rc = ecryptfs_find_daemon_by_euid(&daemon);
75 rc = ecryptfs_spawn_daemon(&daemon, file);
77 printk(KERN_ERR "%s: Error attempting to spawn daemon; "
81 mutex_lock(&daemon->mux);
82 if (daemon->flags & ECRYPTFS_DAEMON_MISCDEV_OPEN) {
86 daemon->flags |= ECRYPTFS_DAEMON_MISCDEV_OPEN;
87 file->private_data = daemon;
90 mutex_unlock(&daemon->mux);
101 * This keeps the daemon registered until the daemon sends another
109 struct ecryptfs_daemon *daemon = file->private_data;
112 mutex_lock(&daemon->mux);
113 BUG_ON(!(daemon->flags & ECRYPTFS_DAEMON_MISCDEV_OPEN));
114 daemon->flags &= ~ECRYPTFS_DAEMON_MISCDEV_OPEN;
116 mutex_unlock(&daemon->mux);
119 rc = ecryptfs_exorcise_daemon(daemon);
123 "shut down daemon; rc = [%d]. Please report this "
132 * @data: Data to send to daemon; may be NULL
133 * @data_size: Amount of data to send to daemon
138 * @daemon: eCryptfs daemon object
148 u16 msg_flags, struct ecryptfs_daemon *daemon)
163 list_add_tail(&msg_ctx->daemon_out_list, &daemon->msg_ctx_out_queue);
166 mutex_lock(&daemon->mux);
167 daemon->num_queued_msg_ctx++;
168 wake_up_interruptible(&daemon->wait);
169 mutex_unlock(&daemon->mux);
200 * @buf: User buffer into which to copy the next message on the daemon queue
204 * Pulls the most recent message from the daemon queue, formats it for
213 struct ecryptfs_daemon *daemon = file->private_data;
221 mutex_lock(&daemon->mux);
222 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
225 "daemon\n", __func__);
228 if (daemon->flags & ECRYPTFS_DAEMON_IN_READ) {
232 /* This daemon will not go away so long as this flag is set */
233 daemon->flags |= ECRYPTFS_DAEMON_IN_READ;
235 if (list_empty(&daemon->msg_ctx_out_queue)) {
236 mutex_unlock(&daemon->mux);
238 daemon->wait, !list_empty(&daemon->msg_ctx_out_queue));
239 mutex_lock(&daemon->mux);
245 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
249 if (list_empty(&daemon->msg_ctx_out_queue)) {
255 msg_ctx = list_first_entry(&daemon->msg_ctx_out_queue,
301 /* We do not expect a reply from the userspace daemon for any
308 daemon->flags &= ~ECRYPTFS_DAEMON_IN_READ;
309 mutex_unlock(&daemon->mux);
314 * ecryptfs_miscdev_response - miscdevess response to message previously sent to daemon
321 static int ecryptfs_miscdev_response(struct ecryptfs_daemon *daemon, char *data,
334 rc = ecryptfs_process_response(daemon, msg, seq);
343 * ecryptfs_miscdev_write - handle write to daemon miscdev handle
464 * Messages sent to the userspace daemon from the kernel are placed on
465 * a queue associated with the daemon. The next read against the
466 * miscdev handle by that daemon will return the oldest message placed
467 * on the message queue for the daemon.