Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ba8f8cb in mainline for uspace/lib/libc/generic/ipc.c


Ignore:
Timestamp:
2009-10-11T16:20:24Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
db4d6de, f307f12
Parents:
0da4e41
Message:

The original ipc_data_*() and ipc_share_*() should use plain HelenOS IPC.
Remove ipc_*_receive() because it cannot be easily expressed without the async
framework.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/ipc.c

    r0da4e41 rba8f8cb  
    730730        int res;
    731731        sysarg_t tmp_flags;
    732         res = async_req_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
     732        res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
    733733            (ipcarg_t) size, arg, NULL, &tmp_flags);
    734734        if (flags)
     
    737737}
    738738
    739 /** Wrapper for receiving the IPC_M_SHARE_IN calls.
    740  *
    741  * This wrapper only makes it more comfortable to receive IPC_M_SHARE_IN calls
    742  * so that the user doesn't have to remember the meaning of each IPC argument.
    743  *
    744  * So far, this wrapper is to be used from within a connection fibril.
    745  *
    746  * @param callid        Storage where the hash of the IPC_M_SHARE_IN call will
    747  *                      be stored.
    748  * @param size          Destination address space area size.   
    749  *
    750  * @return              Non-zero on success, zero on failure.
    751  */
    752 int ipc_share_in_receive(ipc_callid_t *callid, size_t *size)
    753 {
    754         ipc_call_t data;
    755        
    756         assert(callid);
    757         assert(size);
    758 
    759         *callid = async_get_call(&data);
    760         if (IPC_GET_METHOD(data) != IPC_M_SHARE_IN)
    761                 return 0;
    762         *size = (size_t) IPC_GET_ARG2(data);
    763         return 1;
    764 }
    765 
    766739/** Wrapper for answering the IPC_M_SHARE_IN calls.
    767740 *
     
    790763int ipc_share_out_start(int phoneid, void *src, int flags)
    791764{
    792         return async_req_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
     765        return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
    793766            (ipcarg_t) flags);
    794 }
    795 
    796 /** Wrapper for receiving the IPC_M_SHARE_OUT calls.
    797  *
    798  * This wrapper only makes it more comfortable to receive IPC_M_SHARE_OUT calls
    799  * so that the user doesn't have to remember the meaning of each IPC argument.
    800  *
    801  * So far, this wrapper is to be used from within a connection fibril.
    802  *
    803  * @param callid        Storage where the hash of the IPC_M_SHARE_OUT call will
    804  *                      be stored.
    805  * @param size          Storage where the source address space area size will be
    806  *                      stored.
    807  * @param flags         Storage where the sharing flags will be stored.
    808  *
    809  * @return              Non-zero on success, zero on failure.
    810  */
    811 int ipc_share_out_receive(ipc_callid_t *callid, size_t *size, int *flags)
    812 {
    813         ipc_call_t data;
    814        
    815         assert(callid);
    816         assert(size);
    817         assert(flags);
    818 
    819         *callid = async_get_call(&data);
    820         if (IPC_GET_METHOD(data) != IPC_M_SHARE_OUT)
    821                 return 0;
    822         *size = (size_t) IPC_GET_ARG2(data);
    823         *flags = (int) IPC_GET_ARG3(data);
    824         return 1;
    825767}
    826768
     
    851793int ipc_data_read_start(int phoneid, void *dst, size_t size)
    852794{
    853         return async_req_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
     795        return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
    854796            (ipcarg_t) size);
    855 }
    856 
    857 /** Wrapper for receiving the IPC_M_DATA_READ calls.
    858  *
    859  * This wrapper only makes it more comfortable to receive IPC_M_DATA_READ calls
    860  * so that the user doesn't have to remember the meaning of each IPC argument.
    861  *
    862  * So far, this wrapper is to be used from within a connection fibril.
    863  *
    864  * @param callid        Storage where the hash of the IPC_M_DATA_READ call will
    865  *                      be stored.
    866  * @param size          Storage where the maximum size will be stored. Can be
    867  *                      NULL.
    868  *
    869  * @return              Non-zero on success, zero on failure.
    870  */
    871 int ipc_data_read_receive(ipc_callid_t *callid, size_t *size)
    872 {
    873         ipc_call_t data;
    874        
    875         assert(callid);
    876 
    877         *callid = async_get_call(&data);
    878         if (IPC_GET_METHOD(data) != IPC_M_DATA_READ)
    879                 return 0;
    880         if (size)
    881                 *size = (size_t) IPC_GET_ARG2(data);
    882         return 1;
    883797}
    884798
     
    910824int ipc_data_write_start(int phoneid, const void *src, size_t size)
    911825{
    912         return async_req_2_0(phoneid, IPC_M_DATA_WRITE, (ipcarg_t) src,
     826        return ipc_call_sync_2_0(phoneid, IPC_M_DATA_WRITE, (ipcarg_t) src,
    913827            (ipcarg_t) size);
    914 }
    915 
    916 /** Wrapper for receiving the IPC_M_DATA_WRITE calls.
    917  *
    918  * This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE calls
    919  * so that the user doesn't have to remember the meaning of each IPC argument.
    920  *
    921  * So far, this wrapper is to be used from within a connection fibril.
    922  *
    923  * @param callid        Storage where the hash of the IPC_M_DATA_WRITE call will
    924  *                      be stored.
    925  * @param size          Storage where the suggested size will be stored. May be
    926  *                      NULL
    927  *
    928  * @return              Non-zero on success, zero on failure.
    929  */
    930 int ipc_data_write_receive(ipc_callid_t *callid, size_t *size)
    931 {
    932         ipc_call_t data;
    933        
    934         assert(callid);
    935 
    936         *callid = async_get_call(&data);
    937         if (IPC_GET_METHOD(data) != IPC_M_DATA_WRITE)
    938                 return 0;
    939         if (size)
    940                 *size = (size_t) IPC_GET_ARG2(data);
    941         return 1;
    942828}
    943829
Note: See TracChangeset for help on using the changeset viewer.