Ignore:
File:
1 edited

Legend:

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

    r3dd148d rfeeac0d  
    9191static bool fat_is_file(fs_node_t *node);
    9292static service_id_t fat_service_get(fs_node_t *node);
    93 static int fat_size_block(service_id_t, uint32_t *);
    94 static int fat_total_block_count(service_id_t, uint64_t *);
    95 static int fat_free_block_count(service_id_t, uint64_t *);
    9693
    9794/*
     
    152149static int fat_node_fini_by_service_id(service_id_t service_id)
    153150{
    154         fat_node_t *nodep;
    155151        int rc;
    156152
     
    163159restart:
    164160        fibril_mutex_lock(&ffn_mutex);
    165         list_foreach(ffn_list, lnk) {
    166                 nodep = list_get_instance(lnk, fat_node_t, ffn_link);
     161        list_foreach(ffn_list, ffn_link, fat_node_t, nodep) {
    167162                if (!fibril_mutex_trylock(&nodep->lock)) {
    168163                        fibril_mutex_unlock(&ffn_mutex);
     
    846841}
    847842
    848 int fat_size_block(service_id_t service_id, uint32_t *size)
    849 {
    850         fat_bs_t *bs;
    851 
    852         bs = block_bb_get(service_id);
    853         *size = BPC(bs);
    854 
    855         return EOK;
    856 }
    857 
    858 int fat_total_block_count(service_id_t service_id, uint64_t *count)
    859 {
    860         fat_bs_t *bs;
    861        
    862         bs = block_bb_get(service_id);
    863         *count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
    864 
    865         return EOK;
    866 }
    867 
    868 int fat_free_block_count(service_id_t service_id, uint64_t *count)
    869 {
    870         fat_bs_t *bs;
    871         fat_cluster_t e0;
    872         uint64_t block_count;
    873         int rc;
    874         uint32_t cluster_no, clusters;
    875 
    876         block_count = 0;
    877         bs = block_bb_get(service_id);
    878         clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
    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         *count = block_count;
    888        
    889         return EOK;
    890 }
    891 
    892843/** libfs operations */
    893844libfs_ops_t fat_libfs_ops = {
     
    907858        .is_directory = fat_is_directory,
    908859        .is_file = fat_is_file,
    909         .service_get = fat_service_get,
    910         .size_block = fat_size_block,
    911         .total_block_count = fat_total_block_count,
    912         .free_block_count = fat_free_block_count
     860        .service_get = fat_service_get
    913861};
    914862
Note: See TracChangeset for help on using the changeset viewer.