Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 245b7945 in mainline


Ignore:
Timestamp:
2011-08-14T08:22:25Z (10 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master
Children:
5f0e16e4
Parents:
a18bd22
Message:

exFAT: implement bitmap_set_clusters, bitmap_clear_clusters,
bitmap_free_clusters

Location:
uspace/srv/fs/exfat
Files:
2 edited

Legend:

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

    ra18bd22 r245b7945  
    483483}
    484484
     485int bitmap_set_cluster(exfat_bs_t *bs, devmap_handle_t devmap_handle,
     486    exfat_cluster_t firstc)
     487{
     488        /* TODO */
     489        return EOK;
     490}
     491
     492int bitmap_clear_cluster(exfat_bs_t *bs, devmap_handle_t devmap_handle,
     493    exfat_cluster_t firstc)
     494{
     495        /* TODO */
     496        return EOK;
     497}
     498
    485499int bitmap_set_clusters(exfat_bs_t *bs, devmap_handle_t devmap_handle,
    486500    exfat_cluster_t firstc, exfat_cluster_t count)
    487501{
    488         /* TODO */
    489         return EOK;
    490 }
    491 
     502        int rc;
     503        exfat_cluster_t clst;
     504        clst = firstc;
     505
     506        while (clst < firstc+count ) {
     507                rc = bitmap_set_cluster(bs, devmap_handle, clst);
     508                if (rc != EOK) {
     509                        if ((clst-firstc) > 0)
     510                                (void) bitmap_clear_clusters(bs, devmap_handle, firstc, clst-firstc);
     511                        return rc;
     512                }
     513                clst++;
     514        }
     515        return EOK;
     516}
     517
     518int bitmap_clear_clusters(exfat_bs_t *bs, devmap_handle_t devmap_handle,
     519    exfat_cluster_t firstc, exfat_cluster_t count)
     520{
     521        int rc;
     522        exfat_cluster_t clst;
     523        clst = firstc;
     524
     525        while (clst < firstc+count ) {
     526                rc = bitmap_clear_cluster(bs, devmap_handle, clst);
     527                if (rc != EOK)
     528                        return rc;
     529                clst++;
     530        }
     531        return EOK;
     532}
    492533
    493534int bitmap_alloc_clusters(exfat_bs_t *bs, devmap_handle_t devmap_handle,
     
    544585    exfat_cluster_t count)
    545586{
    546         /* TODO */
    547         return EOK;
     587        exfat_cluster_t lastc;
     588        lastc = nodep->firstc + ROUND_UP(nodep->size, BPC(bs)) / BPC(bs) - 1;
     589        lastc -= count;
     590
     591        return bitmap_clear_clusters(bs, nodep->idx->devmap_handle, lastc+1, count);
    548592}
    549593
  • uspace/srv/fs/exfat/exfat_fat.h

    ra18bd22 r245b7945  
    8686extern int bitmap_is_free(struct exfat_bs *bs, devmap_handle_t devmap_handle,
    8787    exfat_cluster_t clst);
     88extern int bitmap_set_cluster(struct exfat_bs *bs, devmap_handle_t devmap_handle,
     89    exfat_cluster_t firstc);
     90extern int bitmap_clear_cluster(struct exfat_bs *bs, devmap_handle_t devmap_handle,
     91    exfat_cluster_t firstc);
    8892extern int bitmap_set_clusters(struct exfat_bs *bs, devmap_handle_t devmap_handle,
     93    exfat_cluster_t firstc, exfat_cluster_t count);
     94extern int bitmap_clear_clusters(struct exfat_bs *bs, devmap_handle_t devmap_handle,
    8995    exfat_cluster_t firstc, exfat_cluster_t count);
    9096
Note: See TracChangeset for help on using the changeset viewer.