Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 2d2c6ce in mainline


Ignore:
Timestamp:
2012-01-21T12:47:15Z (8 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
master
Children:
73196d2
Parents:
121e7adf
Message:

Skeleton for inode allocation and initialization

Location:
uspace/lib/ext4
Files:
2 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{
  • uspace/lib/ext4/libext4_filesystem.h

    r121e7adf r2d2c6ce  
    6161                ext4_inode_ref_t **);
    6262extern int ext4_filesystem_put_inode_ref(ext4_inode_ref_t *);
     63extern int ext4_filesystem_alloc_inode(ext4_filesystem_t *, ext4_inode_ref_t **);
     64extern int ext4_filesystem_init_inode(ext4_filesystem_t *, ext4_inode_ref_t *, int);
    6365extern int ext4_filesystem_free_inode(ext4_filesystem_t *, ext4_inode_ref_t *);
    6466extern int ext4_filesystem_truncate_inode(ext4_filesystem_t *,
Note: See TracChangeset for help on using the changeset viewer.