Changes in uspace/srv/fs/fat/fat_ops.c [3dd148d:feeac0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r3dd148d rfeeac0d 91 91 static bool fat_is_file(fs_node_t *node); 92 92 static 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 *);96 93 97 94 /* … … 152 149 static int fat_node_fini_by_service_id(service_id_t service_id) 153 150 { 154 fat_node_t *nodep;155 151 int rc; 156 152 … … 163 159 restart: 164 160 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) { 167 162 if (!fibril_mutex_trylock(&nodep->lock)) { 168 163 fibril_mutex_unlock(&ffn_mutex); … … 846 841 } 847 842 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 892 843 /** libfs operations */ 893 844 libfs_ops_t fat_libfs_ops = { … … 907 858 .is_directory = fat_is_directory, 908 859 .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 913 861 }; 914 862
Note:
See TracChangeset
for help on using the changeset viewer.