Changeset de5b708 in mainline for uspace/lib/ext4/src/ops.c


Ignore:
Timestamp:
2017-05-12T17:15:49Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
395df52
Parents:
be39fc6
Message:

Restructure ext4 filesystem opening/closing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/src/ops.c

    rbe39fc6 rde5b708  
    928928    fs_index_t *index, aoff64_t *size, unsigned *lnkcnt)
    929929{
    930         /* Allocate libext4 filesystem structure */
    931         ext4_filesystem_t *fs = (ext4_filesystem_t *)
    932             malloc(sizeof(ext4_filesystem_t));
    933         if (fs == NULL)
    934                 return ENOMEM;
     930        ext4_filesystem_t *fs;
    935931       
    936932        /* Allocate instance structure */
    937933        ext4_instance_t *inst = (ext4_instance_t *)
    938934            malloc(sizeof(ext4_instance_t));
    939         if (inst == NULL) {
    940                 free(fs);
     935        if (inst == NULL)
    941936                return ENOMEM;
    942         }
    943937       
    944938        enum cache_mode cmode;
     
    951945        link_initialize(&inst->link);
    952946        inst->service_id = service_id;
    953         inst->filesystem = fs;
    954947        inst->open_nodes_count = 0;
    955948       
    956949        /* Initialize the filesystem */
    957950        aoff64_t rnsize;
    958         int rc = ext4_filesystem_init(fs, inst, service_id, cmode, &rnsize);
    959         if (rc != EOK) {
    960                 free(fs);
     951        int rc = ext4_filesystem_open(inst, service_id, cmode, &rnsize, &fs);
     952        if (rc != EOK) {
    961953                free(inst);
    962954                return rc;
     
    1005997        fibril_mutex_unlock(&open_nodes_lock);
    1006998       
    1007         return ext4_filesystem_fini(inst->filesystem);
     999        rc = ext4_filesystem_close(inst->filesystem);
     1000        if (rc != EOK) {
     1001                fibril_mutex_lock(&instance_list_mutex);
     1002                list_append(&inst->link, &instance_list);
     1003                fibril_mutex_unlock(&instance_list_mutex);
     1004        }
     1005
     1006        free(inst);
     1007        return EOK;
    10081008}
    10091009
Note: See TracChangeset for help on using the changeset viewer.