Ignore:
Timestamp:
2010-10-21T20:13:40Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
848e3d15
Parents:
a79d88d
Message:

Cstyle fixes in libdrv.

File:
1 edited

Legend:

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

    ra79d88d r7a252ec8  
    11/*
    2  * Copyright (c) 2010 Lenka Trochtova 
     2 * Copyright (c) 2010 Lenka Trochtova
    33 * All rights reserved.
    44 *
     
    4242#define MAX_CHAR_RW_COUNT 256
    4343
    44 static void remote_char_read(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call);
    45 static void remote_char_write(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call);
     44static void remote_char_read(device_t *, void *, ipc_callid_t, ipc_call_t *);
     45static void remote_char_write(device_t *, void *, ipc_callid_t, ipc_call_t *);
    4646
    47 /** Remote character interface operations.
    48  */
     47/** Remote character interface operations. */
    4948static remote_iface_func_ptr_t remote_char_iface_ops [] = {
    5049        &remote_char_read,
    51         &remote_char_write     
    52 };
    53  
    54 /** Remote character interface structure.
    55  * Interface for processing request from remote clients addressed to the character interface.
     50        &remote_char_write
     51};
     52
     53/** Remote character interface structure.
     54 *
     55 * Interface for processing request from remote clients addressed to the
     56 * character interface.
    5657 */
    5758remote_iface_t remote_char_iface = {
    58         .method_count = sizeof(remote_char_iface_ops) / sizeof(remote_iface_func_ptr_t),
     59        .method_count = sizeof(remote_char_iface_ops) /
     60            sizeof(remote_iface_func_ptr_t),
    5961        .methods = remote_char_iface_ops
    6062};
    6163
    6264/** Process the read request from the remote client.
    63  *
    64  * Receive the read request's parameters from the remote client and pass them to the local interface.
    65  * Return the result of the operation processed by the local interface to the remote client.
    66  *
    67  * @param dev the device from which the data are read.
    68  * @param iface the local interface structure.
     65 *
     66 * Receive the read request's parameters from the remote client and pass them
     67 * to the local interface. Return the result of the operation processed by the
     68 * local interface to the remote client.
     69 *
     70 * @param dev           The device from which the data are read.
     71 * @param iface         The local interface structure.
    6972 */
    70 static void remote_char_read(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call)
     73static void
     74remote_char_read(device_t *dev, void *iface, ipc_callid_t callid,
     75    ipc_call_t *call)
    7176{       
    72         char_iface_t *char_iface = (char_iface_t *)iface;
     77        char_iface_t *char_iface = (char_iface_t *) iface;
    7378        ipc_callid_t cid;
    7479       
    7580        size_t len;
    7681        if (!async_data_read_receive(&cid, &len)) {
    77                 // TODO handle protocol error
     82                /* TODO handle protocol error. */
    7883                ipc_answer_0(callid, EINVAL);
    7984                return;
     
    8691        }
    8792       
    88         if (len > MAX_CHAR_RW_COUNT) {
     93        if (len > MAX_CHAR_RW_COUNT)
    8994                len = MAX_CHAR_RW_COUNT;
    90         }
    9195       
    9296        char buf[MAX_CHAR_RW_COUNT];
    9397        int ret = (*char_iface->read)(dev, buf, len);
    9498       
    95         if (ret < 0) { // some error occured
     99        if (ret < 0) {
     100                /* Some error occured. */
    96101                async_data_read_finalize(cid, buf, 0);
    97102                ipc_answer_0(callid, ret);
     
    99104        }
    100105       
    101         // the operation was successful, return the number of data read
     106        /* The operation was successful, return the number of data read. */
    102107        async_data_read_finalize(cid, buf, ret);
    103         ipc_answer_1(callid, EOK, ret); 
     108        ipc_answer_1(callid, EOK, ret);
    104109}
    105110
    106111/** Process the write request from the remote client.
    107  *
    108  * Receive the write request's parameters from the remote client and pass them to the local interface.
    109  * Return the result of the operation processed by the local interface to the remote client.
    110  *
    111  * @param dev the device to which the data are written.
    112  * @param iface the local interface structure.
     112 *
     113 * Receive the write request's parameters from the remote client and pass them
     114 * to the local interface. Return the result of the operation processed by the
     115 * local interface to the remote client.
     116 *
     117 * @param dev           The device to which the data are written.
     118 * @param iface         The local interface structure.
    113119 */
    114 static void remote_char_write(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call)
     120static void
     121remote_char_write(device_t *dev, void *iface, ipc_callid_t callid,
     122    ipc_call_t *call)
    115123{
    116         char_iface_t *char_iface = (char_iface_t *)iface;
     124        char_iface_t *char_iface = (char_iface_t *) iface;
    117125        ipc_callid_t cid;
    118126        size_t len;
    119127       
    120128        if (!async_data_write_receive(&cid, &len)) {
    121                 // TODO handle protocol error
     129                /* TODO handle protocol error. */
    122130                ipc_answer_0(callid, EINVAL);
    123131                return;
    124     }
     132        }
    125133       
    126134        if (!char_iface->write) {
     
    130138        }       
    131139       
    132         if (len > MAX_CHAR_RW_COUNT) {
     140        if (len > MAX_CHAR_RW_COUNT)
    133141                len = MAX_CHAR_RW_COUNT;
    134         }
    135142       
    136143        char buf[MAX_CHAR_RW_COUNT];
     
    139146       
    140147        int ret = (*char_iface->write)(dev, buf, len);
    141         if (ret < 0) { // some error occured
     148        if (ret < 0) {
     149                /* Some error occured. */
    142150                ipc_answer_0(callid, ret);
    143151        } else {
    144                 // the operation was successful, return the number of data written
     152                /*
     153                 * The operation was successful, return the number of data
     154                 * written.
     155                 */
    145156                ipc_answer_1(callid, EOK, ret);
    146157        }
    147158}
    148159
    149  /**
     160/**
    150161 * @}
    151162 */
Note: See TracChangeset for help on using the changeset viewer.