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