Changeset 8bd5dad in mainline for uspace/lib/ext2
- Timestamp:
- 2011-02-13T21:20:21Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c00e729
- Parents:
- 566c401
- Location:
- uspace/lib/ext2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext2/Makefile
r566c401 r8bd5dad 32 32 LIBRARY = libext2 33 33 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) 34 LIBS = $(LIBBLOCK_PREFIX)/libblock.a 34 35 35 36 SOURCES = \ -
uspace/lib/ext2/libext2.h
r566c401 r8bd5dad 67 67 #define EXT2_SUPERBLOCK_LAST_BYTE (EXT2_SUPERBLOCK_OFFSET + \ 68 68 EXT2_SUPERBLOCK_SIZE -1) 69 // allow maximum this block size 70 #define EXT2_MAX_BLOCK_SIZE 8096 69 71 70 72 inline uint16_t ext2_superblock_get_magic(ext2_superblock_t *); -
uspace/lib/ext2/libext2_filesystem.c
r566c401 r8bd5dad 44 44 * initializes libblock cache with appropriate logical block size. 45 45 * 46 * @param fs 47 * @param devmap_handle 46 * @param fs Pointer to ext2_filesystem_t to initialize 47 * @param devmap_handle Device handle of the block device 48 48 */ 49 49 int ext2_filesystem_init(ext2_filesystem_t *fs, devmap_handle_t devmap_handle) … … 51 51 int rc; 52 52 ext2_superblock_t *temp_superblock; 53 size_t block_size; 53 54 54 55 fs->device = devmap_handle; … … 65 66 } 66 67 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; 68 82 69 83 return EOK; … … 77 91 void ext2_filesystem_fini(ext2_filesystem_t *fs) 78 92 { 93 free(fs->superblock); 79 94 block_fini(fs->device); 80 95 } -
uspace/lib/ext2/libext2_superblock.c
r566c401 r8bd5dad 79 79 inline uint32_t ext2_superblock_get_block_size(ext2_superblock_t *sb) 80 80 { 81 return 1024 << ext2_superblock_get_block_size (sb);81 return 1024 << ext2_superblock_get_block_size_log2(sb); 82 82 } 83 83
Note:
See TracChangeset
for help on using the changeset viewer.