Changeset a35b458 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r3061bc1 ra35b458  
    163163        tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link);
    164164        node_key_t *key = (node_key_t *)key_arg;
    165        
     165
    166166        return key->service_id == node->service_id && key->index == node->index;
    167167}
     
    220220        if (!hash_table_create(&nodes, 0, 0, &nodes_ops))
    221221                return false;
    222        
     222
    223223        return true;
    224224}
     
    228228        fs_node_t *rfn;
    229229        errno_t rc;
    230        
     230
    231231        rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY);
    232232        if (rc != EOK || !rfn)
     
    240240        service_id_t sid = *(service_id_t*)arg;
    241241        tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link);
    242        
     242
    243243        if (node->service_id == sid) {
    244244                hash_table_remove_item(&nodes, &node->nh_link);
     
    273273                .index = index
    274274        };
    275        
     275
    276276        ht_link_t *lnk = hash_table_find(&nodes, &key);
    277        
     277
    278278        if (lnk) {
    279279                tmpfs_node_t *nodep;
     
    338338{
    339339        tmpfs_node_t *nodep = TMPFS_NODE(fn);
    340        
     340
    341341        assert(!nodep->lnkcnt);
    342342        assert(list_empty(&nodep->cs_list));
    343        
     343
    344344        hash_table_remove_item(&nodes, &nodep->nh_link);
    345345
     
    406406        if (!childp)
    407407                return ENOENT;
    408                
     408
    409409        if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_list))
    410410                return ENOTEMPTY;
     
    432432        fs_node_t *rootfn;
    433433        errno_t rc;
    434        
     434
    435435        /* Check if this device is not already mounted. */
    436436        rc = tmpfs_root_get(&rootfn, service_id);
     
    474474                .index = index
    475475        };
    476        
     476
    477477        ht_link_t *hlp = hash_table_find(&nodes, &key);
    478478        if (!hlp)
    479479                return ENOENT;
    480        
     480
    481481        tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link);
    482        
     482
    483483        /*
    484484         * Receive the read request.
     
    499499                tmpfs_dentry_t *dentryp;
    500500                link_t *lnk;
    501                
     501
    502502                assert(nodep->type == TMPFS_DIRECTORY);
    503                
     503
    504504                /*
    505505                 * Yes, we really use O(n) algorithm here.
     
    508508                 */
    509509                lnk = list_nth(&nodep->cs_list, pos);
    510                
     510
    511511                if (lnk == NULL) {
    512512                        async_answer_0(callid, ENOENT);
     
    536536                .index = index
    537537        };
    538        
     538
    539539        ht_link_t *hlp = hash_table_find(&nodes, &key);
    540        
     540
    541541        if (!hlp)
    542542                return ENOENT;
    543        
     543
    544544        tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link);
    545545
     
    599599                .index = index
    600600        };
    601        
     601
    602602        ht_link_t *hlp = hash_table_find(&nodes, &key);
    603        
     603
    604604        if (!hlp)
    605605                return ENOENT;
    606606        tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link);
    607        
     607
    608608        if (size == nodep->size)
    609609                return EOK;
    610        
     610
    611611        if (size > SIZE_MAX)
    612612                return ENOMEM;
    613        
     613
    614614        void *newdata = realloc(nodep->data, size);
    615615        if (!newdata)
    616616                return ENOMEM;
    617        
     617
    618618        if (size > nodep->size) {
    619619                size_t delta = size - nodep->size;
    620620                memset(newdata + nodep->size, 0, delta);
    621621        }
    622        
     622
    623623        nodep->size = size;
    624624        nodep->data = newdata;
     
    637637                .index = index
    638638        };
    639        
     639
    640640        ht_link_t *hlp = hash_table_find(&nodes, &key);
    641641        if (!hlp)
Note: See TracChangeset for help on using the changeset viewer.