From c512d30ab2dcbf8922086795e897798a446c7566 Mon Sep 17 00:00:00 2001 From: tjr Date: Wed, 18 Feb 2004 14:08:25 +0000 Subject: Add partial support for large (>4GB) files on ext2 filesystems. This support is partial in that it will refuse to create large files on filesystems that haven't been upgraded to EXT2_DYN_REV or that don't have the EXT2_FEATURE_RO_COMPAT_LARGE_FILE flag set in the superblock. MFC after: 2 weeks --- sys/gnu/ext2fs/ext2_inode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/gnu/ext2fs/ext2_inode.c') diff --git a/sys/gnu/ext2fs/ext2_inode.c b/sys/gnu/ext2fs/ext2_inode.c index ec7215e..d940a5c 100644 --- a/sys/gnu/ext2fs/ext2_inode.c +++ b/sys/gnu/ext2fs/ext2_inode.c @@ -164,6 +164,16 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length); * value of oszie is 0, length will be at least 1. */ if (osize < length) { + /* + * XXX Refuse to extend files past 2GB on old format + * filesystems or ones that don't already have the + * large file flag set in the superblock. + */ + if (osize < 0x8000000 && length >= 0x80000000 && + (oip->i_e2fs->s_es->s_rev_level == EXT2_GOOD_OLD_REV || + (oip->i_e2fs->s_es->s_feature_ro_compat & + EXT2_FEATURE_RO_COMPAT_LARGE_FILE) == 0)) + return (EFBIG); offset = blkoff(fs, length - 1); lbn = lblkno(fs, length - 1); aflags = B_CLRBUF; -- cgit v1.1