Changeset 99c2c69e in mainline for uspace/srv/fs/fat/fat_ops.c
- Timestamp:
- 2013-09-13T00:36:30Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 67fbd5e
- Parents:
- 7f84430 (diff), 11d41be5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r7f84430 r99c2c69e 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 { 151 fat_node_t *nodep;152 154 int rc; 153 155 … … 160 162 restart: 161 163 fibril_mutex_lock(&ffn_mutex); 162 list_foreach(ffn_list, lnk) { 163 nodep = list_get_instance(lnk, fat_node_t, ffn_link); 164 list_foreach(ffn_list, ffn_link, fat_node_t, nodep) { 164 165 if (!fibril_mutex_trylock(&nodep->lock)) { 165 166 fibril_mutex_unlock(&ffn_mutex); … … 843 844 } 844 845 846 int fat_size_block(service_id_t service_id, uint32_t *size) 847 { 848 fat_bs_t *bs; 849 850 bs = block_bb_get(service_id); 851 *size = BPC(bs); 852 853 return EOK; 854 } 855 856 int fat_total_block_count(service_id_t service_id, uint64_t *count) 857 { 858 fat_bs_t *bs; 859 860 bs = block_bb_get(service_id); 861 *count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0; 862 863 return EOK; 864 } 865 866 int fat_free_block_count(service_id_t service_id, uint64_t *count) 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 clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0; 877 for (cluster_no = 0; cluster_no < clusters; cluster_no++) { 878 rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &e0); 879 if (rc != EOK) 880 return EIO; 881 882 if (e0 == FAT_CLST_RES0) 883 block_count++; 884 } 885 *count = block_count; 886 887 return EOK; 888 } 889 845 890 /** libfs operations */ 846 891 libfs_ops_t fat_libfs_ops = { … … 860 905 .is_directory = fat_is_directory, 861 906 .is_file = fat_is_file, 862 .service_get = fat_service_get 907 .service_get = fat_service_get, 908 .size_block = fat_size_block, 909 .total_block_count = fat_total_block_count, 910 .free_block_count = fat_free_block_count 863 911 }; 864 912
Note:
See TracChangeset
for help on using the changeset viewer.