Changeset 9a15176 in mainline
- Timestamp:
- 2009-10-01T11:32:04Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8810c63
- Parents:
- 0fc1e5d
- Location:
- uspace/srv/fs/fat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat.h
r0fc1e5d r9a15176 215 215 extern void fat_sync(ipc_callid_t, ipc_call_t *); 216 216 217 extern fat_idx_t *fat_idx_get_new(dev_handle_t);217 extern int fat_idx_get_new(fat_idx_t **, dev_handle_t); 218 218 extern fat_idx_t *fat_idx_get_by_pos(dev_handle_t, fat_cluster_t, unsigned); 219 219 extern fat_idx_t *fat_idx_get_by_index(dev_handle_t, fs_index_t); -
uspace/srv/fs/fat/fat_idx.c
r0fc1e5d r9a15176 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; -
uspace/srv/fs/fat/fat_ops.c
r0fc1e5d r9a15176 462 462 return rc; 463 463 } 464 idxp = fat_idx_get_new(dev_handle);465 if ( !idxp) {464 rc = fat_idx_get_new(&idxp, dev_handle); 465 if (rc != EOK) { 466 466 (void) fat_free_clusters(bs, dev_handle, mcl); 467 467 (void) fat_node_put(FS_NODE(nodep)); 468 return ENOMEM; /* FIXME: determine the true error code */468 return rc; 469 469 } 470 470 /* idxp->lock held */
Note:
See TracChangeset
for help on using the changeset viewer.