Changeset b7fd2a0 in mainline for uspace/srv/fs/fat/fat_directory.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (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:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

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

    r36f0738 rb7fd2a0  
    4646#include <stdio.h>
    4747
    48 int fat_directory_open(fat_node_t *nodep, fat_directory_t *di)
     48errno_t fat_directory_open(fat_node_t *nodep, fat_directory_t *di)
    4949{
    5050        di->b = NULL;
     
    6262}
    6363
    64 int fat_directory_close(fat_directory_t *di)
    65 {
    66         int rc = EOK;
     64errno_t fat_directory_close(fat_directory_t *di)
     65{
     66        errno_t rc = EOK;
    6767       
    6868        if (di->b)
     
    7272}
    7373
    74 static int fat_directory_block_load(fat_directory_t *di)
     74static errno_t fat_directory_block_load(fat_directory_t *di)
    7575{
    7676        uint32_t i;
    77         int rc;
     77        errno_t rc;
    7878
    7979        i = (di->pos * sizeof(fat_dentry_t)) / BPS(di->bs);
     
    9898}
    9999
    100 int fat_directory_next(fat_directory_t *di)
    101 {
    102         int rc;
     100errno_t fat_directory_next(fat_directory_t *di)
     101{
     102        errno_t rc;
    103103
    104104        di->pos += 1;
     
    110110}
    111111
    112 int fat_directory_prev(fat_directory_t *di)
    113 {
    114         int rc = EOK;
     112errno_t fat_directory_prev(fat_directory_t *di)
     113{
     114        errno_t rc = EOK;
    115115       
    116116        if (di->pos > 0) {
     
    126126}
    127127
    128 int fat_directory_seek(fat_directory_t *di, aoff64_t pos)
     128errno_t fat_directory_seek(fat_directory_t *di, aoff64_t pos)
    129129{
    130130        aoff64_t _pos = di->pos;
    131         int rc;
     131        errno_t rc;
    132132
    133133        di->pos = pos;
     
    139139}
    140140
    141 int fat_directory_get(fat_directory_t *di, fat_dentry_t **d)
    142 {
    143         int rc;
     141errno_t fat_directory_get(fat_directory_t *di, fat_dentry_t **d)
     142{
     143        errno_t rc;
    144144       
    145145        rc = fat_directory_block_load(di);
     
    152152}
    153153
    154 int fat_directory_read(fat_directory_t *di, char *name, fat_dentry_t **de)
     154errno_t fat_directory_read(fat_directory_t *di, char *name, fat_dentry_t **de)
    155155{
    156156        fat_dentry_t *d = NULL;
     
    160160        int long_entry_count = 0;
    161161        uint8_t checksum = 0;
    162         int rc;
     162        errno_t rc;
    163163
    164164        void *data;
     
    236236}
    237237
    238 int fat_directory_erase(fat_directory_t *di)
    239 {
    240         int rc;
     238errno_t fat_directory_erase(fat_directory_t *di)
     239{
     240        errno_t rc;
    241241        fat_dentry_t *d;
    242242        bool flag = false;
     
    267267}
    268268
    269 int fat_directory_write(fat_directory_t *di, const char *name, fat_dentry_t *de)
    270 {
    271         int rc;
     269errno_t fat_directory_write(fat_directory_t *di, const char *name, fat_dentry_t *de)
     270{
     271        errno_t rc;
    272272        void *data;
    273273        fat_instance_t *instance;
     
    348348}
    349349
    350 int fat_directory_create_sfn(fat_directory_t *di, fat_dentry_t *de,
     350errno_t fat_directory_create_sfn(fat_directory_t *di, fat_dentry_t *de,
    351351    const char *lname)
    352352{
     
    398398}
    399399
    400 int fat_directory_write_dentry(fat_directory_t *di, fat_dentry_t *de)
     400errno_t fat_directory_write_dentry(fat_directory_t *di, fat_dentry_t *de)
    401401{
    402402        fat_dentry_t *d;
    403         int rc;
     403        errno_t rc;
    404404
    405405        rc = fat_directory_get(di, &d);
     
    412412}
    413413
    414 int fat_directory_expand(fat_directory_t *di)
    415 {
    416         int rc;
     414errno_t fat_directory_expand(fat_directory_t *di)
     415{
     416        errno_t rc;
    417417        fat_cluster_t mcl, lcl;
    418418
     
    444444}
    445445
    446 int fat_directory_lookup_free(fat_directory_t *di, size_t count)
     446errno_t fat_directory_lookup_free(fat_directory_t *di, size_t count)
    447447{
    448448        fat_dentry_t *d;
    449449        size_t found;
    450450        aoff64_t pos;
    451         int rc;
     451        errno_t rc;
    452452       
    453453        do {
     
    485485}
    486486
    487 int fat_directory_lookup_name(fat_directory_t *di, const char *name,
     487errno_t fat_directory_lookup_name(fat_directory_t *di, const char *name,
    488488    fat_dentry_t **de)
    489489{
     
    506506{
    507507        fat_dentry_t *d;
    508         int rc;
     508        errno_t rc;
    509509
    510510        fat_directory_seek(di, 0);
     
    538538 * @return EOK on success, ENOENT if not found, EIO on I/O error
    539539 */
    540 int fat_directory_vollabel_get(fat_directory_t *di, char *label)
     540errno_t fat_directory_vollabel_get(fat_directory_t *di, char *label)
    541541{
    542542        fat_dentry_t *d;
    543         int rc;
     543        errno_t rc;
    544544
    545545        fat_directory_seek(di, 0);
Note: See TracChangeset for help on using the changeset viewer.