Changeset cca29e3c in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2009-09-03T14:46:17Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2f636b6
Parents:
dc87ad11
Message:

Make fat_append_clusters(), fat_chop_clusters(), fat_free_clusters(),
fat_alloc_shadow_clusters(), fat_set_cluster(), fat_fill_gap() and
fat_zero_cluster() return an error code.

File:
1 edited

Legend:

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

    rdc87ad11 rcca29e3c  
    329329        nodep = fat_node_get_new();
    330330        if (!nodep) {
    331                 fat_free_clusters(bs, dev_handle, mcl);
     331                (void) fat_free_clusters(bs, dev_handle, mcl);
    332332                return NULL;
    333333        }
    334334        idxp = fat_idx_get_new(dev_handle);
    335335        if (!idxp) {
    336                 fat_free_clusters(bs, dev_handle, mcl);
     336                (void) fat_free_clusters(bs, dev_handle, mcl); 
    337337                fat_node_put(FS_NODE(nodep));
    338338                return NULL;
     
    341341        if (flags & L_DIRECTORY) {
    342342                /* Populate the new cluster with unused dentries. */
    343                 fat_zero_cluster(bs, dev_handle, mcl);
     343                rc = fat_zero_cluster(bs, dev_handle, mcl);
     344                assert(rc == EOK);
    344345                nodep->type = FAT_DIRECTORY;
    345346                nodep->firstc = mcl;
     
    365366        fat_node_t *nodep = FAT_NODE(fn);
    366367        fat_bs_t *bs;
     368        int rc = EOK;
    367369
    368370        /*
     
    383385                assert(nodep->size);
    384386                /* Free all clusters allocated to the node. */
    385                 fat_free_clusters(bs, nodep->idx->dev_handle, nodep->firstc);
     387                rc = fat_free_clusters(bs, nodep->idx->dev_handle,
     388                    nodep->firstc);
    386389        }
    387390
     
    389392        free(nodep->bp);
    390393        free(nodep);
    391         return EOK;
     394        return rc;
    392395}
    393396
     
    470473                return rc;
    471474        }
    472         fat_zero_cluster(bs, parentp->idx->dev_handle, mcl);
    473         fat_append_clusters(bs, parentp, mcl);
     475        rc = fat_zero_cluster(bs, parentp->idx->dev_handle, mcl);
     476        assert(rc == EOK);
     477        rc = fat_append_clusters(bs, parentp, mcl);
     478        assert(rc == EOK);
    474479        parentp->size += bps * bs->spc;
    475480        parentp->dirty = true;          /* need to sync node */
     
    10881093                 * next block size boundary.
    10891094                 */
    1090                 fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos);
     1095                rc = fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos);
     1096                assert(rc == EOK);
    10911097                rc = fat_block_get(&b, bs, nodep, pos / bps, flags);
    10921098                assert(rc == EOK);
     
    11231129                }
    11241130                /* zero fill any gaps */
    1125                 fat_fill_gap(bs, nodep, mcl, pos);
     1131                rc = fat_fill_gap(bs, nodep, mcl, pos);
     1132                assert(rc == EOK);
    11261133                rc = _fat_block_get(&b, bs, dev_handle, lcl, (pos / bps) % spc,
    11271134                    flags);
     
    11361143                 * node's cluster chain.
    11371144                 */
    1138                 fat_append_clusters(bs, nodep, mcl);
     1145                rc = fat_append_clusters(bs, nodep, mcl);
     1146                assert(rc == EOK);
    11391147                nodep->size = pos + bytes;
    11401148                nodep->dirty = true;            /* need to sync node */
     
    11891197                 */
    11901198                if (size == 0) {
    1191                         fat_chop_clusters(bs, nodep, FAT_CLST_RES0);
     1199                        rc = fat_chop_clusters(bs, nodep, FAT_CLST_RES0);
     1200                        if (rc != EOK)
     1201                                goto out;
    11921202                } else {
    11931203                        fat_cluster_t lastc;
     
    11961206                        if (rc != EOK)
    11971207                                goto out;
    1198                         fat_chop_clusters(bs, nodep, lastc);
     1208                        rc = fat_chop_clusters(bs, nodep, lastc);
     1209                        if (rc != EOK)
     1210                                goto out;
    11991211                }
    12001212                nodep->size = size;
Note: See TracChangeset for help on using the changeset viewer.