Changeset b670523 in mainline for uspace/lib


Ignore:
Timestamp:
2011-06-09T20:42:27Z (14 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ec25a6
Parents:
503e4e3 (diff), 390d80d (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

Location:
uspace/lib/c
Files:
3 edited

Legend:

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

    r503e4e3 rb670523  
    23392339 * @param mgmt Exchange management style.
    23402340 *
    2341  * @return New async session or NULL on failure.
     2341 * @return New async session.
     2342 * @return NULL on failure.
    23422343 *
    23432344 */
     
    23772378}
    23782379
     2380/** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls.
     2381 *
     2382 * If the call is IPC_M_CONNECT_TO_ME then a new
     2383 * async session is created. However, the phone is
     2384 * not accepted automatically.
     2385 *
     2386 * @param mgmt   Exchange management style.
     2387 * @param call   Call data.
     2388 *
     2389 * @return New async session.
     2390 * @return NULL on failure.
     2391 * @return NULL if the call is not IPC_M_CONNECT_TO_ME.
     2392 *
     2393 */
     2394async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call)
     2395{
     2396        int phone = (int) IPC_GET_ARG5(*call);
     2397       
     2398        if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) ||
     2399            (phone < 0))
     2400                return NULL;
     2401       
     2402        async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));
     2403        if (sess == NULL)
     2404                return NULL;
     2405       
     2406        sess->mgmt = mgmt;
     2407        sess->phone = phone;
     2408        sess->arg1 = 0;
     2409        sess->arg2 = 0;
     2410        sess->arg3 = 0;
     2411       
     2412        list_initialize(&sess->exch_list);
     2413        fibril_mutex_initialize(&sess->mutex);
     2414        atomic_set(&sess->refcnt, 0);
     2415       
     2416        return sess;
     2417}
     2418
    23792419/** @}
    23802420 */
  • uspace/lib/c/generic/devman.c

    r503e4e3 rb670523  
    231231        }
    232232       
    233         async_wait_for(req, &retval);
    234         if (retval != EOK) {
    235                 devman_exchange_end(exch);
    236                
    237                 if (funh != NULL)
    238                         *funh = -1;
    239                
    240                 return retval;
    241         }
    242        
    243         if (funh != NULL)
    244                 *funh = (int) IPC_GET_ARG1(answer);
    245        
    246233        link_t *link = match_ids->ids.next;
    247234        match_id_t *match_id = NULL;
     
    250237                match_id = list_get_instance(link, match_id_t, link);
    251238               
    252                 ipc_call_t answer;
    253                 aid_t req = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
    254                     match_id->score, &answer);
     239                ipc_call_t answer2;
     240                aid_t req2 = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
     241                    match_id->score, &answer2);
    255242                retval = async_data_write_start(exch, match_id->id,
    256243                    str_size(match_id->id));
     244                if (retval != EOK) {
     245                        devman_exchange_end(exch);
     246                        async_wait_for(req2, NULL);
     247                        async_wait_for(req, NULL);
     248                        return retval;
     249                }
     250               
     251                async_wait_for(req2, &retval);
    257252                if (retval != EOK) {
    258253                        devman_exchange_end(exch);
     
    261256                }
    262257               
    263                 async_wait_for(req, &retval);
    264                 if (retval != EOK) {
    265                         devman_exchange_end(exch);
    266                         return retval;
    267                 }
    268                
    269258                link = link->next;
    270259        }
    271260       
    272261        devman_exchange_end(exch);
    273         return EOK;
     262       
     263        async_wait_for(req, &retval);
     264        if (retval == EOK) {
     265                if (funh != NULL)
     266                        *funh = (int) IPC_GET_ARG1(answer);
     267        } else {
     268                if (funh != NULL)
     269                        *funh = -1;
     270        }
     271       
     272        return retval;
    274273}
    275274
  • uspace/lib/c/include/async.h

    r503e4e3 rb670523  
    464464extern async_sess_t *async_clone_receive(exch_mgmt_t);
    465465extern async_sess_t *async_callback_receive(exch_mgmt_t);
     466extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    466467
    467468#endif
Note: See TracChangeset for help on using the changeset viewer.