Skip to content

Commit

Permalink
exfat: changes the minimum supported kernel version from 4.10 to 5.15
Browse files Browse the repository at this point in the history
Backporting new patches to the 4.x kernel has become difficult.
The existing 4.x support version was made into a branch of
for-kernel-version-from-4.1.0.

Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
namjaejeon committed Dec 1, 2023
1 parent 3ad1490 commit 47ed74d
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 707 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libelf-dev wget tar gzip python2.7
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.1.36.tar.gz
tar xf linux-4.1.36.tar.gz
mv linux-4.1.36 linux-stable
rm -rf linux-4.1.36.tar.gz
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.15.140.tar.gz
tar xf linux-5.15.140.tar.gz
mv linux-5.15.140 linux-stable
rm -rf linux-5.15.140.tar.gz
- name: Prerequisite for xfstests testing
run: |
sudo apt-get install linux-headers-$(uname -r)
Expand All @@ -35,14 +35,11 @@ jobs:
- name: Copy exfat source to kernel
run: |
mv linux-stable ../
mkdir ../linux-stable/fs/exfat
cp -ar * ../linux-stable/fs/exfat/
- name: Compile with 4.1 kernel
- name: Compile with 5.15 kernel
run: |
cd ../linux-stable
yes "" | make oldconfig > /dev/null
echo 'obj-$(CONFIG_EXFAT_FS) += exfat/' >> fs/Makefile
echo 'source "fs/exfat/Kconfig"' >> fs/Kconfig
echo 'CONFIG_EXFAT_FS=m' >> .config
echo 'CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"' >> .config
make -j$((`nproc`+1)) fs/exfat/exfat.ko
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## exFAT filesystem
This is the exfat filesystem for support from the linux 4.1 kernel
This is the exfat filesystem for support from the linux 5.15 kernel
to the latest kernel.

## Installing as a stand-alone module
Expand Down
8 changes: 0 additions & 8 deletions balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
#include <linux/blkdev.h>
#include <linux/slab.h>
#include <linux/buffer_head.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/signal.h>
#else
#include <linux/sched.h>
#endif
#include <linux/vmalloc.h>

#include "exfat_raw.h"
Expand Down Expand Up @@ -76,12 +72,8 @@ static int exfat_allocate_bitmap(struct super_block *sb,
}
sbi->map_sectors = ((need_map_size - 1) >>
(sb->s_blocksize_bits)) + 1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
sbi->vol_amap = kvmalloc_array(sbi->map_sectors,
sizeof(struct buffer_head *), GFP_KERNEL);
#else
sbi->vol_amap = vmalloc(sbi->map_sectors * sizeof(struct buffer_head *));
#endif
if (!sbi->vol_amap)
return -ENOMEM;

Expand Down
8 changes: 0 additions & 8 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,19 +461,11 @@ int exfat_init_dir_entry(struct inode *inode, struct exfat_chain *p_dir,
{
struct super_block *sb = inode->i_sb;
struct exfat_sb_info *sbi = EXFAT_SB(sb);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
struct timespec64 ts;
#else
struct timespec ts;
#endif
struct exfat_dentry *ep;
struct buffer_head *bh;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
ts = current_time(inode);
#else
ts = CURRENT_TIME_SEC;
#endif

/*
* We cannot use exfat_get_dentry_set here because file ep is not
Expand Down
29 changes: 0 additions & 29 deletions exfat_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,9 @@ struct exfat_dir_entry {
unsigned short attr;
loff_t size;
unsigned int num_subdirs;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
struct timespec64 atime;
struct timespec64 mtime;
struct timespec64 crtime;
#else
struct timespec atime;
struct timespec mtime;
struct timespec crtime;
#endif
struct exfat_dentry_namebuf namebuf;
};

Expand Down Expand Up @@ -344,11 +338,7 @@ struct exfat_inode_info {
struct rw_semaphore truncate_lock;
struct inode vfs_inode;
/* File creation time */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
struct timespec64 i_crtime;
#else
struct timespec i_crtime;
#endif
};

static inline struct exfat_sb_info *EXFAT_SB(struct super_block *sb)
Expand Down Expand Up @@ -478,7 +468,6 @@ extern const struct file_operations exfat_file_operations;
int __exfat_truncate(struct inode *inode);
void exfat_truncate(struct inode *inode);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
struct iattr *attr);
Expand All @@ -492,16 +481,6 @@ int exfat_getattr(struct user_namespace *mnt_userns, const struct path *path,
struct kstat *stat, unsigned int request_mask,
unsigned int query_flags);
#endif
#else
int exfat_setattr(struct dentry *dentry, struct iattr *attr);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
int exfat_getattr(const struct path *path, struct kstat *stat,
unsigned int request_mask, unsigned int query_flags);
#else
int exfat_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
#endif
#endif
int exfat_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
long exfat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
long exfat_compat_ioctl(struct file *filp, unsigned int cmd,
Expand Down Expand Up @@ -594,7 +573,6 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
#define exfat_debug(sb, fmt, ...) \
pr_debug("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
u8 tz, __le16 time, __le16 date, u8 time_cs);
void exfat_truncate_atime(struct timespec64 *ts);
Expand All @@ -603,13 +581,6 @@ void exfat_truncate_inode_atime(struct inode *inode);
#endif
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
u8 *tz, __le16 *time, __le16 *date, u8 *time_cs);
#else
void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec *ts,
u8 tz, __le16 time, __le16 date, u8 time_cs);
void exfat_truncate_atime(struct timespec *ts);
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec *ts,
u8 *tz, __le16 *time, __le16 *date, u8 *time_cs);
#endif
u16 exfat_calc_chksum16(void *data, int len, u16 chksum, int type);
u32 exfat_calc_chksum32(void *data, int len, u32 chksum, int type);
void exfat_update_bh(struct buffer_head *bh, int sync);
Expand Down
8 changes: 0 additions & 8 deletions fatent.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ static int exfat_mirror_bh(struct super_block *sb, sector_t sec,
memcpy(c_bh->b_data, bh->b_data, sb->s_blocksize);
set_buffer_uptodate(c_bh);
mark_buffer_dirty(c_bh);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
if (sb->s_flags & SB_SYNCHRONOUS)
#else
if (sb->s_flags & MS_SYNCHRONOUS)
#endif
err = sync_dirty_buffer(c_bh);
brelse(c_bh);
}
Expand Down Expand Up @@ -80,11 +76,7 @@ int exfat_ent_set(struct super_block *sb, unsigned int loc,

fat_entry = (__le32 *)&(bh->b_data[off]);
*fat_entry = cpu_to_le32(content);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
exfat_update_bh(bh, sb->s_flags & SB_SYNCHRONOUS);
#else
exfat_update_bh(bh, sb->s_flags & MS_SYNCHRONOUS);
#endif
exfat_mirror_bh(sb, sec, bh);
brelse(bh);
return 0;
Expand Down
Loading

0 comments on commit 47ed74d

Please sign in to comment.