Merge pull request #26 from namjaejeon/exfat-next

Exfat next
This commit is contained in:
Namjae Jeon 2021-07-11 09:46:43 +09:00 • committed by GitHub
commit 8dd4dd5d52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 6 deletions

View file

@ -7,7 +7,7 @@
#include <linux/blkdev.h>
#include <linux/slab.h>
#include <linux/buffer_head.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
#include <linux/sched/signal.h>
#endif

8
dir.c
View file

@ -64,7 +64,7 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb,
static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_entry *dir_entry)
{
int i, dentries_per_clu, dentries_per_clu_bits = 0, num_ext;
unsigned int type, clu_offset;
unsigned int type, clu_offset, max_dentries;
sector_t sector;
struct exfat_chain dir, clu;
struct exfat_uni_name uni_name;
@ -87,6 +87,8 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent
dentries_per_clu = sbi->dentries_per_clu;
dentries_per_clu_bits = ilog2(dentries_per_clu);
max_dentries = (unsigned int)min_t(u64, MAX_EXFAT_DENTRIES,
(u64)sbi->num_clusters << dentries_per_clu_bits);
clu_offset = dentry >> dentries_per_clu_bits;
exfat_chain_dup(&clu, &dir);
@ -110,7 +112,7 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent
}
}
while (clu.dir != EXFAT_EOF_CLUSTER) {
while (clu.dir != EXFAT_EOF_CLUSTER && dentry < max_dentries) {
i = dentry & (dentries_per_clu - 1);
for ( ; i < dentries_per_clu; i++, dentry++) {
@ -246,7 +248,7 @@ static int exfat_iterate(struct file *filp, struct dir_context *ctx)
if (err)
goto unlock;
get_new:
if (cpos >= i_size_read(inode))
if (ei->flags == ALLOC_NO_FAT_CHAIN && cpos >= i_size_read(inode))
goto end_of_dir;
err = exfat_readdir(inode, &cpos, &de);

View file

@ -11,7 +11,7 @@
#include <linux/ratelimit.h>
#include <linux/nls.h>
#define EXFAT_VERSION "5.12.3"
#define EXFAT_VERSION "5.14.1"
#define EXFAT_SUPER_MAGIC 0x2011BAB0UL
#define EXFAT_ROOT_INO 1

2
misc.c
View file

@ -119,6 +119,8 @@ void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec *ts,
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
u8 *tz, __le16 *time, __le16 *date, u8 *time_cs)
#else
#undef EXFAT_MAX_TIMESTAMP_SECS
#define EXFAT_MAX_TIMESTAMP_SECS 0xffffffff
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec *ts,
u8 *tz, __le16 *time, __le16 *date, u8 *time_cs)
#endif

View file

@ -984,7 +984,7 @@ static int exfat_fill_super(struct super_block *sb, void *data, int silent)
if (!sb->s_root) {
exfat_err(sb, "failed to get the root dentry");
err = -ENOMEM;
goto put_inode;
goto free_table;
}
return 0;