useful-e2fsck-files/blknum.c
errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode,
				ext2_off64_t size)
{
	/* Only regular files get to be larger than 4GB */
	if (!LINUX_S_ISREG(inode->i_mode) && (size >> 32))
		return EXT2_ET_FILE_TOO_BIG;

	/* If we're writing a large file, set the large_file flag */
	if (LINUX_S_ISREG(inode->i_mode) &&
	    ext2fs_needs_large_file_feature(size) &&
	    (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE) ||
	     fs->super->s_rev_level == EXT2_GOOD_OLD_REV)) {
		fs->super->s_feature_ro_compat |=
					EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
		ext2fs_update_dynamic_rev(fs);
		ext2fs_mark_super_dirty(fs);
	}

	inode->i_size = size & 0xffffffff;
	inode->i_size_high = (size >> 32);

	return 0;
}
/*
 * Set the size of the inode
 */
Set the size of the inode
Set the size of the inode
errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode,
				ext2_off64_t size)
{
	if (!LINUX_S_ISREG(inode->i_mode) && (size >> 32))
		return EXT2_ET_FILE_TOO_BIG;
	if (LINUX_S_ISREG(inode->i_mode) &&
	    ext2fs_needs_large_file_feature(size) &&
	    (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE) ||
	     fs->super->s_rev_level == EXT2_GOOD_OLD_REV)) {
		fs->super->s_feature_ro_compat |=
					EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
		ext2fs_update_dynamic_rev(fs);
		ext2fs_mark_super_dirty(fs);
	}
	inode->i_size = size & 0xffffffff;
	inode->i_size_high = (size >> 32);
	return 0;
}
errcode_t ext2fs_inode_size_set ( ext2_filsys fs , struct ext2_inode * inode , ext2_off64_t size ) { if ( ! LINUX_S_ISREG ( inode -> i_mode ) && ( size >> 32 ) ) return EXT2_ET_FILE_TOO_BIG ; if ( LINUX_S_ISREG ( inode -> i_mode ) && ext2fs_needs_large_file_feature ( size ) && ( ! EXT2_HAS_RO_COMPAT_FEATURE ( fs -> super , EXT2_FEATURE_RO_COMPAT_LARGE_FILE ) || fs -> super -> s_rev_level == EXT2_GOOD_OLD_REV ) ) { fs -> super -> s_feature_ro_compat |= EXT2_FEATURE_RO_COMPAT_LARGE_FILE ; ext2fs_update_dynamic_rev ( fs ) ; ext2fs_mark_super_dirty ( fs ) ; } inode -> i_size = size & 0xffffffff ; inode -> i_size_high = ( size >> 32 ) ; return 0 ; }
Set the size of the inode
Set the size of the inode
/* Only regular files get to be larger than 4GB */ /* If we're writing a large file, set the large_file flag */