Changes in uspace/srv/fs/fat/fat_idx.c [ca093b3:1e4cada] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_idx.c
rca093b3 r1e4cada 43 43 #include <adt/list.h> 44 44 #include <assert.h> 45 #include <fibril_sync .h>45 #include <fibril_synch.h> 46 46 47 47 /** Each instance of this type describes one interval of freed VFS indices. */ … … 339 339 } 340 340 341 static fat_idx_t *fat_idx_create(dev_handle_t dev_handle)341 static int fat_idx_create(fat_idx_t **fidxp, dev_handle_t dev_handle) 342 342 { 343 343 fat_idx_t *fidx; … … 345 345 fidx = (fat_idx_t *) malloc(sizeof(fat_idx_t)); 346 346 if (!fidx) 347 return NULL;347 return ENOMEM; 348 348 if (!fat_index_alloc(dev_handle, &fidx->index)) { 349 349 free(fidx); 350 return NULL;350 return ENOSPC; 351 351 } 352 352 … … 359 359 fidx->nodep = NULL; 360 360 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 365 int fat_idx_get_new(fat_idx_t **fidxp, dev_handle_t dev_handle) 365 366 { 366 367 fat_idx_t *fidx; 368 int rc; 367 369 368 370 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) { 371 373 fibril_mutex_unlock(&used_lock); 372 return NULL;374 return rc; 373 375 } 374 376 … … 382 384 fibril_mutex_unlock(&used_lock); 383 385 384 return fidx; 386 *fidxp = fidx; 387 return EOK; 385 388 } 386 389 … … 401 404 fidx = hash_table_get_instance(l, fat_idx_t, uph_link); 402 405 } 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) { 405 410 fibril_mutex_unlock(&used_lock); 406 411 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.