Changeset 8bd5dad in mainline for uspace/lib/ext2/libext2_filesystem.c


Ignore:
Timestamp:
2011-02-13T21:20:21Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c00e729
Parents:
566c401
Message:

Initialize libext2 in ext2info & fixed some bugs in libext2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext2/libext2_filesystem.c

    r566c401 r8bd5dad  
    4444 * initializes libblock cache with appropriate logical block size.
    4545 *
    46  * @param fs Pointer to ext2_filesystem_t to initialize
    47  * @param devmap_handle Device handle of the block device
     46 * @param fs                    Pointer to ext2_filesystem_t to initialize
     47 * @param devmap_handle Device handle of the block device
    4848 */
    4949int ext2_filesystem_init(ext2_filesystem_t *fs, devmap_handle_t devmap_handle)
     
    5151        int rc;
    5252        ext2_superblock_t *temp_superblock;
     53        size_t block_size;
    5354       
    5455        fs->device = devmap_handle;
     
    6566        }
    6667       
    67         free(temp_superblock);
     68        block_size = ext2_superblock_get_block_size(temp_superblock);
     69       
     70        if (block_size > EXT2_MAX_BLOCK_SIZE) {
     71                block_fini(fs->device);
     72                return ENOTSUP;
     73        }
     74       
     75        rc = block_cache_init(devmap_handle, block_size, 0, CACHE_MODE_WT);
     76        if (rc != EOK) {
     77                block_fini(fs->device);
     78                return rc;
     79        }
     80       
     81        fs->superblock = temp_superblock;
    6882       
    6983        return EOK;
     
    7791void ext2_filesystem_fini(ext2_filesystem_t *fs)
    7892{
     93        free(fs->superblock);
    7994        block_fini(fs->device);
    8095}
Note: See TracChangeset for help on using the changeset viewer.