Changeset 5b16912 in mainline for uspace/lib/ext4/libext4_filesystem.c
- Timestamp:
- 2012-04-07T13:22:50Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce6de59
- Parents:
- c6a44a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_filesystem.c
rc6a44a3 r5b16912 887 887 } 888 888 889 int ext4_filesystem_append_inode_block(ext4_inode_ref_t *inode_ref, 890 uint32_t *fblock, uint32_t *iblock) 891 { 892 893 // TODO append to extent 894 895 int rc; 896 897 ext4_superblock_t *sb = inode_ref->fs->superblock; 898 899 // Compute next block index and allocate data block 900 uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode); 901 uint32_t block_size = ext4_superblock_get_block_size(sb); 902 903 assert(inode_size % block_size == 0); 904 905 // Logical blocks are numbered from 0 906 uint32_t new_block_idx = inode_size / block_size; 907 908 uint32_t phys_block; 909 rc = ext4_balloc_alloc_block(inode_ref, &phys_block); 910 if (rc != EOK) { 911 return rc; 912 } 913 914 rc = ext4_filesystem_set_inode_data_block_index(inode_ref, new_block_idx, phys_block); 915 if (rc != EOK) { 916 ext4_balloc_free_block(inode_ref, phys_block); 917 return rc; 918 } 919 920 ext4_inode_set_size(inode_ref->inode, inode_size + block_size); 921 922 inode_ref->dirty = true; 923 924 *fblock = phys_block; 925 *iblock = new_block_idx; 926 return EOK; 927 } 928 889 929 int ext4_filesystem_add_orphan(ext4_inode_ref_t *inode_ref) 890 930 {
Note:
See TracChangeset
for help on using the changeset viewer.