Changes in / [1db44ea7:f9d8c3a] in mainline
- Location:
- uspace
- Files:
-
- 10 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
r1db44ea7 rf9d8c3a 143 143 { 144 144 enum cache_mode cmode; 145 struct mfs_superblock *sb = NULL;146 struct mfs3_superblock *sb3 = NULL;147 struct mfs_sb_info *sbi = NULL;148 struct mfs_instance *instance = NULL;145 struct mfs_superblock *sb; 146 struct mfs3_superblock *sb3; 147 struct mfs_sb_info *sbi; 148 struct mfs_instance *instance; 149 149 bool native, longnames; 150 150 mfs_version_t version; … … 166 166 sbi = malloc(sizeof(*sbi)); 167 167 if (!sbi) { 168 rc = ENOMEM;169 goto out_error;168 block_fini(service_id); 169 return ENOMEM; 170 170 } 171 171 … … 173 173 instance = malloc(sizeof(*instance)); 174 174 if (!instance) { 175 rc = ENOMEM; 176 goto out_error; 175 free(sbi); 176 block_fini(service_id); 177 return ENOMEM; 177 178 } 178 179 179 180 sb = malloc(MFS_SUPERBLOCK_SIZE); 180 181 if (!sb) { 181 rc = ENOMEM; 182 goto out_error; 182 free(instance); 183 free(sbi); 184 block_fini(service_id); 185 return ENOMEM; 183 186 } 184 187 185 188 /* Read the superblock */ 186 189 rc = block_read_direct(service_id, MFS_SUPERBLOCK << 1, 2, sb); 187 if (rc != EOK) 188 goto out_error; 190 if (rc != EOK) { 191 free(instance); 192 free(sbi); 193 free(sb); 194 block_fini(service_id); 195 return rc; 196 } 189 197 190 198 sb3 = (struct mfs3_superblock *) sb; … … 199 207 /*Not recognized*/ 200 208 mfsdebug("magic number not recognized\n"); 201 rc = ENOTSUP; 202 goto out_error; 209 free(instance); 210 free(sbi); 211 free(sb); 212 block_fini(service_id); 213 return ENOTSUP; 203 214 } 204 215 … … 245 256 MFS_MAX_NAME_LEN; 246 257 } 247 248 if (sbi->log2_zone_size != 0) {249 /* In MFS, file space is allocated per zones.250 * Zones are a collection of consecutive blocks on disk.251 *252 * The current MFS implementation supports only filesystems253 * where the size of a zone is equal to the254 * size of a block.255 */256 rc = ENOTSUP;257 goto out_error;258 }259 260 258 sbi->itable_off = 2 + sbi->ibmap_blocks + sbi->zbmap_blocks; 259 260 free(sb); 261 261 262 262 rc = block_cache_init(service_id, sbi->block_size, 0, cmode); 263 263 if (rc != EOK) { 264 free(instance); 265 free(sbi); 266 block_cache_fini(service_id); 267 block_fini(service_id); 264 268 mfsdebug("block cache initialization failed\n"); 265 rc = EINVAL; 266 goto out_error; 269 return EINVAL; 267 270 } 268 271 … … 292 295 *linkcnt = 1; 293 296 294 free(sb);295 296 297 return mfs_node_put(fn); 297 298 out_error:299 block_fini(service_id);300 if (sb)301 free(sb);302 if (sbi)303 free(sbi);304 if(instance)305 free(instance);306 return rc;307 298 } 308 299
Note:
See TracChangeset
for help on using the changeset viewer.