summaryrefslogtreecommitdiffstats
path: root/fs/ext2
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
parenta10ce7ef2066b455d69187643ddf2073bfc4db24 (diff)
Merge with 2.3.27.
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/acl.c10
-rw-r--r--fs/ext2/balloc.c16
-rw-r--r--fs/ext2/bitmap.c4
-rw-r--r--fs/ext2/dir.c9
-rw-r--r--fs/ext2/file.c31
-rw-r--r--fs/ext2/fsync.c13
-rw-r--r--fs/ext2/ialloc.c16
-rw-r--r--fs/ext2/inode.c33
-rw-r--r--fs/ext2/ioctl.c11
-rw-r--r--fs/ext2/namei.c10
-rw-r--r--fs/ext2/super.c21
-rw-r--r--fs/ext2/symlink.c9
-rw-r--r--fs/ext2/truncate.c17
13 files changed, 64 insertions, 136 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 111a2d6e0..5ec306fdf 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -7,16 +7,16 @@
* Universite Pierre et Marie Curie (Paris VI)
*/
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/sched.h>
+
+
/*
* This file will contain the Access Control Lists management for the
* second extended file system.
*/
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
/*
* ext2_permission ()
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index b7cfd2212..e0f7a655c 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -11,6 +11,12 @@
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/locks.h>
+#include <linux/quotaops.h>
+
+
/*
* balloc.c contains the blocks allocation and deallocation routines
*/
@@ -26,16 +32,6 @@
* when a file system is mounted (see ext2_read_super).
*/
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/stat.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/locks.h>
-#include <linux/quotaops.h>
-
-#include <asm/bitops.h>
-#include <asm/byteorder.h>
#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
diff --git a/fs/ext2/bitmap.c b/fs/ext2/bitmap.c
index 8b9b5d233..ddd0ac12c 100644
--- a/fs/ext2/bitmap.c
+++ b/fs/ext2/bitmap.c
@@ -7,8 +7,10 @@
* Universite Pierre et Marie Curie (Paris VI)
*/
+#include <linux/module.h>
#include <linux/fs.h>
-#include <linux/ext2_fs.h>
+
+
static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index cf9e615bd..e1f45105e 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -18,13 +18,10 @@
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
-#include <asm/uaccess.h>
-
-#include <linux/errno.h>
+#include <linux/module.h>
#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
+
+
static ssize_t ext2_dir_read (struct file * filp, char * buf,
size_t count, loff_t *ppos)
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;
}
diff --git a/fs/ext2/fsync.c b/fs/ext2/fsync.c
index 3969e17e9..cd12a68bd 100644
--- a/fs/ext2/fsync.c
+++ b/fs/ext2/fsync.c
@@ -22,17 +22,10 @@
* we can depend on generic_block_fdatasync() to sync the data blocks.
*/
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/byteorder.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>
+
+
#define blocksize (EXT2_BLOCK_SIZE(inode->i_sb))
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index d4b5ca33f..d6953e4cb 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -12,6 +12,12 @@
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/locks.h>
+#include <linux/quotaops.h>
+
+
/*
* ialloc.c contains the inodes allocation and deallocation routines
*/
@@ -27,16 +33,6 @@
* when a file system is mounted (see ext2_read_super).
*/
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/locks.h>
-#include <linux/quotaops.h>
-
-#include <asm/bitops.h>
-#include <asm/byteorder.h>
/*
* Read the inode allocation bitmap for a given block_group, reading
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 4cf932d51..a980df858 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -20,18 +20,13 @@
* (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/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
#include <linux/locks.h>
-#include <linux/mm.h>
#include <linux/smp_lock.h>
+#include <linux/sched.h>
+
+
static int ext2_update_inode(struct inode * inode, int do_sync);
@@ -692,15 +687,8 @@ void ext2_read_inode (struct inode * inode)
inode->u.ext2_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
else {
inode->u.ext2_i.i_dir_acl = 0;
- inode->u.ext2_i.i_high_size =
- le32_to_cpu(raw_inode->i_size_high);
-#if BITS_PER_LONG < 64
- if (raw_inode->i_size_high)
- inode->i_size = (__u32)-1;
-#else
- inode->i_size |= ((__u64)le32_to_cpu(raw_inode->i_size_high))
- << 32;
-#endif
+ inode->u.ext2_i.i_high_size = le32_to_cpu(raw_inode->i_size_high);
+ inode->i_size |= ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
}
inode->i_generation = le32_to_cpu(raw_inode->i_generation);
inode->u.ext2_i.i_block_group = block_group;
@@ -821,14 +809,9 @@ static int ext2_update_inode(struct inode * inode, int do_sync)
raw_inode->i_file_acl = cpu_to_le32(inode->u.ext2_i.i_file_acl);
if (S_ISDIR(inode->i_mode))
raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext2_i.i_dir_acl);
- else {
-#if BITS_PER_LONG < 64
- raw_inode->i_size_high =
- cpu_to_le32(inode->u.ext2_i.i_high_size);
-#else
+ else
raw_inode->i_size_high = cpu_to_le32(inode->i_size >> 32);
-#endif
- }
+
raw_inode->i_generation = cpu_to_le32(inode->i_generation);
if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
raw_inode->i_block[0] = cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index 4d54fd354..a582fd545 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -7,14 +7,11 @@
* Universite Pierre et Marie Curie (Paris VI)
*/
-#include <asm/uaccess.h>
-
-#include <linux/errno.h>
+#include <linux/module.h>
#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/ioctl.h>
#include <linux/sched.h>
-#include <linux/mm.h>
+#include <asm/uaccess.h>
+
int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
unsigned long arg)
@@ -26,7 +23,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
switch (cmd) {
case EXT2_IOC_GETFLAGS:
flags = inode->u.ext2_i.i_flags & EXT2_FL_USER_VISIBLE;
- return put_user(inode->u.ext2_i.i_flags, (int *) arg);
+ return put_user(flags, (int *) arg);
case EXT2_IOC_SETFLAGS: {
unsigned int oldflags;
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 90cb80050..8bc7532de 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -18,19 +18,13 @@
* for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998
*/
-#include <asm/uaccess.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/string.h>
#include <linux/locks.h>
#include <linux/quotaops.h>
+
/*
* define how far ahead to read directories while searching them.
*/
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 37b8e15c5..dadd3c67e 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -17,23 +17,14 @@
*/
#include <linux/module.h>
-
-#include <stdarg.h>
-
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/malloc.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
#include <linux/string.h>
-#include <linux/locks.h>
-#include <linux/blkdev.h>
+#include <linux/fs.h>
+#include <linux/slab.h>
#include <linux/init.h>
+#include <linux/locks.h>
+#include <asm/uaccess.h>
+
+
static char error_buf[1024];
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c
index 5f73159c3..bf880e68a 100644
--- a/fs/ext2/symlink.c
+++ b/fs/ext2/symlink.c
@@ -15,14 +15,11 @@
* ext2 symlink handling code
*/
+#include <linux/module.h>
+#include <linux/fs.h>
#include <asm/uaccess.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/stat.h>
+
static int ext2_readlink (struct dentry *, char *, int);
static struct dentry *ext2_follow_link(struct dentry *, struct dentry *, unsigned int);
diff --git a/fs/ext2/truncate.c b/fs/ext2/truncate.c
index d824edb0b..653936278 100644
--- a/fs/ext2/truncate.c
+++ b/fs/ext2/truncate.c
@@ -18,20 +18,16 @@
* General cleanup and race fixes, wsh, 1998
*/
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/locks.h>
+
+
/*
* Real random numbers for secure rm added 94/02/18
* Idea from Pierre del Perugia <delperug@gla.ecoledoc.ibp.fr>
*/
-#include <linux/errno.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/string.h>
-
#if 0
/*
@@ -54,8 +50,7 @@ static int ext2_secrm_seed = 152; /* Random generator base */
* there's no need to test for changes during the operation.
*/
#define DIRECT_BLOCK(inode) \
- ((inode->i_size + inode->i_sb->s_blocksize - 1) / \
- inode->i_sb->s_blocksize)
+ ((unsigned long) ((inode->i_size + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits))
#define INDIRECT_BLOCK(inode,offset) ((int)DIRECT_BLOCK(inode) - offset)
#define DINDIRECT_BLOCK(inode,offset) \
(INDIRECT_BLOCK(inode,offset) / addr_per_block)