Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exfat: return actual access time instead of zero #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion exfat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,14 @@ s32 ffsGetStat(struct inode *inode, DIR_ENTRY_T *info)
info->ModifyTimestamp.Second = tm.sec;
info->ModifyTimestamp.MilliSecond = 0;

memset((char *) &info->AccessTimestamp, 0, sizeof(DATE_TIME_T));
p_fs->fs_func->get_entry_time(ep, &tm, TM_ACCESS);
info->AccessTimestamp.Year = tm.year;
info->AccessTimestamp.Month = tm.mon;
info->AccessTimestamp.Day = tm.day;
info->AccessTimestamp.Hour = tm.hour;
info->AccessTimestamp.Minute = tm.min;
info->AccessTimestamp.Second = tm.sec;
info->AccessTimestamp.MilliSecond = 0;

*(uni_name.name) = 0x0;
/* XXX this is very bad for exfat cuz name is already included in es.
Expand Down Expand Up @@ -1271,6 +1278,13 @@ s32 ffsSetStat(struct inode *inode, DIR_ENTRY_T *info)
tm.year = info->ModifyTimestamp.Year;
p_fs->fs_func->set_entry_time(ep, &tm, TM_MODIFY);

tm.sec = info->AccessTimestamp.Second;
tm.min = info->AccessTimestamp.Minute;
tm.hour = info->AccessTimestamp.Hour;
tm.day = info->AccessTimestamp.Day;
tm.mon = info->AccessTimestamp.Month;
tm.year = info->AccessTimestamp.Year;
p_fs->fs_func->set_entry_time(ep, &tm, TM_ACCESS);

p_fs->fs_func->set_entry_size(ep2, info->Size);

Expand Down Expand Up @@ -2750,6 +2764,9 @@ void fat_get_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, u8 mode)
t = GET16_A(ep->modify_time);
d = GET16_A(ep->modify_date);
break;
case TM_ACCESS:
d = GET16_A(ep->access_date);
break;
}

tp->sec = (t & 0x001F) << 1;
Expand Down Expand Up @@ -2805,6 +2822,9 @@ void fat_set_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, u8 mode)
SET16_A(ep->modify_time, t);
SET16_A(ep->modify_date, d);
break;
case TM_ACCESS:
SET16_A(ep->access_date, d);
break;
}
} /* end of fat_set_entry_time */

Expand Down