Skip to content

Commit d400592

Browse files
authored
Merge pull request #13 from namjaejeon/exfat-next
Exfat next
2 parents 7468511 + aff434e commit d400592

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

exfat_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <linux/ratelimit.h>
1212
#include <linux/nls.h>
1313

14-
#define EXFAT_VERSION "5.10.1"
14+
#define EXFAT_VERSION "5.11.1"
1515

1616
#define EXFAT_SUPER_MAGIC 0x2011BAB0UL
1717
#define EXFAT_ROOT_INO 1

file.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ void exfat_truncate(struct inode *inode, loff_t size)
244244
{
245245
struct super_block *sb = inode->i_sb;
246246
struct exfat_sb_info *sbi = EXFAT_SB(sb);
247+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
247248
unsigned int blocksize = i_blocksize(inode);
249+
#else
250+
unsigned int blocksize = 1 << inode->i_blkbits;
251+
#endif
248252
loff_t aligned_size;
249253
int err;
250254

nls.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
44
*/
55

6+
#include <linux/version.h>
67
#include <linux/string.h>
78
#include <linux/slab.h>
89
#include <linux/buffer_head.h>
10+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
11+
#include <linux/vmalloc.h>
12+
#endif
913
#include <asm/unaligned.h>
1014

1115
#include "exfat_raw.h"
@@ -659,7 +663,11 @@ static int exfat_load_upcase_table(struct super_block *sb,
659663
unsigned char skip = false;
660664
unsigned short *upcase_table;
661665

662-
upcase_table = kcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
666+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
667+
upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
668+
#else
669+
upcase_table = vzalloc(UTBL_COUNT * sizeof(unsigned short));
670+
#endif
663671
if (!upcase_table)
664672
return -ENOMEM;
665673

@@ -715,7 +723,11 @@ static int exfat_load_default_upcase_table(struct super_block *sb)
715723
unsigned short uni = 0, *upcase_table;
716724
unsigned int index = 0;
717725

718-
upcase_table = kcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
726+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
727+
upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
728+
#else
729+
upcase_table = vzalloc(UTBL_COUNT * sizeof(unsigned short));
730+
#endif
719731
if (!upcase_table)
720732
return -ENOMEM;
721733

@@ -803,5 +815,9 @@ int exfat_create_upcase_table(struct super_block *sb)
803815

804816
void exfat_free_upcase_table(struct exfat_sb_info *sbi)
805817
{
806-
kfree(sbi->vol_utbl);
818+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
819+
kvfree(sbi->vol_utbl);
820+
#else
821+
vfree(sbi->vol_utbl);
822+
#endif
807823
}

0 commit comments

Comments
 (0)