Changeset fe1776c2 in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2011-02-11T12:41:11Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d81ef61c
Parents:
78d1525 (diff), 5d4193c (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 from usb/development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/main.c

    r78d1525 rfe1776c2  
    7575        iid = async_get_call(&icall);
    7676        if (IPC_GET_IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) {
    77                 ipc_answer_0(iid, EREFUSED);
     77                async_answer_0(iid, EREFUSED);
    7878                return NULL;
    7979        }
     
    8484        int rc = async_data_write_accept((void **) &drv_name, true, 0, 0, 0, 0);
    8585        if (rc != EOK) {
    86                 ipc_answer_0(iid, rc);
     86                async_answer_0(iid, rc);
    8787                return NULL;
    8888        }
     
    9898                free(drv_name);
    9999                drv_name = NULL;
    100                 ipc_answer_0(iid, ENOENT);
     100                async_answer_0(iid, ENOENT);
    101101                return NULL;
    102102        }
     
    110110        ipc_callid_t callid = async_get_call(&call);
    111111        if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
    112                 ipc_answer_0(callid, ENOTSUP);
    113                 ipc_answer_0(iid, ENOTSUP);
     112                async_answer_0(callid, ENOTSUP);
     113                async_answer_0(iid, ENOTSUP);
    114114                return NULL;
    115115        }
     
    121121            driver->name);
    122122       
    123         ipc_answer_0(callid, EOK);
    124         ipc_answer_0(iid, EOK);
     123        async_answer_0(callid, EOK);
     124        async_answer_0(iid, EOK);
    125125       
    126126        return driver;
     
    144144                printf(NAME ": ERROR: devman_receive_match_id - invalid "
    145145                    "protocol.\n");
    146                 ipc_answer_0(callid, EINVAL);
     146                async_answer_0(callid, EINVAL);
    147147                delete_match_id(match_id);
    148148                return EINVAL;
     
    152152                printf(NAME ": ERROR: devman_receive_match_id - failed to "
    153153                    "allocate match id.\n");
    154                 ipc_answer_0(callid, ENOMEM);
     154                async_answer_0(callid, ENOMEM);
    155155                return ENOMEM;
    156156        }
    157157       
    158         ipc_answer_0(callid, EOK);
     158        async_answer_0(callid, EOK);
    159159       
    160160        match_id->score = IPC_GET_ARG1(call);
     
    219219        if (parent == NULL) {
    220220                fibril_rwlock_write_unlock(&tree->rwlock);
    221                 ipc_answer_0(callid, ENOENT);
     221                async_answer_0(callid, ENOENT);
    222222                return;
    223223        }
     
    227227        if (rc != EOK) {
    228228                fibril_rwlock_write_unlock(&tree->rwlock);
    229                 ipc_answer_0(callid, rc);
     229                async_answer_0(callid, rc);
    230230                return;
    231231        }
     
    235235                fibril_rwlock_write_unlock(&tree->rwlock);
    236236                delete_dev_node(node);
    237                 ipc_answer_0(callid, ENOMEM);
     237                async_answer_0(callid, ENOMEM);
    238238                return;
    239239        }
     
    264264
    265265        /* Return device handle to parent's driver. */
    266         ipc_answer_1(callid, EOK, node->handle);
     266        async_answer_1(callid, EOK, node->handle);
    267267}
    268268
     
    302302            0, 0, 0, 0);
    303303        if (rc != EOK) {
    304                 ipc_answer_0(callid, rc);
     304                async_answer_0(callid, rc);
    305305                return;
    306306        }       
     
    308308        node_t *dev = find_dev_node(&device_tree, handle);
    309309        if (dev == NULL) {
    310                 ipc_answer_0(callid, ENOENT);
     310                async_answer_0(callid, ENOENT);
    311311                return;
    312312        }
     
    321321            "asigned to it\n", dev->pathname, class_name, class_info->dev_name);
    322322
    323         ipc_answer_0(callid, EOK);
     323        async_answer_0(callid, EOK);
    324324}
    325325
     
    343343{
    344344        /* Accept the connection. */
    345         ipc_answer_0(iid, EOK);
     345        async_answer_0(iid, EOK);
    346346       
    347347        driver_t *driver = devman_driver_register();
     
    379379                        break;
    380380                default:
    381                         ipc_answer_0(callid, EINVAL);
     381                        async_answer_0(callid, EINVAL);
    382382                        break;
    383383                }
     
    393393        int rc = async_data_write_accept((void **) &pathname, true, 0, 0, 0, 0);
    394394        if (rc != EOK) {
    395                 ipc_answer_0(iid, rc);
     395                async_answer_0(iid, rc);
    396396                return;
    397397        }
     
    402402
    403403        if (dev == NULL) {
    404                 ipc_answer_0(iid, ENOENT);
    405                 return;
    406         }
    407        
    408         ipc_answer_1(iid, EOK, dev->handle);
     404                async_answer_0(iid, ENOENT);
     405                return;
     406        }
     407       
     408        async_answer_1(iid, EOK, dev->handle);
    409409}
    410410
     
    414414{
    415415        /* Accept connection. */
    416         ipc_answer_0(iid, EOK);
     416        async_answer_0(iid, EOK);
    417417       
    418418        bool cont = true;
     
    429429                        break;
    430430                default:
    431                         ipc_answer_0(callid, ENOENT);
     431                        async_answer_0(callid, ENOENT);
    432432                }
    433433        }
     
    443443                printf(NAME ": devman_forward error - no device with handle %" PRIun
    444444                    " was found.\n", handle);
    445                 ipc_answer_0(iid, ENOENT);
     445                async_answer_0(iid, ENOENT);
    446446                return;
    447447        }
     
    461461                    " (%s) is not in usable state.\n",
    462462                    handle, dev->pathname);
    463                 ipc_answer_0(iid, ENOENT);
     463                async_answer_0(iid, ENOENT);
    464464                return;
    465465        }
     
    475475                    driver->name);
    476476                printf("the driver's phone is %" PRIun ").\n", driver->phone);
    477                 ipc_answer_0(iid, EINVAL);
    478                 return;
    479         }
    480 
    481 //      printf(NAME ": devman_forward: forward connection to device %s to "
    482 //          "driver %s.\n", dev->pathname, driver->name);
    483         ipc_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE);
     477                async_answer_0(iid, EINVAL);
     478                return;
     479        }
     480
     481        printf(NAME ": devman_forward: forward connection to device %s to "
     482            "driver %s.\n", dev->pathname, driver->name);
     483        async_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE);
    484484}
    485485
     
    496496       
    497497        if (dev == NULL || dev->drv == NULL) {
    498                 ipc_answer_0(iid, ENOENT);
     498                async_answer_0(iid, ENOENT);
    499499                return;
    500500        }
    501501       
    502502        if (dev->state != DEVICE_USABLE || dev->drv->phone <= 0) {
    503                 ipc_answer_0(iid, EINVAL);
    504                 return;
    505         }
    506        
    507         ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
     503                async_answer_0(iid, EINVAL);
     504                return;
     505        }
     506       
     507        async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
    508508            IPC_FF_NONE);
    509509        printf(NAME ": devman_connection_devmapper: forwarded connection to "
     
    536536        default:
    537537                /* No such interface */
    538                 ipc_answer_0(iid, ENOENT);
     538                async_answer_0(iid, ENOENT);
    539539        }
    540540}
     
    587587
    588588        /* Register device manager at naming service. */
    589         if (ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAN, 0, 0, NULL, NULL) != 0)
     589        if (service_register(SERVICE_DEVMAN) != EOK)
    590590                return -1;
    591591
Note: See TracChangeset for help on using the changeset viewer.