Changeset a35b458 in mainline for uspace/srv/vfs/vfs_file.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/vfs/vfs_file.c

    r3061bc1 ra35b458  
    9494                        (void) _vfs_fd_free(vfs_data, i);
    9595        }
    96        
     96
    9797        free(vfs_data->files);
    9898
     
    100100                link_t *lnk;
    101101                vfs_boxed_handle_t *bh;
    102                
     102
    103103                lnk = list_first(&vfs_data->passed_handles);
    104104                list_remove(lnk);
     
    120120                vfs_data->files = NULL;
    121121        }
    122        
     122
    123123        return vfs_data;
    124124}
     
    136136{
    137137        assert(!file->refcnt);
    138        
     138
    139139        async_exch_t *exch = vfs_exchange_grab(file->node->fs_handle);
    140        
     140
    141141        ipc_call_t answer;
    142142        aid_t msg = async_send_2(exch, VFS_OUT_CLOSE, file->node->service_id,
    143143            file->node->index, &answer);
    144        
     144
    145145        vfs_exchange_release(exch);
    146        
     146
    147147        errno_t rc;
    148148        async_wait_for(msg, &rc);
    149        
     149
    150150        return IPC_GET_RETVAL(answer);
    151151}
     
    179179                 * endpoint FS and drop our reference to the underlying VFS node.
    180180                 */
    181                
     181
    182182                if (file->node != NULL) {
    183183                        if (file->open_read || file->open_write) {
     
    196196        if (!vfs_files_init(vfs_data))
    197197                return ENOMEM;
    198        
     198
    199199        unsigned int i;
    200200        if (desc)
     
    202202        else
    203203                i = 0;
    204        
     204
    205205        fibril_mutex_lock(&vfs_data->lock);
    206206        while (true) {
     
    211211                                return ENOMEM;
    212212                        }
    213                        
    214                        
     213
     214
    215215                        memset(vfs_data->files[i], 0, sizeof(vfs_file_t));
    216                        
     216
    217217                        fibril_mutex_initialize(&vfs_data->files[i]->_lock);
    218218                        fibril_mutex_lock(&vfs_data->files[i]->_lock);
    219219                        vfs_file_addref(vfs_data, vfs_data->files[i]);
    220                        
     220
    221221                        *file = vfs_data->files[i];
    222222                        vfs_file_addref(vfs_data, *file);
    223                        
     223
    224224                        fibril_mutex_unlock(&vfs_data->lock);
    225225                        *out_fd = (int) i;
    226226                        return EOK;
    227227                }
    228                
     228
    229229                if (desc) {
    230230                        if (i == 0)
    231231                                break;
    232                        
     232
    233233                        i--;
    234234                } else {
    235235                        if (i == MAX_OPEN_FILES - 1)
    236236                                break;
    237                        
     237
    238238                        i++;
    239239                }
    240240        }
    241241        fibril_mutex_unlock(&vfs_data->lock);
    242        
     242
    243243        return EMFILE;
    244244}
     
    280280        rc = _vfs_fd_free_locked(vfs_data, fd);
    281281        fibril_mutex_unlock(&vfs_data->lock);
    282        
     282
    283283        return rc;
    284284}
     
    319319        (void) _vfs_fd_free_locked(VFS_DATA, fd);
    320320        assert(FILES[fd] == NULL);
    321        
     321
    322322        FILES[fd] = file;
    323323        vfs_file_addref(VFS_DATA, FILES[fd]);
    324324        fibril_mutex_unlock(&VFS_DATA->lock);
    325        
     325
    326326        return EOK;
    327327}
     
    330330{
    331331        fibril_mutex_unlock(&file->_lock);
    332        
     332
    333333        fibril_mutex_lock(&vfs_data->lock);
    334334        vfs_file_delref(vfs_data, file);
     
    340340        if (!vfs_files_init(vfs_data))
    341341                return NULL;
    342        
     342
    343343        fibril_mutex_lock(&vfs_data->lock);
    344344        if ((fd >= 0) && (fd < MAX_OPEN_FILES)) {
     
    347347                        vfs_file_addref(vfs_data, file);
    348348                        fibril_mutex_unlock(&vfs_data->lock);
    349                        
     349
    350350                        fibril_mutex_lock(&file->_lock);
    351351                        if (file->node == NULL) {
     
    359359        }
    360360        fibril_mutex_unlock(&vfs_data->lock);
    361        
     361
    362362        return NULL;
    363363}
     
    432432{
    433433        vfs_client_data_t *vfs_data = VFS_DATA;
    434        
     434
    435435        fibril_mutex_lock(&vfs_data->lock);
    436436        while (list_empty(&vfs_data->passed_handles))
     
    449449                return rc;
    450450        }
    451        
     451
    452452        file->node = bh->node;
    453453        file->permissions = bh->permissions;
Note: See TracChangeset for help on using the changeset viewer.