Changeset 3712434 in mainline


Ignore:
Timestamp:
2011-10-05T12:48:33Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b9d37bb
Parents:
3711e7e
Message:

Added more getters on basic ext4 structures

Location:
uspace
Files:
8 edited

Legend:

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

    r3711e7e r3712434  
    3939#include "libext4.h"
    4040
     41uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *bg)
     42{
     43        return ((uint64_t)uint32_t_le2host(bg->block_bitmap_hi) << 32) |
     44                uint32_t_le2host(bg->block_bitmap_lo);
     45}
     46
     47uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *bg)
     48{
     49        return ((uint64_t)uint32_t_le2host(bg->inode_bitmap_hi) << 32) |
     50                uint32_t_le2host(bg->inode_bitmap_lo);
     51}
     52
    4153uint64_t ext4_block_group_get_inode_table_first_block(ext4_block_group_t *bg)
    4254{
    43         return ((uint64_t)uint32_t_le2host(bg->inode_table_first_hi) << 32) |
    44                         uint32_t_le2host(bg->inode_table_first_lo);
     55        return ((uint64_t)uint32_t_le2host(bg->inode_table_first_block_hi) << 32) |
     56                uint32_t_le2host(bg->inode_table_first_block_lo);
     57}
     58
     59uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *bg)
     60{
     61        return ((uint32_t)uint16_t_le2host(bg->free_blocks_count_hi) << 16) |
     62                uint16_t_le2host(bg->free_blocks_count_lo);
     63}
     64
     65uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *bg)
     66{
     67        return ((uint32_t)uint16_t_le2host(bg->free_inodes_count_hi) << 16) |
     68                uint16_t_le2host(bg->free_inodes_count_lo);
     69}
     70
     71uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *bg)
     72{
     73        return ((uint32_t)uint16_t_le2host(bg->used_dirs_count_hi) << 16) |
     74                uint16_t_le2host(bg->used_dirs_count_lo);
     75}
     76
     77uint16_t ext4_block_group_get_flags(ext4_block_group_t *bg)
     78{
     79        return uint16_t_le2host(bg->flags);
     80}
     81
     82uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *bg)
     83{
     84        return ((uint32_t)uint16_t_le2host(bg->itable_unused_hi) << 16) |
     85                uint16_t_le2host(bg->itable_unused_lo);
     86}
     87
     88uint16_t ext4_block_group_get_checksum(ext4_block_group_t *bg)
     89{
     90        return uint16_t_le2host(bg->checksum);
    4591}
    4692
  • uspace/lib/ext4/libext4_block_group.h

    r3711e7e r3712434  
    4343        uint32_t block_bitmap_lo; // Blocks bitmap block
    4444        uint32_t inode_bitmap_lo; // Inodes bitmap block
    45         uint32_t inode_table_first_lo; // Inodes table block
     45        uint32_t inode_table_first_block_lo; // Inodes table block
    4646        uint16_t free_blocks_count_lo; // Free blocks count
    4747        uint16_t free_inodes_count_lo; // Free inodes count
     
    5353        uint32_t block_bitmap_hi; // Blocks bitmap block MSB
    5454        uint32_t inode_bitmap_hi; // Inodes bitmap block MSB
    55         uint32_t inode_table_first_hi; // Inodes table block MSB
     55        uint32_t inode_table_first_block_hi; // Inodes table block MSB
    5656        uint16_t free_blocks_count_hi; // Free blocks count MSB
    5757        uint16_t free_inodes_count_hi; // Free inodes count MSB
     
    6969#define EXT4_BLOCK_GROUP_DESCRIPTOR_SIZE 32
    7070
     71extern uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *);
     72extern uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *);
    7173extern uint64_t ext4_block_group_get_inode_table_first_block(ext4_block_group_t *);
     74extern uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *);
     75extern uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *);
     76extern uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *);
     77extern uint16_t ext4_block_group_get_flags(ext4_block_group_t *);
     78extern uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *);
     79extern uint16_t ext4_block_group_get_checksum(ext4_block_group_t *);
    7280
    7381#endif
  • uspace/lib/ext4/libext4_filesystem.c

    r3711e7e r3712434  
    159159
    160160        /* Block group descriptor table starts at the next block after superblock */
    161         block_id = ext4_superblock_get_first_block(fs->superblock) + 1;
     161        block_id = ext4_superblock_get_first_data_block(fs->superblock) + 1;
    162162
    163163        /* Find the block containing the descriptor we are looking for */
  • uspace/lib/ext4/libext4_inode.c

    r3711e7e r3712434  
    3939#include "libext4.h"
    4040
    41 // TODO check return type
    42 /**
    43  * TODO doxy
    44  */
    45 uint16_t ext4_inode_get_usage_count(ext4_inode_t *inode)
     41/*
     42uint32_t ext4_inode_get_mode(ext4_inode_t *inode)
     43uint32_t ext4_inode_get_uid(ext4_inode_t *inode)
     44*/
     45
     46uint64_t ext4_inode_get_size(ext4_inode_t *inode)
     47{
     48        return ((uint64_t)uint32_t_le2host(inode->size_hi)) << 32 |
     49                        ((uint64_t)uint32_t_le2host(inode->size_lo));
     50}
     51
     52/*
     53extern uint32_t ext4_inode_get_access_time(ext4_inode_t *);
     54extern uint32_t ext4_inode_get_change_inode_time(ext4_inode_t *);
     55extern uint32_t ext4_inode_get_modification_time(ext4_inode_t *);
     56extern uint32_t ext4_inode_get_deletion_time(ext4_inode_t *);
     57extern uint32_t ext4_inode_get_gid(ext4_inode_t *);
     58*/
     59
     60uint16_t ext4_inode_get_links_count(ext4_inode_t *inode)
    4661{
    4762        return uint16_t_le2host(inode->links_count);
    4863}
    4964
     65/*
     66extern uint64_t ext4_inode_get_blocks_count(ext4_inode_t *);
     67extern uint32_t ext4_inode_get_flags(ext4_inode_t *);
     68*/
    5069
    5170/**
  • uspace/lib/ext4/libext4_inode.h

    r3711e7e r3712434  
    5050        uint16_t uid; // Low 16 bits of owner uid
    5151        uint32_t size_lo; // Size in bytes
    52 
    53         // TODO Used in HelenOS ???
    54         uint32_t atime; // Access time
    55         uint32_t ctime; // Inode change time
    56         uint32_t mtime; // Modification time
    57         uint32_t dtime; // Deletion time
    58 
     52        uint32_t acess_time; // Access time
     53        uint32_t change_inode_time; // Inode change time
     54        uint32_t modification_time; // Modification time
     55        uint32_t deletion_time; // Deletion time
    5956        uint16_t gid; // Low 16 bits of group id
    6057        uint16_t links_count; // Links count
    61         uint32_t blocks_lo; // Blocks count
     58        uint32_t blocks_count_lo; // Blocks count
    6259        uint32_t flags; // File flags
    6360        uint32_t unused_osd1; // OS dependent - not used in HelenOS
     
    8784} ext4_inode_ref_t;
    8885
    89 extern uint16_t ext4_inode_get_usage_count(ext4_inode_t *);
     86/*
     87extern uint16_t ext4_inode_get_mode(ext4_inode_t *);
     88extern uint32_t ext4_inode_get_uid(ext4_inode_t *);
     89*/
     90extern uint64_t ext4_inode_get_size(ext4_inode_t *);
     91/*
     92extern uint32_t ext4_inode_get_access_time(ext4_inode_t *);
     93extern uint32_t ext4_inode_get_change_inode_time(ext4_inode_t *);
     94extern uint32_t ext4_inode_get_modification_time(ext4_inode_t *);
     95extern uint32_t ext4_inode_get_deletion_time(ext4_inode_t *);
     96extern uint32_t ext4_inode_get_gid(ext4_inode_t *);
     97*/
     98extern uint16_t ext4_inode_get_links_count(ext4_inode_t *);
     99/*
     100extern uint64_t ext4_inode_get_blocks_count(ext4_inode_t *);
     101extern uint32_t ext4_inode_get_flags(ext4_inode_t *);
     102*/
     103
     104/*
     105uint32_t blocks[EXT4_INODE_BLOCKS]; // Pointers to blocks
     106uint32_t generation;
     107uint32_t file_acl_lo; // File ACL
     108uint16_t extra_isize;
     109uint32_t ctime_extra; // Extra change time (nsec << 2 | epoch)
     110uint32_t mtime_extra; // Extra Modification time (nsec << 2 | epoch)
     111uint32_t atime_extra; // Extra Access time (nsec << 2 | epoch)
     112uint32_t crtime; // File creation time
     113uint32_t crtime_extra; // Extra file creation time (nsec << 2 | epoch)
     114uint32_t version_hi;   // High 32 bits for 64-bit version
     115*/
    90116
    91117#endif
  • uspace/lib/ext4/libext4_superblock.c

    r3711e7e r3712434  
    4242#include "libext4.h"
    4343
    44 /**
    45  * TODO doxy
    46  */
     44uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *sb)
     45{
     46        return uint32_t_le2host(sb->inodes_count);
     47}
     48
     49uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *sb)
     50{
     51        return ((uint64_t)uint32_t_le2host(sb->blocks_count_hi) << 32) |
     52                        uint32_t_le2host(sb->blocks_count_lo);
     53}
     54
     55uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *sb)
     56{
     57        return ((uint64_t)uint32_t_le2host(sb->reserved_blocks_count_hi) << 32) |
     58                        uint32_t_le2host(sb->reserved_blocks_count_lo);
     59}
     60
     61uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *sb)
     62{
     63        return ((uint64_t)uint32_t_le2host(sb->free_blocks_count_hi) << 32) |
     64                        uint32_t_le2host(sb->free_blocks_count_lo);
     65}
     66
     67uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *sb)
     68{
     69        return uint32_t_le2host(sb->free_inodes_count);
     70}
     71
     72uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *sb)
     73{
     74        return uint32_t_le2host(sb->first_data_block);
     75}
     76
     77uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *sb)
     78{
     79        return uint32_t_le2host(sb->log_block_size);
     80}
     81
     82uint32_t ext4_superblock_get_block_size(ext4_superblock_t *sb)
     83{
     84        return 1024 << ext4_superblock_get_log_block_size(sb);
     85}
     86
     87
     88uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *sb)
     89{
     90        return uint32_t_le2host(sb->blocks_per_group);
     91}
     92
     93uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *sb)
     94{
     95        return uint32_t_le2host(sb->inodes_per_group);
     96}
     97
     98uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *sb)
     99{
     100        return uint32_t_le2host(sb->mount_time);
     101}
     102
     103uint32_t ext4_superblock_get_write_time(ext4_superblock_t *sb)
     104{
     105        return uint32_t_le2host(sb->write_time);
     106}
     107
     108uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *sb)
     109{
     110        return uint16_t_le2host(sb->mount_count);
     111}
     112
     113uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *sb)
     114{
     115        return uint16_t_le2host(sb->max_mount_count);
     116}
     117
    47118uint16_t ext4_superblock_get_magic(ext4_superblock_t *sb)
    48119{
     
    50121}
    51122
    52 /**
    53  * TODO doxy
    54  */
    55 uint32_t ext4_superblock_get_first_block(ext4_superblock_t *sb)
    56 {
    57         return uint32_t_le2host(sb->first_data_block);
    58 }
    59 
    60 /**
    61  * TODO doxy
    62  */
    63 uint32_t ext4_superblock_get_block_size_log2(ext4_superblock_t *sb)
    64 {
    65         return uint32_t_le2host(sb->log_block_size);
    66 }
    67 
    68 /**
    69  * TODO doxy
    70  */
    71 uint32_t ext4_superblock_get_block_size(ext4_superblock_t *sb)
    72 {
    73         return 1024 << ext4_superblock_get_block_size_log2(sb);
    74 }
    75 
    76 /**
    77  * TODO doxy
    78  */
     123uint16_t ext4_superblock_get_state(ext4_superblock_t *sb)
     124{
     125        return uint16_t_le2host(sb->state);
     126}
     127
     128uint16_t ext4_superblock_get_errors(ext4_superblock_t *sb)
     129{
     130        return uint16_t_le2host(sb->errors);
     131}
     132
     133
     134uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *sb)
     135{
     136        return uint16_t_le2host(sb->minor_rev_level);
     137}
     138
     139uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *sb)
     140{
     141        return uint32_t_le2host(sb->last_check_time);
     142}
     143
     144uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *sb){
     145        return uint32_t_le2host(sb->check_interval);
     146}
     147
     148uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *sb)
     149{
     150        return uint32_t_le2host(sb->creator_os);
     151}
     152
    79153uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *sb)
    80154{
     
    82156}
    83157
    84 /**
    85  * TODO doxy
    86  */
    87158uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *sb)
    88159{
     
    93164}
    94165
    95 /**
    96  * TODO doxy
     166uint16_t ext4_superblock_get_block_group_number(ext4_superblock_t *sb)
     167{
     168        return uint16_t_le2host(sb->block_group_number);
     169}
     170
     171uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *sb)
     172{
     173        return uint32_t_le2host(sb->features_compatible);
     174}
     175
     176uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *sb)
     177{
     178        return uint32_t_le2host(sb->features_incompatible);
     179}
     180
     181uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *sb)
     182{
     183        return uint32_t_le2host(sb->features_read_only);
     184}
     185
     186
     187/*
     188 * More complex superblock functions
    97189 */
    98 uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *sb)
    99 {
    100         return uint32_t_le2host(sb->inodes_per_group);
    101 }
    102 
    103 /**
    104  * TODO doxy
    105  */
    106 uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *sb)
    107 {
    108         return uint32_t_le2host(sb->features_compatible);
    109 }
    110 
    111 /**
    112  * TODO doxy
    113  */
    114 uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *sb)
    115 {
    116         return uint32_t_le2host(sb->features_incompatible);
    117 }
    118 
    119 /**
    120  * TODO doxy
    121  */
    122 uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *sb)
    123 {
    124         return uint32_t_le2host(sb->features_read_only);
    125 }
    126 
    127 
    128 /**
    129  * TODO doxy
    130  */
     190
    131191int ext4_superblock_read_direct(service_id_t service_id,
    132192    ext4_superblock_t **superblock)
     
    153213}
    154214
    155 /**
    156  * TODO doxy
    157  */
    158215int ext4_superblock_check_sanity(ext4_superblock_t *sb)
    159216{
  • uspace/lib/ext4/libext4_superblock.h

    r3711e7e r3712434  
    4242typedef struct ext4_superblock {
    4343        uint32_t inodes_count; // Inodes count
    44         uint32_t s_blocks_count_lo; // Blocks count
    45         uint32_t s_r_blocks_count_lo; // Reserved blocks count
     44        uint32_t blocks_count_lo; // Blocks count
     45        uint32_t reserved_blocks_count_lo; // Reserved blocks count
    4646        uint32_t free_blocks_count_lo; // Free blocks count
    4747        uint32_t free_inodes_count; // Free inodes count
    4848        uint32_t first_data_block; // First Data Block
    4949        uint32_t log_block_size; // Block size
    50         uint32_t s_obso_log_frag_size; // Obsoleted fragment size
    51         uint32_t s_blocks_per_group; // Number of blocks per group
    52         uint32_t s_obso_frags_per_group; // Obsoleted fragments per group
     50        uint32_t obso_log_frag_size; // Obsoleted fragment size
     51        uint32_t blocks_per_group; // Number of blocks per group
     52        uint32_t obso_frags_per_group; // Obsoleted fragments per group
    5353        uint32_t inodes_per_group; // Number of inodes per group
    54         uint32_t s_mtime; // Mount time
    55         uint32_t s_wtime; // Write time
     54        uint32_t mount_time; // Mount time
     55        uint32_t write_time; // Write time
    5656        uint16_t mount_count; // Mount count
    5757        uint16_t max_mount_count; // Maximal mount count
     
    6060        uint16_t errors; // Behaviour when detecting errors
    6161        uint16_t minor_rev_level; // Minor revision level
    62         uint32_t last_check; // Time of last check
    63         uint32_t checkinterval; // Maximum time between checks
     62        uint32_t last_check_time; // Time of last check
     63        uint32_t check_interval; // Maximum time between checks
    6464        uint32_t creator_os; // Creator OS
    6565        uint32_t rev_level; // Revision level
    66         uint16_t s_def_resuid; // Default uid for reserved blocks
    67         uint16_t s_def_resgid; // Default gid for reserved blocks
     66        uint16_t def_resuid; // Default uid for reserved blocks
     67        uint16_t def_resgid; // Default gid for reserved blocks
    6868
    6969        // Fields for EXT4_DYNAMIC_REV superblocks only.
    70         uint32_t s_first_ino; // First non-reserved inode
     70        uint32_t first_inode; // First non-reserved inode
    7171        uint16_t inode_size; // Size of inode structure
    72         uint16_t s_block_group_nr; // Block group number of this superblock
     72        uint16_t block_group_number; // Block group number of this superblock
    7373        uint32_t features_compatible; // Compatible feature set
    7474        uint32_t features_incompatible; // Incompatible feature set
    7575        uint32_t features_read_only; // Readonly-compatible feature set
    76         uint8_t s_uuid[16]; // 128-bit uuid for volume
    77         char s_volume_name[16]; // Volume name
    78         char s_last_mounted[64]; // Directory where last mounted
    79         uint32_t s_algorithm_usage_bitmap; // For compression
     76        uint8_t uuid[16]; // 128-bit uuid for volume
     77        char volume_name[16]; // Volume name
     78        char last_mounted[64]; // Directory where last mounted
     79        uint32_t algorithm_usage_bitmap; // For compression
    8080
    8181        /*
     
    9090         * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
    9191         */
    92         uint8_t s_journal_uuid[16]; // UUID of journal superblock
    93         uint32_t s_journal_inum; // Inode number of journal file
    94         uint32_t s_journal_dev; // Device number of journal file
    95         uint32_t s_last_orphan; // Head of list of inodes to delete
    96         uint32_t s_hash_seed[4]; // HTREE hash seed
    97         uint8_t s_def_hash_version; // Default hash version to use
    98         uint8_t s_jnl_backup_type;
    99         uint16_t s_desc_size; // Size of group descriptor
    100         uint32_t s_default_mount_opts; // Default mount options
    101         uint32_t s_first_meta_bg; // First metablock block group
    102         uint32_t s_mkfs_time; // When the filesystem was created
    103         uint32_t s_jnl_blocks[17]; // Backup of the journal inode
     92        uint8_t journal_uuid[16]; // UUID of journal superblock
     93        uint32_t journal_inode_number; // Inode number of journal file
     94        uint32_t journal_dev; // Device number of journal file
     95        uint32_t last_orphan; // Head of list of inodes to delete
     96        uint32_t hash_seed[4]; // HTREE hash seed
     97        uint8_t default_hash_version; // Default hash version to use
     98        uint8_t journal_backup_type;
     99        uint16_t desc_size; // Size of group descriptor
     100        uint32_t default_mount_opts; // Default mount options
     101        uint32_t first_meta_bg; // First metablock block group
     102        uint32_t mkfs_time; // When the filesystem was created
     103        uint32_t journal_blocks[17]; // Backup of the journal inode
    104104
    105105        /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
    106         uint32_t s_blocks_count_hi; // Blocks count
    107         uint32_t s_r_blocks_count_hi; // Reserved blocks count
    108         uint32_t s_free_blocks_count_hi; // Free blocks count
    109         uint16_t s_min_extra_isize; // All inodes have at least # bytes
    110         uint16_t s_want_extra_isize; // New inodes should reserve # bytes
    111         uint32_t s_flags; // Miscellaneous flags
    112         uint16_t s_raid_stride; // RAID stride
    113         uint16_t s_mmp_interval; // # seconds to wait in MMP checking
    114         uint64_t s_mmp_block; // Block for multi-mount protection
    115         uint32_t s_raid_stripe_width; // blocks on all data disks (N*stride)
    116         uint8_t s_log_groups_per_flex; // FLEX_BG group size
    117         uint8_t s_reserved_char_pad;
    118         uint16_t s_reserved_pad;
    119         uint64_t s_kbytes_written; // Number of lifetime kilobytes written
    120         uint32_t s_snapshot_inum; // Inode number of active snapshot
    121         uint32_t s_snapshot_id; // Sequential ID of active snapshot
    122         uint64_t s_snapshot_r_blocks_count; /* reserved blocks for active snapshot's future use */
    123         uint32_t s_snapshot_list; // inode number of the head of the on-disk snapshot list
    124         uint32_t s_error_count; // number of fs errors
    125         uint32_t s_first_error_time; // First time an error happened
    126         uint32_t s_first_error_ino; // Inode involved in first error
    127         uint64_t s_first_error_block; // block involved of first error
    128         uint8_t s_first_error_func[32]; // Function where the error happened
    129         uint32_t s_first_error_line; // Line number where error happened
    130         uint32_t s_last_error_time; // Most recent time of an error
    131         uint32_t s_last_error_ino; // Inode involved in last error
    132         uint32_t s_last_error_line; // Line number where error happened
    133         uint64_t s_last_error_block;     /* block involved of last error */
    134         uint8_t s_last_error_func[32];  /* function where the error happened */
    135         uint8_t s_mount_opts[64];
    136         uint32_t s_reserved[112]; // Padding to the end of the block
    137 
     106        uint32_t blocks_count_hi; // Blocks count
     107        uint32_t reserved_blocks_count_hi; // Reserved blocks count
     108        uint32_t free_blocks_count_hi; // Free blocks count
     109        uint16_t min_extra_isize; // All inodes have at least # bytes
     110        uint16_t want_extra_isize; // New inodes should reserve # bytes
     111        uint32_t lags; // Miscellaneous flags
     112        uint16_t raid_stride; // RAID stride
     113        uint16_t mmp_interval; // # seconds to wait in MMP checking
     114        uint64_t mmp_block; // Block for multi-mount protection
     115        uint32_t raid_stripe_width; // blocks on all data disks (N*stride)
     116        uint8_t log_groups_per_flex; // FLEX_BG group size
     117        uint8_t reserved_char_pad;
     118        uint16_t reserved_pad;
     119        uint64_t kbytes_written; // Number of lifetime kilobytes written
     120        uint32_t snapshot_inum; // Inode number of active snapshot
     121        uint32_t snapshot_id; // Sequential ID of active snapshot
     122        uint64_t snapshot_r_blocks_count; /* reserved blocks for active snapshot's future use */
     123        uint32_t snapshot_list; // inode number of the head of the on-disk snapshot list
     124        uint32_t error_count; // number of fs errors
     125        uint32_t first_error_time; // First time an error happened
     126        uint32_t first_error_ino; // Inode involved in first error
     127        uint64_t first_error_block; // block involved of first error
     128        uint8_t first_error_func[32]; // Function where the error happened
     129        uint32_t first_error_line; // Line number where error happened
     130        uint32_t last_error_time; // Most recent time of an error
     131        uint32_t last_error_ino; // Inode involved in last error
     132        uint32_t last_error_line; // Line number where error happened
     133        uint64_t last_error_block;     // Block involved of last error
     134        uint8_t last_error_func[32];  // Function where the error happened
     135        uint8_t mount_opts[64];
     136        uint32_t padding[112]; // Padding to the end of the block
    138137} __attribute__((packed)) ext4_superblock_t;
    139138
     
    142141#define EXT4_SUPERBLOCK_OFFSET          1024
    143142
     143extern uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *);
     144extern uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *);
     145extern uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *);
     146extern uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *);
     147extern uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *);
     148extern uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *);
     149extern uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *);
     150extern uint32_t ext4_superblock_get_block_size(ext4_superblock_t *);
     151extern uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *);
     152extern uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *);
     153extern uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *);
     154extern uint32_t ext4_superblock_get_write_time(ext4_superblock_t *);
     155extern uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *);
     156extern uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *);
    144157extern uint16_t ext4_superblock_get_magic(ext4_superblock_t *);
    145 extern uint32_t ext4_superblock_get_first_block(ext4_superblock_t *);
    146 extern uint32_t ext4_superblock_get_block_size_log2(ext4_superblock_t *);
    147 extern uint32_t ext4_superblock_get_block_size(ext4_superblock_t *);
    148 extern uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *);
    149 extern uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *);
    150 extern uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *);
     158extern uint16_t ext4_superblock_get_state(ext4_superblock_t *);
     159extern uint16_t ext4_superblock_get_errors(ext4_superblock_t *);
     160extern uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *);
     161extern uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *);
     162extern uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *);
     163extern uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *);
     164extern uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *);
     165
     166/*
     167uint16_t s_def_resuid; // Default uid for reserved blocks
     168uint16_t s_def_resgid; // Default gid for reserved blocks
     169*/
     170
     171extern uint32_t ext4_superblock_get_first_inode(ext4_superblock_t *);
     172extern uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *);
     173extern uint16_t ext4_superblock_get_block_group_number(ext4_superblock_t *);
    151174extern uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *);
    152175extern uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *);
    153176extern uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *);
    154177
     178/*
     179uint8_t s_uuid[16]; // 128-bit uuid for volume
     180char volume_name[16]; // Volume name
     181char last_mounted[64]; // Directory where last mounted
     182uint32_t s_algorithm_usage_bitmap; // For compression
     183uint8_t s_prealloc_blocks; // Number of blocks to try to preallocate
     184uint8_t s_prealloc_dir_blocks; // Number to preallocate for dirs
     185uint16_t s_reserved_gdt_blocks; // Per group desc for online growth
     186uint8_t s_journal_uuid[16]; // UUID of journal superblock
     187uint32_t s_journal_inum; // Inode number of journal file
     188uint32_t s_journal_dev; // Device number of journal file
     189uint32_t s_last_orphan; // Head of list of inodes to delete
     190uint32_t s_hash_seed[4]; // HTREE hash seed
     191uint8_t s_def_hash_version; // Default hash version to use
     192uint8_t s_jnl_backup_type;
     193uint16_t s_desc_size; // Size of group descriptor
     194uint32_t s_default_mount_opts; // Default mount options
     195uint32_t s_first_meta_bg; // First metablock block group
     196uint32_t s_mkfs_time; // When the filesystem was created
     197uint32_t s_jnl_blocks[17]; // Backup of the journal inode
     198uint16_t s_min_extra_isize; // All inodes have at least # bytes
     199uint16_t s_want_extra_isize; // New inodes should reserve # bytes
     200uint32_t s_flags; // Miscellaneous flags
     201uint16_t s_raid_stride; // RAID stride
     202uint16_t s_mmp_interval; // # seconds to wait in MMP checking
     203uint64_t s_mmp_block; // Block for multi-mount protection
     204uint32_t s_raid_stripe_width; // blocks on all data disks (N*stride)
     205uint8_t s_log_groups_per_flex; // FLEX_BG group size
     206uint8_t s_reserved_char_pad;
     207uint16_t s_reserved_pad;
     208uint64_t s_kbytes_written; // Number of lifetime kilobytes written
     209uint32_t s_snapshot_inum; // Inode number of active snapshot
     210uint32_t s_snapshot_id; // Sequential ID of active snapshot
     211uint64_t s_snapshot_r_blocks_count; // reserved blocks for active snapshot's future use
     212uint32_t s_snapshot_list; // inode number of the head of the on-disk snapshot list
     213uint32_t s_error_count; // number of fs errors
     214uint32_t s_first_error_time; // First time an error happened
     215uint32_t s_first_error_ino; // Inode involved in first error
     216uint64_t s_first_error_block; // block involved of first error
     217uint8_t s_first_error_func[32]; // Function where the error happened
     218uint32_t s_first_error_line; // Line number where error happened
     219uint32_t s_last_error_time; // Most recent time of an error
     220uint32_t s_last_error_ino; // Inode involved in last error
     221uint32_t s_last_error_line; // Line number where error happened
     222uint64_t s_last_error_block;     // block involved of last error
     223uint8_t s_last_error_func[32];  // function where the error happened
     224uint8_t s_mount_opts[64];
     225*/
     226
     227/* More complex superblock functions */
    155228extern int ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
    156229extern int ext4_superblock_check_sanity(ext4_superblock_t *);
  • uspace/srv/fs/ext4fs/ext4fs_ops.c

    r3711e7e r3712434  
    501501        *index = EXT4_INODE_ROOT_INDEX;
    502502        *size = 0;
    503         *lnkcnt = ext4_inode_get_usage_count(enode->inode_ref->inode);
     503        *lnkcnt = ext4_inode_get_links_count(enode->inode_ref->inode);
    504504
    505505        ext4fs_node_put(root_node);
Note: See TracChangeset for help on using the changeset viewer.