Changeset a35b458 in mainline for uspace/srv/fs/tmpfs/tmpfs_dump.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_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);
Note: See TracChangeset for help on using the changeset viewer.