Changeset a0a134b in mainline for uspace/srv


Ignore:
Timestamp:
2011-04-13T18:27:21Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4c70554
Parents:
d6522dd (diff), b77ce84 (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:

Development branch changes

Location:
uspace/srv
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/ata_bd/ata_bd.c

    rd6522dd ra0a134b  
    372372        uint16_t w;
    373373        uint8_t c;
     374        uint16_t bc;
    374375        size_t pos, len;
    375376        int rc;
     
    387388        } else if (rc == EIO) {
    388389                /*
    389                  * There is something, but not a register device.
    390                  * It could be a packet device.
     390                 * There is something, but not a register device. Check to see
     391                 * whether the IDENTIFY command left the packet signature in
     392                 * the registers in case this is a packet device.
     393                 *
     394                 * According to the ATA specification, the LBA low and
     395                 * interrupt reason registers should be set to 0x01. However,
     396                 * there are many devices that do not follow this and only set
     397                 * the byte count registers. So, only check these.
    391398                 */
    392                 rc = identify_pkt_dev(disk_id, &idata);
    393                 if (rc == EOK) {
    394                         /* We have a packet device. */
    395                         d->dev_type = ata_pkt_dev;
     399                bc = ((uint16_t)pio_read_8(&cmd->cylinder_high) << 8) |
     400                    pio_read_8(&cmd->cylinder_low);
     401
     402                if (bc == PDEV_SIGNATURE_BC) {
     403                        rc = identify_pkt_dev(disk_id, &idata);
     404                        if (rc == EOK) {
     405                                /* We have a packet device. */
     406                                d->dev_type = ata_pkt_dev;
     407                        } else {
     408                                return EIO;
     409                        }
    396410                } else {
    397411                        /* Nope. Something's there, but not recognized. */
     
    403417        }
    404418
    405         printf("device caps: 0x%04x\n", idata.caps);
    406419        if (d->dev_type == ata_pkt_dev) {
    407420                /* Packet device */
     
    566579
    567580        /*
    568          * This is where we would most likely expect a non-existing device to
    569          * show up by not setting SR_DRDY.
     581         * Do not wait for DRDY to be set in case this is a packet device.
     582         * We determine whether the device is present by waiting for DRQ to be
     583         * set after issuing the command.
    570584         */
    571         if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
     585        if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
    572586                return ETIMEOUT;
    573587
     
    577591                return ETIMEOUT;
    578592
     593        /*
     594         * If ERR is set, this may be a packet device, so return EIO to cause
     595         * the caller to check for one.
     596         */
     597        if ((status & SR_ERR) != 0) {
     598                return EIO;
     599        }
     600
     601        if (wait_status(SR_DRQ, ~SR_BSY, &status, TIMEOUT_PROBE) != EOK)
     602                return ETIMEOUT;
     603
    579604        /* Read data from the disk buffer. */
    580605
    581         if ((status & SR_DRQ) != 0) {
    582                 for (i = 0; i < identify_data_size / 2; i++) {
    583                         data = pio_read_16(&cmd->data_port);
    584                         ((uint16_t *) buf)[i] = data;
    585                 }
    586         }
    587 
    588         if ((status & SR_ERR) != 0) {
    589                 return EIO;
     606        for (i = 0; i < identify_data_size / 2; i++) {
     607                data = pio_read_16(&cmd->data_port);
     608                ((uint16_t *) buf)[i] = data;
    590609        }
    591610
  • uspace/srv/bd/ata_bd/ata_hw.h

    rd6522dd ra0a134b  
    293293};
    294294
     295enum ata_pdev_signature {
     296        /**
     297         * Signature put by a packet device in byte count register
     298         * in response to Identify command.
     299         */
     300        PDEV_SIGNATURE_BC       = 0xEB14
     301};
     302
    295303#endif
    296304
  • uspace/srv/devman/devman.c

    rd6522dd ra0a134b  
    555555}
    556556
    557 /** Remember the driver's phone.
    558  *
    559  * @param driver        The driver.
    560  * @param phone         The phone to the driver.
    561  */
    562 void set_driver_phone(driver_t *driver, sysarg_t phone)
    563 {
    564         fibril_mutex_lock(&driver->driver_mutex);
    565         assert(driver->state == DRIVER_STARTING);
    566         driver->phone = phone;
    567         fibril_mutex_unlock(&driver->driver_mutex);
    568 }
    569 
    570557/** Notify driver about the devices to which it was assigned.
    571558 *
     
    685672        list_initialize(&drv->devices);
    686673        fibril_mutex_initialize(&drv->driver_mutex);
     674        drv->phone = -1;
    687675}
    688676
  • uspace/srv/devman/devman.h

    rd6522dd ra0a134b  
    8888       
    8989        /** Phone asociated with this driver. */
    90         sysarg_t phone;
     90        int phone;
    9191        /** Name of the device driver. */
    9292        char *name;
     
    316316
    317317extern driver_t *find_driver(driver_list_t *, const char *);
    318 extern void set_driver_phone(driver_t *, sysarg_t);
    319318extern void initialize_running_driver(driver_t *, dev_tree_t *);
    320319
  • uspace/srv/devman/main.c

    rd6522dd ra0a134b  
    9595        /* Find driver structure. */
    9696        driver = find_driver(&drivers_list, drv_name);
    97        
    9897        if (driver == NULL) {
    9998                log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name);
     
    107106        drv_name = NULL;
    108107       
     108        fibril_mutex_lock(&driver->driver_mutex);
     109       
     110        if (driver->phone >= 0) {
     111                /* We already have a connection to the driver. */
     112                log_msg(LVL_ERROR, "Driver '%s' already started.\n",
     113                    driver->name);
     114                fibril_mutex_unlock(&driver->driver_mutex);
     115                async_answer_0(iid, EEXISTS);
     116                return NULL;
     117        }
     118       
     119        switch (driver->state) {
     120        case DRIVER_NOT_STARTED:
     121                /* Somebody started the driver manually. */
     122                log_msg(LVL_NOTE, "Driver '%s' started manually.\n",
     123                    driver->name);
     124                driver->state = DRIVER_STARTING;
     125                break;
     126        case DRIVER_STARTING:
     127                /* The expected case */
     128                break;
     129        case DRIVER_RUNNING:
     130                /* Should not happen since we do not have a connected phone */
     131                assert(false);
     132        }
     133       
    109134        /* Create connection to the driver. */
    110135        log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.",
     
    113138        ipc_callid_t callid = async_get_call(&call);
    114139        if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
     140                fibril_mutex_unlock(&driver->driver_mutex);
    115141                async_answer_0(callid, ENOTSUP);
    116142                async_answer_0(iid, ENOTSUP);
     
    119145       
    120146        /* Remember driver's phone. */
    121         set_driver_phone(driver, IPC_GET_ARG5(call));
     147        driver->phone = IPC_GET_ARG5(call);
     148       
     149        fibril_mutex_unlock(&driver->driver_mutex);
    122150       
    123151        log_msg(LVL_NOTE,
     
    579607                method = DRIVER_CLIENT;
    580608       
    581         if (driver->phone <= 0) {
     609        if (driver->phone < 0) {
    582610                log_msg(LVL_ERROR,
    583611                    "Could not forward to driver `%s' (phone is %d).",
     
    619647        dev = fun->dev;
    620648       
    621         if (dev->state != DEVICE_USABLE || dev->drv->phone <= 0) {
     649        if (dev->state != DEVICE_USABLE || dev->drv->phone < 0) {
    622650                async_answer_0(iid, EINVAL);
    623651                return;
  • uspace/srv/fs/fat/fat_ops.c

    rd6522dd ra0a134b  
    722722                    (str_cmp((char *) d->name, FAT_NAME_DOT)) == 0) {
    723723                        memset(d, 0, sizeof(fat_dentry_t));
    724                         str_cpy((char *) d->name, 8, FAT_NAME_DOT);
    725                         str_cpy((char *) d->ext, 3, FAT_EXT_PAD);
     724                        memcpy(d->name, FAT_NAME_DOT, FAT_NAME_LEN);
     725                        memcpy(d->ext, FAT_EXT_PAD, FAT_EXT_LEN);
    726726                        d->attr = FAT_ATTR_SUBDIR;
    727727                        d->firstc = host2uint16_t_le(childp->firstc);
     
    732732                    (str_cmp((char *) d->name, FAT_NAME_DOT_DOT) == 0)) {
    733733                        memset(d, 0, sizeof(fat_dentry_t));
    734                         str_cpy((char *) d->name, 8, FAT_NAME_DOT_DOT);
    735                         str_cpy((char *) d->ext, 3, FAT_EXT_PAD);
     734                        memcpy(d->name, FAT_NAME_DOT_DOT, FAT_NAME_LEN);
     735                        memcpy(d->ext, FAT_EXT_PAD, FAT_EXT_LEN);
    736736                        d->attr = FAT_ATTR_SUBDIR;
    737737                        d->firstc = (parentp->firstc == FAT_CLST_ROOT) ?
  • uspace/srv/net/il/ip/ip.c

    rd6522dd ra0a134b  
    176176        socklen_t addrlen;
    177177
    178         // detach the first packet and release the others
     178        /* Detach the first packet and release the others */
    179179        next = pq_detach(packet);
    180180        if (next)
     
    185185                        return ENOMEM;
    186186
    187                 // get header
     187                /* Get header */
    188188                header = (ip_header_t *) packet_get_data(packet);
    189189                if (!header)
     
    192192        }
    193193
    194         // only for the first fragment
     194        /* Only for the first fragment */
    195195        if (IP_FRAGMENT_OFFSET(header))
    196196                return EINVAL;
    197197
    198         // not for the ICMP protocol
     198        /* Not for the ICMP protocol */
    199199        if (header->protocol == IPPROTO_ICMP)
    200200                return EPERM;
    201201
    202         // set the destination address
     202        /* Set the destination address */
    203203        switch (header->version) {
    204204        case IPVERSION:
     
    351351        configuration = &names[0];
    352352
    353         // get configuration
     353        /* Get configuration */
    354354        rc = net_get_device_conf_req(ip_globals.net_phone, ip_netif->device_id,
    355355            &configuration, count, &data);
     
    419419        }
    420420
    421         // binds the netif service which also initializes the device
     421        /* Bind netif service which also initializes the device */
    422422        ip_netif->phone = nil_bind_service(ip_netif->service,
    423423            (sysarg_t) ip_netif->device_id, SERVICE_IP,
     
    429429        }
    430430
    431         // has to be after the device netif module initialization
     431        /* Has to be after the device netif module initialization */
    432432        if (ip_netif->arp) {
    433433                if (route) {
     
    445445        }
    446446
    447         // get packet dimensions
     447        /* Get packet dimensions */
    448448        rc = nil_packet_size_req(ip_netif->phone, ip_netif->device_id,
    449449            &ip_netif->packet_dimension);
     
    463463       
    464464        if (gateway.s_addr) {
    465                 // the default gateway
     465                /* The default gateway */
    466466                ip_globals.gateway.address.s_addr = 0;
    467467                ip_globals.gateway.netmask.s_addr = 0;
     
    512512                ip_netif->arp->usage++;
    513513
    514         // print the settings
     514        /* Print the settings */
    515515        printf("%s: Device registered (id: %d, phone: %d, ipv: %d, conf: %s)\n",
    516516            NAME, ip_netif->device_id, ip_netif->phone, ip_netif->ipv,
     
    587587        ip_netif_t *netif;
    588588
    589         // start with the last netif - the newest one
     589        /* Start with the last netif - the newest one */
    590590        index = ip_netifs_count(&ip_globals.netifs) - 1;
    591591        while (index >= 0) {
     
    629629        size_t length;
    630630
    631         // copy first itself
     631        /* Copy first itself */
    632632        memcpy(last, first, sizeof(ip_header_t));
    633633        length = sizeof(ip_header_t);
    634634        next = sizeof(ip_header_t);
    635635
    636         // process all ip options
     636        /* Process all IP options */
    637637        while (next < first->header_length) {
    638638                option = (ip_option_t *) (((uint8_t *) first) + next);
    639                 // skip end or noop
     639                /* Skip end or noop */
    640640                if ((option->type == IPOPT_END) ||
    641641                    (option->type == IPOPT_NOOP)) {
    642642                        next++;
    643643                } else {
    644                         // copy if told so or skip
     644                        /* Copy if told so or skip */
    645645                        if (IPOPT_COPIED(option->type)) {
    646646                                memcpy(((uint8_t *) last) + length,
     
    648648                                length += option->length;
    649649                        }
    650                         // next option
     650                        /* Next option */
    651651                        next += option->length;
    652652                }
    653653        }
    654654
    655         // align 4 byte boundary
     655        /* Align 4 byte boundary */
    656656        if (length % 4) {
    657657                bzero(((uint8_t *) last) + length, 4 - (length % 4));
     
    789789
    790790        header->total_length = htons(length);
    791         // unnecessary for all protocols
     791        /* Unnecessary for all protocols */
    792792        header->header_checksum = IP_HEADER_CHECKSUM(header);
    793793
     
    916916                return ENOMEM;
    917917
    918         // get header
     918        /* Get header */
    919919        header = (ip_header_t *) packet_get_data(packet);
    920920        if (!header)
    921921                return EINVAL;
    922922
    923         // fragmentation forbidden?
     923        /* Fragmentation forbidden? */
    924924        if(header->flags & IPFLAG_DONT_FRAGMENT)
    925925                return EPERM;
    926926
    927         // create the last fragment
     927        /* Create the last fragment */
    928928        new_packet = packet_get_4_remote(ip_globals.net_phone, prefix, length,
    929929            suffix, ((addrlen > addr_len) ? addrlen : addr_len));
     
    931931                return ENOMEM;
    932932
    933         // allocate as much as originally
     933        /* Allocate as much as originally */
    934934        last_header = (ip_header_t *) packet_suffix(new_packet,
    935935            IP_HEADER_LENGTH(header));
     
    939939        ip_create_last_header(last_header, header);
    940940
    941         // trim the unused space
     941        /* Trim the unused space */
    942942        rc = packet_trim(new_packet, 0,
    943943            IP_HEADER_LENGTH(header) - IP_HEADER_LENGTH(last_header));
     
    945945                return ip_release_and_return(packet, rc);
    946946
    947         // biggest multiple of 8 lower than content
     947        /* Greatest multiple of 8 lower than content */
    948948        // TODO even fragmentation?
    949949        length = length & ~0x7;
     
    957957                return ip_release_and_return(packet, rc);
    958958
    959         // mark the first as fragmented
     959        /* Mark the first as fragmented */
    960960        header->flags |= IPFLAG_MORE_FRAGMENTS;
    961961
    962         // create middle framgents
     962        /* Create middle fragments */
    963963        while (IP_TOTAL_LENGTH(header) > length) {
    964964                new_packet = packet_get_4_remote(ip_globals.net_phone, prefix,
     
    981981        }
    982982
    983         // finish the first fragment
     983        /* Finish the first fragment */
    984984        header->header_checksum = IP_HEADER_CHECKSUM(header);
    985985
     
    10121012
    10131013        next = packet;
    1014         // check all packets
     1014        /* Check all packets */
    10151015        while (next) {
    10161016                length = packet_get_data_length(next);
     
    10211021                }
    10221022
    1023                 // too long
     1023                /* Too long */
    10241024                result = ip_fragment_packet(next, content, prefix,
    10251025                    suffix, addr_len);
     
    10271027                        new_packet = pq_detach(next);
    10281028                        if (next == packet) {
    1029                                 // the new first packet of the queue
     1029                                /* The new first packet of the queue */
    10301030                                packet = new_packet;
    10311031                        }
    1032                         // fragmentation needed?
     1032                        /* Fragmentation needed? */
    10331033                        if (result == EPERM) {
    10341034                                phone = ip_prepare_icmp_and_get_phone(
    10351035                                    error, next, NULL);
    10361036                                if (phone >= 0) {
    1037                                         // fragmentation necessary ICMP
     1037                                        /* Fragmentation necessary ICMP */
    10381038                                        icmp_destination_unreachable_msg(phone,
    10391039                                            ICMP_FRAG_NEEDED, content, next);
     
    10801080        int rc;
    10811081
    1082         // get destination hardware address
     1082        /* Get destination hardware address */
    10831083        if (netif->arp && (route->address.s_addr != dest.s_addr)) {
    10841084                destination.value = route->gateway.s_addr ?
     
    11021102                            NULL);
    11031103                        if (phone >= 0) {
    1104                                 // unreachable ICMP if no routing
     1104                                /* Unreachable ICMP if no routing */
    11051105                                icmp_destination_unreachable_msg(phone,
    11061106                                    ICMP_HOST_UNREACH, 0, packet);
     
    11481148        int rc;
    11491149
    1150         // addresses in the host byte order
    1151         // should be the next hop address or the target destination address
     1150        /*
     1151         * Addresses in the host byte order
     1152         * Should be the next hop address or the target destination address
     1153         */
    11521154        addrlen = packet_get_addr(packet, NULL, (uint8_t **) &addr);
    11531155        if (addrlen < 0)
     
    11741176        fibril_rwlock_read_lock(&ip_globals.netifs_lock);
    11751177
    1176         // device specified?
     1178        /* Device specified? */
    11771179        if (device_id > 0) {
    11781180                netif = ip_netifs_find(&ip_globals.netifs, device_id);
     
    11901192                phone = ip_prepare_icmp_and_get_phone(error, packet, NULL);
    11911193                if (phone >= 0) {
    1192                         // unreachable ICMP if no routing
     1194                        /* Unreachable ICMP if no routing */
    11931195                        icmp_destination_unreachable_msg(phone,
    11941196                            ICMP_NET_UNREACH, 0, packet);
     
    11981200
    11991201        if (error) {
    1200                 // do not send for broadcast, anycast packets or network
    1201                 // broadcast
     1202                /*
     1203                 * Do not send for broadcast, anycast packets or network
     1204                 * broadcast.
     1205                 */
    12021206                if (!dest->s_addr || !(~dest->s_addr) ||
    12031207                    !(~((dest->s_addr & ~route->netmask.s_addr) |
     
    12081212        }
    12091213       
    1210         // if the local host is the destination
     1214        /* If the local host is the destination */
    12111215        if ((route->address.s_addr == dest->s_addr) &&
    12121216            (dest->s_addr != IPV4_LOCALHOST_ADDRESS)) {
    1213                 // find the loopback device to deliver
     1217                /* Find the loopback device to deliver */
    12141218                dest->s_addr = IPV4_LOCALHOST_ADDRESS;
    12151219                route = ip_find_route(*dest);
     
    12201224                            NULL);
    12211225                        if (phone >= 0) {
    1222                                 // unreachable ICMP if no routing
     1226                                /* Unreachable ICMP if no routing */
    12231227                                icmp_destination_unreachable_msg(phone,
    12241228                                    ICMP_HOST_UNREACH, 0, packet);
     
    12521256
    12531257        fibril_rwlock_write_lock(&ip_globals.netifs_lock);
    1254         // find the device
     1258        /* Find the device */
    12551259        netif = ip_netifs_find(&ip_globals.netifs, device_id);
    12561260        if (!netif) {
     
    13441348                return ip_release_and_return(packet, rc);
    13451349
    1346         // trim padding if present
     1350        /* Trim padding if present */
    13471351        if (!error &&
    13481352            (IP_TOTAL_LENGTH(header) < packet_get_data_length(packet))) {
     
    13601364                phone = ip_prepare_icmp_and_get_phone(error, packet, header);
    13611365                if (phone >= 0) {
    1362                         // unreachable ICMP
     1366                        /* Unreachable ICMP */
    13631367                        icmp_destination_unreachable_msg(phone,
    13641368                            ICMP_PROT_UNREACH, 0, packet);
     
    14171421                return ip_release_and_return(packet, ENOMEM);
    14181422
    1419         // checksum
     1423        /* Checksum */
    14201424        if ((header->header_checksum) &&
    14211425            (IP_HEADER_CHECKSUM(header) != IP_CHECKSUM_ZERO)) {
    14221426                phone = ip_prepare_icmp_and_get_phone(0, packet, header);
    14231427                if (phone >= 0) {
    1424                         // checksum error ICMP
     1428                        /* Checksum error ICMP */
    14251429                        icmp_parameter_problem_msg(phone, ICMP_PARAM_POINTER,
    14261430                            ((size_t) ((void *) &header->header_checksum)) -
     
    14331437                phone = ip_prepare_icmp_and_get_phone(0, packet, header);
    14341438                if (phone >= 0) {
    1435                         // ttl exceeded ICMP
     1439                        /* TTL exceeded ICMP */
    14361440                        icmp_time_exceeded_msg(phone, ICMP_EXC_TTL, packet);
    14371441                }
     
    14391443        }
    14401444       
    1441         // process ipopt and get destination
     1445        /* Process ipopt and get destination */
    14421446        dest = ip_get_destination(header);
    14431447
    1444         // set the addrination address
     1448        /* Set the destination address */
    14451449        switch (header->version) {
    14461450        case IPVERSION:
     
    14641468                phone = ip_prepare_icmp_and_get_phone(0, packet, header);
    14651469                if (phone >= 0) {
    1466                         // unreachable ICMP
     1470                        /* Unreachable ICMP */
    14671471                        icmp_destination_unreachable_msg(phone,
    14681472                            ICMP_HOST_UNREACH, 0, packet);
     
    14721476
    14731477        if (route->address.s_addr == dest.s_addr) {
    1474                 // local delivery
     1478                /* Local delivery */
    14751479                return ip_deliver_local(device_id, packet, header, 0);
    14761480        }
     
    14841488        phone = ip_prepare_icmp_and_get_phone(0, packet, header);
    14851489        if (phone >= 0) {
    1486                 // unreachable ICMP if no routing
     1490                /* Unreachable ICMP if no routing */
    14871491                icmp_destination_unreachable_msg(phone, ICMP_HOST_UNREACH, 0,
    14881492                    packet);
     
    17701774                header = (ip_header_t *)(data + offset);
    17711775
    1772                 // destination host unreachable?
     1776                /* Destination host unreachable? */
    17731777                if ((type != ICMP_DEST_UNREACH) ||
    17741778                    (code != ICMP_HOST_UNREACH)) {
    1775                         // no, something else
     1779                        /* No, something else */
    17761780                        break;
    17771781                }
     
    17871791                route = ip_routes_get_index(&netif->routes, 0);
    17881792
    1789                 // from the same network?
     1793                /* From the same network? */
    17901794                if (route && ((route->address.s_addr & route->netmask.s_addr) ==
    17911795                    (header->destination_address & route->netmask.s_addr))) {
    1792                         // clear the ARP mapping if any
     1796                        /* Clear the ARP mapping if any */
    17931797                        address.value = (uint8_t *) &header->destination_address;
    17941798                        address.length = sizeof(header->destination_address);
     
    18441848        fibril_rwlock_read_lock(&ip_globals.lock);
    18451849        route = ip_find_route(*dest);
    1846         // if the local host is the destination
     1850        /* If the local host is the destination */
    18471851        if (route && (route->address.s_addr == dest->s_addr) &&
    18481852            (dest->s_addr != IPV4_LOCALHOST_ADDRESS)) {
    1849                 // find the loopback device to deliver
     1853                /* Find the loopback device to deliver */
    18501854                dest->s_addr = IPV4_LOCALHOST_ADDRESS;
    18511855                route = ip_find_route(*dest);
  • uspace/srv/net/nil/eth/eth.c

    rd6522dd ra0a134b  
    531531                            proto->service);
    532532                } else {
    533                         // drop invalid/unknown
     533                        /* Drop invalid/unknown */
    534534                        pq_release_remote(eth_globals.net_phone,
    535535                            packet_get_id(packet));
  • uspace/srv/net/tl/tcp/tcp.c

    rd6522dd ra0a134b  
    299299                return tcp_release_and_return(packet, NO_DATA);
    300300
    301 //      printf("header len %d, port %d \n", TCP_HEADER_LENGTH(header),
    302 //          ntohs(header->destination_port));
    303 
     301#if 0
     302        printf("header len %d, port %d \n", TCP_HEADER_LENGTH(header),
     303            ntohs(header->destination_port));
     304#endif
    304305        result = packet_get_addr(packet, (uint8_t **) &src, (uint8_t **) &dest);
    305306        if (result <= 0)
     
    10621063        tcp_process_acknowledgement(socket, socket_data, header);
    10631064
    1064         socket_data->next_incoming = ntohl(header->sequence_number);    // + 1;
     1065        socket_data->next_incoming = ntohl(header->sequence_number); /* + 1; */
    10651066        pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
    10661067        socket_data->state = TCP_SOCKET_ESTABLISHED;
  • uspace/srv/net/tl/tcp/tcp.h

    rd6522dd ra0a134b  
    190190        int backlog;
    191191       
    192 //      /** Segment size. */
    193 //      size_t segment_size;
    194 
    195192        /**
    196193         * Parent listening socket identifier.
  • uspace/srv/net/tl/udp/udp.c

    rd6522dd ra0a134b  
    499499        device_id_t device_id;
    500500        packet_dimension_t *packet_dimension;
     501        size_t size;
    501502        int rc;
     503
     504        /* In case of error, do not update the data fragment size. */
     505        *data_fragment_size = 0;
    502506       
    503507        rc = tl_get_address_port(addr, addrlen, &dest_port);
     
    539543                packet_dimension = &udp_globals.packet_dimension;
    540544//      }
     545
     546        /*
     547         * Update the data fragment size based on what the lower layers can
     548         * handle without fragmentation, but not more than the maximum allowed
     549         * for UDP.
     550         */
     551        size = MAX_UDP_FRAGMENT_SIZE;
     552        if (packet_dimension->content < size)
     553            size = packet_dimension->content;
     554        *data_fragment_size = size;
    541555
    542556        /* Read the first packet fragment */
     
    740754        int socket_id;
    741755        size_t addrlen;
    742         size_t size = 0;
     756        size_t size;
    743757        ipc_call_t answer;
    744758        size_t answer_count;
     
    786800                                break;
    787801                       
     802                        size = MAX_UDP_FRAGMENT_SIZE;
    788803                        if (tl_get_ip_packet_dimension(udp_globals.ip_phone,
    789804                            &udp_globals.dimensions, DEVICE_INVALID_ID,
    790805                            &packet_dimension) == EOK) {
    791                                 SOCKET_SET_DATA_FRAGMENT_SIZE(answer,
    792                                     packet_dimension->content);
     806                                if (packet_dimension->content < size)
     807                                        size = packet_dimension->content;
    793808                        }
    794 
    795 //                      SOCKET_SET_DATA_FRAGMENT_SIZE(answer,
    796 //                          MAX_UDP_FRAGMENT_SIZE);
     809                        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size);
    797810                        SOCKET_SET_HEADER_SIZE(answer, UDP_HEADER_SIZE);
    798811                        answer_count = 3;
  • uspace/srv/vfs/vfs_file.c

    rd6522dd ra0a134b  
    258258        if ((fd >= 0) && (fd < MAX_OPEN_FILES)) {
    259259                vfs_file_t *file = FILES[fd];
    260                 vfs_file_addref(file);
    261                 fibril_mutex_unlock(&VFS_DATA->lock);
    262                 return file;
     260                if (file != NULL) {
     261                        vfs_file_addref(file);
     262                        fibril_mutex_unlock(&VFS_DATA->lock);
     263                        return file;
     264                }
    263265        }
    264266        fibril_mutex_unlock(&VFS_DATA->lock);
Note: See TracChangeset for help on using the changeset viewer.