Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/src/protocol.c

    r33b8d024 rcf13b17  
    9393{
    9494        service_id_t id = 0;
    95         const errno_t ret =
     95        const int ret =
    9696            loc_service_get_id(service, &id, IPC_FLAG_BLOCKING);
    9797        if (ret != EOK)
     
    115115 * @param name Valid string identifier
    116116 * @param record True if the application context wishes to receive data.
    117  *
    118  * @param[out] id  Return context ID.
    119  *
    120  * @return EOK on success, Error code on failure.
    121  */
    122 errno_t hound_service_register_context(hound_sess_t *sess,
    123     const char *name, bool record, hound_context_id_t *id)
     117 * @return Valid ID on success, Error code on failure.
     118 */
     119hound_context_id_t hound_service_register_context(hound_sess_t *sess,
     120    const char *name, bool record)
    124121{
    125122        assert(sess);
     
    129126        aid_t mid =
    130127            async_send_1(exch, IPC_M_HOUND_CONTEXT_REGISTER, record, &call);
    131         errno_t ret = mid ? EOK : EPARTY;
     128        int ret = mid ? EOK : EPARTY;
    132129
    133130        if (ret == EOK)
     
    137134
    138135        if (ret == EOK)
    139                 async_wait_for(mid, &ret);
     136                async_wait_for(mid, (sysarg_t *)&ret);
    140137
    141138        async_exchange_end(exch);
    142         if (ret == EOK) {
    143                 *id = (hound_context_id_t)IPC_GET_ARG1(call);
    144         }
    145 
    146         return ret;
     139        return ret == EOK ? (hound_context_id_t)IPC_GET_ARG1(call) : ret;
    147140}
    148141
     
    153146 * @return Error code.
    154147 */
    155 errno_t hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id)
     148int hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id)
    156149{
    157150        assert(sess);
    158151        async_exch_t *exch = async_exchange_begin(sess);
    159         const errno_t ret =
     152        const int ret =
    160153            async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER, id);
    161154        async_exchange_end(exch);
     
    173166 * @retval Error code.
    174167 */
    175 errno_t hound_service_get_list(hound_sess_t *sess, char ***ids, size_t *count,
     168int hound_service_get_list(hound_sess_t *sess, const char ***ids, size_t *count,
    176169    int flags, const char *connection)
    177170{
     
    189182        ipc_call_t res_call;
    190183        aid_t mid = async_send_3(exch, IPC_M_HOUND_GET_LIST, flags, *count,
    191             connection != NULL, &res_call);
    192 
    193         errno_t ret = EOK;
     184            (bool)connection, &res_call);
     185
     186        int ret = EOK;
    194187        if (mid && connection)
    195188                ret = async_data_write_start(exch, connection,
     
    197190
    198191        if (ret == EOK)
    199                 async_wait_for(mid, &ret);
     192                async_wait_for(mid, (sysarg_t*)&ret);
    200193
    201194        if (ret != EOK) {
     
    206199
    207200        /* Start receiving names */
    208         char **names = NULL;
     201        const char **names = NULL;
    209202        if (name_count) {
    210203                size_t *sizes = calloc(name_count, sizeof(size_t));
     
    247240 * @return Error code.
    248241 */
    249 errno_t hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
     242int hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
    250243    const char *sink)
    251244{
     
    259252        ipc_call_t call;
    260253        aid_t id = async_send_0(exch, IPC_M_HOUND_CONNECT, &call);
    261         errno_t ret = id ? EOK : EPARTY;
     254        int ret = id ? EOK : EPARTY;
    262255        if (ret == EOK)
    263256                ret = async_data_write_start(exch, source, str_size(source));
    264257        if (ret == EOK)
    265258                ret = async_data_write_start(exch, sink, str_size(sink));
    266         async_wait_for(id, &ret);
     259        async_wait_for(id, (sysarg_t*)&ret);
    267260        async_exchange_end(exch);
    268261        return ret;
     
    276269 * @return Error code.
    277270 */
    278 errno_t hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
     271int hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
    279272    const char *sink)
    280273{
     
    285278        ipc_call_t call;
    286279        aid_t id = async_send_0(exch, IPC_M_HOUND_DISCONNECT, &call);
    287         errno_t ret = id ? EOK : EPARTY;
     280        int ret = id ? EOK : EPARTY;
    288281        if (ret == EOK)
    289282                ret = async_data_write_start(exch, source, str_size(source));
    290283        if (ret == EOK)
    291284                ret = async_data_write_start(exch, sink, str_size(sink));
    292         async_wait_for(id, &ret);
     285        async_wait_for(id, (sysarg_t*)&ret);
    293286        async_exchange_end(exch);
    294287        return ENOTSUP;
     
    304297 * @return Error code.
    305298 */
    306 errno_t hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
     299int hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
    307300    int flags, pcm_format_t format, size_t bsize)
    308301{
     
    321314 * @return Error code.
    322315 */
    323 errno_t hound_service_stream_exit(async_exch_t *exch)
     316int hound_service_stream_exit(async_exch_t *exch)
    324317{
    325318        return async_req_0_0(exch, IPC_M_HOUND_STREAM_EXIT);
     
    331324 * @return Error code.
    332325 */
    333 errno_t hound_service_stream_drain(async_exch_t *exch)
     326int hound_service_stream_drain(async_exch_t *exch)
    334327{
    335328        return async_req_0_0(exch, IPC_M_HOUND_STREAM_DRAIN);
     
    343336 * @return Error code.
    344337 */
    345 errno_t hound_service_stream_write(async_exch_t *exch, const void *data, size_t size)
     338int hound_service_stream_write(async_exch_t *exch, const void *data, size_t size)
    346339{
    347340        return async_data_write_start(exch, data, size);
     
    355348 * @return Error code.
    356349 */
    357 errno_t hound_service_stream_read(async_exch_t *exch, void *data, size_t size)
     350int hound_service_stream_read(async_exch_t *exch, void *data, size_t size)
    358351{
    359352        return async_data_read_start(exch, data, size);
     
    407400
    408401                        /* Get context name */
    409                         errno_t ret =
     402                        int ret =
    410403                            async_data_write_accept(&name, true, 0, 0, 0, 0);
    411404                        if (ret != EOK) {
     
    434427                        /* get id, 1st param */
    435428                        hound_context_id_t id = IPC_GET_ARG1(call);
    436                         const errno_t ret =
     429                        const int ret =
    437430                            server_iface->rem_context(server_iface->server, id);
    438431                        async_answer_0(callid, ret);
     
    446439                        }
    447440
    448                         char **list = NULL;
     441                        const char **list = NULL;
    449442                        const int flags = IPC_GET_ARG1(call);
    450443                        size_t count = IPC_GET_ARG2(call);
    451444                        const bool conn = IPC_GET_ARG3(call);
    452445                        char *conn_name = NULL;
    453                         errno_t ret = EOK;
     446                        int ret = EOK;
    454447
    455448                        /* get connected actor name if provided */
     
    513506
    514507                        /* read source name */
    515                         errno_t ret =
     508                        int ret =
    516509                            async_data_write_accept(&source, true, 0, 0, 0, 0);
    517510                        /* read sink name */
     
    539532
    540533                        /* read source name */
    541                         errno_t ret =
     534                        int ret =
    542535                            async_data_write_accept(&source, true, 0, 0, 0, 0);
    543536                        /*read sink name */
     
    574567
    575568                        void *stream;
    576                         errno_t ret = server_iface->add_stream(server_iface->server,
     569                        int ret = server_iface->add_stream(server_iface->server,
    577570                            id, flags, f, bsize, &stream);
    578571                        if (ret != EOK) {
     
    626619        ipc_call_t call;
    627620        size_t size = 0;
    628         errno_t ret_answer = EOK;
     621        int ret_answer = EOK;
    629622        /* accept data write or drain */
    630623        while (async_data_write_receive_call(&callid, &call, &size)
     
    632625                /* check drain first */
    633626                if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) {
    634                         errno_t ret = ENOTSUP;
     627                        int ret = ENOTSUP;
    635628                        if (server_iface->drain_stream)
    636629                                ret = server_iface->drain_stream(stream);
     
    650643                        continue;
    651644                }
    652                 const errno_t ret = async_data_write_finalize(callid, buffer, size);
     645                const int ret = async_data_write_finalize(callid, buffer, size);
    653646                if (ret == EOK) {
    654647                        /* push data to stream */
     
    657650                }
    658651        }
    659         const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
     652        const int ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
    660653            ? EOK : EINVAL;
    661654
     
    673666        ipc_call_t call;
    674667        size_t size = 0;
    675         errno_t ret_answer = EOK;
     668        int ret_answer = EOK;
    676669        /* accept data read and drain */
    677670        while (async_data_read_receive_call(&callid, &call, &size)
     
    679672                /* drain does not make much sense but it is allowed */
    680673                if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) {
    681                         errno_t ret = ENOTSUP;
     674                        int ret = ENOTSUP;
    682675                        if (server_iface->drain_stream)
    683676                                ret = server_iface->drain_stream(stream);
     
    695688                        continue;
    696689                }
    697                 errno_t ret = server_iface->stream_data_read(stream, buffer, size);
     690                int ret = server_iface->stream_data_read(stream, buffer, size);
    698691                if (ret == EOK) {
    699692                        ret_answer =
     
    701694                }
    702695        }
    703         const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
     696        const int ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
    704697            ? EOK : EINVAL;
    705698
     
    718711 * @return Error code.
    719712 */
    720 errno_t hound_server_register(const char *name, service_id_t *id)
     713int hound_server_register(const char *name, service_id_t *id)
    721714{
    722715        if (!name || !id)
    723716                return EINVAL;
    724717
    725         errno_t ret = loc_server_register(name);
     718        int ret = loc_server_register(name);
    726719        if (ret != EOK)
    727720                return ret;
     
    744737 * @return Error code.
    745738 */
    746 errno_t hound_server_set_device_change_callback(dev_change_callback_t cb)
     739int hound_server_set_device_change_callback(dev_change_callback_t cb)
    747740{
    748741        return loc_register_cat_change_cb(cb);
     
    754747 * @return Error code.
    755748 */
    756 errno_t hound_server_devices_iterate(device_callback_t callback)
     749int hound_server_devices_iterate(device_callback_t callback)
    757750{
    758751        if (!callback)
     
    762755
    763756        if (!resolved) {
    764                 const errno_t ret = loc_category_get_id("audio-pcm", &cat_id,
     757                const int ret = loc_category_get_id("audio-pcm", &cat_id,
    765758                    IPC_FLAG_BLOCKING);
    766759                if (ret != EOK)
     
    771764        service_id_t *svcs = NULL;
    772765        size_t count = 0;
    773         const errno_t ret = loc_category_get_svcs(cat_id, &svcs, &count);
     766        const int ret = loc_category_get_svcs(cat_id, &svcs, &count);
    774767        if (ret != EOK)
    775768                return ret;
Note: See TracChangeset for help on using the changeset viewer.