Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ba67b05 authored by derfelot's avatar derfelot Committed by Andreas Schneider
Browse files

fs: sdfat: Update to version 2.3.0

Taken from SM-G975F_QQ_Opensource kernel (G975FXXU3BSKO)
parent 1c002b11
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -119,3 +119,8 @@ config SDFAT_STATISTICS
	bool "enable statistics for bigdata"
	depends on SDFAT_FS
	default y

config SDFAT_UEVENT
	bool "enable uevent"
	depends on SDFAT_FS
	default y
+10 −1
Original line number Diff line number Diff line
@@ -98,6 +98,14 @@ typedef struct {
/*  Type Definitions                                                    */
/*----------------------------------------------------------------------*/
/* should be merged it to DATE_TIME_T */
typedef union {
	struct {
		u8 off : 7;
		u8 valid : 1;
	};
	u8 value;
} TIMEZONE_T;

typedef struct {
	u16      sec;        /* 0 ~ 59               */
	u16      min;        /* 0 ~ 59               */
@@ -105,9 +113,9 @@ typedef struct {
	u16      day;        /* 1 ~ 31               */
	u16      mon;        /* 1 ~ 12               */
	u16      year;       /* 0 ~ 127 (since 1980) */
	TIMEZONE_T tz;
} TIMESTAMP_T;


typedef struct {
	u16      Year;
	u16      Month;
@@ -116,6 +124,7 @@ typedef struct {
	u16      Minute;
	u16      Second;
	u16      MilliSecond;
	TIMEZONE_T Timezone;
} DATE_TIME_T;

typedef struct {
+21 −2
Original line number Diff line number Diff line
@@ -33,12 +33,27 @@
#include <linux/writeback.h>
#include <linux/kernel.h>
#include <linux/log2.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
#include <linux/iversion.h>
#endif

#include "sdfat.h"
#include "core.h"
#include <asm/byteorder.h>
#include <asm/unaligned.h>


/*************************************************************************
 * FUNCTIONS WHICH HAS KERNEL VERSION DEPENDENCY
 *************************************************************************/
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
static inline u64 inode_peek_iversion(struct inode *inode)
{
	return inode->i_version;
}
#endif


/*----------------------------------------------------------------------*/
/*  Constant & Macro Definitions                                        */
/*----------------------------------------------------------------------*/
@@ -1956,10 +1971,10 @@ s32 fscore_lookup(struct inode *inode, u8 *path, FILE_ID_T *fid)
		return ret;

	/* check the validation of hint_stat and initialize it if required */
	if (dir_fid->version != (u32)(inode->i_version & 0xffffffff)) {
	if (dir_fid->version != (u32)inode_peek_iversion(inode)) {
		dir_fid->hint_stat.clu = dir.dir;
		dir_fid->hint_stat.eidx = 0;
		dir_fid->version = (u32)(inode->i_version & 0xffffffff);
		dir_fid->version = (u32)inode_peek_iversion(inode);
		dir_fid->hint_femp.eidx = -1;
	}

@@ -2956,6 +2971,7 @@ s32 fscore_read_inode(struct inode *inode, DIR_ENTRY_T *info)
	info->CreateTimestamp.Minute = tm.min;
	info->CreateTimestamp.Second = tm.sec;
	info->CreateTimestamp.MilliSecond = 0;
	info->CreateTimestamp.Timezone.value = tm.tz.value;

	fsi->fs_func->get_entry_time(ep, &tm, TM_MODIFY);
	info->ModifyTimestamp.Year = tm.year;
@@ -2965,6 +2981,7 @@ s32 fscore_read_inode(struct inode *inode, DIR_ENTRY_T *info)
	info->ModifyTimestamp.Minute = tm.min;
	info->ModifyTimestamp.Second = tm.sec;
	info->ModifyTimestamp.MilliSecond = 0;
	info->ModifyTimestamp.Timezone.value = tm.tz.value;

	memset((s8 *) &info->AccessTimestamp, 0, sizeof(DATE_TIME_T));

@@ -3067,6 +3084,7 @@ s32 fscore_write_inode(struct inode *inode, DIR_ENTRY_T *info, s32 sync)
	fsi->fs_func->set_entry_attr(ep, info->Attr);

	/* set FILE_INFO structure using the acquired DENTRY_T */
	tm.tz  = info->CreateTimestamp.Timezone;
	tm.sec  = info->CreateTimestamp.Second;
	tm.min  = info->CreateTimestamp.Minute;
	tm.hour = info->CreateTimestamp.Hour;
@@ -3075,6 +3093,7 @@ s32 fscore_write_inode(struct inode *inode, DIR_ENTRY_T *info, s32 sync)
	tm.year = info->CreateTimestamp.Year;
	fsi->fs_func->set_entry_time(ep, &tm, TM_CREATE);

	tm.tz  = info->ModifyTimestamp.Timezone;
	tm.sec  = info->ModifyTimestamp.Second;
	tm.min  = info->ModifyTimestamp.Minute;
	tm.hour = info->ModifyTimestamp.Hour;
+8 −2
Original line number Diff line number Diff line
@@ -222,24 +222,28 @@ static void exfat_set_entry_size(DENTRY_T *p_entry, u64 size)

static void exfat_get_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, u8 mode)
{
	u16 t = 0x00, d = 0x21;
	u16 t = 0x00, d = 0x21, tz = 0x00;
	FILE_DENTRY_T *ep = (FILE_DENTRY_T *)p_entry;

	switch (mode) {
	case TM_CREATE:
		t = le16_to_cpu(ep->create_time);
		d = le16_to_cpu(ep->create_date);
		tz = ep->create_tz;
		break;
	case TM_MODIFY:
		t = le16_to_cpu(ep->modify_time);
		d = le16_to_cpu(ep->modify_date);
		tz = ep->modify_tz;
		break;
	case TM_ACCESS:
		t = le16_to_cpu(ep->access_time);
		d = le16_to_cpu(ep->access_date);
		tz = ep->access_tz;
		break;
	}

	tp->tz.value = tz;
	tp->sec  = (t & 0x001F) << 1;
	tp->min  = (t >> 5) & 0x003F;
	tp->hour = (t >> 11);
@@ -260,14 +264,17 @@ static void exfat_set_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, u8 mode)
	case TM_CREATE:
		ep->create_time = cpu_to_le16(t);
		ep->create_date = cpu_to_le16(d);
		ep->create_tz = tp->tz.value;
		break;
	case TM_MODIFY:
		ep->modify_time = cpu_to_le16(t);
		ep->modify_date = cpu_to_le16(d);
		ep->modify_tz = tp->tz.value;
		break;
	case TM_ACCESS:
		ep->access_time = cpu_to_le16(t);
		ep->access_date = cpu_to_le16(d);
		ep->access_tz = tp->tz.value; 
		break;
	}
} /* end of exfat_set_entry_time */
@@ -285,7 +292,6 @@ static void __init_file_entry(struct super_block *sb, FILE_DENTRY_T *ep, u32 typ
	exfat_set_entry_time((DENTRY_T *) ep, tp, TM_ACCESS);
	ep->create_time_ms = 0;
	ep->modify_time_ms = 0;
	ep->access_time_ms = 0;
} /* end of __init_file_entry */

static void __init_strm_entry(STRM_DENTRY_T *ep, u8 flags, u32 start_clu, u64 size)
+1 −0
Original line number Diff line number Diff line
@@ -441,6 +441,7 @@ static void fat_get_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, u8 mode)
		break;
	}

	tp->tz.value = 0x00;
	tp->sec  = (t & 0x001F) << 1;
	tp->min  = (t >> 5) & 0x003F;
	tp->hour = (t >> 11);
Loading