msdosfs: use same max filesize #define as NetBSD and move to header

For use by makefs msdosfs support.

Obtained from:	NetBSD denode.h 1.6
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2018-07-30 20:36:51 +00:00
parent 8db239dc6b
commit 22e56aea3f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336935
2 changed files with 4 additions and 4 deletions

View File

@ -174,6 +174,8 @@ struct denode {
#define DE_MODIFIED 0x0020 /* Denode has been modified */
#define DE_RENAME 0x0040 /* Denode is in the process of being renamed */
/* Maximum size of a file on a FAT filesystem */
#define MSDOSFS_FILESIZE_MAX 0xFFFFFFFFLL
/*
* Transfer directory entries between internal and external form.

View File

@ -79,8 +79,6 @@
#include <fs/msdosfs/fat.h>
#include <fs/msdosfs/msdosfsmount.h>
#define DOS_FILESIZE_MAX 0xffffffff
/*
* Prototypes for MSDOSFS vnode operations
*/
@ -548,7 +546,7 @@ msdosfs_read(struct vop_read_args *ap)
* The caller is supposed to ensure that
* uio->uio_offset >= 0 and uio->uio_resid >= 0.
* We don't need to check for large offsets as in ffs because
* dep->de_FileSize <= DOS_FILESIZE_MAX < OFF_MAX, so large
* dep->de_FileSize <= MSDOSFS_FILESIZE_MAX < OFF_MAX, so large
* offsets cannot cause overflow even in theory.
*/
@ -663,7 +661,7 @@ msdosfs_write(struct vop_write_args *ap)
* The caller is supposed to ensure that
* uio->uio_offset >= 0 and uio->uio_resid >= 0.
*/
if ((uoff_t)uio->uio_offset + uio->uio_resid > DOS_FILESIZE_MAX)
if ((uoff_t)uio->uio_offset + uio->uio_resid > MSDOSFS_FILESIZE_MAX)
return (EFBIG);
/*