Changeset 557c7d0 in mainline for uspace/srv


Ignore:
Timestamp:
2010-12-19T10:12:49Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8dd039a, f568ee7
Parents:
11658b64 (diff), 40dc422 (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

Location:
uspace/srv
Files:
18 edited

Legend:

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

    r11658b64 r557c7d0  
    6262}
    6363
     64static int devmap_devices_class_compare(unsigned long key[], hash_count_t keys,
     65    link_t *item)
     66{
     67        dev_class_info_t *class_info
     68            = hash_table_get_instance(item, dev_class_info_t, devmap_link);
     69        assert(class_info != NULL);
     70
     71        return (class_info->devmap_handle == (devmap_handle_t) key[0]);
     72}
     73
    6474static void devices_remove_callback(link_t *item)
    6575{
     
    7585        .hash = devices_hash,
    7686        .compare = devmap_devices_compare,
     87        .remove_callback = devices_remove_callback
     88};
     89
     90static hash_table_operations_t devmap_devices_class_ops = {
     91        .hash = devices_hash,
     92        .compare = devmap_devices_class_compare,
    7793        .remove_callback = devices_remove_callback
    7894};
     
    678694        }
    679695       
    680         devmap_device_register(devmap_pathname, &node->devmap_handle);
     696        devmap_device_register_with_iface(devmap_pathname,
     697            &node->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
    681698       
    682699        tree_add_devmap_device(tree, node);
     
    10501067       
    10511068        info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
    1052         if (info != NULL)
     1069        if (info != NULL) {
    10531070                memset(info, 0, sizeof(dev_class_info_t));
     1071                list_initialize(&info->dev_classes);
     1072                list_initialize(&info->devmap_link);
     1073                list_initialize(&info->link);
     1074        }
    10541075       
    10551076        return info;
     
    11751196        fibril_rwlock_initialize(&class_list->rwlock);
    11761197        hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1,
    1177             &devmap_devices_ops);
     1198            &devmap_devices_class_ops);
    11781199}
    11791200
     
    12231244        hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link);
    12241245        fibril_rwlock_write_unlock(&class_list->rwlock);
     1246
     1247        assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);
    12251248}
    12261249
  • uspace/srv/devman/main.c

    r11658b64 r557c7d0  
    281281         * handle.
    282282         */
    283         devmap_device_register(devmap_pathname, &cli->devmap_handle);
     283        devmap_device_register_with_iface(devmap_pathname,
     284            &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
    284285       
    285286        /*
     
    486487static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall)
    487488{
    488         devmap_handle_t devmap_handle = IPC_GET_IMETHOD(*icall);
     489        devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall);
    489490        node_t *dev;
    490491
     
    503504        }
    504505       
    505         printf(NAME ": devman_connection_devmapper: forward connection to "
    506             "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    507506        ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
    508507            IPC_FF_NONE);
     508        printf(NAME ": devman_connection_devmapper: forwarded connection to "
     509            "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    509510}
    510511
     
    512513static void devman_connection(ipc_callid_t iid, ipc_call_t *icall)
    513514{
    514         /*
    515          * Silly hack to enable the device manager to register as a driver by
    516          * the device mapper. If the ipc method is not IPC_M_CONNECT_ME_TO, this
    517          * is not the forwarded connection from naming service, so it must be a
    518          * connection from the devmapper which thinks this is a devmapper-style
    519          * driver. So pretend this is a devmapper-style driver. (This does not
    520          * work for device with handle == IPC_M_CONNECT_ME_TO, because devmapper
    521          * passes device handle to the driver as an ipc method.)
    522          */
    523         if (IPC_GET_IMETHOD(*icall) != IPC_M_CONNECT_ME_TO)
    524                 devman_connection_devmapper(iid, icall);
    525 
    526         /*
    527          * ipc method is IPC_M_CONNECT_ME_TO, so this is forwarded connection
    528          * from naming service by which we registered as device manager, so be
    529          * device manager.
    530          */
    531        
    532515        /* Select interface. */
    533516        switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     
    542525                devman_forward(iid, icall, false);
    543526                break;
     527        case DEVMAN_CONNECT_FROM_DEVMAP:
     528                /* Someone connected through devmap node. */
     529                devman_connection_devmapper(iid, icall);
     530                break;
    544531        case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
    545532                /* Connect client to selected device. */
  • uspace/srv/devmap/devmap.c

    r11658b64 r557c7d0  
    9999        /** Device driver handling this device */
    100100        devmap_driver_t *driver;
     101        /** Use this interface when forwarding to driver. */
     102        sysarg_t forward_interface;
    101103} devmap_device_t;
    102104
     
    517519        }
    518520       
     521        /* Set the interface, if any. */
     522        device->forward_interface = IPC_GET_ARG1(*icall);
     523
    519524        /* Get fqdn */
    520525        char *fqdn;
     
    566571        /* Get unique device handle */
    567572        device->handle = devmap_create_handle();
    568        
     573
    569574        devmap_namespace_addref(namespace, device);
    570575        device->driver = driver;
     
    617622        }
    618623       
    619         ipc_forward_fast(callid, dev->driver->phone, dev->handle,
    620             IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
     624        if (dev->forward_interface == 0) {
     625                ipc_forward_fast(callid, dev->driver->phone,
     626                    dev->handle, 0, 0,
     627                    IPC_FF_NONE);
     628        } else {
     629                ipc_forward_fast(callid, dev->driver->phone,
     630                    dev->forward_interface, dev->handle, 0,
     631                    IPC_FF_NONE);
     632        }
    621633       
    622634        fibril_mutex_unlock(&devices_list_mutex);
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    r11658b64 r557c7d0  
    197197                return rc;
    198198        address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
    199         address->length = CONVERT_SIZE(ether_addr_t, char, 1);
     199        address->length = sizeof(ether_addr_t);
    200200        return EOK;
    201201}
     
    310310        async_set_interrupt_received(irq_handler);
    311311
    312         return REGISTER_ME(SERVICE_DP8390, &phonehash);
     312        return ipc_connect_to_me(PHONE_NS, SERVICE_DP8390, 0, 0, &phonehash);
    313313}
    314314
  • uspace/srv/net/il/arp/arp.c

    r11658b64 r557c7d0  
    483483        des_proto = des_hw + header->hardware_length;
    484484        trans = arp_addr_find(&proto->addresses, (char *) src_proto,
    485             CONVERT_SIZE(uint8_t, char, header->protocol_length));
     485            header->protocol_length);
    486486        /* Exists? */
    487487        if (trans && trans->hw_addr) {
    488                 if (trans->hw_addr->length != CONVERT_SIZE(uint8_t, char,
    489                     header->hardware_length)) {
     488                if (trans->hw_addr->length != header->hardware_length)
    490489                        return EINVAL;
    491                 }
    492490                memcpy(trans->hw_addr->value, src_hw, trans->hw_addr->length);
    493491        }
    494492        /* Is my protocol address? */
    495         if (proto->addr->length != CONVERT_SIZE(uint8_t, char,
    496             header->protocol_length)) {
     493        if (proto->addr->length != header->protocol_length)
    497494                return EINVAL;
    498         }
    499495        if (!str_lcmp(proto->addr->value, (char *) des_proto,
    500496            proto->addr->length)) {
     
    507503                        fibril_condvar_initialize(&trans->cv);
    508504                        rc = arp_addr_add(&proto->addresses, (char *) src_proto,
    509                             CONVERT_SIZE(uint8_t, char, header->protocol_length),
    510                             trans);
     505                            header->protocol_length, trans);
    511506                        if (rc != EOK) {
    512507                                /* The generic char map has already freed trans! */
     
    516511                if (!trans->hw_addr) {
    517512                        trans->hw_addr = measured_string_create_bulk(
    518                             (char *) src_hw, CONVERT_SIZE(uint8_t, char,
    519                             header->hardware_length));
     513                            (char *) src_hw, header->hardware_length);
    520514                        if (!trans->hw_addr)
    521515                                return ENOMEM;
     
    606600
    607601        /* ARP packet content size = header + (address + translation) * 2 */
    608         length = 8 + 2 * (CONVERT_SIZE(char, uint8_t, proto->addr->length) +
    609             CONVERT_SIZE(char, uint8_t, device->addr->length));
     602        length = 8 + 2 * (proto->addr->length + device->addr->length);
    610603        if (length > device->packet_dimension.content)
    611604                return ELIMIT;
     
    640633
    641634        rc = packet_set_addr(packet, (uint8_t *) device->addr->value,
    642             (uint8_t *) device->broadcast_addr->value,
    643             CONVERT_SIZE(char, uint8_t, device->addr->length));
     635            (uint8_t *) device->broadcast_addr->value, device->addr->length);
    644636        if (rc != EOK) {
    645637                pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
  • uspace/srv/net/il/arp/arp_module.c

    r11658b64 r557c7d0  
    7979                goto out;
    8080       
    81         rc = REGISTER_ME(SERVICE_ARP, &phonehash);
     81        rc = ipc_connect_to_me(PHONE_NS, SERVICE_ARP, 0, 0, &phonehash);
    8282        if (rc != EOK)
    8383                goto out;
  • uspace/srv/net/il/ip/ip.c

    r11658b64 r557c7d0  
    442442                if (route) {
    443443                        address.value = (char *) &route->address.s_addr;
    444                         address.length = CONVERT_SIZE(in_addr_t, char, 1);
     444                        address.length = sizeof(in_addr_t);
    445445                       
    446446                        rc = arp_device_req(ip_netif->arp->phone,
     
    639639        if (destination) {
    640640                rc = packet_set_addr(packet, NULL, (uint8_t *) destination->value,
    641                     CONVERT_SIZE(char, uint8_t, destination->length));
     641                    destination->length);
    642642        } else {
    643643                rc = packet_set_addr(packet, NULL, NULL, 0);
     
    687687                                rc = packet_set_addr(next, NULL,
    688688                                    (uint8_t *) destination->value,
    689                                     CONVERT_SIZE(char, uint8_t,
    690                                     destination->length));
     689                                    destination->length);
    691690                                if (rc != EOK) {
    692691                                        free(last_header);
     
    718717                        rc = packet_set_addr(next, NULL,
    719718                            (uint8_t *) destination->value,
    720                             CONVERT_SIZE(char, uint8_t, destination->length));
     719                            destination->length);
    721720                        if (rc != EOK) {
    722721                                free(last_header);
     
    10061005                destination.value = route->gateway.s_addr ?
    10071006                    (char *) &route->gateway.s_addr : (char *) &dest.s_addr;
    1008                 destination.length = CONVERT_SIZE(dest.s_addr, char, 1);
     1007                destination.length = sizeof(dest.s_addr);
    10091008
    10101009                rc = arp_translate_req(netif->arp->phone, netif->device_id,
     
    17581757                        // clear the ARP mapping if any
    17591758                        address.value = (char *) &header->destination_address;
    1760                         address.length = CONVERT_SIZE(uint8_t, char,
    1761                             sizeof(header->destination_address));
     1759                        address.length = sizeof(header->destination_address);
    17621760                        arp_clear_address_req(netif->arp->phone,
    17631761                            netif->device_id, SERVICE_IP, &address);
     
    19511949
    19521950        case NET_IP_GET_ROUTE:
    1953                 rc = data_receive((void **) &addr, &addrlen);
     1951                rc = async_data_write_accept((void **) &addr, false, 0, 0, 0,
     1952                    &addrlen);
    19541953                if (rc != EOK)
    19551954                        return rc;
  • uspace/srv/net/il/ip/ip_module.c

    r11658b64 r557c7d0  
    8080                goto out;
    8181       
    82         rc = REGISTER_ME(SERVICE_IP, &phonehash);
     82        rc = ipc_connect_to_me(PHONE_NS, SERVICE_IP, 0, 0, &phonehash);
    8383        if (rc != EOK)
    8484                goto out;
  • uspace/srv/net/net/net.c

    r11658b64 r557c7d0  
    335335                goto out;
    336336       
    337         rc = REGISTER_ME(SERVICE_NETWORKING, &phonehash);
     337        rc = ipc_connect_to_me(PHONE_NS, SERVICE_NETWORKING, 0, 0, &phonehash);
    338338        if (rc != EOK)
    339339                goto out;
  • uspace/srv/net/netif/lo/lo.c

    r11658b64 r557c7d0  
    166166        sysarg_t phonehash;
    167167
    168         return REGISTER_ME(SERVICE_LO, &phonehash);
     168        return ipc_connect_to_me(PHONE_NS, SERVICE_LO, 0, 0, &phonehash);
    169169}
    170170
  • uspace/srv/net/nil/eth/eth.c

    r11658b64 r557c7d0  
    201201
    202202        eth_globals.broadcast_addr =
    203             measured_string_create_bulk("\xFF\xFF\xFF\xFF\xFF\xFF",
    204             CONVERT_SIZE(uint8_t, char, ETH_ADDR));
     203            measured_string_create_bulk("\xFF\xFF\xFF\xFF\xFF\xFF", ETH_ADDR);
    205204        if (!eth_globals.broadcast_addr) {
    206205                rc = ENOMEM;
  • uspace/srv/net/nil/eth/eth_module.c

    r11658b64 r557c7d0  
    6666                goto out;
    6767
    68         rc = REGISTER_ME(SERVICE_ETHERNET, &phonehash);
     68        rc = ipc_connect_to_me(PHONE_NS, SERVICE_ETHERNET, 0, 0, &phonehash);
    6969        if (rc != EOK)
    7070                goto out;
  • uspace/srv/net/nil/nildummy/nildummy_module.c

    r11658b64 r557c7d0  
    6767                goto out;
    6868       
    69         rc = REGISTER_ME(SERVICE_NILDUMMY, &phonehash);
     69        rc = ipc_connect_to_me(PHONE_NS, SERVICE_NILDUMMY, 0, 0, &phonehash);
    7070        if (rc != EOK)
    7171                goto out;
  • uspace/srv/net/tl/icmp/icmp_module.c

    r11658b64 r557c7d0  
    7474                goto out;
    7575
    76         rc = REGISTER_ME(SERVICE_ICMP, &phonehash);
     76        rc = ipc_connect_to_me(PHONE_NS, SERVICE_ICMP, 0, 0, &phonehash);
    7777        if (rc != EOK)
    7878                goto out;
  • uspace/srv/net/tl/tcp/tcp.c

    r11658b64 r557c7d0  
    13651365
    13661366                case NET_SOCKET_BIND:
    1367                         res = data_receive((void **) &addr, &addrlen);
     1367                        res = async_data_write_accept((void **) &addr, false,
     1368                            0, 0, 0, &addrlen);
    13681369                        if (res != EOK)
    13691370                                break;
     
    14021403
    14031404                case NET_SOCKET_CONNECT:
    1404                         res = data_receive((void **) &addr, &addrlen);
     1405                        res = async_data_write_accept((void **) &addr, false,
     1406                            0, 0, 0, &addrlen);
    14051407                        if (res != EOK)
    14061408                                break;
     
    14531455
    14541456                case NET_SOCKET_SENDTO:
    1455                         res = data_receive((void **) &addr, &addrlen);
     1457                        res = async_data_write_accept((void **) &addr, false,
     1458                            0, 0, 0, &addrlen);
    14561459                        if (res != EOK)
    14571460                                break;
  • uspace/srv/net/tl/tcp/tcp_module.c

    r11658b64 r557c7d0  
    7575                goto out;
    7676
    77         rc = REGISTER_ME(SERVICE_TCP, &phonehash);
     77        rc = ipc_connect_to_me(PHONE_NS, SERVICE_TCP, 0, 0, &phonehash);
    7878        if (rc != EOK)
    7979                goto out;
  • uspace/srv/net/tl/udp/udp.c

    r11658b64 r557c7d0  
    771771
    772772                case NET_SOCKET_BIND:
    773                         res = data_receive((void **) &addr, &addrlen);
     773                        res = async_data_write_accept((void **) &addr, false,
     774                            0, 0, 0, &addrlen);
    774775                        if (res != EOK)
    775776                                break;
     
    784785
    785786                case NET_SOCKET_SENDTO:
    786                         res = data_receive((void **) &addr, &addrlen);
     787                        res = async_data_write_accept((void **) &addr, false,
     788                            0, 0, 0, &addrlen);
    787789                        if (res != EOK)
    788790                                break;
  • uspace/srv/net/tl/udp/udp_module.c

    r11658b64 r557c7d0  
    7575                goto out;
    7676       
    77         rc = REGISTER_ME(SERVICE_UDP, &phonehash);
     77        rc = ipc_connect_to_me(PHONE_NS, SERVICE_UDP, 0, 0, &phonehash);
    7878        if (rc != EOK)
    7979                goto out;
Note: See TracChangeset for help on using the changeset viewer.