Changeset 28a3e74 in mainline


Ignore:
Timestamp:
2011-04-02T09:22:46Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
250dbef, b2a081ae
Parents:
ea53529
Message:

Fix comment style.

Location:
uspace
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    rea53529 r28a3e74  
    195195                                        wchar_t c = str_decode(buff, &offset, bytes);
    196196                                        if (c == 0) {
    197                                                 // reached end of string
     197                                                /* Reached end of string */
    198198                                                break;
    199199                                        }
     
    228228        int rc;
    229229       
    230         // reset global state
    231         // TODO: move to structure?
     230        /*
     231         * reset global state
     232         * TODO: move to structure?
     233         */
    232234        paging_enabled = false;
    233235        chars_remaining = 0;
  • uspace/app/stats/stats.c

    rea53529 r28a3e74  
    265265                /* Threads */
    266266                if ((off = arg_parse_short_long(argv[i], "-t", "--task=")) != -1) {
    267                         // TODO: Support for 64b range
     267                        /* TODO: Support for 64b range */
    268268                        int tmp;
    269269                        int ret = arg_parse_int(argc, argv, &i, &tmp, off);
  • uspace/app/trace/trace.c

    rea53529 r28a3e74  
    5353#include <libc.h>
    5454
    55 // Temporary: service and method names
     55/* Temporary: service and method names */
    5656#include "proto.h"
    5757#include <ipc/services.h>
  • uspace/drv/isa/isa.c

    rea53529 r28a3e74  
    8383static bool isa_enable_fun_interrupt(ddf_fun_t *fnode)
    8484{
    85         // TODO
     85        /* TODO */
    8686
    8787        return false;
  • uspace/lib/c/generic/adt/measured_strings.c

    rea53529 r28a3e74  
    7474        new->length = length;
    7575        new->value = ((uint8_t *) new) + sizeof(measured_string_t);
    76         // append terminating zero explicitly - to be safe
     76        /* Append terminating zero explicitly - to be safe */
    7777        memcpy(new->value, string, new->length);
    7878        new->value[new->length] = '\0';
  • uspace/lib/drv/generic/driver.c

    rea53529 r28a3e74  
    402402                            get_remote_method(rem_iface, iface_method_idx);
    403403                        if (iface_method_ptr == NULL) {
    404                                 // the interface has not such method
     404                                /* The interface has not such method */
    405405                                printf("%s: driver_connection_gen error - "
    406406                                    "invalid interface method.", driver->name);
  • uspace/lib/net/generic/generic.c

    rea53529 r28a3e74  
    106106                return EBADMEM;
    107107
    108         // request the address
     108        /* Request the address */
    109109        message_id = async_send_1(phone, (sysarg_t) message,
    110110            (sysarg_t) device_id, NULL);
     
    112112        async_wait_for(message_id, &result);
    113113
    114         // if not successful
     114        /* If not successful */
    115115        if ((string == EOK) && (result != EOK)) {
    116                 // clear the data
     116                /* Clear the data */
    117117                free(*address);
    118118                free(*data);
     
    242242                return EBADMEM;
    243243
    244         // request the translation
     244        /* Request the translation */
    245245        message_id = async_send_3(phone, (sysarg_t) message,
    246246            (sysarg_t) device_id, (sysarg_t) count, (sysarg_t) service, NULL);
     
    249249        async_wait_for(message_id, &result);
    250250
    251         // if not successful
     251        /* If not successful */
    252252        if ((string == EOK) && (result != EOK)) {
    253                 // clear the data
     253                /* Clear the data */
    254254                free(*translation);
    255255                free(*data);
  • uspace/lib/net/generic/net_checksum.c

    rea53529 r28a3e74  
    5252uint16_t compact_checksum(uint32_t sum)
    5353{
    54         // shorten to the 16 bits
     54        /* Shorten to the 16 bits */
    5555        while (sum >> 16)
    5656                sum = (sum & 0xffff) + (sum >> 16);
     
    7272        size_t index;
    7373
    74         // sum all the 16 bit fields
     74        /* Sum all the 16 bit fields */
    7575        for (index = 0; index + 1 < length; index += 2)
    7676                seed += (data[index] << 8) + data[index + 1];
    7777
    78         // last odd byte with zero padding
     78        /* Last odd byte with zero padding */
    7979        if (index + 1 == length)
    8080                seed += data[index] << 8;
     
    9494        size_t index;
    9595
    96         // process full bytes
     96        /* Process full bytes */
    9797        while (length >= 8) {
    98                 // add the data
     98                /* Add the data */
    9999                seed ^= (*data) << 24;
    100100               
    101                 // for each added bit
     101                /* For each added bit */
    102102                for (index = 0; index < 8; ++index) {
    103                         // if the first bit is set
     103                        /* If the first bit is set */
    104104                        if (seed & 0x80000000) {
    105                                 // shift and divide the checksum
     105                                /* Shift and divide the checksum */
    106106                                seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
    107107                        } else {
    108                                 // shift otherwise
     108                                /* shift otherwise */
    109109                                seed <<= 1;
    110110                        }
    111111                }
    112112               
    113                 // move to the next byte
     113                /* Move to the next byte */
    114114                ++data;
    115115                length -= 8;
    116116        }
    117117
    118         // process the odd bits
     118        /* Process the odd bits */
    119119        if (length > 0) {
    120                 // add the data with zero padding
     120                /* Add the data with zero padding */
    121121                seed ^= ((*data) & (0xff << (8 - length))) << 24;
    122122               
    123                 // for each added bit
     123                /* For each added bit */
    124124                for (index = 0; index < length; ++index) {
    125                         // if the first bit is set
     125                        /* If the first bit is set */
    126126                        if (seed & 0x80000000) {
    127                                 // shift and divide the checksum
     127                                /* Shift and divide the checksum */
    128128                                seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
    129129                        } else {
    130                                 // shift otherwise
     130                                /* Shift otherwise */
    131131                                seed <<= 1;
    132132                        }
     
    148148        size_t index;
    149149
    150         // process full bytes
     150        /* Process full bytes */
    151151        while (length >= 8) {
    152                 // add the data
     152                /* Add the data */
    153153                seed ^= (*data);
    154154               
    155                 // for each added bit
     155                /* For each added bit */
    156156                for (index = 0; index < 8; ++index) {
    157                         // if the last bit is set
     157                        /* If the last bit is set */
    158158                        if (seed & 1) {
    159                                 // shift and divide the checksum
     159                                /* Shift and divide the checksum */
    160160                                seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
    161161                        } else {
    162                                 // shift otherwise
     162                                /* Shift otherwise */
    163163                                seed >>= 1;
    164164                        }
    165165                }
    166166               
    167                 // move to the next byte
     167                /* Move to the next byte */
    168168                ++data;
    169169                length -= 8;
    170170        }
    171171
    172         // process the odd bits
     172        /* Process the odd bits */
    173173        if (length > 0) {
    174                 // add the data with zero padding
     174                /* Add the data with zero padding */
    175175                seed ^= (*data) >> (8 - length);
    176176               
    177177                for (index = 0; index < length; ++index) {
    178                         // if the last bit is set
     178                        /* If the last bit is set */
    179179                        if (seed & 1) {
    180                                 // shift and divide the checksum
     180                                /* Shift and divide the checksum */
    181181                                seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
    182182                        } else {
    183                                 // shift otherwise
     183                                /* Shift otherwise */
    184184                                seed >>= 1;
    185185                        }
     
    198198uint16_t flip_checksum(uint16_t checksum)
    199199{
    200         // flip, zero is returned as 0xFFFF (not flipped)
     200        /* Flip, zero is returned as 0xFFFF (not flipped) */
    201201        checksum = ~checksum;
    202202        return checksum ? checksum : IP_CHECKSUM_ZERO;
     
    216216uint16_t ip_checksum(uint8_t *data, size_t length)
    217217{
    218         // compute, compact and flip the data checksum
     218        /* Compute, compact and flip the data checksum */
    219219        return flip_checksum(compact_checksum(compute_checksum(0, data,
    220220            length)));
  • uspace/lib/net/generic/packet_client.c

    rea53529 r28a3e74  
    267267                return NULL;
    268268
    269         // get a new packet
     269        /* Get a new packet */
    270270        copy = packet_get_4_remote(phone, PACKET_DATA_LENGTH(packet),
    271271            PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix,
     
    274274                return NULL;
    275275
    276         // get addresses
     276        /* Get addresses */
    277277        addrlen = packet_get_addr(packet, &src, &dest);
    278         // copy data
     278        /* Copy data */
    279279        if ((packet_copy_data(copy, packet_get_data(packet),
    280280            PACKET_DATA_LENGTH(packet)) == EOK) &&
    281             // copy addresses if present
     281            /* Copy addresses if present */
    282282            ((addrlen <= 0) ||
    283283            (packet_set_addr(copy, src, dest, addrlen) == EOK))) {
  • uspace/lib/net/il/ip_client.c

    rea53529 r28a3e74  
    123123                return EOK;
    124124
    125         // TODO IPv6
     125        /* TODO IPv6 */
    126126/*      case AF_INET6:
    127127                if (addrlen != sizeof(struct sockaddr_in6))
     
    159159        size_t padding;
    160160
    161         // compute the padding if IP options are set
    162         // multiple of 4 bytes
     161        /*
     162         * Compute the padding if IP options are set
     163         * multiple of 4 bytes
     164         */
    163165        padding =  ipopt_length % 4;
    164166        if (padding) {
     
    167169        }
    168170
    169         // prefix the header
     171        /* Prefix the header */
    170172        data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
    171173        if (!data)
    172174                return ENOMEM;
    173175
    174         // add the padding
     176        /* Add the padding */
    175177        while (padding--)
    176178                data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
    177179
    178         // set the header
     180        /* Set the header */
    179181        header = (ip_header_t *) data;
    180182        header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) +
     
    256258                header_in->data_length = htons(data_length);
    257259                return EOK;
    258         // TODO IPv6
     260        /* TODO IPv6 */
    259261        } else {
    260262                return EINVAL;
  • uspace/lib/net/include/ip_client.h

    rea53529 r28a3e74  
    5454    socklen_t, struct sockaddr *, socklen_t, size_t, void **, size_t *);
    5555
    56 // TODO ipopt manipulation
     56/* TODO ipopt manipulation */
    5757
    5858#endif
  • uspace/lib/net/tl/icmp_client.c

    rea53529 r28a3e74  
    8181                *mtu = header->un.frag.mtu;
    8282
    83         // remove debug dump
     83        /* Remove debug dump */
    8484#ifdef CONFIG_DEBUG
    8585        printf("ICMP error %d (%d) in packet %d\n", header->type, header->code,
  • uspace/lib/net/tl/socket_core.c

    rea53529 r28a3e74  
    9191        int packet_id;
    9292
    93         // if bound
     93        /* If bound */
    9494        if (socket->port) {
    95                 // release the port
     95                /* Release the port */
    9696                socket_port_release(global_sockets, socket);
    9797        }
    9898       
    99         // release all received packets
     99        /* Release all received packets */
    100100        while ((packet_id = dyn_fifo_pop(&socket->received)) >= 0)
    101101                pq_release_remote(packet_phone, packet_id);
     
    166166        int rc;
    167167
    168         // create a wrapper
     168        /* Create a wrapper */
    169169        socket_ref = malloc(sizeof(*socket_ref));
    170170        if (!socket_ref)
     
    172172
    173173        *socket_ref = socket;
    174         // add the wrapper
     174        /* Add the wrapper */
    175175        rc = socket_port_map_add(&socket_port->map, key, key_length,
    176176            socket_ref);
     
    206206        int rc;
    207207
    208         // create a wrapper
     208        /* Create a wrapper */
    209209        socket_port = malloc(sizeof(*socket_port));
    210210        if (!socket_port)
     
    221221                goto fail;
    222222       
    223         // register the incomming port
     223        /* Register the incoming port */
    224224        rc = socket_ports_add(global_sockets, port, socket_port);
    225225        if (rc < 0)
     
    277277               
    278278                address_in = (struct sockaddr_in *) addr;
    279                 // find the socket
     279                /* Find the socket */
    280280                socket = socket_cores_find(local_sockets, socket_id);
    281281                if (!socket)
    282282                        return ENOTSOCK;
    283283               
    284                 // bind a free port?
     284                /* Bind a free port? */
    285285                if (address_in->sin_port <= 0)
    286286                        return socket_bind_free_port(global_sockets, socket,
    287287                             free_ports_start, free_ports_end, last_used_port);
    288288               
    289                 // try to find the port
     289                /* Try to find the port */
    290290                socket_port = socket_ports_find(global_sockets,
    291291                    ntohs(address_in->sin_port));
    292292                if (socket_port) {
    293                         // already used
     293                        /* Already used */
    294294                        return EADDRINUSE;
    295295                }
    296296               
    297                 // if bound
     297                /* If bound */
    298298                if (socket->port) {
    299                         // release the port
     299                        /* Release the port */
    300300                        socket_port_release(global_sockets, socket);
    301301                }
     
    306306               
    307307        case AF_INET6:
    308                 // TODO IPv6
     308                /* TODO IPv6 */
    309309                break;
    310310        }
     
    333333        int index;
    334334
    335         // from the last used one
     335        /* From the last used one */
    336336        index = last_used_port;
    337337       
     
    339339                ++index;
    340340               
    341                 // til the range end
     341                /* Till the range end */
    342342                if (index >= free_ports_end) {
    343                         // start from the range beginning
     343                        /* Start from the range beginning */
    344344                        index = free_ports_start - 1;
    345345                        do {
    346346                                ++index;
    347                                 // til the last used one
     347                                /* Till the last used one */
    348348                                if (index >= last_used_port) {
    349                                         // none found
     349                                        /* None found */
    350350                                        return ENOTCONN;
    351351                                }
    352352                        } while (socket_ports_find(global_sockets, index));
    353353                       
    354                         // found, break immediately
     354                        /* Found, break immediately */
    355355                        break;
    356356                }
     
    384384                        socket_id = 1;
    385385                        ++count;
    386                 // only this branch for last_id
     386                /* Only this branch for last_id */
    387387                } else {
    388388                        if (socket_id < INT_MAX) {
     
    425425                return EINVAL;
    426426       
    427         // store the socket
     427        /* Store the socket */
    428428        if (*socket_id <= 0) {
    429429                positive = (*socket_id == 0);
     
    441441                return ENOMEM;
    442442       
    443         // initialize
     443        /* Initialize */
    444444        socket->phone = app_phone;
    445445        socket->port = -1;
     
    493493        int accepted_id;
    494494
    495         // find the socket
     495        /* Find the socket */
    496496        socket = socket_cores_find(local_sockets, socket_id);
    497497        if (!socket)
    498498                return ENOTSOCK;
    499499       
    500         // destroy all accepted sockets
     500        /* Destroy all accepted sockets */
    501501        while ((accepted_id = dyn_fifo_pop(&socket->accepted)) >= 0)
    502502                socket_destroy(packet_phone, accepted_id, local_sockets,
     
    535535        next_packet = pq_next(packet);
    536536        if (!next_packet) {
    537                 // write all if only one fragment
     537                /* Write all if only one fragment */
    538538                rc = data_reply(packet_get_data(packet),
    539539                    packet_get_data_length(packet));
    540540                if (rc != EOK)
    541541                        return rc;
    542                 // store the total length
     542                /* Store the total length */
    543543                *length = packet_get_data_length(packet);
    544544        } else {
    545                 // count the packet fragments
     545                /* Count the packet fragments */
    546546                fragments = 1;
    547547                next_packet = pq_next(packet);
     
    549549                        ++fragments;
    550550               
    551                 // compute and store the fragment lengths
     551                /* Compute and store the fragment lengths */
    552552                lengths = (size_t *) malloc(sizeof(size_t) * fragments +
    553553                    sizeof(size_t));
     
    565565                }
    566566               
    567                 // write the fragment lengths
     567                /* Write the fragment lengths */
    568568                rc = data_reply(lengths, sizeof(int) * (fragments + 1));
    569569                if (rc != EOK) {
     
    573573                next_packet = packet;
    574574               
    575                 // write the fragments
     575                /* Write the fragments */
    576576                for (index = 0; index < fragments; ++index) {
    577577                        rc = data_reply(packet_get_data(next_packet),
     
    584584                }
    585585               
    586                 // store the total length
     586                /* Store the total length */
    587587                *length = lengths[fragments];
    588588                free(lengths);
     
    636636                return;
    637637       
    638         // find ports
     638        /* Find ports */
    639639        socket_port = socket_ports_find(global_sockets, socket->port);
    640640        if (socket_port) {
    641                 // find the socket
     641                /* Find the socket */
    642642                socket_ref = socket_port_map_find(&socket_port->map,
    643643                    socket->key, socket->key_length);
     
    646646                        --socket_port->count;
    647647                       
    648                         // release if empty
     648                        /* Release if empty */
    649649                        if (socket_port->count <= 0) {
    650                                 // destroy the map
     650                                /* Destroy the map */
    651651                                socket_port_map_destroy(&socket_port->map, free);
    652                                 // release the port
     652                                /* Release the port */
    653653                                socket_ports_exclude(global_sockets,
    654654                                    socket->port, free);
    655655                        } else {
    656                                 // remove
     656                                /* Remove */
    657657                                socket_port_map_exclude(&socket_port->map,
    658658                                    socket->key, socket->key_length, free);
     
    685685        int rc;
    686686
    687         // find ports
     687        /* Find ports */
    688688        socket_port = socket_ports_find(global_sockets, port);
    689689        if (!socket_port)
    690690                return ENOENT;
    691691       
    692         // add the socket
     692        /* Add the socket */
    693693        rc = socket_port_add_core(socket_port, socket, key, key_length);
    694694        if (rc != EOK)
  • uspace/lib/net/tl/tl_common.c

    rea53529 r28a3e74  
    255255        int length;
    256256
    257         // detach the first packet and release the others
     257        /* Detach the first packet and release the others */
    258258        next = pq_detach(packet);
    259259        if (next)
     
    262262        length = packet_get_addr(packet, &src, NULL);
    263263        if ((length > 0) && (!error) && (icmp_phone >= 0) &&
    264             // set both addresses to the source one (avoids the source address
    265             // deletion before setting the destination one)
     264            /*
     265             * Set both addresses to the source one (avoids the source address
     266             * deletion before setting the destination one)
     267             */
    266268            (packet_set_addr(packet, src, src, (size_t) length) == EOK)) {
    267269                return EOK;
     
    299301                return EINVAL;
    300302
    301         // get the data length
     303        /* Get the data length */
    302304        if (!async_data_write_receive(&callid, &length))
    303305                return EINVAL;
    304306
    305         // get a new packet
     307        /* Get a new packet */
    306308        *packet = packet_get_4_remote(packet_phone, length, dimension->addr_len,
    307309            prefix + dimension->prefix, dimension->suffix);
     
    309311                return ENOMEM;
    310312
    311         // allocate space in the packet
     313        /* Allocate space in the packet */
    312314        data = packet_suffix(*packet, length);
    313315        if (!data) {
     
    316318        }
    317319
    318         // read the data into the packet
     320        /* Read the data into the packet */
    319321        rc = async_data_write_finalize(callid, data, length);
    320322        if (rc != EOK) {
     
    323325        }
    324326       
    325         // set the packet destination address
     327        /* Set the packet destination address */
    326328        rc = packet_set_addr(*packet, NULL, (uint8_t *) addr, addrlen);
    327329        if (rc != EOK) {
  • uspace/lib/packet/generic/packet_server.c

    rea53529 r28a3e74  
    112112    size_t max_content, size_t max_suffix)
    113113{
    114         // clear the packet content
     114        /* Clear the packet content */
    115115        bzero(((void *) packet) + sizeof(packet_t),
    116116            packet->length - sizeof(packet_t));
    117117       
    118         // clear the packet header
     118        /* Clear the packet header */
    119119        packet->order = 0;
    120120        packet->metric = 0;
     
    151151        assert(fibril_mutex_is_locked(&ps_globals.lock));
    152152
    153         // already locked
     153        /* Already locked */
    154154        packet = (packet_t *) mmap(NULL, length, PROTO_READ | PROTO_WRITE,
    155155            MAP_SHARED | MAP_ANONYMOUS, 0, 0);
  • uspace/lib/softint/generic/multiplication.c

    rea53529 r28a3e74  
    109109         * result does not fit in signed one */
    110110        if (SOFTINT_CHECK_OF && ((t2 < t1) || (t2 & (1ull << 63)))) {
    111                 // error, overflow
     111                /* Error, overflow */
    112112                return (neg ? INT64_MIN : INT64_MAX);
    113113        }
  • uspace/srv/hw/irc/apic/apic.c

    rea53529 r28a3e74  
    5656static int apic_enable_irq(sysarg_t irq)
    5757{
    58         // FIXME: TODO
     58        /* FIXME: TODO */
    5959        return ENOTSUP;
    6060}
  • uspace/srv/net/il/ip/ip.c

    rea53529 r28a3e74  
    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);
     
    365365               
    366366                if (ip_netif->dhcp) {
    367                         // TODO dhcp
     367                        /* TODO dhcp */
    368368                        net_free_settings(configuration, data);
    369369                        return ENOTSUP;
     
    398398                        }
    399399                } else {
    400                         // TODO ipv6 in separate module
     400                        /* TODO ipv6 in separate module */
    401401                        net_free_settings(configuration, data);
    402402                        return ENOTSUP;
     
    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,
    517517            ip_netif->dhcp ? "dhcp" : "static");
    518518       
    519         // TODO ipv6 addresses
     519        /* TODO ipv6 addresses */
    520520       
    521521        char address[INET_ADDRSTRLEN];
     
    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
    948         // TODO even fragmentation?
     947        /* Greatest multiple of 8 lower than content */
     948        /* TODO even fragmentation? */
    949949        length = length & ~0x7;
    950950       
     
    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        /* Ff 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) {
     
    12751279        in_addr_t destination;
    12761280
    1277         // TODO search set ipopt route?
     1281        /* TODO search set ipopt route? */
    12781282        destination.s_addr = header->destination_address;
    12791283        return destination;
     
    13171321        if ((header->flags & IPFLAG_MORE_FRAGMENTS) ||
    13181322            IP_FRAGMENT_OFFSET(header)) {
    1319                 // TODO fragmented
     1323                /* TODO fragmented */
    13201324                return ENOTSUP;
    13211325        }
     
    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

    rea53529 r28a3e74  
    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

    rea53529 r28a3e74  
    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

    rea53529 r28a3e74  
    190190        int backlog;
    191191       
    192 //      /** Segment size. */
    193 //      size_t segment_size;
    194 
    195192        /**
    196193         * Parent listening socket identifier.
  • uspace/srv/vfs/vfs_ops.c

    rea53529 r28a3e74  
    611611void vfs_open_node(ipc_callid_t rid, ipc_call_t *request)
    612612{
    613         // FIXME: check for sanity of the supplied fs, dev and index
     613        /* FIXME: check for sanity of the supplied fs, dev and index */
    614614       
    615615        /*
Note: See TracChangeset for help on using the changeset viewer.