Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
1bd5bbcb
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1bd5bbcb
编写于
9月 28, 2006
作者:
S
Steve French
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CIFS] Legacy time handling for Win9x and OS/2 part 1
Signed-off-by:
N
Steve French
<
sfrench@us.ibm.com
>
上级
0889a944
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
80 addition
and
4 deletion
+80
-4
fs/cifs/cifsproto.h
fs/cifs/cifsproto.h
+3
-0
fs/cifs/cifssmb.c
fs/cifs/cifssmb.c
+9
-1
fs/cifs/inode.c
fs/cifs/inode.c
+5
-2
fs/cifs/link.c
fs/cifs/link.c
+5
-1
fs/cifs/netmisc.c
fs/cifs/netmisc.c
+51
-0
fs/cifs/readdir.c
fs/cifs/readdir.c
+7
-0
未找到文件。
fs/cifs/cifsproto.h
浏览文件 @
1bd5bbcb
...
...
@@ -80,6 +80,9 @@ extern struct oplock_q_entry * AllocOplockQEntry(struct inode *, u16,
extern
void
DeleteOplockQEntry
(
struct
oplock_q_entry
*
);
extern
struct
timespec
cifs_NTtimeToUnix
(
u64
/* utc nanoseconds since 1601 */
);
extern
u64
cifs_UnixTimeToNT
(
struct
timespec
);
extern
__le64
cnvrtDosCifsTm
(
__u16
date
,
__u16
time
);
extern
struct
timespec
cnvrtDosUnixTm
(
__u16
date
,
__u16
time
);
extern
int
cifs_get_inode_info
(
struct
inode
**
pinode
,
const
unsigned
char
*
search_path
,
FILE_ALL_INFO
*
pfile_info
,
...
...
fs/cifs/cifssmb.c
浏览文件 @
1bd5bbcb
...
...
@@ -2856,7 +2856,6 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
return
rc
;
}
/* Legacy Query Path Information call for lookup to old servers such
as Win9x/WinME */
int
SMBQueryInformation
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
...
...
@@ -2898,7 +2897,16 @@ int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
if
(
rc
)
{
cFYI
(
1
,
(
"Send error in QueryInfo = %d"
,
rc
));
}
else
if
(
pFinfo
)
{
/* decode response */
struct
timespec
ts
;
__u32
time
=
le32_to_cpu
(
pSMBr
->
last_write_time
);
/* BB FIXME - add time zone adjustment BB */
memset
(
pFinfo
,
0
,
sizeof
(
FILE_ALL_INFO
));
ts
.
tv_nsec
=
0
;
ts
.
tv_sec
=
time
;
/* decode time fields */
pFinfo
->
ChangeTime
=
cifs_UnixTimeToNT
(
ts
);
pFinfo
->
LastWriteTime
=
pFinfo
->
ChangeTime
;
pFinfo
->
LastAccessTime
=
0
;
pFinfo
->
AllocationSize
=
cpu_to_le64
(
le32_to_cpu
(
pSMBr
->
size
));
pFinfo
->
EndOfFile
=
pFinfo
->
AllocationSize
;
...
...
fs/cifs/inode.c
浏览文件 @
1bd5bbcb
...
...
@@ -432,8 +432,11 @@ int cifs_get_inode_info(struct inode **pinode,
(pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/
/* Linux can not store file creation time so ignore it */
inode
->
i_atime
=
cifs_NTtimeToUnix
(
le64_to_cpu
(
pfindData
->
LastAccessTime
));
if
(
pfindData
->
LastAccessTime
)
inode
->
i_atime
=
cifs_NTtimeToUnix
(
le64_to_cpu
(
pfindData
->
LastAccessTime
));
else
/* do not need to use current_fs_time - time not stored */
inode
->
i_atime
=
CURRENT_TIME
;
inode
->
i_mtime
=
cifs_NTtimeToUnix
(
le64_to_cpu
(
pfindData
->
LastWriteTime
));
inode
->
i_ctime
=
...
...
fs/cifs/link.c
浏览文件 @
1bd5bbcb
...
...
@@ -254,7 +254,11 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
tmpbuffer
,
len
-
1
,
cifs_sb
->
local_nls
);
else
{
else
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_UNX_EMUL
)
{
cERROR
(
1
,(
"SFU style symlinks not implemented yet"
));
/* add open and read as in fs/cifs/inode.c */
}
else
{
rc
=
CIFSSMBOpen
(
xid
,
pTcon
,
full_path
,
FILE_OPEN
,
GENERIC_READ
,
OPEN_REPARSE_POINT
,
&
fid
,
&
oplock
,
NULL
,
cifs_sb
->
local_nls
,
...
...
fs/cifs/netmisc.c
浏览文件 @
1bd5bbcb
...
...
@@ -909,3 +909,54 @@ cifs_UnixTimeToNT(struct timespec t)
/* Convert to 100ns intervals and then add the NTFS time offset. */
return
(
u64
)
t
.
tv_sec
*
10000000
+
t
.
tv_nsec
/
100
+
NTFS_TIME_OFFSET
;
}
static
int
total_days_of_prev_months
[]
=
{
0
,
31
,
59
,
90
,
120
,
151
,
181
,
212
,
243
,
273
,
304
,
334
};
__le64
cnvrtDosCifsTm
(
__u16
date
,
__u16
time
)
{
return
cpu_to_le64
(
cifs_UnixTimeToNT
(
cnvrtDosUnixTm
(
date
,
time
)));
}
struct
timespec
cnvrtDosUnixTm
(
__u16
date
,
__u16
time
)
{
__u8
dt
[
2
];
__u8
tm
[
2
];
struct
timespec
ts
;
int
sec
,
min
,
days
,
month
,
year
;
struct
timespec
removeme
;
/* BB removeme BB */
/* SMB_TIME * st = (SMB_TIME *)&time;*/
cFYI
(
1
,(
"date %d time %d"
,
date
,
time
));
dt
[
0
]
=
date
&
0xFF
;
dt
[
1
]
=
(
date
&
0xFF00
)
>>
8
;
tm
[
0
]
=
time
&
0xFF
;
tm
[
1
]
=
(
time
&
0xFF00
)
>>
8
;
sec
=
tm
[
0
]
&
0x1F
;
sec
=
2
*
sec
;
min
=
((
tm
[
0
]
>>
5
)
&
0xFF
)
+
((
tm
[
1
]
&
0x7
)
<<
3
);
sec
+=
(
min
*
60
);
sec
+=
60
*
60
*
((
tm
[
1
]
>>
3
)
&
0xFF
)
/* hours */
;
days
=
(
dt
[
0
]
&
0x1F
)
-
1
;
month
=
((
dt
[
0
]
>>
5
)
&
0xFF
)
+
((
dt
[
1
]
&
0x1
)
<<
3
);
if
(
month
>
12
)
cERROR
(
1
,(
"illegal month %d in date"
,
month
));
month
-=
1
;
days
+=
total_days_of_prev_months
[
month
];
days
+=
3653
;
/* account for difference in days between 1980 and 1970 */
year
=
(
dt
[
1
]
>>
1
)
&
0xFF
;
days
+=
year
*
365
;
days
+=
(
year
/
4
);
/* leap year */
/* adjust for leap year where we are still before leap day */
days
-=
((
year
&
0x03
)
==
0
)
&&
(
month
<
2
?
1
:
0
);
sec
+=
24
*
60
*
60
*
days
;
removeme
=
CURRENT_TIME
;
/* BB removeme BB */
ts
.
tv_sec
=
sec
;
ts
.
tv_nsec
=
0
;
return
ts
;
}
fs/cifs/readdir.c
浏览文件 @
1bd5bbcb
...
...
@@ -135,12 +135,19 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
tmp_inode
->
i_ctime
=
cifs_NTtimeToUnix
(
le64_to_cpu
(
pfindData
->
ChangeTime
));
}
else
{
/* legacy, OS2 and DOS style */
/* struct timespec ts;*/
FIND_FILE_STANDARD_INFO
*
pfindData
=
(
FIND_FILE_STANDARD_INFO
*
)
buf
;
/* ts = cnvrtDosUnixTm(
le16_to_cpu(pfindData->LastWriteDate),
le16_to_cpu(pfindData->LastWriteTime));*/
attr
=
le16_to_cpu
(
pfindData
->
Attributes
);
allocation_size
=
le32_to_cpu
(
pfindData
->
AllocationSize
);
end_of_file
=
le32_to_cpu
(
pfindData
->
DataSize
);
/* do not need to use current_fs_time helper function since
time not stored for this case so atime can not "go backwards"
by pulling newer older from disk when inode refrenshed */
tmp_inode
->
i_atime
=
CURRENT_TIME
;
/* tmp_inode->i_mtime = BB FIXME - add dos time handling
tmp_inode->i_ctime = 0; BB FIXME */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录