summaryrefslogtreecommitdiffstats
path: root/fs/fat/file.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
commit27cfca1ec98e91261b1a5355d10a8996464b63af (patch)
tree8e895a53e372fa682b4c0a585b9377d67ed70d0e /fs/fat/file.c
parent6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff)
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too o Upgrade to 2.1.89. Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r--fs/fat/file.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/fs/fat/file.c b/fs/fat/file.c
index c1357f784..9052042f4 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -17,6 +17,7 @@
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/pagemap.h>
+#include <linux/fat_cvf.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@ -104,7 +105,41 @@ struct inode_operations fat_file_inode_operations_1024 = {
NULL, /* rename */
NULL, /* readlink */
NULL, /* follow_link */
- NULL, /* readpage */
+ generic_readpage, /* readpage */
+ NULL, /* writepage */
+ NULL, /* bmap */
+ fat_truncate, /* truncate */
+ NULL, /* permission */
+ NULL /* smap */
+};
+
+static struct file_operations fat_file_operations_readpage = {
+ NULL, /* lseek - default */
+ fat_file_read, /* read */
+ fat_file_write, /* write */
+ NULL, /* readdir - bad */
+ NULL, /* select v2.0.x/poll v2.1.x - default */
+ NULL, /* ioctl - default */
+ generic_file_mmap, /* mmap */
+ NULL, /* no special open is needed */
+ NULL, /* release */
+ file_fsync /* fsync */
+};
+
+struct inode_operations fat_file_inode_operations_readpage = {
+ &fat_file_operations_readpage, /* default file operations */
+ NULL, /* create */
+ NULL, /* lookup */
+ NULL, /* link */
+ NULL, /* unlink */
+ NULL, /* symlink */
+ NULL, /* mkdir */
+ NULL, /* rmdir */
+ NULL, /* mknod */
+ NULL, /* rename */
+ NULL, /* readlink */
+ NULL, /* follow_link */
+ fat_readpage, /* readpage */
NULL, /* writepage */
NULL, /* bmap */
fat_truncate, /* truncate */
@@ -277,7 +312,18 @@ ssize_t fat_file_read(
loff_t *ppos)
{
struct inode *inode = filp->f_dentry->d_inode;
- if (!MSDOS_I(inode)->i_binary)
+ if (MSDOS_SB(inode->i_sb)->cvf_format &&
+ MSDOS_SB(inode->i_sb)->cvf_format->cvf_file_read)
+ return MSDOS_SB(inode->i_sb)->cvf_format
+ ->cvf_file_read(filp,buf,count,ppos);
+
+ /*
+ * MS-DOS filesystems with a blocksize > 512 may have blocks
+ * spread over several hardware sectors (unaligned), which
+ * is not something the generic routines can (or would want
+ * to) handle).
+ */
+ if (!MSDOS_I(inode)->i_binary || inode->i_sb->s_blocksize > 512)
return fat_file_read_text(filp, buf, count, ppos);
return generic_file_read(filp, buf, count, ppos);
}
@@ -299,10 +345,17 @@ ssize_t fat_file_write(
struct buffer_head *bh;
int binary_mode = MSDOS_I(inode)->i_binary;
+ PRINTK(("fat_file_write: dentry=%p, inode=%p, ino=%ld\n",
+ filp->f_dentry, inode, inode->i_ino));
if (!inode) {
printk("fat_file_write: inode = NULL\n");
return -EINVAL;
}
+ if (MSDOS_SB(sb)->cvf_format &&
+ MSDOS_SB(sb)->cvf_format->cvf_file_write)
+ return MSDOS_SB(sb)->cvf_format
+ ->cvf_file_write(filp,buf,count,ppos);
+
/* S_ISLNK allows for UMSDOS. Should never happen for normal MSDOS */
if (!S_ISREG(inode->i_mode) && !S_ISLNK(inode->i_mode)) {
printk("fat_file_write: mode = %07o\n",inode->i_mode);