From 6d90c2e9e876a6c5875145c296efb16f8f23e480 Mon Sep 17 00:00:00 2001 From: Liu Qishuai Date: Thu, 24 Jul 2014 09:11:58 +0000 Subject: [PATCH] Fix compilation on linux-3.3.x (OpenWrt AA) and remove the experimental AIO stuff --- README.md | 8 ++------ exfat_core.c | 2 +- exfat_super.c | 48 ++++++------------------------------------------ 3 files changed, 9 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index ad0462f..3a67833 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,13 @@ exfat-nofuse ============ -Android ARM Linux non-fuse read/write kernel driver for the exFAT, FAT12, FAT16 and vfat (FAT32) file systems.
+Linux non-fuse read/write kernel driver for the exFAT, FAT12, FAT16 and vfat (FAT32) file systems.
Originally ported from Android kernel v3.0. -Will not work on no ARM builds. -Till someone can fix that :) - - Kudos to ksv1986 for the mutex patch!
Thanks to JackNorris for being awesome and providing the clear_inode() patch.

-Big thanks to lqs for completing the driver! +Big thanks to lqs for completing the driver!
Big thanks to benpicco for fixing 3.11.y compatibility! diff --git a/exfat_core.c b/exfat_core.c index b0d0883..f6ea43e 100644 --- a/exfat_core.c +++ b/exfat_core.c @@ -2681,7 +2681,7 @@ void exfat_set_entry_flag(DENTRY_T *p_entry, u8 flags) u32 fat_get_entry_clu0(DENTRY_T *p_entry) { DOS_DENTRY_T *ep = (DOS_DENTRY_T *) p_entry; - return (GET32_A(ep->start_clu_hi) << 16) | GET16_A(ep->start_clu_lo); + return ((u32) GET16_A(ep->start_clu_hi) << 16) | GET16_A(ep->start_clu_lo); } /* end of fat_get_entry_clu0 */ u32 exfat_get_entry_clu0(DENTRY_T *p_entry) diff --git a/exfat_super.c b/exfat_super.c index 897d970..8a7a20d 100644 --- a/exfat_super.c +++ b/exfat_super.c @@ -643,7 +643,7 @@ const struct file_operations exfat_dir_operations = { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,00) static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,00) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) #else @@ -924,7 +924,7 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry, const char *t return err; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,00) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) #else static int exfat_mkdir(struct inode *dir, struct dentry *dentry, int mode) @@ -1566,18 +1566,9 @@ static int exfat_write_end(struct file *file, struct address_space *mapping, return err; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) -static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, - loff_t offset) -#else static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, -#ifdef CONFIG_AIO_OPTIMIZATION - struct iov_iter *iter, loff_t offset) -#else - const struct iovec *iov, - loff_t offset, unsigned long nr_segs) -#endif -#endif + const struct iovec *iov, + loff_t offset, unsigned long nr_segs) { struct inode *inode = iocb->ki_filp->f_mapping->host; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) @@ -1586,31 +1577,12 @@ static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, ssize_t ret; if (rw == WRITE) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) - if (EXFAT_I(inode)->mmu_private < (offset + iov_iter_count(iter))) -#else -#ifdef CONFIG_AIO_OPTIMIZATION - if (EXFAT_I(inode)->mmu_private < - (offset + iov_iter_count(iter))) -#else if (EXFAT_I(inode)->mmu_private < (offset + iov_length(iov, nr_segs))) -#endif -#endif return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,00) -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) - ret = blockdev_direct_IO(rw, iocb, inode, iter, - offset, exfat_get_block); -#else -#ifdef CONFIG_AIO_OPTIMIZATION - ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, - exfat_get_block); -#else +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, exfat_get_block); -#endif -#endif #else ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs, exfat_get_block, NULL); @@ -1618,15 +1590,7 @@ static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) if ((ret < 0) && (rw & WRITE)) -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) - exfat_write_failed(mapping, offset+iov_iter_count(iter)); -#else -#ifdef CONFIG_AIO_OPTIMIZATION - exfat_write_failed(mapping, offset+iov_iter_count(iter)); -#else exfat_write_failed(mapping, offset+iov_length(iov, nr_segs)); -#endif -#endif #endif return ret; } @@ -1982,7 +1946,7 @@ static int exfat_remount(struct super_block *sb, int *flags, char *data) return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,00) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) static int exfat_show_options(struct seq_file *m, struct dentry *root) { struct exfat_sb_info *sbi = EXFAT_SB(root->d_sb);