Changeset acd869e in mainline


Ignore:
Timestamp:
2011-10-11T10:32:02Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8958a26
Parents:
6d52126b
Message:

Preparations for extent reading

Location:
uspace/lib/ext4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_extent.c

    r6d52126b racd869e  
    3636 */
    3737
     38#include <byteorder.h>
     39#include "libext4_extent.h"
    3840
     41uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *header)
     42{
     43        return uint16_t_le2host(header->magic);
     44}
     45
     46uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *header)
     47{
     48        return uint16_t_le2host(header->entries_count);
     49}
     50
     51uint16_t ext4_extent_header_get_max_entries_count(ext4_extent_header_t *header)
     52{
     53        return uint16_t_le2host(header->max_entries_count);
     54}
     55
     56uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *header)
     57{
     58        return uint16_t_le2host(header->depth);
     59}
     60
     61uint32_t ext4_extent_header_get_generation(ext4_extent_header_t *header)
     62{
     63        return uint32_t_le2host(header->generation);
     64}
    3965
    4066/**
  • uspace/lib/ext4/libext4_extent.h

    r6d52126b racd869e  
    6868} ext4_extent_header_t;
    6969
    70 #define EXT4_EXTENT_MAGIC host2uint16_t_le(0xF30A)
     70#define EXT4_EXTENT_MAGIC       0xF30A
     71
     72extern uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *);
     73extern uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *);
     74extern uint16_t ext4_extent_header_get_max_entries_count(ext4_extent_header_t *);
     75extern uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *);
     76extern uint32_t ext4_extent_header_get_generation(ext4_extent_header_t *);
    7177
    7278#endif
  • uspace/lib/ext4/libext4_filesystem.c

    r6d52126b racd869e  
    301301        block_t *block;
    302302
     303        // TODO extents
     304        if (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_EXTENTS)) {
     305                EXT4FS_DBG("Inode contains Extent");
     306                // TODO
     307                /*
     308                current_block = ext4_inode_get_extent_block(inode, iblock);
     309                *fblock = current_block;
     310                return EOK;
     311                */
     312
     313        }
     314
    303315        /* Handle simple case when we are dealing with direct reference */
    304316        if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
  • uspace/lib/ext4/libext4_inode.c

    r6d52126b racd869e  
    6262        uint32_t major_rev = ext4_superblock_get_rev_level(sb);
    6363
    64         if (major_rev > 0 && ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)) {
     64        if ((major_rev > 0) && ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)) {
    6565                return ((uint64_t)uint32_t_le2host(inode->size_hi)) << 32 |
    6666                            ((uint64_t)uint32_t_le2host(inode->size_lo));
     
    102102}
    103103
     104uint32_t ext4_inode_get_extent_block(ext4_inode_t *inode, uint64_t idx)
     105{
     106        //ext4_extent_header_t *header = ext4_inode_get_extent_header(inode);
     107        // TODO search required block
     108        return 0;
     109
     110}
     111
     112ext4_extent_header_t * ext4_inode_get_extent_header(ext4_inode_t *inode)
     113{
     114        return (ext4_extent_header_t *)inode->blocks;
     115}
    104116
    105117// Flags checker
  • uspace/lib/ext4/libext4_inode.h

    r6d52126b racd869e  
    3636#include <libblock.h>
    3737#include <sys/types.h>
     38#include "libext4_extent.h"
    3839#include "libext4_superblock.h"
    3940
     
    167168uint32_t ext4_inode_get_direct_block(ext4_inode_t *, uint8_t);
    168169uint32_t ext4_inode_get_indirect_block(ext4_inode_t *, uint8_t);
    169 
     170uint32_t ext4_inode_get_extent_block(ext4_inode_t *, uint64_t);
    170171/*
    171172uint32_t blocks[EXT4_INODE_BLOCKS]; // Pointers to blocks
     
    181182*/
    182183
     184extern ext4_extent_header_t * ext4_inode_get_extent_header(ext4_inode_t *);
    183185extern bool ext4_inode_has_flag(ext4_inode_t *, uint32_t);
    184186
Note: See TracChangeset for help on using the changeset viewer.