From: Lawrence S. <ljs...@us...> - 2013-04-18 18:10:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via d405eb6a7c1ef5163bee53ba7f7c40affb42f369 (commit) from 4f338fd7a8bcc34f241a39555d09d25db2e9674f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d405eb6a7c1ef5163bee53ba7f7c40affb42f369 Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 18 14:09:50 2013 -0400 Account for xattr blocks in ext2_inode_read_block and ext2_inode_alloc_block. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 885cb27..6c47396 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -789,6 +789,10 @@ uint8_t *ext2_inode_alloc_block(ext2_fs_t *fs, ext2_inode_t *inode, int *err) { return NULL; } + /* Subtract out the xattr block if there is one. */ + if(inode->i_file_acl) + blocks -= 1; + bg = (iinode->inode_num - 1) / fs->sb.s_inodes_per_group; /* First, see if we have a slot in the direct blocks open still. */ @@ -1271,9 +1275,14 @@ uint8_t *ext2_inode_read_block(ext2_fs_t *fs, const ext2_inode_t *inode, int *err) { uint32_t blks_per_ind, ibn; uint32_t *iblock; + int shift = (1 << fs->sb.s_log_block_size); + int sub = 0; + + if(inode->i_file_acl) + sub = 1 << shift; /* Check to be sure we're not being asked to do something stupid... */ - if(block_num >= inode->i_blocks) { + if((block_num << shift) >= inode->i_blocks - sub) { *err = EINVAL; return NULL; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |