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


Ignore:
Timestamp:
2013-07-29T15:15:49Z (12 years ago)
Author:
Manuele Conti <conti.ma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
736b07b
Parents:
a1c95da
Message:

Change stafs function operation to allow correct error handling.

File:
1 edited

Legend:

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

    ra1c95da r3dd148d  
    9191static bool fat_is_file(fs_node_t *node);
    9292static service_id_t fat_service_get(fs_node_t *node);
    93 static uint32_t fat_size_block(service_id_t);
    94 static uint64_t fat_total_block_count(service_id_t);
    95 static uint64_t fat_free_block_count(service_id_t);
     93static int fat_size_block(service_id_t, uint32_t *);
     94static int fat_total_block_count(service_id_t, uint64_t *);
     95static int fat_free_block_count(service_id_t, uint64_t *);
    9696
    9797/*
     
    846846}
    847847
    848 uint32_t fat_size_block(service_id_t service_id)
     848int fat_size_block(service_id_t service_id, uint32_t *size)
    849849{
    850850        fat_bs_t *bs;
     851
    851852        bs = block_bb_get(service_id);
    852 
    853         return BPC(bs);
    854 }
    855 
    856 uint64_t fat_total_block_count(service_id_t service_id)
     853        *size = BPC(bs);
     854
     855        return EOK;
     856}
     857
     858int fat_total_block_count(service_id_t service_id, uint64_t *count)
    857859{
    858860        fat_bs_t *bs;
     861       
    859862        bs = block_bb_get(service_id);
    860 
    861         uint64_t block_count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
    862 
    863         return block_count;
    864 }
    865 
    866 uint64_t fat_free_block_count(service_id_t service_id)
     863        *count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
     864
     865        return EOK;
     866}
     867
     868int fat_free_block_count(service_id_t service_id, uint64_t *count)
    867869{
    868870        fat_bs_t *bs;
     
    874876        block_count = 0;
    875877        bs = block_bb_get(service_id);
    876        
    877878        clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
    878        
    879879        for (cluster_no = 0; cluster_no < clusters; cluster_no++) {
    880880                rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &e0);
     
    885885                        block_count++;
    886886        }
    887 
    888         return block_count;
     887        *count = block_count;
     888       
     889        return EOK;
    889890}
    890891
Note: See TracChangeset for help on using the changeset viewer.