Changeset 3dd148d in mainline
- Timestamp:
- 2013-07-29T15:15:49Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 736b07b
- Parents:
- a1c95da
- Location:
- uspace
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
ra1c95da r3dd148d 834 834 835 835 ops->node_put(fn); 836 836 837 837 838 async_data_read_finalize(callid, &stat, sizeof(struct stat)); 838 839 async_answer_0(rid, EOK); … … 862 863 memset(&statfs, 0, sizeof(struct statfs)); 863 864 864 if (NULL != ops->size_block) 865 statfs.f_bsize = ops->size_block(service_id); 866 if (NULL != ops->total_block_count) 867 statfs.f_blocks = ops->total_block_count(service_id); 868 if (NULL != ops->free_block_count) 869 statfs.f_bfree = ops->free_block_count(service_id); 870 865 if (NULL != ops->size_block) { 866 rc = ops->size_block(service_id, &statfs.f_bsize); 867 if (rc != EOK) goto error; 868 } 869 870 if (NULL != ops->total_block_count) { 871 rc = ops->total_block_count(service_id, &statfs.f_blocks); 872 if (rc != EOK) goto error; 873 } 874 875 if (NULL != ops->free_block_count) { 876 rc = ops->free_block_count(service_id, &statfs.f_bfree); 877 if (rc != EOK) goto error; 878 } 879 871 880 ops->node_put(fn); 872 873 881 async_data_read_finalize(callid, &statfs, sizeof(struct statfs)); 874 882 async_answer_0(rid, EOK); 883 return; 884 885 error: 886 ops->node_put(fn); 887 async_answer_0(callid, EINVAL); 888 async_answer_0(rid, EINVAL); 875 889 } 876 890 -
uspace/lib/fs/libfs.h
ra1c95da r3dd148d 93 93 bool (* is_file)(fs_node_t *); 94 94 service_id_t (* service_get)(fs_node_t *); 95 uint32_t (* size_block)(service_id_t);96 uint64_t (* total_block_count)(service_id_t);97 uint64_t (* free_block_count)(service_id_t);95 int (* size_block)(service_id_t, uint32_t *); 96 int (* total_block_count)(service_id_t, uint64_t *); 97 int (* free_block_count)(service_id_t, uint64_t *); 98 98 } libfs_ops_t; 99 99 -
uspace/srv/fs/cdfs/cdfs_ops.c
ra1c95da r3dd148d 625 625 } 626 626 627 static uint32_t cdfs_size_block(service_id_t service_id) 628 { 629 uint32_t block_size = BLOCK_SIZE; 630 return block_size; 627 static int cdfs_size_block(service_id_t service_id, uint32_t *size) 628 { 629 *size = BLOCK_SIZE; 630 631 return EOK; 631 632 } 632 633 -
uspace/srv/fs/exfat/exfat_ops.c
ra1c95da r3dd148d 89 89 static bool exfat_is_file(fs_node_t *node); 90 90 static service_id_t exfat_service_get(fs_node_t *node); 91 static uint32_t exfat_size_block(service_id_t);92 static uint64_t exfat_total_block_count(service_id_t);93 static uint64_t exfat_free_block_count(service_id_t);91 static int exfat_size_block(service_id_t, uint32_t *); 92 static int exfat_total_block_count(service_id_t, uint64_t *); 93 static int exfat_free_block_count(service_id_t, uint64_t *); 94 94 95 95 /* … … 915 915 } 916 916 917 uint32_t exfat_size_block(service_id_t service_id)917 int exfat_size_block(service_id_t service_id, uint32_t *size) 918 918 { 919 919 exfat_bs_t *bs; 920 920 bs = block_bb_get(service_id); 921 922 return BPC(bs); 923 } 924 925 uint64_t exfat_total_block_count(service_id_t service_id) 921 *size = BPC(bs); 922 923 return EOK; 924 } 925 926 int exfat_total_block_count(service_id_t service_id, uint64_t *count) 926 927 { 927 928 exfat_bs_t *bs; 928 929 bs = block_bb_get(service_id); 930 *count = DATA_CNT(bs); 929 931 930 uint64_t block_count = DATA_CNT(bs); 931 932 return block_count; 933 } 934 935 uint64_t exfat_free_block_count(service_id_t service_id) 932 return EOK; 933 } 934 935 int exfat_free_block_count(service_id_t service_id, uint64_t *count) 936 936 { 937 937 fs_node_t *node; … … 943 943 int rc; 944 944 945 block_count = exfat_total_block_count(service_id); 945 rc = exfat_total_block_count(service_id, &block_count); 946 if (rc != EOK) 947 goto exit; 946 948 947 949 bs = block_bb_get(service_id); … … 985 987 exit: 986 988 exfat_node_put(node); 987 return free_block_count; 989 *count = free_block_count; 990 return rc; 988 991 } 989 992 -
uspace/srv/fs/ext4fs/ext4fs_ops.c
ra1c95da r3dd148d 101 101 static bool ext4fs_is_file(fs_node_t *node); 102 102 static service_id_t ext4fs_service_get(fs_node_t *node); 103 static uint32_t ext4fs_size_block(service_id_t);104 static uint64_t ext4fs_total_block_count(service_id_t);105 static uint64_t ext4fs_free_block_count(service_id_t);103 static int ext4fs_size_block(service_id_t, uint32_t *); 104 static int ext4fs_total_block_count(service_id_t, uint64_t *); 105 static int ext4fs_free_block_count(service_id_t, uint64_t *); 106 106 107 107 /* Static variables */ … … 841 841 } 842 842 843 uint32_t ext4fs_size_block(service_id_t service_id)843 int ext4fs_size_block(service_id_t service_id, uint32_t *size) 844 844 { 845 845 ext4fs_instance_t *inst; … … 847 847 if (rc != EOK) 848 848 return rc; 849 849 850 if (NULL == inst) 850 851 return ENOENT; 851 852 852 853 ext4_superblock_t *sb = inst->filesystem->superblock; 853 uint32_t block_size = ext4_superblock_get_block_size(sb);854 855 return block_size;856 } 857 858 uint64_t ext4fs_total_block_count(service_id_t service_id)854 *size = ext4_superblock_get_block_size(sb); 855 856 return EOK; 857 } 858 859 int ext4fs_total_block_count(service_id_t service_id, uint64_t *count) 859 860 { 860 861 ext4fs_instance_t *inst; … … 862 863 if (rc != EOK) 863 864 return rc; 865 864 866 if (NULL == inst) 865 867 return ENOENT; 866 868 867 869 ext4_superblock_t *sb = inst->filesystem->superblock; 868 uint64_t block_count = ext4_superblock_get_blocks_count(sb);869 870 return block_count;871 } 872 873 uint64_t ext4fs_free_block_count(service_id_t service_id)870 *count = ext4_superblock_get_blocks_count(sb); 871 872 return EOK; 873 } 874 875 int ext4fs_free_block_count(service_id_t service_id, uint64_t *count) 874 876 { 875 877 ext4fs_instance_t *inst; … … 881 883 882 884 ext4_superblock_t *sb = inst->filesystem->superblock; 883 uint64_t block_count = ext4_superblock_get_free_blocks_count(sb);884 885 return block_count;885 *count = ext4_superblock_get_free_blocks_count(sb); 886 887 return EOK; 886 888 } 887 889 -
uspace/srv/fs/fat/fat_ops.c
ra1c95da 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 uint32_t fat_size_block(service_id_t);94 static uint64_t fat_total_block_count(service_id_t);95 static uint64_t fat_free_block_count(service_id_t);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 *); 96 96 97 97 /* … … 846 846 } 847 847 848 uint32_t fat_size_block(service_id_t service_id)848 int fat_size_block(service_id_t service_id, uint32_t *size) 849 849 { 850 850 fat_bs_t *bs; 851 851 852 bs = block_bb_get(service_id); 852 853 return BPC(bs); 854 } 855 856 uint64_t fat_total_block_count(service_id_t 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) 857 859 { 858 860 fat_bs_t *bs; 861 859 862 bs = block_bb_get(service_id); 860 861 uint64_t block_count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0; 862 863 return block_count; 864 } 865 866 uint64_t fat_free_block_count(service_id_t 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) 867 869 { 868 870 fat_bs_t *bs; … … 874 876 block_count = 0; 875 877 bs = block_bb_get(service_id); 876 877 878 clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0; 878 879 879 for (cluster_no = 0; cluster_no < clusters; cluster_no++) { 880 880 rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &e0); … … 885 885 block_count++; 886 886 } 887 888 return block_count; 887 *count = block_count; 888 889 return EOK; 889 890 } 890 891 -
uspace/srv/fs/mfs/mfs_ops.c
ra1c95da r3dd148d 64 64 static int mfs_check_sanity(struct mfs_sb_info *sbi); 65 65 static bool is_power_of_two(uint32_t n); 66 static uint32_t mfs_size_block(service_id_t service_id);67 static uint64_t mfs_total_block_count(service_id_t service_id);68 static uint64_t mfs_free_block_count(service_id_t service_id);66 static int mfs_size_block(service_id_t service_id, uint32_t *size); 67 static int mfs_total_block_count(service_id_t service_id, uint64_t *count); 68 static int mfs_free_block_count(service_id_t service_id, uint64_t *count); 69 69 70 70 static hash_table_t open_nodes; … … 1135 1135 } 1136 1136 1137 static uint32_t 1138 mfs_size_block(service_id_t service_id) 1139 { 1140 uint32_t block_size; 1141 1137 static int 1138 mfs_size_block(service_id_t service_id, uint32_t *size) 1139 { 1142 1140 struct mfs_instance *inst; 1143 int rc = mfs_instance_get(service_id, &inst); 1141 int rc; 1142 1143 rc = mfs_instance_get(service_id, &inst); 1144 1144 if (rc != EOK) 1145 1145 return rc; 1146 1146 1147 if (NULL == inst) 1147 1148 return ENOENT; 1148 1149 1149 block_size = inst->sbi->block_size; 1150 1151 return block_size; 1152 } 1153 1154 static uint64_t 1155 mfs_total_block_count(service_id_t service_id) 1156 { 1157 uint64_t block_total; 1150 *size = inst->sbi->block_size; 1151 1152 return EOK; 1153 } 1154 1155 static int 1156 mfs_total_block_count(service_id_t service_id, uint64_t *count) 1157 { 1158 struct mfs_instance *inst; 1159 int rc; 1158 1160 1159 struct mfs_instance *inst; 1160 int rc = mfs_instance_get(service_id, &inst); 1161 rc = mfs_instance_get(service_id, &inst); 1161 1162 if (rc != EOK) 1162 1163 return rc; … … 1165 1166 return ENOENT; 1166 1167 1167 block_total= (uint64_t) MFS_BMAP_SIZE_BITS(inst->sbi, BMAP_ZONE);1168 1169 return block_total;1170 } 1171 1172 static uint64_t1173 mfs_free_block_count(service_id_t service_id )1168 *count = (uint64_t) MFS_BMAP_SIZE_BITS(inst->sbi, BMAP_ZONE); 1169 1170 return EOK; 1171 } 1172 1173 static int 1174 mfs_free_block_count(service_id_t service_id, uint64_t *count) 1174 1175 { 1175 1176 uint32_t block_free; … … 1184 1185 1185 1186 mfs_count_free_zones(inst, &block_free); 1186 1187 return (uint64_t)block_free; 1187 *count = block_free; 1188 1189 return EOK; 1188 1190 } 1189 1191 -
uspace/srv/fs/udf/udf_ops.c
ra1c95da r3dd148d 249 249 } 250 250 251 static uint32_t udf_size_block(service_id_t service_id)251 static int udf_size_block(service_id_t service_id, uint32_t *size) 252 252 { 253 253 udf_instance_t *instance; … … 259 259 return ENOENT; 260 260 261 return instance->volumes[DEFAULT_VOL].logical_block_size; 261 *size = instance->volumes[DEFAULT_VOL].logical_block_size; 262 263 return EOK; 262 264 } 263 265
Note:
See TracChangeset
for help on using the changeset viewer.