Changeset 17bf658 in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2009-10-01T10:24:45Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0fc1e5d
Parents:
e6bc3a5
Message:

Make fat_node_get_new() return an error code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    re6bc3a5 r17bf658  
    115115}
    116116
    117 static fat_node_t *fat_node_get_new(void)
     117static int fat_node_get_new(fat_node_t **nodepp)
    118118{
    119119        fs_node_t *fn;
     
    137137                if (nodep->dirty) {
    138138                        rc = fat_node_sync(nodep);
    139                         assert(rc == EOK);
     139                        if (rc != EOK) {
     140                                idxp_tmp->nodep = NULL;
     141                                fibril_mutex_unlock(&nodep->lock);
     142                                fibril_mutex_unlock(&idxp_tmp->lock);
     143                                free(nodep->bp);
     144                                free(nodep);
     145                                return rc;
     146                        }
    140147                }
    141148                idxp_tmp->nodep = NULL;
     
    149156                fn = (fs_node_t *)malloc(sizeof(fs_node_t));
    150157                if (!fn)
    151                         return NULL;
     158                        return ENOMEM;
    152159                nodep = (fat_node_t *)malloc(sizeof(fat_node_t));
    153160                if (!nodep) {
    154161                        free(fn);
    155                         return NULL;
     162                        return ENOMEM;
    156163                }
    157164        }
     
    161168        nodep->bp = fn;
    162169       
    163         return nodep;
     170        *nodepp = nodep;
     171        return EOK;
    164172}
    165173
     
    200208        assert(idxp->pfc);
    201209
    202         nodep = fat_node_get_new();
    203         if (!nodep)
     210        rc = fat_node_get_new(&nodep);
     211        if (rc != EOK)
    204212                return NULL;
    205213
     
    432440        }
    433441
    434         nodep = fat_node_get_new();
    435         if (!nodep) {
     442        rc = fat_node_get_new(&nodep);
     443        if (rc != EOK) {
    436444                (void) fat_free_clusters(bs, dev_handle, mcl);
    437                 return ENOMEM;  /* FIXME: determine the true error code */
     445                return rc;
    438446        }
    439447        idxp = fat_idx_get_new(dev_handle);
Note: See TracChangeset for help on using the changeset viewer.