summaryrefslogtreecommitdiffstats
path: root/sys/gnu/ext2fs/ext2_inode.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-02-18 14:08:25 +0000
committertjr <tjr@FreeBSD.org>2004-02-18 14:08:25 +0000
commitc512d30ab2dcbf8922086795e897798a446c7566 (patch)
tree5838560abb54c61b72c76ee0ffcb6112ee73874d /sys/gnu/ext2fs/ext2_inode.c
parent5ce7073e531054245115e365d35219c5345eed34 (diff)
downloadFreeBSD-src-c512d30ab2dcbf8922086795e897798a446c7566.zip
FreeBSD-src-c512d30ab2dcbf8922086795e897798a446c7566.tar.gz
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
Diffstat (limited to 'sys/gnu/ext2fs/ext2_inode.c')
-rw-r--r--sys/gnu/ext2fs/ext2_inode.c10
1 files changed, 10 insertions, 0 deletions
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;
OpenPOWER on IntegriCloud