Changeset 0d110908 in mainline


Ignore:
Timestamp:
2013-07-22T21:48:09Z (11 years ago)
Author:
Manuele Conti <conti.ma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
675a2bb
Parents:
17a0fb8
Message:

Start to implement free block count operation for FAT fs.

File:
1 edited

Legend:

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

    r17a0fb8 r0d110908  
    9393static uint32_t fat_size_block(service_id_t);
    9494static uint64_t fat_total_block_count(service_id_t);
     95static uint64_t fat_free_block_count(service_id_t);
    9596
    9697/*
     
    863864}
    864865
     866uint64_t fat_free_block_count(service_id_t service_id)
     867{
     868        fat_bs_t *bs;
     869        fat_cluster_t e0 = 0;
     870        uint64_t block_count;
     871        int rc;
     872        uint32_t fat_no, fat_tot;
     873
     874        block_count = 0;
     875        bs = block_bb_get(service_id);
     876       
     877        fat_tot = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
     878       
     879        for (fat_no = 0; fat_no < fat_tot; fat_no++) {
     880                rc = fat_get_cluster(bs, service_id, FAT1, e0, &e0);
     881                if (rc != EOK)
     882                        return EIO;
     883
     884                if (e0 == FAT_CLST_RES0)
     885                        block_count++;
     886        }
     887
     888        return block_count;
     889}
     890
    865891/** libfs operations */
    866892libfs_ops_t fat_libfs_ops = {
     
    882908        .service_get = fat_service_get,
    883909        .size_block = fat_size_block,
    884         .total_block_count = fat_total_block_count
     910        .total_block_count = fat_total_block_count,
     911        .free_block_count = fat_free_block_count
    885912};
    886913
Note: See TracChangeset for help on using the changeset viewer.