Changeset 79ae36dd in mainline for uspace/drv/vhc/conndev.c


Ignore:
Timestamp:
2011-06-08T19:01:55Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0eff68e
Parents:
764d71e
Message:

new async framework with integrated exchange tracking

  • strict isolation between low-level IPC and high-level async framework with integrated exchange tracking
    • each IPC connection is represented by an async_sess_t structure
    • each IPC exchange is represented by an async_exch_t structure
    • exchange management is either based on atomic messages (EXCHANGE_ATOMIC), locking (EXCHANGE_SERIALIZE) or connection cloning (EXCHANGE_CLONE)
  • async_obsolete: temporary compatibility layer to keep old async clients working (several pieces of code are currently broken, but only non-essential functionality)
  • IPC_M_PHONE_HANGUP is now method no. 0 (for elegant boolean evaluation)
  • IPC_M_DEBUG_ALL has been renamed to IPC_M_DEBUG
  • IPC_M_PING has been removed (VFS protocol now has VFS_IN_PING)
  • console routines in libc have been rewritten for better abstraction
  • additional use for libc-private header files (FILE structure opaque to the client)
  • various cstyle changes (typos, indentation, missing externs in header files, improved comments, etc.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/conndev.c

    r764d71e r79ae36dd  
    3838#include <ddf/driver.h>
    3939#include <usbvirt/ipc.h>
     40#include <async.h>
    4041#include "conn.h"
    4142
     
    4445static fibril_local char plugged_device_name[PLUGGED_DEVICE_NAME_MAXLEN + 1] = "<unknown>";
    4546
     47#if 0
    4648/** Receive device name.
    4749 *
    4850 * @warning Errors are silently ignored.
    4951 *
    50  * @param phone Phone to the virtual device.
     52 * @param sess Session to the virtual device.
     53 *
    5154 */
    52 static void receive_device_name(int phone)
     55static void receive_device_name(async_sess_t *sess)
    5356{
    54         aid_t opening_request = async_send_0(phone, IPC_M_USBVIRT_GET_NAME, NULL);
     57        async_exch_t *exch = async_exchange_begin(sess);
     58       
     59        aid_t opening_request = async_send_0(exch, IPC_M_USBVIRT_GET_NAME, NULL);
    5560        if (opening_request == 0) {
     61                async_exchange_end(exch);
    5662                return;
    5763        }
    58 
    59 
     64       
    6065        ipc_call_t data_request_call;
    61         aid_t data_request = async_data_read(phone,
    62              plugged_device_name, PLUGGED_DEVICE_NAME_MAXLEN,
    63              &data_request_call);
    64 
     66        aid_t data_request = async_data_read(exch, plugged_device_name,
     67             PLUGGED_DEVICE_NAME_MAXLEN, &data_request_call);
     68       
     69        async_exchange_end(exch);
     70       
    6571        if (data_request == 0) {
    6672                async_wait_for(opening_request, NULL);
    6773                return;
    6874        }
    69 
     75       
    7076        sysarg_t data_request_rc;
    7177        sysarg_t opening_request_rc;
    7278        async_wait_for(data_request, &data_request_rc);
    7379        async_wait_for(opening_request, &opening_request_rc);
    74 
    75         if ((data_request_rc != EOK) || (opening_request_rc != EOK)) {
     80       
     81        if ((data_request_rc != EOK) || (opening_request_rc != EOK))
    7682                return;
    77         }
    78 
     83       
    7984        size_t len = IPC_GET_ARG2(data_request_call);
    8085        plugged_device_name[len] = 0;
    8186}
     87#endif
    8288
    8389/** Default handler for IPC methods not handled by DDF.
     
    9096    ipc_callid_t icallid, ipc_call_t *icall)
    9197{
     98// FIXME:
     99// This code needs to be refactored since the async
     100// framework does not support automatic callback connections
     101// yet.
     102
     103#if 0
    92104        vhc_data_t *vhc = fun->dev->driver_data;
    93105        sysarg_t method = IPC_GET_IMETHOD(*icall);
     
    112124                return;
    113125        }
     126#endif
    114127
    115128        async_answer_0(icallid, EINVAL);
Note: See TracChangeset for help on using the changeset viewer.