Changeset a35b458 in mainline for uspace/srv/fs/tmpfs


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 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.

Location:
uspace/srv/fs/tmpfs
Files:
3 edited

Legend:

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

    r3061bc1 ra35b458  
    7575                }
    7676        }
    77        
     77
    7878        if (!tmpfs_init()) {
    7979                printf(NAME ": failed to initialize TMPFS\n");
    8080                return -1;
    8181        }
    82        
     82
    8383        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    8484            INTERFACE_VFS_DRIVER, 0);
     
    8787                return -1;
    8888        }
    89        
     89
    9090        errno_t rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
    9191            &tmpfs_libfs_ops);
     
    9494                return rc;
    9595        }
    96        
     96
    9797        printf(NAME ": Accepting connections\n");
    9898        task_retval(0);
    9999        async_manager();
    100        
     100
    101101        /* Not reached */
    102102        return 0;
  • uspace/srv/fs/tmpfs/tmpfs_dump.c

    r3061bc1 ra35b458  
    6464        libfs_ops_t *ops = &tmpfs_libfs_ops;
    6565        errno_t rc;
    66        
     66
    6767        do {
    6868                char *fname;
     
    7070                tmpfs_node_t *nodep;
    7171                uint32_t size;
    72                
     72
    7373                if (block_seqread(dsid, tmpfs_buf, bufpos, buflen, pos, &entry,
    7474                    sizeof(entry)) != EOK)
    7575                        return false;
    76                
     76
    7777                entry.len = uint32_t_le2host(entry.len);
    78                
     78
    7979                switch (entry.type) {
    8080                case TMPFS_NONE:
     
    8484                        if (fname == NULL)
    8585                                return false;
    86                        
     86
    8787                        rc = ops->create(&fn, dsid, L_FILE);
    8888                        if (rc != EOK || fn == NULL) {
     
    9090                                return false;
    9191                        }
    92                        
     92
    9393                        if (block_seqread(dsid, tmpfs_buf, bufpos, buflen, pos, fname,
    9494                            entry.len) != EOK) {
     
    9898                        }
    9999                        fname[entry.len] = 0;
    100                        
     100
    101101                        rc = ops->link(pfn, fn, fname);
    102102                        if (rc != EOK) {
     
    106106                        }
    107107                        free(fname);
    108                        
     108
    109109                        if (block_seqread(dsid, tmpfs_buf, bufpos, buflen, pos, &size,
    110110                            sizeof(size)) != EOK)
    111111                                return false;
    112                        
     112
    113113                        size = uint32_t_le2host(size);
    114                        
     114
    115115                        nodep = TMPFS_NODE(fn);
    116116                        nodep->data = malloc(size);
    117117                        if (nodep->data == NULL)
    118118                                return false;
    119                        
     119
    120120                        nodep->size = size;
    121121                        if (block_seqread(dsid, tmpfs_buf, bufpos, buflen, pos, nodep->data,
    122122                            size) != EOK)
    123123                                return false;
    124                        
     124
    125125                        break;
    126126                case TMPFS_DIRECTORY:
     
    128128                        if (fname == NULL)
    129129                                return false;
    130                        
     130
    131131                        rc = ops->create(&fn, dsid, L_DIRECTORY);
    132132                        if (rc != EOK || fn == NULL) {
     
    134134                                return false;
    135135                        }
    136                        
     136
    137137                        if (block_seqread(dsid, tmpfs_buf, bufpos, buflen, pos, fname,
    138138                            entry.len) != EOK) {
     
    150150                        }
    151151                        free(fname);
    152                        
     152
    153153                        if (!tmpfs_restore_recursion(dsid, bufpos, buflen, pos,
    154154                            fn))
    155155                                return false;
    156                        
     156
    157157                        break;
    158158                default:
     
    160160                }
    161161        } while (entry.type != TMPFS_NONE);
    162        
     162
    163163        return true;
    164164}
     
    173173        if (rc != EOK)
    174174                return false;
    175        
     175
    176176        size_t bufpos = 0;
    177177        size_t buflen = 0;
    178178        aoff64_t pos = 0;
    179        
     179
    180180        char tag[6];
    181181        if (block_seqread(dsid, tmpfs_buf, &bufpos, &buflen, &pos, tag, 5) != EOK)
    182182                goto error;
    183        
     183
    184184        tag[5] = 0;
    185185        if (str_cmp(tag, "TMPFS") != 0)
    186186                goto error;
    187        
     187
    188188        rc = ops->root_get(&fn, dsid);
    189189        if (rc != EOK)
     
    192192        if (!tmpfs_restore_recursion(dsid, &bufpos, &buflen, &pos, fn))
    193193                goto error;
    194                
     194
    195195        block_fini(dsid);
    196196        return true;
    197        
     197
    198198error:
    199199        block_fini(dsid);
  • 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.