Changeset 46577995 in mainline for uspace/srv/fs/exfat/exfat_fat.c


Ignore:
Timestamp:
2018-01-04T20:50:52Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
e211ea04
Parents:
facacc71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
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.

After this commit, HelenOS is free of code that mixes error codes with non-error
values on the assumption that error codes are negative.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat_fat.c

    rfacacc71 r46577995  
    7373 * @return              EOK on success or an error code.
    7474 */
    75 int
     75errno_t
    7676exfat_cluster_walk(exfat_bs_t *bs, service_id_t service_id,
    7777    exfat_cluster_t firstc, exfat_cluster_t *lastc, uint32_t *numc,
     
    8080        uint32_t clusters = 0;
    8181        exfat_cluster_t clst = firstc;
    82         int rc;
     82        errno_t rc;
    8383
    8484        if (firstc < EXFAT_CLST_FIRST) {
     
    122122 * @return              EOK on success or an error code.
    123123 */
    124 int
     124errno_t
    125125exfat_block_get(block_t **block, exfat_bs_t *bs, exfat_node_t *nodep,
    126126    aoff64_t bn, int flags)
     
    129129        exfat_cluster_t currc = 0;
    130130        aoff64_t relbn = bn;
    131         int rc;
     131        errno_t rc;
    132132
    133133        if (!nodep->size)
     
    186186 * @return              EOK on success or an error code.
    187187 */
    188 int
     188errno_t
    189189exfat_block_get_by_clst(block_t **block, exfat_bs_t *bs,
    190190    service_id_t service_id, bool fragmented, exfat_cluster_t fcl,
     
    194194        uint32_t max_clusters;
    195195        exfat_cluster_t c = EXFAT_CLST_FIRST;
    196         int rc;
     196        errno_t rc;
    197197
    198198        if (fcl < EXFAT_CLST_FIRST || fcl > DATA_CNT(bs) + 2)
     
    229229 * @return              EOK or an error code.
    230230 */
    231 int
     231errno_t
    232232exfat_get_cluster(exfat_bs_t *bs, service_id_t service_id,
    233233    exfat_cluster_t clst, exfat_cluster_t *value)
     
    235235        block_t *b;
    236236        aoff64_t offset;
    237         int rc;
     237        errno_t rc;
    238238
    239239        offset = clst * sizeof(exfat_cluster_t);
     
    259259 * @return              EOK on success or an error code.
    260260 */
    261 int
     261errno_t
    262262exfat_set_cluster(exfat_bs_t *bs, service_id_t service_id,
    263263    exfat_cluster_t clst, exfat_cluster_t value)
     
    265265        block_t *b;
    266266        aoff64_t offset;
    267         int rc;
     267        errno_t rc;
    268268
    269269        offset = clst * sizeof(exfat_cluster_t);
     
    297297 * @return              EOK on success, an error code otherwise.
    298298 */
    299 int
     299errno_t
    300300exfat_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, unsigned nclsts,
    301301    exfat_cluster_t *mcl, exfat_cluster_t *lcl)
     
    304304        unsigned found = 0;     /* top of the free cluster number stack */
    305305        exfat_cluster_t clst;
    306         int rc = EOK;
     306        errno_t rc = EOK;
    307307
    308308        lifo = (exfat_cluster_t *) malloc(nclsts * sizeof(exfat_cluster_t));
     
    363363 * @return              EOK on success or an error code.
    364364 */
    365 int
     365errno_t
    366366exfat_free_clusters(exfat_bs_t *bs, service_id_t service_id, exfat_cluster_t firstc)
    367367{
    368368        exfat_cluster_t nextc;
    369         int rc;
     369        errno_t rc;
    370370
    371371        /* Mark all clusters in the chain as free */
     
    396396 * @return              EOK on success or an error code.
    397397 */
    398 int
     398errno_t
    399399exfat_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t mcl,
    400400    exfat_cluster_t lcl)
     
    402402        service_id_t service_id = nodep->idx->service_id;
    403403        exfat_cluster_t lastc = 0;
    404         int rc;
     404        errno_t rc;
    405405
    406406        if (nodep->firstc == 0) {
     
    440440 * @return              EOK on success or an error code.
    441441 */
    442 int exfat_chop_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t lcl)
    443 {
    444         int rc;
     442errno_t exfat_chop_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t lcl)
     443{
     444        errno_t rc;
    445445        service_id_t service_id = nodep->idx->service_id;
    446446
     
    486486}
    487487
    488 int
     488errno_t
    489489exfat_zero_cluster(exfat_bs_t *bs, service_id_t service_id, exfat_cluster_t c)
    490490{
    491491        size_t i;
    492492        block_t *b;
    493         int rc;
     493        errno_t rc;
    494494
    495495        for (i = 0; i < SPC(bs); i++) {
     
    508508}
    509509
    510 int
     510errno_t
    511511exfat_read_uctable(exfat_bs_t *bs, exfat_node_t *nodep, uint8_t *uctable)
    512512{
    513513        size_t i, blocks, count;
    514514        block_t *b;
    515         int rc;
     515        errno_t rc;
    516516        blocks = ROUND_UP(nodep->size, BPS(bs))/BPS(bs);
    517517        count = BPS(bs);
     
    540540 * does not contain a exfat file system.
    541541 */
    542 int exfat_sanity_check(exfat_bs_t *bs)
     542errno_t exfat_sanity_check(exfat_bs_t *bs)
    543543{
    544544        if (str_cmp((char const *)bs->oem_name, "EXFAT   "))
Note: See TracChangeset for help on using the changeset viewer.