Skip to content

Commit

Permalink
EXFAT 1.2.5 merged with Samsung Source 1.2.4 and modded, READ MORE be…
Browse files Browse the repository at this point in the history
…low.

Driver modded to work with 3.0.y up to 3.10.y

+ all recent fixes and guide how to add to kernel.

I will be happy to add any other fixes to this driver.

RXRZ passed ownership of the source to me.
  • Loading branch information
Dorimanx committed Aug 25, 2013
1 parent 3e001ad commit 0809cdb
Show file tree
Hide file tree
Showing 25 changed files with 1,078 additions and 665 deletions.
19 changes: 19 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
config EXFAT_FS
tristate "exFAT filesystem support"
select NLS
help
exFAT driver from Samsung

config EXFAT_DEFAULT_CODEPAGE
int "Default codepage for exFAT"
depends on EXFAT_FS
default 437
help
This option should be set to the codepage of your exFAT filesystems.

config EXFAT_DEFAULT_IOCHARSET
string "Default iocharset for exFAT"
depends on EXFAT_FS
default "utf8"
help
Set this to the default input/output character set you'd like exFAT to use.
26 changes: 2 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
# Exfat Linux kernel modules
#

obj-m += exfat.o
obj-$(CONFIG_EXFAT_FS) += exfat.o

exfat-y := exfat_core.o exfat_api.o exfat_blkdev.o exfat_cache.o exfat_super.o \
exfat_data.o exfat_global.o exfat_nls.o exfat_oal.o exfat_upcase.o

EXTRA_FLAGS += -I$(PWD)

#KDIR := /usr/src/linux/
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

all:
$(MAKE) -C $(KDIR) M=$(PWD) modules

clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean

help:
$(MAKE) -C $(KDIR) M=$(PWD) help

.PHONY : install
install : all
sudo $(MAKE) -C $(KDIR) M=$(PWD) modules_install; sudo depmod
exfat_data.o exfat_global.o exfat_nls.o exfat_oal.o exfat_upcase.o
80 changes: 55 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,55 @@
exfat-nofuse
============

Linux non-fuse read/write kernel driver for the exFAT file system.<br />
Originally ported from android kernel v3.0.


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!


Special thanks to github user AndreiLux for spreading the word about the leak!<br />


Installation:
> make<br />
> make install
To load the driver manually, run this as root:
> modprobe exfat

Free Software for the Free Minds!
exfat-nofuse
============

Linux non-fuse read/write kernel driver for the exFAT file system.<br />
Originally ported from android kernel v3.0.


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!


Special thanks to github user AndreiLux for spreading the word about the leak!<br />

To load the driver manually, run this as root:
> modprobe exfat

Free Software for the Free Minds!
=====================================

To add to kernel you need to do this:

cd your kernel source dir

mkdir fs/exfat

copy all files (exept .git) from exfat-nofuse to your kernel source fs/exfat/

see
https://github.com/dorimanx/Dorimanx-SG2-I9100-Kernel/commit/e8fc728a68096db9ffcebff40244ebfb60a3de18

edit fs/Kconfig
edit fs/Makefile

cd your kernel source
make menuconfig

go to: File systems > DOS/FAT/NT > check the exfat as MODULE (M)
<M> exFAT filesystem support
(437) Default codepage for exFAT
(utf8) Default iocharset for exFAT

ESC to main menu
Save an Alternate Configuration File
ESC ESC

build your kernel.

and you will have new module!

exfat.ko

