• Home
  • Raw
  • Download

Lines Matching +full:non +full:- +full:zero

4  * Copyright (C) 2004-2008 International Business Machines Corp.
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
46 * on the context. Sets the msg_ctx task to current. Returns zero on
47 * success; non-zero on error or upon failure to acquire a free
62 rc = -ENOMEM; in ecryptfs_acquire_free_msg_ctx()
67 if (mutex_trylock(&(*msg_ctx)->mux)) { in ecryptfs_acquire_free_msg_ctx()
68 (*msg_ctx)->task = current; in ecryptfs_acquire_free_msg_ctx()
73 rc = -ENOMEM; in ecryptfs_acquire_free_msg_ctx()
86 list_move(&msg_ctx->node, &ecryptfs_msg_ctx_alloc_list); in ecryptfs_msg_ctx_free_to_alloc()
87 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_PENDING; in ecryptfs_msg_ctx_free_to_alloc()
88 msg_ctx->counter = ++ecryptfs_msg_counter; in ecryptfs_msg_ctx_free_to_alloc()
99 list_move(&(msg_ctx->node), &ecryptfs_msg_ctx_free_list); in ecryptfs_msg_ctx_alloc_to_free()
100 kfree(msg_ctx->msg); in ecryptfs_msg_ctx_alloc_to_free()
101 msg_ctx->msg = NULL; in ecryptfs_msg_ctx_alloc_to_free()
102 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_FREE; in ecryptfs_msg_ctx_alloc_to_free()
107 * @daemon: If return value is zero, points to the desired daemon pointer
113 * Returns zero if the user id exists in the list; non-zero otherwise.
122 if (uid_eq((*daemon)->file->f_cred->euid, current_euid())) { in ecryptfs_find_daemon_by_euid()
127 rc = -EINVAL; in ecryptfs_find_daemon_by_euid()
133 * ecryptfs_spawn_daemon - Create and initialize a new daemon struct
140 * Returns zero on success; non-zero otherwise
149 rc = -ENOMEM; in ecryptfs_spawn_daemon()
152 (*daemon)->file = file; in ecryptfs_spawn_daemon()
153 mutex_init(&(*daemon)->mux); in ecryptfs_spawn_daemon()
154 INIT_LIST_HEAD(&(*daemon)->msg_ctx_out_queue); in ecryptfs_spawn_daemon()
155 init_waitqueue_head(&(*daemon)->wait); in ecryptfs_spawn_daemon()
156 (*daemon)->num_queued_msg_ctx = 0; in ecryptfs_spawn_daemon()
157 hlist_add_head(&(*daemon)->euid_chain, in ecryptfs_spawn_daemon()
164 * ecryptfs_exorcise_daemon - Destroy the daemon struct
174 mutex_lock(&daemon->mux); in ecryptfs_exorcise_daemon()
175 if ((daemon->flags & ECRYPTFS_DAEMON_IN_READ) in ecryptfs_exorcise_daemon()
176 || (daemon->flags & ECRYPTFS_DAEMON_IN_POLL)) { in ecryptfs_exorcise_daemon()
177 rc = -EBUSY; in ecryptfs_exorcise_daemon()
178 mutex_unlock(&daemon->mux); in ecryptfs_exorcise_daemon()
182 &daemon->msg_ctx_out_queue, daemon_out_list) { in ecryptfs_exorcise_daemon()
183 list_del(&msg_ctx->daemon_out_list); in ecryptfs_exorcise_daemon()
184 daemon->num_queued_msg_ctx--; in ecryptfs_exorcise_daemon()
189 hlist_del(&daemon->euid_chain); in ecryptfs_exorcise_daemon()
190 mutex_unlock(&daemon->mux); in ecryptfs_exorcise_daemon()
199 * msg->data_len and free the memory
211 * that msg_ctx->state == ECRYPTFS_MSG_CTX_STATE_DONE, and then
212 * proceed to read off and process the response message. Returns zero
213 * upon delivery to desired context element; non-zero upon delivery
216 * Returns zero on success; non-zero otherwise
225 if (msg->index >= ecryptfs_message_buf_len) { in ecryptfs_process_response()
226 rc = -EINVAL; in ecryptfs_process_response()
229 "allowable is [%d]\n", __func__, msg->index, in ecryptfs_process_response()
230 (ecryptfs_message_buf_len - 1)); in ecryptfs_process_response()
233 msg_ctx = &ecryptfs_msg_ctx_arr[msg->index]; in ecryptfs_process_response()
234 mutex_lock(&msg_ctx->mux); in ecryptfs_process_response()
235 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_PENDING) { in ecryptfs_process_response()
236 rc = -EINVAL; in ecryptfs_process_response()
240 } else if (msg_ctx->counter != seq) { in ecryptfs_process_response()
241 rc = -EINVAL; in ecryptfs_process_response()
244 msg_ctx->counter, seq); in ecryptfs_process_response()
247 msg_size = (sizeof(*msg) + msg->data_len); in ecryptfs_process_response()
248 msg_ctx->msg = kmemdup(msg, msg_size, GFP_KERNEL); in ecryptfs_process_response()
249 if (!msg_ctx->msg) { in ecryptfs_process_response()
250 rc = -ENOMEM; in ecryptfs_process_response()
253 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_DONE; in ecryptfs_process_response()
254 wake_up_process(msg_ctx->task); in ecryptfs_process_response()
257 mutex_unlock(&msg_ctx->mux); in ecryptfs_process_response()
270 * Returns zero on success; non-zero otherwise
281 rc = -ENOTCONN; in ecryptfs_send_message_locked()
293 mutex_unlock(&(*msg_ctx)->mux); in ecryptfs_send_message_locked()
312 * Returns zero on success; non-zero otherwise
332 * of time exceeds ecryptfs_message_wait_timeout. If zero is
334 * non-zero value is returned upon failure to receive a message or an
346 mutex_lock(&msg_ctx->mux); in ecryptfs_wait_for_response()
347 if (msg_ctx->state != ECRYPTFS_MSG_CTX_STATE_DONE) { in ecryptfs_wait_for_response()
349 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()
353 rc = -ENOMSG; in ecryptfs_wait_for_response()
355 *msg = msg_ctx->msg; in ecryptfs_wait_for_response()
356 msg_ctx->msg = NULL; in ecryptfs_wait_for_response()
359 mutex_unlock(&msg_ctx->mux); in ecryptfs_wait_for_response()
384 rc = -ENOMEM; in ecryptfs_init_messaging()
396 rc = -ENOMEM; in ecryptfs_init_messaging()