Changeset 8b5690f in mainline for uspace/lib/c/generic/net/modules.c


Ignore:
Timestamp:
2011-02-03T05:11:01Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ba38f72c
Parents:
22027b6e (diff), 86d7bfa (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/net/modules.c

    r22027b6e r8b5690f  
    3232
    3333/** @file
    34  * Generic module functions implementation. 
     34 * Generic module functions implementation.
    3535 *
    3636 * @todo MAKE IT POSSIBLE TO REMOVE THIS FILE VIA EITHER REPLACING PART OF ITS
     
    4343#include <errno.h>
    4444#include <sys/time.h>
    45 
    46 #include <ipc/ipc.h>
    4745#include <ipc/services.h>
    48 
    4946#include <net/modules.h>
    5047
     
    5249#define MODULE_WAIT_TIME        (10 * 1000)
    5350
    54 /** Answers the call.
    55  *
    56  * @param[in] callid    The call identifier.
    57  * @param[in] result    The message processing result.
    58  * @param[in] answer    The message processing answer.
    59  * @param[in] answer_count The number of answer parameters.
    60  */
    61 void
    62 answer_call(ipc_callid_t callid, int result, ipc_call_t *answer,
    63     int answer_count)
    64 {
    65         /* Choose the most efficient answer function */
    66         if (answer || (!answer_count)) {
    67                 switch (answer_count) {
     51/** Answer a call.
     52 *
     53 * @param[in] callid Call identifier.
     54 * @param[in] result Message processing result.
     55 * @param[in] answer Message processing answer.
     56 * @param[in] count  Number of answer parameters.
     57 *
     58 */
     59void answer_call(ipc_callid_t callid, int result, ipc_call_t *answer,
     60    size_t count)
     61{
     62        /* Choose the most efficient function */
     63        if ((answer != NULL) || (count == 0)) {
     64                switch (count) {
    6865                case 0:
    69                         ipc_answer_0(callid, (sysarg_t) result);
     66                        async_answer_0(callid, (sysarg_t) result);
    7067                        break;
    7168                case 1:
    72                         ipc_answer_1(callid, (sysarg_t) result,
     69                        async_answer_1(callid, (sysarg_t) result,
    7370                            IPC_GET_ARG1(*answer));
    7471                        break;
    7572                case 2:
    76                         ipc_answer_2(callid, (sysarg_t) result,
     73                        async_answer_2(callid, (sysarg_t) result,
    7774                            IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer));
    7875                        break;
    7976                case 3:
    80                         ipc_answer_3(callid, (sysarg_t) result,
     77                        async_answer_3(callid, (sysarg_t) result,
    8178                            IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
    8279                            IPC_GET_ARG3(*answer));
    8380                        break;
    8481                case 4:
    85                         ipc_answer_4(callid, (sysarg_t) result,
     82                        async_answer_4(callid, (sysarg_t) result,
    8683                            IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
    8784                            IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer));
     
    8986                case 5:
    9087                default:
    91                         ipc_answer_5(callid, (sysarg_t) result,
     88                        async_answer_5(callid, (sysarg_t) result,
    9289                            IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
    9390                            IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer),
     
    137134    sysarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)
    138135{
    139         int rc;
    140        
    141136        /* Connect to the needed service */
    142137        int phone = connect_to_service_timeout(need, timeout);
    143138        if (phone >= 0) {
    144139                /* Request the bidirectional connection */
    145                 sysarg_t phonehash;
    146                
    147                 rc = ipc_connect_to_me(phone, arg1, arg2, arg3, &phonehash);
     140                int rc = async_connect_to_me(phone, arg1, arg2, arg3, client_receiver);
    148141                if (rc != EOK) {
    149                         ipc_hangup(phone);
     142                        async_hangup(phone);
    150143                        return rc;
    151144                }
    152                 async_new_connection(phonehash, 0, NULL, client_receiver);
    153145        }
    154146       
     
    228220}
    229221
    230 /** Refreshes answer structure and parameters count.
    231  *
    232  * Erases all attributes.
    233  *
    234  * @param[in,out] answer The message processing answer structure.
    235  * @param[in,out] answer_count The number of answer parameters.
    236  */
    237 void refresh_answer(ipc_call_t *answer, int *answer_count)
    238 {
    239         if (answer_count)
    240                 *answer_count = 0;
    241 
    242         if (answer) {
     222/** Refresh answer structure and argument count.
     223 *
     224 * Erase all arguments.
     225 *
     226 * @param[in,out] answer Message processing answer structure.
     227 * @param[in,out] count  Number of answer arguments.
     228 *
     229 */
     230void refresh_answer(ipc_call_t *answer, size_t *count)
     231{
     232        if (count != NULL)
     233                *count = 0;
     234       
     235        if (answer != NULL) {
    243236                IPC_SET_RETVAL(*answer, 0);
    244                 /* Just to be precise */
    245237                IPC_SET_IMETHOD(*answer, 0);
    246238                IPC_SET_ARG1(*answer, 0);
Note: See TracChangeset for help on using the changeset viewer.