• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/afs/

Lines Matching refs:call

32 /* synchronous call management */
38 /* asynchronous call management */
44 /* asynchronous incoming call management */
49 /* asynchronous incoming call initial processing */
168 * free a call
170 static void afs_free_call(struct afs_call *call)
173 call, call->type->name, atomic_read(&afs_outstanding_calls));
177 ASSERTCMP(call->rxcall, ==, NULL);
178 ASSERT(!work_pending(&call->async_work));
179 ASSERT(skb_queue_empty(&call->rx_queue));
180 ASSERT(call->type->name != NULL);
182 kfree(call->request);
183 kfree(call);
187 * allocate a call with flat request and reply buffers
192 struct afs_call *call;
194 call = kzalloc(sizeof(*call), GFP_NOFS);
195 if (!call)
199 call, type->name, atomic_read(&afs_outstanding_calls));
202 call->type = type;
203 call->request_size = request_size;
204 call->reply_max = reply_size;
207 call->request = kmalloc(request_size, GFP_NOFS);
208 if (!call->request)
213 call->buffer = kmalloc(reply_size, GFP_NOFS);
214 if (!call->buffer)
218 init_waitqueue_head(&call->waitq);
219 skb_queue_head_init(&call->rx_queue);
220 return call;
223 afs_free_call(call);
229 * clean up a call with flat buffer
231 void afs_flat_call_destructor(struct afs_call *call)
235 kfree(call->request);
236 call->request = NULL;
237 kfree(call->buffer);
238 call->buffer = NULL;
242 * attach the data from a bunch of pages on an inode to a call
244 static int afs_send_pages(struct afs_call *call, struct msghdr *msg,
249 pgoff_t first = call->first, last = call->last;
254 offset = call->first_offset;
255 call->first_offset = 0;
263 n = find_get_pages_contig(call->mapping, first, count, pages);
271 to = call->last_to;
287 call->state = AFS_CALL_AWAIT_REPLY;
288 ret = rxrpc_kernel_send_data(call->rxcall, msg,
307 * initiate a call
309 int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
318 _enter("%x,{%d},", addr->s_addr, ntohs(call->port));
320 ASSERT(call->type != NULL);
321 ASSERT(call->type->name != NULL);
324 call, call->type->name, key_serial(call->key),
327 call->wait_mode = wait_mode;
328 INIT_WORK(&call->async_work, afs_process_async_call);
332 srx.srx_service = call->service_id;
336 srx.transport.sin.sin_port = call->port;
339 /* create a call */
340 rxcall = rxrpc_kernel_begin_call(afs_socket, &srx, call->key,
341 (unsigned long) call, gfp);
342 call->key = NULL;
348 call->rxcall = rxcall;
351 iov[0].iov_base = call->request;
352 iov[0].iov_len = call->request_size;
360 msg.msg_flags = (call->send_pages ? MSG_MORE : 0);
365 if (!call->send_pages)
366 call->state = AFS_CALL_AWAIT_REPLY;
367 ret = rxrpc_kernel_send_data(rxcall, &msg, call->request_size);
371 if (call->send_pages) {
372 ret = afs_send_pages(call, &msg, iov);
377 /* at this point, an async call may no longer exist as it may have
379 return wait_mode->wait(call);
384 call->rxcall = NULL;
386 call->type->destructor(call);
387 afs_free_call(call);
400 struct afs_call *call = (struct afs_call *) user_call_ID;
402 _enter("%p,,%u", call, skb->mark);
410 if (!call) {
411 /* its an incoming call for our callback service */
415 /* route the messages directly to the appropriate call */
416 skb_queue_tail(&call->rx_queue, skb);
417 call->wait_mode->rx_wakeup(call);
424 * deliver messages to a call
426 static void afs_deliver_to_call(struct afs_call *call)
435 while ((call->state == AFS_CALL_AWAIT_REPLY ||
436 call->state == AFS_CALL_AWAIT_OP_ID ||
437 call->state == AFS_CALL_AWAIT_REQUEST ||
438 call->state == AFS_CALL_AWAIT_ACK) &&
439 (skb = skb_dequeue(&call->rx_queue))) {
444 ret = call->type->deliver(call, skb, last);
448 call->state == AFS_CALL_AWAIT_REPLY)
449 call->state = AFS_CALL_COMPLETE;
459 if (call->state != AFS_CALL_AWAIT_REPLY)
462 rxrpc_kernel_abort_call(call->rxcall,
464 call->error = ret;
465 call->state = AFS_CALL_ERROR;
473 call->state = AFS_CALL_COMPLETE;
477 call->error = -EBUSY;
478 call->state = AFS_CALL_BUSY;
482 call->error = call->type->abort_to_error(abort_code);
483 call->state = AFS_CALL_ABORTED;
484 _debug("Rcv ABORT %u -> %d", abort_code, call->error);
487 call->error = -rxrpc_kernel_get_error_number(skb);
488 call->state = AFS_CALL_ERROR;
489 _debug("Rcv NET ERROR %d", call->error);
492 call->error = -rxrpc_kernel_get_error_number(skb);
493 call->state = AFS_CALL_ERROR;
494 _debug("Rcv LOCAL ERROR %d", call->error);
504 /* make sure the queue is empty if the call is done with (we might have
505 * aborted the call early because of an unmarshalling error) */
506 if (call->state >= AFS_CALL_COMPLETE) {
507 while ((skb = skb_dequeue(&call->rx_queue)))
509 if (call->incoming) {
510 rxrpc_kernel_end_call(call->rxcall);
511 call->rxcall = NULL;
512 call->type->destructor(call);
513 afs_free_call(call);
521 * wait synchronously for a call to complete
523 static int afs_wait_for_call_to_complete(struct afs_call *call)
532 add_wait_queue(&call->waitq, &myself);
537 if (!skb_queue_empty(&call->rx_queue)) {
539 afs_deliver_to_call(call);
543 ret = call->error;
544 if (call->state >= AFS_CALL_COMPLETE)
552 remove_wait_queue(&call->waitq, &myself);
555 /* kill the call */
556 if (call->state < AFS_CALL_COMPLETE) {
557 _debug("call incomplete");
558 rxrpc_kernel_abort_call(call->rxcall, RX_CALL_DEAD);
559 while ((skb = skb_dequeue(&call->rx_queue)))
563 _debug("call complete");
564 rxrpc_kernel_end_call(call->rxcall);
565 call->rxcall = NULL;
566 call->type->destructor(call);
567 afs_free_call(call);
573 * wake up a waiting call
575 static void afs_wake_up_call_waiter(struct afs_call *call)
577 wake_up(&call->waitq);
581 * wake up an asynchronous call
583 static void afs_wake_up_async_call(struct afs_call *call)
586 queue_work(afs_async_calls, &call->async_work);
590 * put a call into asynchronous mode
591 * - mustn't touch the call descriptor as the call my have completed by the
594 static int afs_dont_wait_for_call_to_complete(struct afs_call *call)
601 * delete an asynchronous call
605 struct afs_call *call =
610 afs_free_call(call);
616 * perform processing on an asynchronous call
622 struct afs_call *call =
627 if (!skb_queue_empty(&call->rx_queue))
628 afs_deliver_to_call(call);
630 if (call->state >= AFS_CALL_COMPLETE && call->wait_mode) {
631 if (call->wait_mode->async_complete)
632 call->wait_mode->async_complete(call->reply,
633 call->error);
634 call->reply = NULL;
636 /* kill the call */
637 rxrpc_kernel_end_call(call->rxcall);
638 call->rxcall = NULL;
639 if (call->type->destructor)
640 call->type->destructor(call);
642 /* we can't just delete the call because the work item may be
644 PREPARE_WORK(&call->async_work, afs_delete_async_call);
645 queue_work(afs_async_calls, &call->async_work);
654 void afs_transfer_reply(struct afs_call *call, struct sk_buff *skb)
658 if (skb_copy_bits(skb, 0, call->buffer + call->reply_size, len) < 0)
660 call->reply_size += len;
669 struct afs_call *call = NULL;
673 _debug("new call");
678 if (!call) {
679 call = kzalloc(sizeof(struct afs_call), GFP_KERNEL);
680 if (!call) {
685 INIT_WORK(&call->async_work, afs_process_async_call);
686 call->wait_mode = &afs_async_incoming_call;
687 call->type = &afs_RXCMxxxx;
688 init_waitqueue_head(&call->waitq);
689 skb_queue_head_init(&call->rx_queue);
690 call->state = AFS_CALL_AWAIT_OP_ID;
693 call, call->type->name,
699 (unsigned long) call);
701 call->rxcall = rxcall;
702 call = NULL;
706 if (call)
707 afs_free_call(call);
711 * grab the operation ID from an incoming cache manager call
713 static int afs_deliver_cm_op_id(struct afs_call *call, struct sk_buff *skb,
717 void *oibuf = (void *) &call->operation_ID;
719 _enter("{%u},{%zu},%d", call->offset, len, last);
721 ASSERTCMP(call->offset, <, 4);
724 len = min_t(size_t, len, 4 - call->offset);
725 if (skb_copy_bits(skb, 0, oibuf + call->offset, len) < 0)
729 call->offset += len;
731 if (call->offset < 4) {
740 call->state = AFS_CALL_AWAIT_REQUEST;
742 /* ask the cache manager to route the call (it'll change the call type
744 if (!afs_cm_incoming_call(call))
749 return call->type->deliver(call, skb, last);
755 void afs_send_empty_reply(struct afs_call *call)
772 call->state = AFS_CALL_AWAIT_ACK;
773 switch (rxrpc_kernel_send_data(call->rxcall, &msg, 0)) {
780 rxrpc_kernel_abort_call(call->rxcall, RX_USER_ABORT);
782 rxrpc_kernel_end_call(call->rxcall);
783 call->rxcall = NULL;
784 call->type->destructor(call);
785 afs_free_call(call);
794 void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)
812 call->state = AFS_CALL_AWAIT_ACK;
813 n = rxrpc_kernel_send_data(call->rxcall, &msg, len);
820 rxrpc_kernel_abort_call(call->rxcall, RX_USER_ABORT);
822 rxrpc_kernel_end_call(call->rxcall);
823 call->rxcall = NULL;
824 call->type->destructor(call);
825 afs_free_call(call);
832 int afs_extract_data(struct afs_call *call, struct sk_buff *skb,
837 _enter("{%u},{%zu},%d,,%zu", call->offset, len, last, count);
839 ASSERTCMP(call->offset, <, count);
841 len = min_t(size_t, len, count - call->offset);
842 if (skb_copy_bits(skb, 0, buf + call->offset, len) < 0 ||
845 call->offset += len;
847 if (call->offset < count) {
849 _leave(" = -EBADMSG [%d < %zu]", call->offset, count);