Changeset 7f3e3e7 in mainline


Ignore:
Timestamp:
2007-11-09T09:08:52Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c4ff8a
Parents:
44358c1
Message:

Cstyle fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devmap/devmap.c

    r44358c1 r7f3e3e7  
    155155}
    156156
    157 /** Unregister device and free it. Its assumed that driver's device list
    158  * is already locked.
    159  *
     157/**
     158 * Unregister device and free it. It's assumed that driver's device list is
     159 * already locked.
    160160 */
    161161static int devmap_device_unregister_core(devmap_device_t *device)
     
    172172}
    173173
    174 /** Read info about new driver and add it into linked list of registered drivers.
     174/**
     175 * Read info about new driver and add it into linked list of registered
     176 * drivers.
    175177 */
    176178static void devmap_driver_register(devmap_driver_t **odriver)
     
    192194        }
    193195
    194         if (NULL == (driver = (devmap_driver_t *)malloc(sizeof(devmap_driver_t)))) {
     196        if (NULL ==
     197            (driver = (devmap_driver_t *)malloc(sizeof(devmap_driver_t)))) {
    195198                ipc_answer_fast(iid, ENOMEM, 0, 0);
    196199                return;
     
    209212
    210213        if (name_size > DEVMAP_NAME_MAXLEN) {
    211                 printf("Too logn name: %u: maximum is %u.\n", name_size, DEVMAP_NAME_MAXLEN);
     214                printf("Too logn name: %u: maximum is %u.\n", name_size,
     215                    DEVMAP_NAME_MAXLEN);
    212216                free(driver);
    213217                ipc_answer_fast(callid, EINVAL, 0, 0);
     
    243247
    244248        /* Initialize futex for list of devices owned by this driver */
    245         futex_initialize(&(driver->devices_futex) ,1);
     249        futex_initialize(&(driver->devices_futex), 1);
    246250
    247251        /*
     
    256260
    257261        if (IPC_M_CONNECT_TO_ME != IPC_GET_METHOD(call)) {
    258                 printf("DevMap: Unexpected method: %u.\n", \
    259                         IPC_GET_METHOD(call));
     262                printf("DevMap: Unexpected method: %u.\n",
     263                    IPC_GET_METHOD(call));
    260264                ipc_answer_fast(callid, ENOTSUP, 0, 0);
    261265               
     
    274278        futex_down(&drivers_list_futex);       
    275279       
    276         /* TODO: check that no driver with name equals to driver->name is registered */
     280        /* TODO:
     281         * check that no driver with name equal to driver->name is registered
     282         */
    277283
    278284        /*
     
    315321
    316322        while (!list_empty(&(driver->devices))) {
    317                 device = list_get_instance(driver->devices.next, devmap_device_t, driver_devices);
     323                device = list_get_instance(driver->devices.next,
     324                    devmap_device_t, driver_devices);
    318325                printf("Unregister device '%s'.\n", device->name);
    319326                devmap_device_unregister_core(device);
     
    355362       
    356363        /* Create new device entry */
    357         if (NULL == (device = (devmap_device_t *)malloc(sizeof(devmap_device_t)))) {
     364        if (NULL ==
     365            (device = (devmap_device_t *)malloc(sizeof(devmap_device_t)))) {
    358366                printf("Cannot allocate new device.\n");
    359367                ipc_answer_fast(iid, ENOMEM, 0, 0);
     
    457465
    458466        if (NULL == dev) {
    459                 printf("DevMap: No registered device with handle %d.\n", handle);
     467                printf("DevMap: No registered device with handle %d.\n",
     468                    handle);
    460469                ipc_answer_fast(callid, ENOENT, 0, 0);
    461470                return;
    462471        }
    463472
    464                 /* FIXME: is this correct method how to pass argument on forwarding ?*/
    465         ipc_forward_fast(callid, dev->driver->phone, (ipcarg_t)(dev->handle), 0);
     473        /* FIXME: is this correct method how to pass argument on forwarding ?*/
     474        ipc_forward_fast(callid, dev->driver->phone, (ipcarg_t)(dev->handle),
     475            0);
    466476        return;
    467477}
     
    509519         * Send confirmation to sender and get data into buffer.
    510520         */
    511         if (EOK != (retval = ipc_data_deliver(callid, &call, name, name_size))) {
     521        if (EOK != (retval = ipc_data_deliver(callid, &call, name,
     522            name_size))) {
    512523                ipc_answer_fast(iid, EREFUSED, 0, 0);
    513524                return;
     
    664675                case DEVMAP_DEVICE_CONNECT_ME_TO:
    665676                        /* Connect client to selected device */
    666                         printf("DevMap: connect to device %d.\n", IPC_GET_ARG1(call));
     677                        printf("DevMap: connect to device %d.\n",
     678                            IPC_GET_ARG1(call));
    667679                        devmap_forward(callid, &call);
    668680                        break;
     
    695707                /* Select interface */
    696708        switch ((ipcarg_t)(IPC_GET_ARG1(*icall))) {
    697                 case DEVMAP_DRIVER:
    698                         devmap_connection_driver(iid, icall);
    699                         break;
    700                 case DEVMAP_CLIENT:
    701                         devmap_connection_client(iid, icall);
    702                         break;
    703                 default:
    704                         ipc_answer_fast(iid, ENOENT, 0, 0); /* No such interface */
    705                         printf("DevMap: Unknown interface %u.\n", \
    706                                 (ipcarg_t)(IPC_GET_ARG1(*icall)));
     709        case DEVMAP_DRIVER:
     710                devmap_connection_driver(iid, icall);
     711                break;
     712        case DEVMAP_CLIENT:
     713                devmap_connection_client(iid, icall);
     714                break;
     715        default:
     716                ipc_answer_fast(iid, ENOENT, 0, 0); /* No such interface */
     717                printf("DevMap: Unknown interface %u.\n",
     718                    (ipcarg_t)(IPC_GET_ARG1(*icall)));
    707719        }
    708720
     
    730742        async_set_client_connection(devmap_connection);
    731743
    732                 /* Register device mapper at naming service */
     744        /* Register device mapper at naming service */
    733745        if (ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAP, 0, &phonead) != 0)
    734746                return -1;
Note: See TracChangeset for help on using the changeset viewer.