Ignore:
File:
1 edited

Legend:

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

    r5cd6c84 r44ecf89  
    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);
    9693
    9794/*
     
    846843}
    847844
    848 uint32_t fat_size_block(service_id_t service_id)
    849 {
    850         fat_bs_t *bs;
    851         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)
    857 {
    858         fat_bs_t *bs;
    859         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)
    867 {
    868         fat_bs_t *bs;
    869         fat_cluster_t e0;
    870         uint64_t block_count;
    871         int rc;
    872         uint32_t cluster_no, clusters;
    873 
    874         block_count = 0;
    875         bs = block_bb_get(service_id);
    876        
    877         clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
    878        
    879         for (cluster_no = 0; cluster_no < clusters; cluster_no++) {
    880                 rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &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 
    891845/** libfs operations */
    892846libfs_ops_t fat_libfs_ops = {
     
    906860        .is_directory = fat_is_directory,
    907861        .is_file = fat_is_file,
    908         .service_get = fat_service_get,
    909         .size_block = fat_size_block,
    910         .total_block_count = fat_total_block_count,
    911         .free_block_count = fat_free_block_count
     862        .service_get = fat_service_get
    912863};
    913864
Note: See TracChangeset for help on using the changeset viewer.