Changeset 296ef5d6 in mainline for uspace/lib/ext4/libext4_inode.c


Ignore:
Timestamp:
2012-04-27T15:27:55Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e40ece98
Parents:
291af81
Message:

Part of inode comments

File:
1 edited

Legend:

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

    r291af81 r296ef5d6  
    4141#include "libext4.h"
    4242
     43/** Compute number of bits for block count.
     44 *
     45 *  @param block_size   filesystem block_size
     46 *  @return             number of bits
     47 */
    4348static uint32_t ext4_inode_block_bits_count(uint32_t block_size)
    4449{
     
    5459}
    5560
     61/** Get mode of the i-node.
     62 *
     63 * @param sb            superblock
     64 * @param inode         i-node to load mode from
     65 * @return              mode of the i-node
     66 */
    5667uint32_t ext4_inode_get_mode(ext4_superblock_t *sb, ext4_inode_t *inode)
    5768{
     
    6374}
    6475
     76/** Set mode of the i-node.
     77 *
     78 * @param sb            superblock
     79 * @param inode         i-node to set mode to
     80 * @param mode          mode to set to i-node
     81 */
    6582void ext4_inode_set_mode(ext4_superblock_t *sb, ext4_inode_t *inode, uint32_t mode)
    6683{
     
    7289}
    7390
     91/** Get ID of the i-node owner (user id).
     92 *
     93 * @param inode         i-node to load uid from
     94 * @return              user ID of the i-node owner
     95 */
    7496uint32_t ext4_inode_get_uid(ext4_inode_t *inode)
    7597{
     
    7799}
    78100
     101/** Set ID of the i-node owner.
     102 *
     103 * @param inode         i-node to set uid to
     104 * @param uid           ID of the i-node owner
     105 */
    79106void ext4_inode_set_uid(ext4_inode_t *inode, uint32_t uid)
    80107{
     
    82109}
    83110
     111/** Get real i-node size.
     112 *
     113 * @param sb            superblock
     114 * @param inode         i-node to load size from
     115 * @return              real size of i-node
     116 */
    84117uint64_t ext4_inode_get_size(ext4_superblock_t *sb, ext4_inode_t *inode)
    85118{
     
    93126}
    94127
    95 void ext4_inode_set_size(ext4_inode_t *inode, uint64_t value) {
    96         inode->size_lo = host2uint32_t_le((value << 32) >> 32);
    97         inode->size_hi = host2uint32_t_le(value >> 32);
     128/** Set real i-node size.
     129 *
     130 *  @param inode        inode to set size to
     131 *  @param size         size of the i-node
     132 */
     133void ext4_inode_set_size(ext4_inode_t *inode, uint64_t size) {
     134        inode->size_lo = host2uint32_t_le((size << 32) >> 32);
     135        inode->size_hi = host2uint32_t_le(size >> 32);
    98136}
    99137
     
    103141}
    104142
     143/** TODO comment
     144 *
     145 */
    105146void ext4_inode_set_access_time(ext4_inode_t *inode, uint32_t time)
    106147{
     
    108149}
    109150
     151/** TODO comment
     152 *
     153 */
    110154uint32_t ext4_inode_get_change_inode_time(ext4_inode_t *inode)
    111155{
     
    113157}
    114158
     159/** TODO comment
     160 *
     161 */
    115162void ext4_inode_set_change_inode_time(ext4_inode_t *inode, uint32_t time)
    116163{
     
    118165}
    119166
     167/** TODO comment
     168 *
     169 */
    120170uint32_t ext4_inode_get_modification_time(ext4_inode_t *inode)
    121171{
     
    123173}
    124174
     175/** TODO comment
     176 *
     177 */
    125178void ext4_inode_set_modification_time(ext4_inode_t *inode, uint32_t time)
    126179{
     
    128181}
    129182
     183/** TODO comment
     184 *
     185 */
    130186uint32_t ext4_inode_get_deletion_time(ext4_inode_t *inode)
    131187{
     
    133189}
    134190
     191/** TODO comment
     192 *
     193 */
    135194void ext4_inode_set_deletion_time(ext4_inode_t *inode, uint32_t time)
    136195{
     
    138197}
    139198
     199/** Get ID of the i-node owner's group.
     200 *
     201 * @param inode         i-node to load gid from
     202 * @return              group ID of the i-node owner
     203 */
    140204uint32_t ext4_inode_get_gid(ext4_inode_t *inode)
    141205{
     
    143207}
    144208
     209/** Set ID ot the i-node owner's group.
     210 *
     211 * @param inode         i-node to set gid to
     212 * @param gid           group ID of the i-node owner
     213 */
    145214void ext4_inode_set_gid(ext4_inode_t *inode, uint32_t gid)
    146215{
     
    148217}
    149218
     219/** Get number of links to i-node.
     220 *
     221 * @param inode         i-node to load number of links from
     222 * @return              number of links to i-node
     223 */
    150224uint16_t ext4_inode_get_links_count(ext4_inode_t *inode)
    151225{
     
    153227}
    154228
     229/** Set number of links to i-node.
     230 *
     231 * @param inode         i-node to set number of links to
     232 * @param count         number of links to i-node
     233 */
    155234void ext4_inode_set_links_count(ext4_inode_t *inode, uint16_t count)
    156235{
     
    158237}
    159238
     239/** TODO comment
     240 *
     241 */
    160242uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode)
    161243{
    162244        if (ext4_superblock_has_feature_read_only(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
    163245
    164                 /* 48-bit field */
     246                // 48-bit field
    165247                uint64_t count = ((uint64_t)uint16_t_le2host(inode->osd2.linux2.blocks_high)) << 32 |
    166248                                uint32_t_le2host(inode->blocks_count_lo);
     
    179261}
    180262
     263
     264/** TODO comment
     265 *
     266 */
    181267int ext4_inode_set_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode,
    182268                uint64_t count)
     
    216302}
    217303
     304/** Get flags (features) of i-node.
     305 *
     306 * @param inode         i-node to get flags from
     307 * @return              flags (bitmap)
     308 */
    218309uint32_t ext4_inode_get_flags(ext4_inode_t *inode) {
    219310        return uint32_t_le2host(inode->flags);
    220311}
    221312
     313/** Set flags (features) of i-node.
     314 *
     315 * @param inode         i-node to set flags to
     316 * @param flags         flags to set to i-node
     317 */
    222318void ext4_inode_set_flags(ext4_inode_t *inode, uint32_t flags) {
    223319        inode->flags = host2uint32_t_le(flags);
    224320}
    225321
     322/** TODO comment
     323 *
     324 */
    226325uint32_t ext4_inode_get_generation(ext4_inode_t *inode)
    227326{
     
    229328}
    230329
     330/** TODO comment
     331 *
     332 */
    231333void ext4_inode_set_generation(ext4_inode_t *inode, uint32_t generation)
    232334{
     
    234336}
    235337
     338/** TODO comment
     339 *
     340 */
    236341uint64_t ext4_inode_get_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb)
    237342{
     
    244349}
    245350
     351/** TODO comment
     352 *
     353 */
    246354void ext4_inode_set_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb,
    247355                uint64_t file_acl)
     
    256364/***********************************************************************/
    257365
     366/** Get block address of specified direct block.
     367 *
     368 * @param inode         i-node to load block from
     369 * @param idx           index of logical block
     370 * @return              physical block address
     371 */
    258372uint32_t ext4_inode_get_direct_block(ext4_inode_t *inode, uint32_t idx)
    259373{
     
    262376}
    263377
     378/** Set block address of specified direct block.
     379 *
     380 * @param inode         i-node to set block address to
     381 * @param idx           index of logical block
     382 * @param fblock        physical block address
     383 */
    264384void ext4_inode_set_direct_block(ext4_inode_t *inode, uint32_t idx, uint32_t fblock)
    265385{
     
    268388}
    269389
     390/** Get block address of specified indirect block.
     391 *
     392 * @param inode         i-node to get block address from
     393 * @param idx           index of indirect block
     394 * @return              physical block address
     395 */
    270396uint32_t ext4_inode_get_indirect_block(ext4_inode_t *inode, uint32_t idx)
    271397{
     
    273399}
    274400
     401/** Set block address of specified indirect block.
     402 *
     403 * @param inode         i-node to set block address to
     404 * @param idx           index of indirect block
     405 * @param fblock        physical block address
     406 */
    275407void ext4_inode_set_indirect_block(ext4_inode_t *inode, uint32_t idx, uint32_t fblock)
    276408{
     
    278410}
    279411
     412/** Check if i-node has specified type.
     413 *
     414 * @param sb            superblock
     415 * @param inode         i-node to check type of
     416 * @param type          type to check
     417 * @return              result of check operation
     418 */
    280419bool ext4_inode_is_type(ext4_superblock_t *sb, ext4_inode_t *inode, uint32_t type)
    281420{
     
    284423}
    285424
    286 
     425/** Get extent header from the root of the extent tree.
     426 *
     427 * @param inode         i-node to get extent header from
     428 * @return              pointer to extent header of the root node
     429 */
    287430ext4_extent_header_t * ext4_inode_get_extent_header(ext4_inode_t *inode)
    288431{
     
    290433}
    291434
    292 // Flags operations
     435/** Check if i-node has specified flag.
     436 *
     437 * @param inode         i-node to check flags of
     438 * @param flag          flag to check
     439 * @return              result of check operation
     440 */
    293441bool ext4_inode_has_flag(ext4_inode_t *inode, uint32_t flag)
    294442{
     
    299447}
    300448
     449/** Remove specified flag from i-node.
     450 *
     451 * @param inode         i-node to clear flag on
     452 * @param clear_flag    flag to be cleared
     453 */
    301454void ext4_inode_clear_flag(ext4_inode_t *inode, uint32_t clear_flag)
    302455{
     
    306459}
    307460
     461/** Set specified flag to i-node.
     462 *
     463 * @param inode         i-node to set flag on
     464 * @param set_flag      falt to be set
     465 */
    308466void ext4_inode_set_flag(ext4_inode_t *inode, uint32_t set_flag)
    309467{
     
    313471}
    314472
     473/** Check if i-node can be truncated.
     474 *
     475 * @param sb            superblock
     476 * @param inode         i-node to check
     477 * @return              result of the check operation
     478 */
    315479bool ext4_inode_can_truncate(ext4_superblock_t *sb, ext4_inode_t *inode)
    316480{
Note: See TracChangeset for help on using the changeset viewer.