summaryrefslogtreecommitdiffstats
path: root/fs/ext2/file.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
commitf969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch)
treeb3530d803df59d726afaabebc6626987dee1ca05 /fs/ext2/file.c
parenta10ce7ef2066b455d69187643ddf2073bfc4db24 (diff)
Merge with 2.3.27.
Diffstat (limited to 'fs/ext2/file.c')
-rw-r--r--fs/ext2/file.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index e223ce277..987b55f94 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -18,19 +18,11 @@
* (jj@sunsite.ms.mff.cuni.cz)
*/
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
+#include <linux/module.h>
#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/fcntl.h>
#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/smp_lock.h>
+
+
#define NBUF 32
@@ -40,8 +32,7 @@
static long long ext2_file_lseek(struct file *, long long, int);
#if BITS_PER_LONG < 64
static int ext2_open_file (struct inode *, struct file *);
-
-#else
+#endif
#define EXT2_MAX_SIZE(bits) \
(((EXT2_NDIR_BLOCKS + (1LL << (bits - 2)) + \
@@ -54,9 +45,6 @@ static long long ext2_max_sizes[] = {
EXT2_MAX_SIZE(10), EXT2_MAX_SIZE(11), EXT2_MAX_SIZE(12), EXT2_MAX_SIZE(13)
};
-#endif
-
-
/*
* Make sure the offset never goes beyond the 32-bit mark..
*/
@@ -74,13 +62,11 @@ static long long ext2_file_lseek(
case 1:
offset += file->f_pos;
}
- if (((unsigned long long) offset >> 32) != 0) {
-#if BITS_PER_LONG < 64
+ if (offset<0)
return -EINVAL;
-#else
+ if (((unsigned long long) offset >> 32) != 0) {
if (offset > ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(inode->i_sb)])
return -EINVAL;
-#endif
}
if (offset != file->f_pos) {
file->f_pos = offset;
@@ -139,11 +125,12 @@ static int ext2_release_file (struct inode * inode, struct file * filp)
#if BITS_PER_LONG < 64
/*
* Called when an inode is about to be open.
- * We use this to disallow opening RW large files on 32bit systems.
+ * We use this to disallow opening RW large files on 32bit systems if
+ * the caller didn't specify O_LARGEFILE.
*/
static int ext2_open_file (struct inode * inode, struct file * filp)
{
- if (inode->u.ext2_i.i_high_size && (filp->f_mode & FMODE_WRITE))
+ if (inode->u.ext2_i.i_high_size && !(filp->f_flags & O_LARGEFILE))
return -EFBIG;
return 0;
}