Ignore:
File:
1 edited

Legend:

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

    rca093b3 r1e4cada  
    4343#include <adt/list.h>
    4444#include <assert.h>
    45 #include <fibril_sync.h>
     45#include <fibril_synch.h>
    4646
    4747/** Each instance of this type describes one interval of freed VFS indices. */
     
    339339}
    340340
    341 static fat_idx_t *fat_idx_create(dev_handle_t dev_handle)
     341static int fat_idx_create(fat_idx_t **fidxp, dev_handle_t dev_handle)
    342342{
    343343        fat_idx_t *fidx;
     
    345345        fidx = (fat_idx_t *) malloc(sizeof(fat_idx_t));
    346346        if (!fidx)
    347                 return NULL;
     347                return ENOMEM;
    348348        if (!fat_index_alloc(dev_handle, &fidx->index)) {
    349349                free(fidx);
    350                 return NULL;
     350                return ENOSPC;
    351351        }
    352352               
     
    359359        fidx->nodep = NULL;
    360360
    361         return fidx;
    362 }
    363 
    364 fat_idx_t *fat_idx_get_new(dev_handle_t dev_handle)
     361        *fidxp = fidx;
     362        return EOK;
     363}
     364
     365int fat_idx_get_new(fat_idx_t **fidxp, dev_handle_t dev_handle)
    365366{
    366367        fat_idx_t *fidx;
     368        int rc;
    367369
    368370        fibril_mutex_lock(&used_lock);
    369         fidx = fat_idx_create(dev_handle);
    370         if (!fidx) {
     371        rc = fat_idx_create(&fidx, dev_handle);
     372        if (rc != EOK) {
    371373                fibril_mutex_unlock(&used_lock);
    372                 return NULL;
     374                return rc;
    373375        }
    374376               
     
    382384        fibril_mutex_unlock(&used_lock);
    383385
    384         return fidx;
     386        *fidxp = fidx;
     387        return EOK;
    385388}
    386389
     
    401404                fidx = hash_table_get_instance(l, fat_idx_t, uph_link);
    402405        } else {
    403                 fidx = fat_idx_create(dev_handle);
    404                 if (!fidx) {
     406                int rc;
     407
     408                rc = fat_idx_create(&fidx, dev_handle);
     409                if (rc != EOK) {
    405410                        fibril_mutex_unlock(&used_lock);
    406411                        return NULL;
Note: See TracChangeset for help on using the changeset viewer.