Skip to content

Commit

Permalink
Fix compilation on linux-3.3.x (OpenWrt AA) and remove the experiment…
Browse files Browse the repository at this point in the history
…al AIO stuff
  • Loading branch information
lqs committed Jul 24, 2014
1 parent f2b3a5a commit 6d90c2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 49 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.<br />
Linux non-fuse read/write kernel driver for the exFAT, FAT12, FAT16 and vfat (FAT32) file systems.<br />
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!<br />
Thanks to JackNorris for being awesome and providing the clear_inode() patch.<br />
<br />
Big thanks to lqs for completing the driver!
Big thanks to lqs for completing the driver!<br />
Big thanks to benpicco for fixing 3.11.y compatibility!


Expand Down
2 changes: 1 addition & 1 deletion exfat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
48 changes: 6 additions & 42 deletions exfat_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -1586,47 +1577,20 @@ 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);
#endif

#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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6d90c2e

Please sign in to comment.