Rev 2660 | Rev 2663 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2660 | Rev 2662 | ||
---|---|---|---|
Line 664... | Line 664... | ||
664 | { |
664 | { |
665 | return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1, |
665 | return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1, |
666 | arg2, mode); |
666 | arg2, mode); |
667 | } |
667 | } |
668 | 668 | ||
- | 669 | /** Wrapper for making IPC_M_DATA_READ calls. |
|
- | 670 | * |
|
- | 671 | * @param phoneid Phone that will be used to contact the receiving side. |
|
- | 672 | * @param dst Address of the beginning of the destination buffer. |
|
- | 673 | * @param size Size of the destination buffer. |
|
- | 674 | * |
|
- | 675 | * @return Zero on success or a negative error code from errno.h. |
|
- | 676 | */ |
|
- | 677 | int ipc_data_read_send(int phoneid, void *dst, size_t size) |
|
- | 678 | { |
|
- | 679 | return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst, |
|
- | 680 | (ipcarg_t) size); |
|
- | 681 | } |
|
- | 682 | ||
- | 683 | /** Wrapper for receiving the IPC_M_DATA_READ calls. |
|
- | 684 | * |
|
- | 685 | * This wrapper only makes it more comfortable to receive IPC_M_DATA_READ calls |
|
- | 686 | * so that the user doesn't have to remember the meaning of each IPC argument. |
|
- | 687 | * |
|
- | 688 | * So far, this wrapper is to be used from within a connection fibril. |
|
- | 689 | * |
|
- | 690 | * @param callid Storage where the hash of the IPC_M_DATA_READ call will |
|
- | 691 | * be stored. |
|
- | 692 | * @param size Storage where the maximum size will be stored. |
|
- | 693 | * |
|
- | 694 | * @return Non-zero on success, zero on failure. |
|
- | 695 | */ |
|
- | 696 | int ipc_data_read_receive(ipc_callid_t *callid, size_t *size) |
|
- | 697 | { |
|
- | 698 | ipc_call_t data; |
|
- | 699 | ||
- | 700 | assert(callid); |
|
- | 701 | ||
- | 702 | *callid = async_get_call(&data); |
|
- | 703 | if (IPC_GET_METHOD(data) != IPC_M_DATA_READ) |
|
- | 704 | return 0; |
|
- | 705 | assert(size); |
|
- | 706 | *size = (size_t) IPC_GET_ARG2(data); |
|
- | 707 | return 1; |
|
- | 708 | } |
|
- | 709 | ||
- | 710 | /** Wrapper for answering the IPC_M_DATA_READ calls. |
|
- | 711 | * |
|
- | 712 | * This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls |
|
- | 713 | * so that the user doesn't have to remember the meaning of each IPC argument. |
|
- | 714 | * |
|
- | 715 | * @param callid Hash of the IPC_M_DATA_READ call to answer. |
|
- | 716 | * @param src Source address for the IPC_M_DATA_READ call. |
|
- | 717 | * @param size Size for the IPC_M_DATA_READ call. Can be smaller than |
|
- | 718 | * the maximum size announced by the sender. |
|
- | 719 | * |
|
- | 720 | * @return Zero on success or a value from @ref errno.h on failure. |
|
- | 721 | */ |
|
- | 722 | int ipc_data_read_deliver(ipc_callid_t callid, void *src, size_t size) |
|
- | 723 | { |
|
- | 724 | return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) size); |
|
- | 725 | } |
|
- | 726 | ||
669 | /** Wrapper for making IPC_M_DATA_WRITE calls. |
727 | /** Wrapper for making IPC_M_DATA_WRITE calls. |
670 | * |
728 | * |
671 | * @param phoneid Phone that will be used to contact the receiving side. |
729 | * @param phoneid Phone that will be used to contact the receiving side. |
672 | * @param src Address of the beginning of the source buffer. |
730 | * @param src Address of the beginning of the source buffer. |
673 | * @param size Size of the source buffer. |
731 | * @param size Size of the source buffer. |
Line 721... | Line 779... | ||
721 | * @param dst Final destination address for the IPC_M_DATA_WRITE call. |
779 | * @param dst Final destination address for the IPC_M_DATA_WRITE call. |
722 | * @param size Final size for the IPC_M_DATA_WRITE call. |
780 | * @param size Final size for the IPC_M_DATA_WRITE call. |
723 | * |
781 | * |
724 | * @return Zero on success or a value from @ref errno.h on failure. |
782 | * @return Zero on success or a value from @ref errno.h on failure. |
725 | */ |
783 | */ |
726 | ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size) |
784 | int ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size) |
727 | { |
785 | { |
728 | return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size); |
786 | return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size); |
729 | } |
787 | } |
730 | 788 | ||
731 | /** @} |
789 | /** @} |