Changeset 2d2c6ce in mainline for uspace/lib/ext4/libext4_filesystem.c


Ignore:
Timestamp:
2012-01-21T12:47:15Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
73196d2
Parents:
121e7adf
Message:

Skeleton for inode allocation and initialization

File:
1 edited

Legend:

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

    r121e7adf r2d2c6ce  
    283283}
    284284
     285int ext4_filesystem_alloc_inode(ext4_filesystem_t *fs, ext4_inode_ref_t **inode_ref)
     286{
     287        // TODO
     288        return EOK;
     289}
     290
     291int ext4_filesystem_init_inode(ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref, int flags)
     292{
     293        ext4_inode_t *inode = inode_ref->inode;
     294
     295        if (flags & L_DIRECTORY) {
     296                ext4_inode_set_mode(fs->superblock, inode, EXT4_INODE_MODE_DIRECTORY);
     297                ext4_inode_set_links_count(inode, 1); // '.' entry
     298        } else {
     299                ext4_inode_set_mode(fs->superblock, inode, EXT4_INODE_MODE_FILE);
     300                ext4_inode_set_links_count(inode, 0);
     301        }
     302
     303        ext4_inode_set_uid(inode, 0);
     304        ext4_inode_set_gid(inode, 0);
     305        ext4_inode_set_size(inode, 0);
     306        ext4_inode_set_access_time(inode, 0);
     307        ext4_inode_set_change_inode_time(inode, 0);
     308        ext4_inode_set_modification_time(inode, 0);
     309        ext4_inode_set_deletion_time(inode, 0);
     310        ext4_inode_set_blocks_count(fs->superblock, inode, 0);
     311        ext4_inode_set_flags(inode, 0);
     312        ext4_inode_set_generation(inode, 0);
     313
     314        for (uint32_t i = 0; i < EXT4_INODE_BLOCKS; i++) {
     315                inode->blocks[i] = 0;
     316        }
     317
     318        return EOK;
     319}
     320
    285321int ext4_filesystem_free_inode(ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref)
    286322{
Note: See TracChangeset for help on using the changeset viewer.