aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/netmisc.c39
-rw-r--r--fs/cifs/readdir.c18
2 files changed, 27 insertions, 30 deletions
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index fa5124d9af19..3d86b31cf2e4 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -918,45 +918,42 @@ __le64 cnvrtDosCifsTm(__u16 date, __u16 time)
918{ 918{
919 return cpu_to_le64(cifs_UnixTimeToNT(cnvrtDosUnixTm(date, time))); 919 return cpu_to_le64(cifs_UnixTimeToNT(cnvrtDosUnixTm(date, time)));
920} 920}
921
921struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) 922struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
922{ 923{
923 __u8 dt[2];
924 __u8 tm[2];
925 struct timespec ts; 924 struct timespec ts;
926 int sec,min, days, month, year; 925 int sec, min, days, month, year;
927 struct timespec removeme; /* BB removeme BB */ 926 SMB_TIME * st = (SMB_TIME *)&time;
928/* SMB_TIME * st = (SMB_TIME *)&time;*/ 927 SMB_DATE * sd = (SMB_DATE *)&date;
929 928
930 cFYI(1,("date %d time %d",date, time)); 929 cFYI(1,("date %d time %d",date, time));
931 930
932 dt[0] = date & 0xFF; 931 sec = 2 * st->TwoSeconds;
933 dt[1] = (date & 0xFF00) >> 8; 932 min = st->Minutes;
934 tm[0] = time & 0xFF; 933 if((sec > 59) || (min > 59))
935 tm[1] = (time & 0xFF00) >> 8; 934 cERROR(1,("illegal time min %d sec %d", min, sec));
936
937 sec = tm[0] & 0x1F;
938 sec = 2 * sec;
939 min = ((tm[0] >>5)&0xFF) + ((tm[1] & 0x7)<<3);
940
941 sec += (min * 60); 935 sec += (min * 60);
942 sec += 60 * 60 * ((tm[1] >> 3) &0xFF) /* hours */; 936 sec += 60 * 60 * st->Hours;
943 days = (dt[0] & 0x1F) - 1; 937 if(st->Hours > 24)
944 month = ((dt[0] >> 5) & 0xFF) + ((dt[1] & 0x1) <<3); 938 cERROR(1,("illegal hours %d",st->Hours));
945 if(month > 12) 939 days = sd->Day;
946 cERROR(1,("illegal month %d in date", month)); 940 month = sd->Month;
941 if((days > 31) || (month > 12))
942 cERROR(1,("illegal date, month %d day: %d", month, days));
947 month -= 1; 943 month -= 1;
948 days += total_days_of_prev_months[month]; 944 days += total_days_of_prev_months[month];
949 days += 3653; /* account for difference in days between 1980 and 1970 */ 945 days += 3653; /* account for difference in days between 1980 and 1970 */
950 year = (dt[1]>>1) & 0xFF; 946 year = sd->Year;
951 days += year * 365; 947 days += year * 365;
952 days += (year/4); /* leap year */ 948 days += (year/4); /* leap year */
953 /* adjust for leap year where we are still before leap day */ 949 /* adjust for leap year where we are still before leap day */
954 days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0); 950 days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);
955 sec += 24 * 60 * 60 * days; 951 sec += 24 * 60 * 60 * days;
956 952
957 removeme = CURRENT_TIME; /* BB removeme BB */
958 ts.tv_sec = sec; 953 ts.tv_sec = sec;
959 954
955 /* cFYI(1,("sec after cnvrt dos to unix time %d",sec)); */
956
960 ts.tv_nsec = 0; 957 ts.tv_nsec = 0;
961 return ts; 958 return ts;
962} 959}
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index b0e5db10664c..81e7b2e5fb4d 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -139,19 +139,19 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
139 FIND_FILE_STANDARD_INFO * pfindData = 139 FIND_FILE_STANDARD_INFO * pfindData =
140 (FIND_FILE_STANDARD_INFO *)buf; 140 (FIND_FILE_STANDARD_INFO *)buf;
141 141
142/* ts = cnvrtDosUnixTm( 142 tmp_inode->i_mtime = cnvrtDosUnixTm(
143 le16_to_cpu(pfindData->LastWriteDate), 143 le16_to_cpu(pfindData->LastWriteDate),
144 le16_to_cpu(pfindData->LastWriteTime));*/ 144 le16_to_cpu(pfindData->LastWriteTime));
145 tmp_inode->i_atime = cnvrtDosUnixTm(
146 le16_to_cpu(pfindData->LastAccessDate),
147 le16_to_cpu(pfindData->LastAccessTime));
148 tmp_inode->i_ctime = cnvrtDosUnixTm(
149 le16_to_cpu(pfindData->LastWriteDate),
150 le16_to_cpu(pfindData->LastWriteTime));
151
145 attr = le16_to_cpu(pfindData->Attributes); 152 attr = le16_to_cpu(pfindData->Attributes);
146 allocation_size = le32_to_cpu(pfindData->AllocationSize); 153 allocation_size = le32_to_cpu(pfindData->AllocationSize);
147 end_of_file = le32_to_cpu(pfindData->DataSize); 154 end_of_file = le32_to_cpu(pfindData->DataSize);
148 /* do not need to use current_fs_time helper function since
149 time not stored for this case so atime can not "go backwards"
150 by pulling newer older from disk when inode refrenshed */
151 tmp_inode->i_atime = CURRENT_TIME;
152 /* tmp_inode->i_mtime = BB FIXME - add dos time handling
153 tmp_inode->i_ctime = 0; BB FIXME */
154
155 } 155 }
156 156
157 /* Linux can not store file creation time unfortunately so ignore it */ 157 /* Linux can not store file creation time unfortunately so ignore it */