Changes in uspace/srv/fs/fat/fat_ops.c [1558d85:44ecf89] in mainline
- File:
-
- 1 edited
-
uspace/srv/fs/fat/fat_ops.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r1558d85 r44ecf89 55 55 #include <assert.h> 56 56 #include <fibril_synch.h> 57 #include <sys/mman.h> 57 58 #include <align.h> 58 59 #include <malloc.h> 60 #include <str.h> 59 61 60 62 #define FAT_NODE(node) ((node) ? (fat_node_t *) (node)->data : NULL) … … 89 91 static bool fat_is_file(fs_node_t *node); 90 92 static service_id_t fat_service_get(fs_node_t *node); 91 static int fat_size_block(service_id_t, uint32_t *);92 static int fat_total_block_count(service_id_t, uint64_t *);93 static int fat_free_block_count(service_id_t, uint64_t *);94 93 95 94 /* … … 150 149 static int fat_node_fini_by_service_id(service_id_t service_id) 151 150 { 151 fat_node_t *nodep; 152 152 int rc; 153 153 … … 160 160 restart: 161 161 fibril_mutex_lock(&ffn_mutex); 162 list_foreach(ffn_list, ffn_link, fat_node_t, nodep) { 162 list_foreach(ffn_list, lnk) { 163 nodep = list_get_instance(lnk, fat_node_t, ffn_link); 163 164 if (!fibril_mutex_trylock(&nodep->lock)) { 164 165 fibril_mutex_unlock(&ffn_mutex); … … 842 843 } 843 844 844 int fat_size_block(service_id_t service_id, uint32_t *size)845 {846 fat_bs_t *bs;847 848 bs = block_bb_get(service_id);849 *size = BPC(bs);850 851 return EOK;852 }853 854 int fat_total_block_count(service_id_t service_id, uint64_t *count)855 {856 fat_bs_t *bs;857 858 bs = block_bb_get(service_id);859 *count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;860 861 return EOK;862 }863 864 int fat_free_block_count(service_id_t service_id, uint64_t *count)865 {866 fat_bs_t *bs;867 fat_cluster_t e0;868 uint64_t block_count;869 int rc;870 uint32_t cluster_no, clusters;871 872 block_count = 0;873 bs = block_bb_get(service_id);874 clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;875 for (cluster_no = 0; cluster_no < clusters; cluster_no++) {876 rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &e0);877 if (rc != EOK)878 return EIO;879 880 if (e0 == FAT_CLST_RES0)881 block_count++;882 }883 *count = block_count;884 885 return EOK;886 }887 888 845 /** libfs operations */ 889 846 libfs_ops_t fat_libfs_ops = { … … 903 860 .is_directory = fat_is_directory, 904 861 .is_file = fat_is_file, 905 .service_get = fat_service_get, 906 .size_block = fat_size_block, 907 .total_block_count = fat_total_block_count, 908 .free_block_count = fat_free_block_count 862 .service_get = fat_service_get 909 863 }; 910 864 … … 929 883 /* Parse mount options. */ 930 884 char *mntopts = (char *) opts; 885 char *saveptr; 931 886 char *opt; 932 while ((opt = str _tok(mntopts, " ,", &mntopts)) != NULL) {887 while ((opt = strtok_r(mntopts, " ,", &saveptr)) != NULL) { 933 888 if (str_cmp(opt, "wtcache") == 0) 934 889 cmode = CACHE_MODE_WT; 935 890 else if (str_cmp(opt, "nolfn") == 0) 936 891 instance->lfn_enabled = false; 892 mntopts = NULL; 937 893 } 938 894 939 895 /* initialize libblock */ 940 rc = block_init( service_id, BS_SIZE);896 rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE); 941 897 if (rc != EOK) { 942 898 free(instance);
Note:
See TracChangeset
for help on using the changeset viewer.
