Changeset 8565a42 in mainline for uspace/lib/nic/src


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (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.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

Location:
uspace/lib/nic/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_addr_db.c

    r3061bc1 r8565a42  
    6868        addr_key_t *key = (addr_key_t*)key_arg;
    6969        nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
    70        
     70
    7171        return memcmp(entry->addr, key->addr, entry->len) == 0;
    7272}
     
    7575{
    7676        size_t hash = 0;
    77        
     77
    7878        for (size_t i = 0; i < len; ++i) {
    7979                hash = (hash << 5) ^ addr[i];
    8080        }
    81        
     81
    8282        return hash;
    8383}
     
    9898{
    9999        nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
    100        
     100
    101101        free(entry);
    102102}
     
    123123{
    124124        assert(db);
    125        
     125
    126126        if (addr_len > UCHAR_MAX)
    127127                return EINVAL;
    128        
     128
    129129        if (!hash_table_create(&db->set, 0, 0, &set_ops))
    130130                return ENOMEM;
    131        
     131
    132132        db->addr_len = addr_len;
    133133        return EOK;
     
    176176                .addr = addr
    177177        };
    178        
     178
    179179        if (hash_table_find(&db->set, &key))
    180180                return EEXIST;
    181        
     181
    182182        nic_addr_entry_t *entry = malloc(sizeof(nic_addr_entry_t) + db->addr_len - 1);
    183183        if (entry == NULL)
     
    186186        entry->len = (uint8_t) db->addr_len;
    187187        memcpy(entry->addr, addr, db->addr_len);
    188        
     188
    189189        hash_table_insert(&db->set, &entry->link);
    190190        return EOK;
     
    203203{
    204204        assert(db && addr);
    205        
     205
    206206        addr_key_t key = {
    207207                .len = db->addr_len,
    208208                .addr = addr
    209209        };
    210        
     210
    211211        if (hash_table_remove(&db->set, &key))
    212212                return EOK;
     
    226226{
    227227        assert(db && addr);
    228        
     228
    229229        addr_key_t key = {
    230230                .len = db->addr_len,
    231231                .addr = addr
    232232        };
    233        
     233
    234234        return 0 != hash_table_find(&db->set, &key);
    235235}
  • uspace/lib/nic/src/nic_driver.c

    r3061bc1 r8565a42  
    6868        nic_globals.frame_cache_size = 0;
    6969        fibril_mutex_initialize(&nic_globals.lock);
    70        
     70
    7171        char buffer[256];
    7272        snprintf(buffer, 256, "drv/" DEVICE_CATEGORY_NIC "/%s", name);
    73        
     73
    7474        return EOK;
    7575}
     
    247247        ddf_dev_t *dev = nic_data->dev;
    248248        async_sess_t *parent_sess;
    249        
     249
    250250        /* Connect to the parent's driver. */
    251251        parent_sess = ddf_dev_parent_sess_get(dev);
    252252        if (parent_sess == NULL)
    253253                return EIO;
    254        
     254
    255255        return hw_res_get_list_parsed(parent_sess, resources, 0);
    256256}
     
    277277                if (!frame)
    278278                        return NULL;
    279                
     279
    280280                link_initialize(&frame->link);
    281281        }
     
    327327        nic_frame_list_t *frames;
    328328        fibril_mutex_lock(&nic_globals.lock);
    329        
     329
    330330        if (nic_globals.frame_list_cache_size > 0) {
    331331                frames =
     
    338338        } else {
    339339                fibril_mutex_unlock(&nic_globals.lock);
    340                
     340
    341341                frames = malloc(sizeof (nic_frame_list_t));
    342342                if (frames != NULL)
    343343                        list_initialize(frames);
    344344        }
    345        
     345
    346346        return frames;
    347347}
     
    426426{
    427427        assert(nic_data);
    428        
     428
    429429        if (address->address[0] & 1)
    430430                return EINVAL;
    431        
     431
    432432        fibril_rwlock_write_lock(&nic_data->main_lock);
    433        
     433
    434434        /* Notify NIL layer (and uppper) if bound - not in add_device */
    435435        if (nic_data->client_session != NULL) {
     
    442442                }
    443443        }
    444        
     444
    445445        fibril_rwlock_write_lock(&nic_data->rxc_lock);
    446        
     446
    447447        /*
    448448         * The initial address (all zeroes) shouldn't be
     
    452452        errno_t rc = nic_rxc_set_addr(&nic_data->rx_control,
    453453            &nic_data->mac, address);
    454        
     454
    455455        /* For the first time also record the default MAC */
    456456        if (MAC_IS_ZERO(nic_data->default_mac.address)) {
     
    458458                memcpy(&nic_data->default_mac, address, sizeof(nic_address_t));
    459459        }
    460        
     460
    461461        fibril_rwlock_write_unlock(&nic_data->rxc_lock);
    462        
     462
    463463        if ((rc != EOK) && (rc != ENOENT)) {
    464464                fibril_rwlock_write_unlock(&nic_data->main_lock);
    465465                return rc;
    466466        }
    467        
     467
    468468        memcpy(&nic_data->mac, address, sizeof(nic_address_t));
    469        
     469
    470470        fibril_rwlock_write_unlock(&nic_data->main_lock);
    471        
     471
    472472        return EOK;
    473473}
     
    593593        if (nic_data == NULL)
    594594                return NULL;
    595        
     595
    596596        /* Force zero to all uninitialized fields (e.g. added in future) */
    597597        if (nic_rxc_init(&nic_data->rx_control) != EOK) {
    598598                return NULL;
    599599        }
    600        
     600
    601601        if (nic_wol_virtues_init(&nic_data->wol_virtues) != EOK) {
    602602                return NULL;
    603603        }
    604        
     604
    605605        nic_data->dev = NULL;
    606606        nic_data->fun = NULL;
     
    614614        nic_data->on_stopping = NULL;
    615615        nic_data->specific = NULL;
    616        
     616
    617617        fibril_rwlock_initialize(&nic_data->main_lock);
    618618        fibril_rwlock_initialize(&nic_data->stats_lock);
    619619        fibril_rwlock_initialize(&nic_data->rxc_lock);
    620620        fibril_rwlock_initialize(&nic_data->wv_lock);
    621        
     621
    622622        memset(&nic_data->mac, 0, sizeof(nic_address_t));
    623623        memset(&nic_data->default_mac, 0, sizeof(nic_address_t));
    624624        memset(&nic_data->stats, 0, sizeof(nic_device_stats_t));
    625        
     625
    626626        return nic_data;
    627627}
     
    642642        if (!nic_data)
    643643                return NULL;
    644        
     644
    645645        nic_data->dev = device;
    646        
     646
    647647        return nic_data;
    648648}
     
    943943        if (count == 0)
    944944                return;
    945        
     945
    946946        fibril_rwlock_write_lock(&nic_data->stats_lock);
    947947        nic_data->stats.send_errors += count;
     
    10791079                        }
    10801080                        async_usleep(wait);
    1081                        
     1081
    10821082                        /* Check if the period was not reset */
    10831083                        if (info->run != run)
    10841084                                break;
    10851085                }
    1086                
     1086
    10871087                /* Provide polling if the period finished */
    10881088                fibril_rwlock_read_lock(&nic->main_lock);
  • uspace/lib/nic/src/nic_impl.c

    r3061bc1 r8565a42  
    195195        nic_t *nic = nic_get_from_ddf_fun(fun);
    196196        fibril_rwlock_write_lock(&nic->main_lock);
    197        
     197
    198198        nic->client_session = async_callback_receive(EXCHANGE_SERIALIZE);
    199199        if (nic->client_session == NULL) {
     
    201201                return ENOMEM;
    202202        }
    203        
     203
    204204        fibril_rwlock_write_unlock(&nic->main_lock);
    205205        return EOK;
  • uspace/lib/nic/src/nic_rx_control.c

    r3061bc1 r8565a42  
    112112                        return rc;
    113113        }
    114        
     114
    115115        return nic_addr_db_insert(&rxc->unicast_addrs,
    116116            (const uint8_t *) &curr_addr->address);
     
    244244        else if (mode != NIC_MULTICAST_LIST && address_list != NULL)
    245245                return EINVAL;
    246        
     246
    247247        if (rxc->multicast_mode == NIC_MULTICAST_LIST)
    248248                nic_addr_db_clear(&rxc->multicast_addrs);
    249        
     249
    250250        rxc->multicast_mode = mode;
    251251        size_t i;
     
    439439                }
    440440        }
    441        
     441
    442442        /* Blocked source addresses */
    443443        if (rxc->block_sources) {
     
    445445                        return false;
    446446        }
    447        
     447
    448448        /* VLAN filtering */
    449449        if (!rxc->vlan_exact && rxc->vlan_mask != NULL) {
     
    459459                }
    460460        }
    461        
     461
    462462        return true;
    463463}
     
    519519        }
    520520    }
    521        
     521
    522522    uint64_t one64 = 1;
    523523    return one64 << (crc >> 26);
  • uspace/lib/nic/src/nic_wol_virtues.c

    r3061bc1 r8565a42  
    7979        wvs->table_operations.equal = 0;
    8080        wvs->table_operations.remove_callback = 0;
    81        
     81
    8282        if (!hash_table_create(&wvs->table, 0, 0, &wvs->table_operations)) {
    8383                return ENOMEM;
Note: See TracChangeset for help on using the changeset viewer.