Changes in / [1db44ea7:f9d8c3a] in mainline


Ignore:
Location:
uspace
Files:
10 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/mfs/mfs_ops.c

    r1db44ea7 rf9d8c3a  
    143143{
    144144        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;
    149149        bool native, longnames;
    150150        mfs_version_t version;
     
    166166        sbi = malloc(sizeof(*sbi));
    167167        if (!sbi) {
    168                 rc = ENOMEM;
    169                 goto out_error;
     168                block_fini(service_id);
     169                return ENOMEM;
    170170        }
    171171
     
    173173        instance = malloc(sizeof(*instance));
    174174        if (!instance) {
    175                 rc = ENOMEM;
    176                 goto out_error;
     175                free(sbi);
     176                block_fini(service_id);
     177                return ENOMEM;
    177178        }
    178179
    179180        sb = malloc(MFS_SUPERBLOCK_SIZE);
    180181        if (!sb) {
    181                 rc = ENOMEM;
    182                 goto out_error;
     182                free(instance);
     183                free(sbi);
     184                block_fini(service_id);
     185                return ENOMEM;
    183186        }
    184187
    185188        /* Read the superblock */
    186189        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        }
    189197
    190198        sb3 = (struct mfs3_superblock *) sb;
     
    199207                /*Not recognized*/
    200208                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;
    203214        }
    204215
     
    245256                                    MFS_MAX_NAME_LEN;
    246257        }
    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 
    260258        sbi->itable_off = 2 + sbi->ibmap_blocks + sbi->zbmap_blocks;
     259
     260        free(sb);
    261261
    262262        rc = block_cache_init(service_id, sbi->block_size, 0, cmode);
    263263        if (rc != EOK) {
     264                free(instance);
     265                free(sbi);
     266                block_cache_fini(service_id);
     267                block_fini(service_id);
    264268                mfsdebug("block cache initialization failed\n");
    265                 rc = EINVAL;
    266                 goto out_error;
     269                return EINVAL;
    267270        }
    268271
     
    292295        *linkcnt = 1;
    293296
    294         free(sb);
    295 
    296297        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;
    307298}
    308299
Note: See TracChangeset for help on using the changeset viewer.