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


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/fat
Files:
8 edited

Legend:

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

    r3061bc1 ra35b458  
    6262{
    6363        printf(NAME ": HelenOS FAT file system server\n");
    64        
     64
    6565        if (argc == 3) {
    6666                if (!str_cmp(argv[1], "--instance"))
     
    7575        if (rc != EOK)
    7676                goto err;
    77        
     77
    7878        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    7979            INTERFACE_VFS_DRIVER, 0);
     
    8282                return -1;
    8383        }
    84        
     84
    8585        rc = fs_register(vfs_sess, &fat_vfs_info, &fat_ops, &fat_libfs_ops);
    8686        if (rc != EOK) {
     
    8888                goto err;
    8989        }
    90        
     90
    9191        printf(NAME ": Accepting connections\n");
    9292        task_retval(0);
    9393        async_manager();
    94        
     94
    9595        /* Not reached */
    9696        return 0;
    97        
     97
    9898err:
    9999        printf(NAME ": Failed to register file system: %s\n", str_error(rc));
  • uspace/srv/fs/fat/fat.h

    r3061bc1 ra35b458  
    213213        /** Back pointer to the FS node. */
    214214        fs_node_t               *bp;
    215        
     215
    216216        fibril_mutex_t          lock;
    217217        fat_node_type_t         type;
  • uspace/srv/fs/fat/fat_dentry.c

    r3061bc1 ra35b458  
    8181{
    8282        unsigned int i;
    83        
     83
    8484        for (i = 0; i < FAT_NAME_LEN; i++) {
    8585                if (d->name[i] == FAT_PAD)
    8686                        break;
    87                
     87
    8888                if (d->name[i] == FAT_DENTRY_E5_ESC)
    8989                        *buf++ = 0xe5;
     
    9595                }
    9696        }
    97        
     97
    9898        if (d->ext[0] != FAT_PAD)
    9999                *buf++ = '.';
    100        
     100
    101101        for (i = 0; i < FAT_EXT_LEN; i++) {
    102102                if (d->ext[i] == FAT_PAD) {
     
    104104                        return;
    105105                }
    106                
     106
    107107                if (d->ext[i] == FAT_DENTRY_E5_ESC)
    108108                        *buf++ = 0xe5;
     
    114114                }
    115115        }
    116        
     116
    117117        *buf = '\0';
    118118}
     
    124124        bool lower_name = true;
    125125        bool lower_ext = true;
    126        
     126
    127127        for (i = 0; i < FAT_NAME_LEN; i++) {
    128128                switch ((uint8_t) *name) {
     
    140140                                        lower_name = false;
    141141                        }
    142                        
     142
    143143                        d->name[i] = toupper(*name++);
    144144                        break;
    145145                }
    146146        }
    147        
     147
    148148        if (*name++ != '.')
    149149                name = fake_ext;
    150        
     150
    151151        for (i = 0; i < FAT_EXT_LEN; i++) {
    152152                switch ((uint8_t) *name) {
     
    163163                                        lower_ext = false;
    164164                        }
    165                        
     165
    166166                        d->ext[i] = toupper(*name++);
    167167                        break;
    168168                }
    169169        }
    170        
     170
    171171        if (lower_name)
    172172                d->lcase |= FAT_LCASE_LOWER_NAME;
    173173        else
    174174                d->lcase &= ~FAT_LCASE_LOWER_NAME;
    175        
     175
    176176        if (lower_ext)
    177177                d->lcase |= FAT_LCASE_LOWER_EXT;
     
    183183{
    184184        unsigned int i;
    185        
     185
    186186        for (i = 0; i < FAT_NAME_LEN; i++) {
    187187                if (d->name[i] == FAT_PAD)
    188188                        break;
    189                
     189
    190190                if (d->name[i] == FAT_DENTRY_E5_ESC)
    191191                        *buf++ = 0xe5;
     
    193193                        *buf++ = d->name[i];
    194194        }
    195        
     195
    196196        for (i = 0; i < FAT_EXT_LEN; i++) {
    197197                if (d->ext[i] == FAT_PAD) {
     
    199199                        return;
    200200                }
    201                
     201
    202202                if (d->ext[i] == FAT_DENTRY_E5_ESC)
    203203                        *buf++ = 0xe5;
     
    205205                        *buf++ = d->ext[i];
    206206        }
    207        
     207
    208208        *buf = '\0';
    209209}
     
    291291{
    292292        size_t size = 0;
    293        
     293
    294294        size += fat_lfn_str_nlength(FAT_LFN_PART1(d), FAT_LFN_PART1_SIZE);
    295295        size += fat_lfn_str_nlength(FAT_LFN_PART2(d), FAT_LFN_PART2_SIZE);
    296296        size += fat_lfn_str_nlength(FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE);
    297        
     297
    298298        return size;
    299299}
     
    354354        d->lfn.type = 0;
    355355        d->lfn.firstc_lo = 0;
    356        
     356
    357357        return *offset;
    358358}
     
    363363        size_t off = 0;
    364364        size_t i = 0;
    365        
     365
    366366        while (i < count) {
    367367                if ((ch = str_decode(src, &off, STR_NO_LIMIT)) != 0) {
     
    384384        size_t offset=0;
    385385        bool result = true;
    386        
     386
    387387        while ((ch = str_decode(name, &offset, STR_NO_LIMIT)) != 0) {
    388388                if (str_chr(FAT_STOP_CHARS, ch) != NULL) {
  • uspace/srv/fs/fat/fat_dentry.h

    r3061bc1 ra35b458  
    6060#define FAT_ATTR_LFN \
    6161    (FAT_ATTR_RDONLY | FAT_ATTR_HIDDEN | FAT_ATTR_SYSTEM | FAT_ATTR_VOLLABEL)
    62    
     62
    6363#define FAT_LCASE_LOWER_NAME    0x08
    6464#define FAT_LCASE_LOWER_EXT     0x10
  • uspace/srv/fs/fat/fat_directory.c

    r3061bc1 ra35b458  
    6565{
    6666        errno_t rc = EOK;
    67        
     67
    6868        if (di->b)
    6969                rc = block_put(di->b);
    70        
     70
    7171        return rc;
    7272}
     
    106106        if (rc != EOK)
    107107                di->pos -= 1;
    108        
     108
    109109        return rc;
    110110}
     
    113113{
    114114        errno_t rc = EOK;
    115        
     115
    116116        if (di->pos > 0) {
    117117                di->pos -= 1;
     
    119119        } else
    120120                return ENOENT;
    121        
     121
    122122        if (rc != EOK)
    123123                di->pos += 1;
    124        
     124
    125125        return rc;
    126126}
     
    135135        if (rc != EOK)
    136136                di->pos = _pos;
    137        
     137
    138138        return rc;
    139139}
     
    142142{
    143143        errno_t rc;
    144        
     144
    145145        rc = fat_directory_block_load(di);
    146146        if (rc == EOK) {
     
    148148                *d = ((fat_dentry_t *)di->b->data) + o;
    149149        }
    150        
     150
    151151        return rc;
    152152}
     
    168168        assert(rc == EOK);
    169169        instance = (fat_instance_t *) data;
    170        
     170
    171171        do {
    172172                rc = fat_directory_get(di, &d);
     
    220220                        } else
    221221                                fat_dentry_name_get(d, name);
    222                                
     222
    223223                        *de = d;
    224224                        return EOK;
     
    232232                }
    233233        } while (fat_directory_next(di) == EOK);
    234        
     234
    235235        return ENOENT;
    236236}
     
    250250        d->name[0] = FAT_DENTRY_ERASED;
    251251        di->b->dirty = true;
    252        
     252
    253253        while (!flag && fat_directory_prev(di) == EOK) {
    254254                if (fat_directory_get(di, &d) == EOK &&
     
    276276        assert(rc == EOK);
    277277        instance = (fat_instance_t *) data;
    278        
     278
    279279        if (fat_valid_short_name(name)) {
    280280                /*
     
    296296                uint16_t wname[FAT_LFN_NAME_LEN];
    297297                size_t lfn_size, lfn_offset;
    298                
     298
    299299                rc = str_to_utf16(wname, FAT_LFN_NAME_LEN, name);
    300300                if (rc != EOK)
    301301                        return rc;
    302                
     302
    303303                lfn_size = utf16_wsize(wname);
    304304                long_entry_count = lfn_size / FAT_LFN_ENTRY_SIZE;
     
    440440        di->nodep->dirty = true;                /* need to sync node */
    441441        di->blocks = di->nodep->size / BPS(di->bs);
    442        
     442
    443443        return EOK;
    444444}
     
    450450        aoff64_t pos;
    451451        errno_t rc;
    452        
     452
    453453        do {
    454454                found = 0;
  • uspace/srv/fs/fat/fat_fat.c

    r3061bc1 ra35b458  
    344344        else
    345345                *value = (*value) & FAT12_MASK;
    346        
     346
    347347        rc = block_put(b);
    348348
     
    463463        if (offset / BPS(bs) >= SF(bs))
    464464                return ERANGE;
    465        
     465
    466466        rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
    467467            offset / BPS(bs), BLOCK_FLAGS_NONE);
     
    687687        if (!lifo)
    688688                return ENOMEM;
    689        
     689
    690690        /*
    691691         * Search FAT1 for unused clusters.
  • uspace/srv/fs/fat/fat_idx.c

    r3061bc1 ra35b458  
    120120{
    121121        pos_key_t *pos = (pos_key_t*)key;
    122        
     122
    123123        size_t hash = 0;
    124124        hash = hash_combine(pos->pfc, pos->pdi);
     
    129129{
    130130        fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link);
    131        
     131
    132132        pos_key_t pkey = {
    133133                .service_id = fidx->service_id,
     
    135135                .pdi = fidx->pdi,
    136136        };
    137        
     137
    138138        return pos_key_hash(&pkey);
    139139}
     
    143143        pos_key_t *pos = (pos_key_t*)key;
    144144        fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link);
    145        
     145
    146146        return pos->service_id == fidx->service_id
    147147                && pos->pdi == fidx->pdi
     
    184184        fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link);
    185185        idx_key_t *key = (idx_key_t*)key_arg;
    186        
     186
    187187        return key->index == fidx->index && key->service_id == fidx->service_id;
    188188}
     
    207207{
    208208        unused_t *u;
    209        
     209
    210210        assert(index);
    211211        u = unused_find(service_id, true);
     
    339339                return ENOSPC;
    340340        }
    341                
     341
    342342        fibril_mutex_initialize(&fidx->lock);
    343343        fidx->service_id = service_id;
     
    361361                return rc;
    362362        }
    363                
     363
    364364        hash_table_insert(&ui_hash, &fidx->uih_link);
    365365        fibril_mutex_lock(&fidx->lock);
     
    393393                        return NULL;
    394394                }
    395                
     395
    396396                fidx->pfc = pfc;
    397397                fidx->pdi = pdi;
     
    514514                hash_table_remove_item(&up_hash, item);
    515515        }
    516        
     516
    517517        return true;
    518518}
     
    526526                hash_table_remove_item(&ui_hash, item);
    527527        }
    528        
     528
    529529        return true;
    530530}
  • uspace/srv/fs/fat/fat_ops.c

    r3061bc1 ra35b458  
    381381        service_id = parentp->idx->service_id;
    382382        fibril_mutex_unlock(&parentp->idx->lock);
    383        
     383
    384384        fat_directory_t di;
    385385        rc = fat_directory_open(parentp, &di);
     
    716716        assert(childp->lnkcnt == 1);
    717717        fibril_mutex_lock(&childp->idx->lock);
    718        
     718
    719719        fat_directory_t di;
    720720        rc = fat_directory_open(parentp, &di);
     
    856856{
    857857        fat_bs_t *bs;
    858        
     858
    859859        bs = block_bb_get(service_id);
    860860        *count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
     
    883883        }
    884884        *count = block_count;
    885        
     885
    886886        return EOK;
    887887}
     
    13301330        int flags = BLOCK_FLAGS_NONE;
    13311331        errno_t rc;
    1332        
     1332
    13331333        rc = fat_node_get(&fn, service_id, index);
    13341334        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.