Subversion Repositories HelenOS

Rev

Rev 2637 | Rev 2662 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2637 Rev 2660
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_SEND calls.
669
/** Wrapper for making IPC_M_DATA_WRITE calls.
670
 *
670
 *
671
 * @param phoneid   Phone that will be used to contact the receiving side.
671
 * @param phoneid   Phone that will be used to contact the receiving side.
672
 * @param src       Address of the beginning of the source buffer.
672
 * @param src       Address of the beginning of the source buffer.
673
 * @param size      Size of the source buffer.
673
 * @param size      Size of the source buffer.
674
 *
674
 *
675
 * @return      Zero on success or a negative error code from errno.h.
675
 * @return      Zero on success or a negative error code from errno.h.
676
 */
676
 */
677
int ipc_data_send(int phoneid, void *src, size_t size)
677
int ipc_data_write_send(int phoneid, void *src, size_t size)
678
{
678
{
679
    return ipc_call_sync_3_0(phoneid, IPC_M_DATA_SEND, 0, (ipcarg_t) src,
679
    return ipc_call_sync_3_0(phoneid, IPC_M_DATA_WRITE, 0, (ipcarg_t) src,
680
        (ipcarg_t) size);
680
        (ipcarg_t) size);
681
}
681
}
682
 
682
 
683
/** Wrapper for receiving the IPC_M_DATA_SEND calls.
683
/** Wrapper for receiving the IPC_M_DATA_WRITE calls.
684
 *
684
 *
685
 * This wrapper only makes it more comfortable to receive IPC_M_DATA_SEND calls
685
 * This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE calls
686
 * so that the user doesn't have to remember the meaning of each IPC argument.
686
 * so that the user doesn't have to remember the meaning of each IPC argument.
687
 *
687
 *
688
 * So far, this wrapper is to be used from within a connection fibril.
688
 * So far, this wrapper is to be used from within a connection fibril.
689
 *
689
 *
690
 * @param callid    Storage where the hash of the IPC_M_DATA_SEND call will
690
 * @param callid    Storage where the hash of the IPC_M_DATA_WRITE call will
691
 *          be stored.
691
 *          be stored.
692
 * @param dst       Storage where the suggested destination address will
692
 * @param dst       Storage where the suggested destination address will
693
 *          be stored. May be NULL.
693
 *          be stored. May be NULL.
694
 * @param size      Storage where the suggested size will be stored. May be
694
 * @param size      Storage where the suggested size will be stored. May be
695
 *          NULL
695
 *          NULL
696
 *
696
 *
697
 * @return      Non-zero on success, zero on failure.
697
 * @return      Non-zero on success, zero on failure.
698
 */
698
 */
699
int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size)
699
int ipc_data_write_receive(ipc_callid_t *callid, void **dst, size_t *size)
700
{
700
{
701
    ipc_call_t data;
701
    ipc_call_t data;
702
   
702
   
703
    assert(callid);
703
    assert(callid);
704
 
704
 
705
    *callid = async_get_call(&data);
705
    *callid = async_get_call(&data);
706
    if (IPC_GET_METHOD(data) != IPC_M_DATA_SEND)
706
    if (IPC_GET_METHOD(data) != IPC_M_DATA_WRITE)
707
        return 0;
707
        return 0;
708
    if (dst)
708
    if (dst)
709
        *dst = (void *) IPC_GET_ARG1(data);
709
        *dst = (void *) IPC_GET_ARG1(data);
710
    if (size)
710
    if (size)
711
        *size = (size_t) IPC_GET_ARG3(data);
711
        *size = (size_t) IPC_GET_ARG3(data);
712
    return 1;
712
    return 1;
713
}
713
}
714
 
714
 
715
/** Wrapper for answering the IPC_M_DATA_SEND calls.
715
/** Wrapper for answering the IPC_M_DATA_WRITE calls.
716
 *
716
 *
717
 * This wrapper only makes it more comfortable to answer IPC_M_DATA_SEND calls
717
 * This wrapper only makes it more comfortable to answer IPC_M_DATA_WRITE calls
718
 * so that the user doesn't have to remember the meaning of each IPC argument.
718
 * so that the user doesn't have to remember the meaning of each IPC argument.
719
 *
719
 *
720
 * @param callid    Hash of the IPC_M_DATA_SEND call to answer.
720
 * @param callid    Hash of the IPC_M_DATA_WRITE call to answer.
721
 * @param dst       Final destination address for the IPC_M_DATA_SEND call.
721
 * @param dst       Final destination address for the IPC_M_DATA_WRITE call.
722
 * @param size      Final size for the IPC_M_DATA_SEND call.
722
 * @param size      Final size for the IPC_M_DATA_WRITE call.
723
 *
723
 *
724
 * @return      Zero on success or a value from @ref errno.h on failure.
724
 * @return      Zero on success or a value from @ref errno.h on failure.
725
 */
725
 */
726
ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size)
726
ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size)
727
{
727
{
728
    return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size);
728
    return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size);
729
}
729
}
730
 
730
 
731
/** @}
731
/** @}