Skip to content

Commit

Permalink
Merge pull request TheScarastic#3 from namjaejeon/exfat-next
Browse files Browse the repository at this point in the history
Exfat next
  • Loading branch information
namjaejeon authored Feb 10, 2020
2 parents 15e6b32 + dafa5b3 commit cad3770
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 10 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ script:
- sudo losetup /dev/loop21 test.img
- sudo mkfs.exfat -c 4 /dev/loop20
- sudo mkfs.exfat -c 4 /dev/loop21
- sudo make uninstall
- cd ..
- cd exfat-testsuites/
- tar xzvf xfstests-exfat.tgz > /dev/null
Expand Down
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# exfat
linux-exfat for 4.1 ~ the latest linus-tree
## exFAT filesystem
This is the exfat filesystem for support from the linux 4.1 kernel
to the latest kernel.

## Installing as a stand-alone module

Install prerequisite package for Fedora, RHEL:
```
yum install kernel-devel-$(uname -r)
```

Build step:
```
make
sudo make install
```

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


## Installing as a part of the kernel

1. Let's take [linux] as the path to your kernel source dir.
```
cd [linux]
cp -ar exfat [linux]/fs/
```

2. edit [linux]/fs/Kconfig
```
source "fs/fat/Kconfig"
+source "fs/exfat/Kconfig"
source "fs/ntfs/Kconfig"
```

3. edit [linux]/fs/Makefile
```
obj-$(CONFIG_FAT_FS) += fat/
+obj-$(CONFIG_EXFAT_FS) += exfat/
obj-$(CONFIG_BFS_FS) += bfs/
```
4. make menuconfig and set exfat
```
File systems --->
DOS/FAT/NT Filesystems --->
<M> exFAT filesystem support
(utf8) Default iocharset for exFAT
```

build your kernel
41 changes: 34 additions & 7 deletions super.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,32 +249,51 @@ enum {
Opt_time_offset,
};

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static const struct constant_table exfat_param_enums[] = {
{ "continue", EXFAT_ERRORS_CONT },
{ "panic", EXFAT_ERRORS_PANIC },
{ "remount-ro", EXFAT_ERRORS_RO },
{}
};
#else
static const struct fs_parameter_enum exfat_param_enums[] = {
{ Opt_errors, "continue", EXFAT_ERRORS_CONT },
{ Opt_errors, "panic", EXFAT_ERRORS_PANIC },
{ Opt_errors, "remount-ro", EXFAT_ERRORS_RO },
{}
};
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static const struct fs_parameter_spec exfat_parameters[] = {
#else
static const struct fs_parameter_spec exfat_param_specs[] = {
#endif
fsparam_u32("uid", Opt_uid),
fsparam_u32("gid", Opt_gid),
fsparam_u32oct("umask", Opt_umask),
fsparam_u32oct("dmask", Opt_dmask),
fsparam_u32oct("fmask", Opt_fmask),
fsparam_u32oct("allow_utime", Opt_allow_utime),
fsparam_string("iocharset", Opt_charset),
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
fsparam_enum("errors", Opt_errors, exfat_param_enums),
#else
fsparam_enum("errors", Opt_errors),
#endif
fsparam_flag("discard", Opt_discard),
fsparam_s32("time_offset", Opt_time_offset),
{}
};

static const struct fs_parameter_enum exfat_param_enums[] = {
{ Opt_errors, "continue", EXFAT_ERRORS_CONT },
{ Opt_errors, "panic", EXFAT_ERRORS_PANIC },
{ Opt_errors, "remount-ro", EXFAT_ERRORS_RO },
{}
};

#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 5, 0)
static const struct fs_parameter_description exfat_parameters = {
.name = "exfat",
.specs = exfat_param_specs,
.enums = exfat_param_enums,
};
#endif

static int exfat_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
Expand All @@ -283,7 +302,11 @@ static int exfat_parse_param(struct fs_context *fc, struct fs_parameter *param)
struct fs_parse_result result;
int opt;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
opt = fs_parse(fc, exfat_parameters, param, &result);
#else
opt = fs_parse(fc, &exfat_parameters, param, &result);
#endif
if (opt < 0)
return opt;

Expand Down Expand Up @@ -893,7 +916,11 @@ static struct file_system_type exfat_fs_type = {
.name = "exfat",
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
.init_fs_context = exfat_init_fs_context,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
.parameters = exfat_parameters,
#else
.parameters = &exfat_parameters,
#endif
#else
.mount = exfat_fs_mount,
#endif
Expand Down

0 comments on commit cad3770

Please sign in to comment.