Changeset 758f8d5 in mainline for uspace/srv/fs/fat
- Timestamp:
- 2013-09-11T21:53:36Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e1ec5a2
- Parents:
- 1e371cf (diff), 9dbdda9 (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
r1e371cf r758f8d5 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 /* … … 841 844 } 842 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 843 890 /** libfs operations */ 844 891 libfs_ops_t fat_libfs_ops = { … … 858 905 .is_directory = fat_is_directory, 859 906 .is_file = fat_is_file, 860 .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 861 911 }; 862 912
Note:
See TracChangeset
for help on using the changeset viewer.