Commit 533f90af authored by Steve French's avatar Steve French

[CIFS] Fix old DOS time conversion to handle timezone

Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 70903ca0
...@@ -942,7 +942,7 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) ...@@ -942,7 +942,7 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
cERROR(1,("illegal date, month %d day: %d", month, days)); cERROR(1,("illegal date, month %d day: %d", month, days));
month -= 1; month -= 1;
days += total_days_of_prev_months[month]; days += total_days_of_prev_months[month];
days += 3653; /* account for difference in days between 1980 and 1970 */ days += 3652; /* account for difference in days between 1980 and 1970 */
year = sd->Year; year = sd->Year;
days += year * 365; days += year * 365;
days += (year/4); /* leap year */ days += (year/4); /* leap year */
......
...@@ -106,6 +106,17 @@ static int construct_dentry(struct qstr *qstring, struct file *file, ...@@ -106,6 +106,17 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
return rc; return rc;
} }
static void AdjustForTZ(struct cifsTconInfo * tcon, struct inode * inode)
{
if((tcon) && (tcon->ses) && (tcon->ses->server)) {
inode->i_ctime.tv_sec += tcon->ses->server.timeAdj;
inode->i_mtime.tv_sec += tcon->ses->server.timeAdj;
inode->i_atime.tv_sec += tcon->ses->server.timeAdj;
}
return;
}
static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
char * buf, int *pobject_type, int isNewInode) char * buf, int *pobject_type, int isNewInode)
{ {
...@@ -148,7 +159,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, ...@@ -148,7 +159,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
tmp_inode->i_ctime = cnvrtDosUnixTm( tmp_inode->i_ctime = cnvrtDosUnixTm(
le16_to_cpu(pfindData->LastWriteDate), le16_to_cpu(pfindData->LastWriteDate),
le16_to_cpu(pfindData->LastWriteTime)); le16_to_cpu(pfindData->LastWriteTime));
AdjustForTZ(cifs_sb->tcon, tmp_inode);
attr = le16_to_cpu(pfindData->Attributes); attr = le16_to_cpu(pfindData->Attributes);
allocation_size = le32_to_cpu(pfindData->AllocationSize); allocation_size = le32_to_cpu(pfindData->AllocationSize);
end_of_file = le32_to_cpu(pfindData->DataSize); end_of_file = le32_to_cpu(pfindData->DataSize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment