Changeset 8565a42 in mainline for uspace/lib/block


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/block/block.c

    r3061bc1 r8565a42  
    9595{
    9696        fibril_mutex_lock(&dcl_lock);
    97        
     97
    9898        list_foreach(dcl, link, devcon_t, devcon) {
    9999                if (devcon->service_id == service_id) {
     
    102102                }
    103103        }
    104        
     104
    105105        fibril_mutex_unlock(&dcl_lock);
    106106        return NULL;
     
    111111{
    112112        devcon_t *devcon;
    113        
     113
    114114        devcon = malloc(sizeof(devcon_t));
    115115        if (!devcon)
    116116                return ENOMEM;
    117        
     117
    118118        link_initialize(&devcon->link);
    119119        devcon->service_id = service_id;
     
    125125        devcon->pblocks = dev_size;
    126126        devcon->cache = NULL;
    127        
     127
    128128        fibril_mutex_lock(&dcl_lock);
    129129        list_foreach(dcl, link, devcon_t, d) {
     
    155155                return ENOENT;
    156156        }
    157        
     157
    158158        errno_t rc = bd_open(sess, &bd);
    159159        if (rc != EOK) {
     
    161161                return rc;
    162162        }
    163        
     163
    164164        size_t bsize;
    165165        rc = bd_get_block_size(bd, &bsize);
     
    177177                return rc;
    178178        }
    179        
     179
    180180        rc = devcon_add(service_id, sess, bsize, dev_size, bd);
    181181        if (rc != EOK) {
     
    184184                return rc;
    185185        }
    186        
     186
    187187        return EOK;
    188188}
     
    192192        devcon_t *devcon = devcon_search(service_id);
    193193        assert(devcon);
    194        
     194
    195195        if (devcon->cache)
    196196                (void) block_cache_fini(service_id);
    197        
     197
    198198        (void)bd_sync_cache(devcon->bd, 0, 0);
    199        
     199
    200200        devcon_remove(devcon);
    201        
     201
    202202        if (devcon->bb_buf)
    203203                free(devcon->bb_buf);
    204        
     204
    205205        bd_close(devcon->bd);
    206206        async_hangup(devcon->sess);
    207        
     207
    208208        free(devcon);
    209209}
     
    282282        if (!cache)
    283283                return ENOMEM;
    284        
     284
    285285        fibril_mutex_initialize(&cache->lock);
    286286        list_initialize(&cache->free_list);
     
    318318                return EOK;
    319319        cache = devcon->cache;
    320        
     320
    321321        /*
    322322         * We are expecting to find all blocks for this device handle on the
     
    337337
    338338                hash_table_remove_item(&cache->block_hash, &b->hash_link);
    339                
     339
    340340                free(b->data);
    341341                free(b);
     
    391391        aoff64_t p_ba;
    392392        errno_t rc;
    393        
     393
    394394        devcon = devcon_search(service_id);
    395395
    396396        assert(devcon);
    397397        assert(devcon->cache);
    398        
     398
    399399        cache = devcon->cache;
    400400
     
    712712        assert(devcon);
    713713        block_size = devcon->pblock_size;
    714        
     714
    715715        while (left > 0) {
    716716                size_t rd;
    717                
     717
    718718                if (*bufpos + left < *buflen)
    719719                        rd = left;
    720720                else
    721721                        rd = *buflen - *bufpos;
    722                
     722
    723723                if (rd > 0) {
    724724                        /*
     
    732732                        left -= rd;
    733733                }
    734                
     734
    735735                if (*bufpos == *buflen) {
    736736                        /* Refill the communication buffer with a new block. */
     
    742742                                return rc;
    743743                        }
    744                        
     744
    745745                        *bufpos = 0;
    746746                        *buflen = block_size;
    747747                }
    748748        }
    749        
     749
    750750        return EOK;
    751751}
     
    860860        size_t blocks;
    861861        size_t offset;
    862        
     862
    863863        rc = block_get_bsize(service_id, &phys_block_size);
    864864        if (rc != EOK) {
    865865                return rc;
    866866        }
    867        
     867
    868868        /* calculate data position and required space */
    869869        first_block = abs_offset / phys_block_size;
     
    872872        blocks = last_block - first_block + 1;
    873873        buf_size = blocks * phys_block_size;
    874        
     874
    875875        /* read the data into memory */
    876876        buffer = malloc(buf_size);
     
    878878                return ENOMEM;
    879879        }
    880        
     880
    881881        rc = block_read_direct(service_id, first_block, blocks, buffer);
    882882        if (rc != EOK) {
     
    884884                return rc;
    885885        }
    886        
     886
    887887        /* copy the data from the buffer */
    888888        memcpy(data, buffer + offset, bytes);
    889889        free(buffer);
    890        
     890
    891891        return EOK;
    892892}
     
    905905{
    906906        devcon_t *devcon = devcon_search(service_id);
    907        
     907
    908908        assert(devcon);
    909909        return bd_read_toc(devcon->bd, session, buf, bufsize);
     
    923923{
    924924        assert(devcon);
    925        
     925
    926926        errno_t rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size);
    927927        if (rc != EOK) {
     
    933933#endif
    934934        }
    935        
     935
    936936        return rc;
    937937}
     
    950950{
    951951        assert(devcon);
    952        
     952
    953953        errno_t rc = bd_write_blocks(devcon->bd, ba, cnt, data, size);
    954954        if (rc != EOK) {
     
    959959#endif
    960960        }
    961        
     961
    962962        return rc;
    963963}
Note: See TracChangeset for help on using the changeset viewer.