diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-11-02 08:53:07 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-11-02 08:53:07 +0000 |
commit | c075c85b3eb488973ae2dcd11747da495f79009e (patch) | |
tree | eaef7a20e7147d7a9ec20476cce6d43acbac670d /sys | |
parent | 904dd55b05f24ee2c4067c9daf167bd8f8844f6f (diff) |
introduce a macro for max file size, instead of hardcoding it; ok
millert@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/fs.h | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index f0bd52cbeb3..20dea16eafd 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.117 2008/09/12 12:27:27 blambert Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.118 2008/11/02 08:53:06 otto Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -892,7 +892,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) * a little added paranoia never hurts. */ ump->um_savedmaxfilesize = fs->fs_maxfilesize; /* XXX */ - maxfilesize = (u_int64_t)0x80000000 * MIN(PAGE_SIZE, fs->fs_bsize) - 1; + maxfilesize = FS_KERNMAXFILESIZE(fs); if (fs->fs_maxfilesize > maxfilesize) /* XXX */ fs->fs_maxfilesize = maxfilesize; /* XXX */ if (ronly == 0) { diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index da799a11497..8acb0db3c5c 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fs.h,v 1.33 2008/01/05 19:49:26 otto Exp $ */ +/* $OpenBSD: fs.h,v 1.34 2008/11/02 08:53:06 otto Exp $ */ /* $NetBSD: fs.h,v 1.6 1995/04/12 21:21:02 mycroft Exp $ */ /* @@ -575,5 +575,13 @@ struct ocg { */ #define NINDIR(fs) ((fs)->fs_nindir) +/* Maximum file size the kernel allows. + * Even though ffs can handle files up to 16TB, we do limit the max file + * to 2^31 pages to prevent overflow of a 32-bit unsigned int. The buffer + * cache has its own checks but a little added paranoia never hurts. + */ +#define FS_KERNMAXFILESIZE(fs) ((u_int64_t)0x80000000 * \ + MIN(PAGE_SIZE, (fs)->fs_bsize) - 1) + extern const int inside[], around[]; extern const u_char *fragtbl[]; |