Ignore:
Timestamp:
2011-02-09T11:46:47Z (14 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cb15135a
Parents:
a49c4002 (diff), 0b37882 (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

Local modifications:

  • change pipefs and ext2 to build again (use async_* calls instead of ipc_*)
File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_char_dev.c

    ra49c4002 rcf2af94  
    3333 */
    3434
    35 #include <ipc/ipc.h>
    3635#include <async.h>
    3736#include <errno.h>
    3837
    39 #include "char.h"
     38#include "ops/char_dev.h"
    4039#include "driver.h"
    4140
     
    4645
    4746/** Remote character interface operations. */
    48 static remote_iface_func_ptr_t remote_char_iface_ops [] = {
     47static remote_iface_func_ptr_t remote_char_dev_iface_ops[] = {
    4948        &remote_char_read,
    5049        &remote_char_write
     
    5655 * character interface.
    5756 */
    58 remote_iface_t remote_char_iface = {
    59         .method_count = sizeof(remote_char_iface_ops) /
     57remote_iface_t remote_char_dev_iface = {
     58        .method_count = sizeof(remote_char_dev_iface_ops) /
    6059            sizeof(remote_iface_func_ptr_t),
    61         .methods = remote_char_iface_ops
     60        .methods = remote_char_dev_iface_ops
    6261};
    6362
     
    6968 *
    7069 * @param dev           The device from which the data are read.
    71  * @param iface         The local interface structure.
     70 * @param ops           The local ops structure.
    7271 */
    7372static void
    74 remote_char_read(device_t *dev, void *iface, ipc_callid_t callid,
     73remote_char_read(device_t *dev, void *ops, ipc_callid_t callid,
    7574    ipc_call_t *call)
    76 {       
    77         char_iface_t *char_iface = (char_iface_t *) iface;
     75{
     76        char_dev_ops_t *char_dev_ops = (char_dev_ops_t *) ops;
    7877        ipc_callid_t cid;
    7978       
     
    8180        if (!async_data_read_receive(&cid, &len)) {
    8281                /* TODO handle protocol error. */
    83                 ipc_answer_0(callid, EINVAL);
     82                async_answer_0(callid, EINVAL);
    8483                return;
    8584        }
    8685       
    87         if (!char_iface->read) {
     86        if (!char_dev_ops->read) {
    8887                async_data_read_finalize(cid, NULL, 0);
    89                 ipc_answer_0(callid, ENOTSUP);
     88                async_answer_0(callid, ENOTSUP);
    9089                return;
    9190        }
     
    9594       
    9695        char buf[MAX_CHAR_RW_COUNT];
    97         int ret = (*char_iface->read)(dev, buf, len);
     96        int ret = (*char_dev_ops->read)(dev, buf, len);
    9897       
    9998        if (ret < 0) {
    10099                /* Some error occured. */
    101100                async_data_read_finalize(cid, buf, 0);
    102                 ipc_answer_0(callid, ret);
     101                async_answer_0(callid, ret);
    103102                return;
    104103        }
     
    106105        /* The operation was successful, return the number of data read. */
    107106        async_data_read_finalize(cid, buf, ret);
    108         ipc_answer_1(callid, EOK, ret);
     107        async_answer_1(callid, EOK, ret);
    109108}
    110109
     
    116115 *
    117116 * @param dev           The device to which the data are written.
    118  * @param iface         The local interface structure.
     117 * @param ops           The local ops structure.
    119118 */
    120119static void
    121 remote_char_write(device_t *dev, void *iface, ipc_callid_t callid,
     120remote_char_write(device_t *dev, void *ops, ipc_callid_t callid,
    122121    ipc_call_t *call)
    123122{
    124         char_iface_t *char_iface = (char_iface_t *) iface;
     123        char_dev_ops_t *char_dev_ops = (char_dev_ops_t *) ops;
    125124        ipc_callid_t cid;
    126125        size_t len;
     
    128127        if (!async_data_write_receive(&cid, &len)) {
    129128                /* TODO handle protocol error. */
    130                 ipc_answer_0(callid, EINVAL);
     129                async_answer_0(callid, EINVAL);
    131130                return;
    132131        }
    133132       
    134         if (!char_iface->write) {
     133        if (!char_dev_ops->write) {
    135134                async_data_write_finalize(cid, NULL, 0);
    136                 ipc_answer_0(callid, ENOTSUP);
     135                async_answer_0(callid, ENOTSUP);
    137136                return;
    138         }       
     137        }
    139138       
    140139        if (len > MAX_CHAR_RW_COUNT)
     
    145144        async_data_write_finalize(cid, buf, len);
    146145       
    147         int ret = (*char_iface->write)(dev, buf, len);
     146        int ret = (*char_dev_ops->write)(dev, buf, len);
    148147        if (ret < 0) {
    149148                /* Some error occured. */
    150                 ipc_answer_0(callid, ret);
     149                async_answer_0(callid, ret);
    151150        } else {
    152151                /*
     
    154153                 * written.
    155154                 */
    156                 ipc_answer_1(callid, EOK, ret);
     155                async_answer_1(callid, EOK, ret);
    157156        }
    158157}
Note: See TracChangeset for help on using the changeset viewer.