Changes in uspace/srv/fs/fat/fat_ops.c [feeac0d:ee3f6f6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
rfeeac0d ree3f6f6 55 55 #include <assert.h> 56 56 #include <fibril_synch.h> 57 #include <sys/mman.h>58 57 #include <align.h> 59 58 #include <malloc.h> … … 91 90 static bool fat_is_file(fs_node_t *node); 92 91 static service_id_t fat_service_get(fs_node_t *node); 92 static int fat_size_block(service_id_t, uint32_t *); 93 static int fat_total_block_count(service_id_t, uint64_t *); 94 static int fat_free_block_count(service_id_t, uint64_t *); 93 95 94 96 /* … … 841 843 } 842 844 845 int fat_size_block(service_id_t service_id, uint32_t *size) 846 { 847 fat_bs_t *bs; 848 849 bs = block_bb_get(service_id); 850 *size = BPC(bs); 851 852 return EOK; 853 } 854 855 int fat_total_block_count(service_id_t service_id, uint64_t *count) 856 { 857 fat_bs_t *bs; 858 859 bs = block_bb_get(service_id); 860 *count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0; 861 862 return EOK; 863 } 864 865 int fat_free_block_count(service_id_t service_id, uint64_t *count) 866 { 867 fat_bs_t *bs; 868 fat_cluster_t e0; 869 uint64_t block_count; 870 int rc; 871 uint32_t cluster_no, clusters; 872 873 block_count = 0; 874 bs = block_bb_get(service_id); 875 clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0; 876 for (cluster_no = 0; cluster_no < clusters; cluster_no++) { 877 rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &e0); 878 if (rc != EOK) 879 return EIO; 880 881 if (e0 == FAT_CLST_RES0) 882 block_count++; 883 } 884 *count = block_count; 885 886 return EOK; 887 } 888 843 889 /** libfs operations */ 844 890 libfs_ops_t fat_libfs_ops = { … … 858 904 .is_directory = fat_is_directory, 859 905 .is_file = fat_is_file, 860 .service_get = fat_service_get 906 .service_get = fat_service_get, 907 .size_block = fat_size_block, 908 .total_block_count = fat_total_block_count, 909 .free_block_count = fat_free_block_count 861 910 }; 862 911 … … 881 930 /* Parse mount options. */ 882 931 char *mntopts = (char *) opts; 883 char *saveptr;884 932 char *opt; 885 while ((opt = str tok_r(mntopts, " ,", &saveptr)) != NULL) {933 while ((opt = str_tok(mntopts, " ,", &mntopts)) != NULL) { 886 934 if (str_cmp(opt, "wtcache") == 0) 887 935 cmode = CACHE_MODE_WT; 888 936 else if (str_cmp(opt, "nolfn") == 0) 889 937 instance->lfn_enabled = false; 890 mntopts = NULL;891 938 } 892 939
Note:
See TracChangeset
for help on using the changeset viewer.