patch-2.1.79 linux/fs/fat/file.c

Next file: linux/fs/fat/inode.c
Previous file: linux/fs/fat/fatfs_syms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.78/linux/fs/fat/file.c linux/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>
@@ -112,6 +113,40 @@
 	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 */
+	NULL,			/* permission */
+	NULL			/* smap */
+};
+
 #define MSDOS_PREFETCH	32
 struct fat_pre {
 	int file_sector;/* Next sector to read in the prefetch table */
@@ -277,6 +312,10 @@
 	loff_t *ppos)
 {
 	struct inode *inode = filp->f_dentry->d_inode;
+	if(MSDOS_SB(inode->i_sb)->cvf_format)
+          if(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);
+
 	if (!MSDOS_I(inode)->i_binary)
 		return fat_file_read_text(filp, buf, count, ppos);
 	return generic_file_read(filp, buf, count, ppos);
@@ -303,6 +342,10 @@
 		printk("fat_file_write: inode = NULL\n");
 		return -EINVAL;
 	}
+        if(MSDOS_SB(sb)->cvf_format)
+          if(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);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov