Changes in uspace/srv/fs/mfs/mfs_ops.c [fc22069:1ba6651] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
rfc22069 r1ba6651 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 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 66 70 67 static hash_table_t open_nodes; … … 87 84 .destroy = mfs_destroy_node, 88 85 .has_children = mfs_has_children, 89 .lnkcnt_get = mfs_lnkcnt_get, 90 .size_block = mfs_size_block, 91 .total_block_count = mfs_total_block_count, 92 .free_block_count = mfs_free_block_count 86 .lnkcnt_get = mfs_lnkcnt_get 93 87 }; 94 88 … … 161 155 162 156 /* initialize libblock */ 163 rc = block_init( service_id, 4096);157 rc = block_init(EXCHANGE_SERIALIZE, service_id, 4096); 164 158 if (rc != EOK) 165 159 return rc; … … 216 210 sbi->isearch = 0; 217 211 sbi->zsearch = 0; 218 sbi->nfree_zones_valid = false;219 sbi->nfree_zones = 0;220 212 221 213 if (version == MFS_VERSION_V3) { … … 1137 1129 } 1138 1130 1139 static int1140 mfs_size_block(service_id_t service_id, uint32_t *size)1141 {1142 struct mfs_instance *inst;1143 int rc;1144 1145 rc = mfs_instance_get(service_id, &inst);1146 if (rc != EOK)1147 return rc;1148 1149 if (NULL == inst)1150 return ENOENT;1151 1152 *size = inst->sbi->block_size;1153 1154 return EOK;1155 }1156 1157 static int1158 mfs_total_block_count(service_id_t service_id, uint64_t *count)1159 {1160 struct mfs_instance *inst;1161 int rc;1162 1163 rc = mfs_instance_get(service_id, &inst);1164 if (rc != EOK)1165 return rc;1166 1167 if (NULL == inst)1168 return ENOENT;1169 1170 *count = (uint64_t) MFS_BMAP_SIZE_BITS(inst->sbi, BMAP_ZONE);1171 1172 return EOK;1173 }1174 1175 static int1176 mfs_free_block_count(service_id_t service_id, uint64_t *count)1177 {1178 uint32_t block_free;1179 1180 struct mfs_instance *inst;1181 int rc = mfs_instance_get(service_id, &inst);1182 if (rc != EOK)1183 return rc;1184 1185 struct mfs_sb_info *sbi = inst->sbi;1186 1187 if (!sbi->nfree_zones_valid) {1188 /* The cached number of free zones is not valid,1189 * we need to scan the bitmap to retrieve the1190 * current value.1191 */1192 1193 rc = mfs_count_free_zones(inst, &block_free);1194 if (rc != EOK)1195 return rc;1196 1197 sbi->nfree_zones = block_free;1198 sbi->nfree_zones_valid = true;1199 }1200 1201 *count = sbi->nfree_zones;1202 1203 return rc;1204 }1205 1206 1131 vfs_out_ops_t mfs_ops = { 1207 1132 .mounted = mfs_mounted,
Note:
See TracChangeset
for help on using the changeset viewer.