have fun.
20 changes: 19 additions & 1 deletion exfat.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/************************************************************************/
/* */
/* PROJECT : exFAT & FAT12/16/32 File System */
Expand Down Expand Up @@ -510,7 +528,7 @@ extern "C" {
INT32 ffsCreateFile(struct inode *inode, UINT8 *path, UINT8 mode, FILE_ID_T *fid);
INT32 ffsReadFile(struct inode *inode, FILE_ID_T *fid, void *buffer, UINT64 count, UINT64 *rcount);
INT32 ffsWriteFile(struct inode *inode, FILE_ID_T *fid, void *buffer, UINT64 count, UINT64 *wcount);
INT32 ffsTruncateFile(struct inode *inode, UINT64 new_size);
INT32 ffsTruncateFile(struct inode *inode, UINT64 old_size, UINT64 new_size);
INT32 ffsMoveFile(struct inode *old_parent_inode, FILE_ID_T *fid, struct inode *new_parent_inode, struct dentry *new_dentry);
INT32 ffsRemoveFile(struct inode *inode, FILE_ID_T *fid);
INT32 ffsSetAttr(struct inode *inode, UINT32 attr);
Expand Down
30 changes: 24 additions & 6 deletions exfat_api.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/************************************************************************/
/* */
/* PROJECT : exFAT & FAT12/16/32 File System */
Expand Down Expand Up @@ -287,24 +305,24 @@ INT32 FsWriteFile(struct inode *inode, FILE_ID_T *fid, void *buffer, UINT64 coun
} /* end of FsWriteFile */

/* FsTruncateFile : resize the file length */
INT32 FsTruncateFile(struct inode *inode, UINT64 new_size)
INT32 FsTruncateFile(struct inode *inode, UINT64 old_size, UINT64 new_size)
{
INT32 err;
struct super_block *sb = inode->i_sb;
FS_INFO_T *p_fs = &(EXFAT_SB(sb)->fs_info);

PRINTK("FsTruncateFile entered (inode %p size %llu\n", inode, new_size);

/* acquire the lock for file system critical section */
sm_P(&(fs_struct[p_fs->drv].v_sem));

err = ffsTruncateFile(inode, new_size);
PRINTK("FsTruncateFile entered (inode %p size %llu)\n", inode, new_size);

/* release the lock for file system critical section */
sm_V(&(fs_struct[p_fs->drv].v_sem));
err = ffsTruncateFile(inode, old_size, new_size);

PRINTK("FsTruncateFile exitted (%d)\n", err);

/* release the lock for file system critical section */
sm_V(&(fs_struct[p_fs->drv].v_sem));

return(err);
} /* end of FsTruncateFile */

Expand Down
20 changes: 19 additions & 1 deletion exfat_api.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/************************************************************************/
/* */
/* PROJECT : exFAT & FAT12/16/32 File System */
Expand Down Expand Up @@ -173,7 +191,7 @@ extern "C" {
INT32 FsCreateFile(struct inode *inode, UINT8 *path, UINT8 mode, FILE_ID_T *fid);
INT32 FsReadFile(struct inode *inode, FILE_ID_T *fid, void *buffer, UINT64 count, UINT64 *rcount);
INT32 FsWriteFile(struct inode *inode, FILE_ID_T *fid, void *buffer, UINT64 count, UINT64 *wcount);
INT32 FsTruncateFile(struct inode *inode, UINT64 new_size);
INT32 FsTruncateFile(struct inode *inode, UINT64 old_size, UINT64 new_size);
INT32 FsMoveFile(struct inode *old_parent_inode, FILE_ID_T *fid, struct inode *new_parent_inode, struct dentry *new_dentry);
INT32 FsRemoveFile(struct inode *inode, FILE_ID_T *fid);
INT32 FsSetAttr(struct inode *inode, UINT32 attr);
Expand Down
35 changes: 31 additions & 4 deletions exfat_blkdev.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/************************************************************************/
/* */
/* PROJECT : exFAT & FAT12/16/32 File System */
Expand Down Expand Up @@ -41,7 +59,7 @@

INT32 bdev_init(void)
{
return(FFS_SUCCESS);
return(FFS_SUCCESS);
}

INT32 bdev_shutdown(void)
Expand Down Expand Up @@ -78,6 +96,7 @@ INT32 bdev_close(struct super_block *sb)
INT32 bdev_read(struct super_block *sb, UINT32 secno, struct buffer_head **bh, UINT32 num_secs, INT32 read)
{
BD_INFO_T *p_bd = &(EXFAT_SB(sb)->bd_info);
FS_INFO_T *p_fs = &(EXFAT_SB(sb)->fs_info);
#if EXFAT_CONFIG_KERNEL_DEBUG
struct exfat_sb_info *sbi = EXFAT_SB(sb);
long flags = sbi->debug_flags;
Expand All @@ -96,7 +115,8 @@ INT32 bdev_read(struct super_block *sb, UINT32 secno, struct buffer_head **bh, U

if (*bh) return(FFS_SUCCESS);

WARN_ONCE(1, "EXFAT: Out of memory\n");
WARN(!p_fs->dev_ejected,
"[EXFAT] No bh, device seems wrong or to be ejected.\n");

return(FFS_MEDIAERR);
}
Expand All @@ -106,6 +126,7 @@ INT32 bdev_write(struct super_block *sb, UINT32 secno, struct buffer_head *bh, U
INT32 count;
struct buffer_head *bh2;
BD_INFO_T *p_bd = &(EXFAT_SB(sb)->bd_info);
FS_INFO_T *p_fs = &(EXFAT_SB(sb)->fs_info);
#if EXFAT_CONFIG_KERNEL_DEBUG
struct exfat_sb_info *sbi = EXFAT_SB(sb);
long flags = sbi->debug_flags;
Expand All @@ -128,7 +149,7 @@ INT32 bdev_write(struct super_block *sb, UINT32 secno, struct buffer_head *bh, U
bh2 = __getblk(sb->s_bdev, secno, count);

if (bh2 == NULL)
return (FFS_MEDIAERR);
goto no_bh;

lock_buffer(bh2);
MEMCPY(bh2->b_data, bh->b_data, count);
Expand All @@ -137,12 +158,18 @@ INT32 bdev_write(struct super_block *sb, UINT32 secno, struct buffer_head *bh, U
unlock_buffer(bh2);
if (sync && (sync_dirty_buffer(bh2) != 0)) {
__brelse(bh2);
return (FFS_MEDIAERR);
goto no_bh;
}
__brelse(bh2);
}

return(FFS_SUCCESS);

no_bh:
WARN(!p_fs->dev_ejected,
"[EXFAT] No bh, device seems wrong or to be ejected.\n");

return (FFS_MEDIAERR);
}

INT32 bdev_sync(struct super_block *sb)
Expand Down
18 changes: 18 additions & 0 deletions exfat_blkdev.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/************************************************************************/
/* */
/* PROJECT : exFAT & FAT12/16/32 File System */
Expand Down
Loading

0 comments on commit 0809cdb

Please sign in to comment.