Changes in / [f9d8c3a:1db44ea] in mainline
- Location:
- uspace
- Files:
-
- 10 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/srv/fs/mfs/mfs_ops.c ¶
rf9d8c3a r1db44ea 143 143 { 144 144 enum cache_mode cmode; 145 struct mfs_superblock *sb ;146 struct mfs3_superblock *sb3 ;147 struct mfs_sb_info *sbi ;148 struct mfs_instance *instance ;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; 149 149 bool native, longnames; 150 150 mfs_version_t version; … … 166 166 sbi = malloc(sizeof(*sbi)); 167 167 if (!sbi) { 168 block_fini(service_id);169 return ENOMEM;168 rc = ENOMEM; 169 goto out_error; 170 170 } 171 171 … … 173 173 instance = malloc(sizeof(*instance)); 174 174 if (!instance) { 175 free(sbi); 176 block_fini(service_id); 177 return ENOMEM; 175 rc = ENOMEM; 176 goto out_error; 178 177 } 179 178 180 179 sb = malloc(MFS_SUPERBLOCK_SIZE); 181 180 if (!sb) { 182 free(instance); 183 free(sbi); 184 block_fini(service_id); 185 return ENOMEM; 181 rc = ENOMEM; 182 goto out_error; 186 183 } 187 184 188 185 /* Read the superblock */ 189 186 rc = block_read_direct(service_id, MFS_SUPERBLOCK << 1, 2, sb); 190 if (rc != EOK) { 191 free(instance); 192 free(sbi); 193 free(sb); 194 block_fini(service_id); 195 return rc; 196 } 187 if (rc != EOK) 188 goto out_error; 197 189 198 190 sb3 = (struct mfs3_superblock *) sb; … … 207 199 /*Not recognized*/ 208 200 mfsdebug("magic number not recognized\n"); 209 free(instance); 210 free(sbi); 211 free(sb); 212 block_fini(service_id); 213 return ENOTSUP; 201 rc = ENOTSUP; 202 goto out_error; 214 203 } 215 204 … … 256 245 MFS_MAX_NAME_LEN; 257 246 } 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 filesystems 253 * where the size of a zone is equal to the 254 * size of a block. 255 */ 256 rc = ENOTSUP; 257 goto out_error; 258 } 259 258 260 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);268 264 mfsdebug("block cache initialization failed\n"); 269 return EINVAL; 265 rc = EINVAL; 266 goto out_error; 270 267 } 271 268 … … 295 292 *linkcnt = 1; 296 293 294 free(sb); 295 297 296 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; 298 307 } 299 308
Note:
See TracChangeset
for help on using the changeset viewer.