Changeset 48eb7a14 in mainline for uspace/srv/fs/fat/fat_idx.c
- Timestamp:
- 2008-11-22T12:00:05Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2eb893b
- Parents:
- 7e6c9eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_idx.c
r7e6c9eb r48eb7a14 215 215 216 216 /** Allocate a VFS index which is not currently in use. */ 217 static bool fat_i dx_alloc(dev_handle_t dev_handle, fs_index_t *index)217 static bool fat_index_alloc(dev_handle_t dev_handle, fs_index_t *index) 218 218 { 219 219 unused_t *u; … … 277 277 278 278 /** Free a VFS index, which is no longer in use. */ 279 static void fat_i dx_free(dev_handle_t dev_handle, fs_index_t index)279 static void fat_index_free(dev_handle_t dev_handle, fs_index_t index) 280 280 { 281 281 unused_t *u; … … 339 339 } 340 340 341 static fat_idx_t *fat_idx_ get_new_core(dev_handle_t dev_handle)341 static fat_idx_t *fat_idx_create(dev_handle_t dev_handle) 342 342 { 343 343 fat_idx_t *fidx; … … 346 346 if (!fidx) 347 347 return NULL; 348 if (!fat_i dx_alloc(dev_handle, &fidx->index)) {348 if (!fat_index_alloc(dev_handle, &fidx->index)) { 349 349 free(fidx); 350 350 return NULL; … … 367 367 368 368 futex_down(&used_futex); 369 fidx = fat_idx_ get_new_core(dev_handle);369 fidx = fat_idx_create(dev_handle); 370 370 if (!fidx) { 371 371 futex_up(&used_futex); … … 401 401 fidx = hash_table_get_instance(l, fat_idx_t, uph_link); 402 402 } else { 403 fidx = fat_idx_ get_new_core(dev_handle);403 fidx = fat_idx_create(dev_handle); 404 404 if (!fidx) { 405 405 futex_up(&used_futex); … … 445 445 } 446 446 447 /** Destroy the index structure. 448 * 449 * @param idx The index structure to be destroyed. 450 */ 451 void fat_idx_destroy(fat_idx_t *idx) 452 { 453 unsigned long ikey[] = { 454 [UIH_DH_KEY] = idx->dev_handle, 455 [UIH_INDEX_KEY] = idx->index, 456 }; 457 458 assert(idx->pfc == FAT_CLST_RES0); 459 460 futex_down(&used_futex); 461 /* 462 * Since we can only free unlinked nodes, the index structure is not 463 * present in the position hash (uph). We therefore hash it out from 464 * the index hash only. 465 */ 466 hash_table_remove(&ui_hash, ikey, 2); 467 futex_up(&used_futex); 468 /* Release the VFS index. */ 469 fat_index_free(idx->dev_handle, idx->index); 470 /* Deallocate the structure. */ 471 free(idx); 472 } 473 447 474 int fat_idx_init(void) 448 475 {
Note:
See TracChangeset
for help on using the changeset viewer.