Merge pull request #13 from namjaejeon/exfat-next

Exfat next
This commit is contained in:
Namjae Jeon 2021-01-06 19:45:55 +09:00 • committed by GitHub
commit d4005926fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View file

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

4
file.c
View file

@ -244,7 +244,11 @@ void exfat_truncate(struct inode *inode, loff_t size)
{
struct super_block *sb = inode->i_sb;
struct exfat_sb_info *sbi = EXFAT_SB(sb);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
unsigned int blocksize = i_blocksize(inode);
#else
unsigned int blocksize = 1 << inode->i_blkbits;
#endif
loff_t aligned_size;
int err;

22
nls.c
View file

@ -3,9 +3,13 @@
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*/
#include <linux/version.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/buffer_head.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
#include <linux/vmalloc.h>
#endif
#include <asm/unaligned.h>
#include "exfat_raw.h"
@ -659,7 +663,11 @@ static int exfat_load_upcase_table(struct super_block *sb,
unsigned char skip = false;
unsigned short *upcase_table;
upcase_table = kcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
#else
upcase_table = vzalloc(UTBL_COUNT * sizeof(unsigned short));
#endif
if (!upcase_table)
return -ENOMEM;
@ -715,7 +723,11 @@ static int exfat_load_default_upcase_table(struct super_block *sb)
unsigned short uni = 0, *upcase_table;
unsigned int index = 0;
upcase_table = kcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
#else
upcase_table = vzalloc(UTBL_COUNT * sizeof(unsigned short));
#endif
if (!upcase_table)
return -ENOMEM;
@ -803,5 +815,9 @@ load_default:
void exfat_free_upcase_table(struct exfat_sb_info *sbi)
{
kfree(sbi->vol_utbl);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
kvfree(sbi->vol_utbl);
#else
vfree(sbi->vol_utbl);
#endif
}