Changeset f9b2cb4c in mainline for uspace/lib/c/generic/ns.c


Ignore:
Timestamp:
2015-08-23T12:50:23Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ef495f
Parents:
0dd16778
Message:

unify interface API

  • introduce new interfaces
  • unify location service clients to always expect service ID as the second argument
  • remove obsolete methods that take explicit exchange management arguments (first phase)
  • use interfaces in device drivers, devman, location service, logger, inet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ns.c

    r0dd16778 rf9b2cb4c  
    4343{
    4444        async_exch_t *exch = async_exchange_begin(session_ns);
    45         int rc = async_connect_to_me(exch, 0, service, 0, NULL, NULL);
     45        int rc = async_connect_to_me(exch, 0, service, 0);
    4646        async_exchange_end(exch);
    4747       
     
    4949}
    5050
    51 async_sess_t *service_connect_iface(exch_mgmt_t mgmt, sysarg_t iface,
    52     service_t service, sysarg_t arg3)
    53 {
    54         async_exch_t *exch = async_exchange_begin(session_ns);
    55         if (!exch)
    56                 return NULL;
    57        
    58         async_sess_t *sess =
    59             async_connect_me_to(mgmt, exch, iface, service, arg3);
    60         async_exchange_end(exch);
    61        
    62         if (!sess)
    63                 return NULL;
    64        
    65         /*
    66          * FIXME Ugly hack to work around limitation of implementing
    67          * parallel exchanges using multiple connections. Shift out
    68          * first argument for non-initial connections.
    69          */
    70         async_sess_args_set(sess, iface, arg3, 0);
    71        
    72         return sess;
    73 }
    7451
    75 async_sess_t *service_connect_iface_extended(service_t service, iface_t iface,
    76     sysarg_t arg3)
     52async_sess_t *service_connect(service_t service, iface_t iface, sysarg_t arg3)
    7753{
    7854        async_exch_t *exch = async_exchange_begin(session_ns);
     
    9773}
    9874
    99 async_sess_t *service_connect(exch_mgmt_t mgmt, service_t service, sysarg_t arg3)
    100 {
    101         async_exch_t *exch = async_exchange_begin(session_ns);
    102         if (!exch)
    103                 return NULL;
    104        
    105         async_sess_t *sess =
    106             async_connect_me_to(mgmt, exch, 0, service, arg3);
    107         async_exchange_end(exch);
    108        
    109         if (!sess)
    110                 return NULL;
    111        
    112         /*
    113          * FIXME Ugly hack to work around limitation of implementing
    114          * parallel exchanges using multiple connections. Shift out
    115          * first argument for non-initial connections.
    116          */
    117         async_sess_args_set(sess, 0, arg3, 0);
    118        
    119         return sess;
    120 }
    121 
    122 async_sess_t *service_connect_blocking_iface(exch_mgmt_t mgmt, sysarg_t iface,
    123     service_t service, sysarg_t arg3)
    124 {
    125         async_exch_t *exch = async_exchange_begin(session_ns);
    126         if (!exch)
    127                 return NULL;
    128         async_sess_t *sess =
    129             async_connect_me_to_blocking(mgmt, exch, iface, service, arg3);
    130         async_exchange_end(exch);
    131        
    132         if (!sess)
    133                 return NULL;
    134        
    135         /*
    136          * FIXME Ugly hack to work around limitation of implementing
    137          * parallel exchanges using multiple connections. Shift out
    138          * first argument for non-initial connections.
    139          */
    140         async_sess_args_set(sess, iface, arg3, 0);
    141        
    142         return sess;
    143 }
    144 
    145 async_sess_t *service_connect_blocking_iface_extended(service_t service,
    146     iface_t iface, sysarg_t arg3)
     75async_sess_t *service_connect_blocking(service_t service, iface_t iface,
     76    sysarg_t arg3)
    14777{
    14878        async_exch_t *exch = async_exchange_begin(session_ns);
     
    16494}
    16595
    166 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, service_t service,
    167     sysarg_t arg3)
    168 {
    169         async_exch_t *exch = async_exchange_begin(session_ns);
    170         async_sess_t *sess =
    171             async_connect_me_to_blocking(mgmt, exch, 0, service, arg3);
    172         async_exchange_end(exch);
    173        
    174         if (!sess)
    175                 return NULL;
    176        
    177         /*
    178          * FIXME Ugly hack to work around limitation of implementing
    179          * parallel exchanges using multiple connections. Shift out
    180          * first argument for non-initial connections.
    181          */
    182         async_sess_args_set(sess, 0, arg3, 0);
    183        
    184         return sess;
    185 }
    186 
    187 /** Create bidirectional connection with a service
    188  *
    189  * @param[in] service         Service.
    190  * @param[in] arg1            First parameter.
    191  * @param[in] arg2            Second parameter.
    192  * @param[in] arg3            Third parameter.
    193  * @param[in] client_receiver Message receiver.
    194  *
    195  * @return Session to the service.
    196  * @return Other error codes as defined by async_connect_to_me().
    197  *
    198  */
    199 async_sess_t *service_bind(service_t service, sysarg_t arg1, sysarg_t arg2,
    200     sysarg_t arg3, async_port_handler_t client_receiver)
    201 {
    202         /* Connect to the needed service */
    203         async_sess_t *sess =
    204             service_connect_blocking(EXCHANGE_SERIALIZE, service, 0);
    205         if (sess != NULL) {
    206                 /* Request callback connection */
    207                 async_exch_t *exch = async_exchange_begin(sess);
    208                 int rc = async_connect_to_me(exch, arg1, arg2, arg3,
    209                     client_receiver, NULL);
    210                 async_exchange_end(exch);
    211                
    212                 if (rc != EOK) {
    213                         async_hangup(sess);
    214                         errno = rc;
    215                         return NULL;
    216                 }
    217         }
    218        
    219         return sess;
    220 }
    22196
    22297int ns_ping(void)
Note: See TracChangeset for help on using the changeset viewer.