exfat: linux 5.6 kernel support

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
This commit is contained in:
Namjae Jeon 2020-02-10 21:57:29 +09:00
parent 9c905ae9e7
commit dafa5b3b3a

41
super.c
View File

@ -249,7 +249,27 @@ 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),
@ -257,24 +277,23 @@ static const struct fs_parameter_spec exfat_param_specs[] = {
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)
{
@ -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;
@ -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