Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
f818dd55
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 1 年 前同步成功
通知
152
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f818dd55
编写于
1月 19, 2009
作者:
S
Steve French
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CIFS] some cleanup to dir.c prior to addition of posix_open
Signed-off-by:
N
Steve French
<
sfrench@us.ibm.com
>
上级
42c24544
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
25 deletion
+31
-25
fs/cifs/dir.c
fs/cifs/dir.c
+31
-25
未找到文件。
fs/cifs/dir.c
浏览文件 @
f818dd55
...
...
@@ -129,6 +129,17 @@ build_path_from_dentry(struct dentry *direntry)
return
full_path
;
}
static
void
setup_cifs_dentry
(
struct
cifsTconInfo
*
tcon
,
struct
dentry
*
direntry
,
struct
inode
*
newinode
)
{
if
(
tcon
->
nocase
)
direntry
->
d_op
=
&
cifs_ci_dentry_ops
;
else
direntry
->
d_op
=
&
cifs_dentry_ops
;
d_instantiate
(
direntry
,
newinode
);
}
/* Inode operations in similar order to how they appear in Linux file fs.h */
int
...
...
@@ -139,14 +150,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
int
xid
;
int
create_options
=
CREATE_NOT_DIR
;
int
oplock
=
0
;
/* BB below access is too much for the mknod to request */
int
desiredAccess
=
GENERIC_READ
|
GENERIC_WRITE
;
__u16
fileHandle
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pT
con
;
struct
cifsTconInfo
*
t
con
;
char
*
full_path
=
NULL
;
FILE_ALL_INFO
*
buf
=
NULL
;
struct
inode
*
newinode
=
NULL
;
struct
cifsFileInfo
*
pCifsFile
=
NULL
;
struct
cifsInodeInfo
*
pCifsInode
;
int
disposition
=
FILE_OVERWRITE_IF
;
bool
write_only
=
false
;
...
...
@@ -154,7 +165,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
xid
=
GetXid
();
cifs_sb
=
CIFS_SB
(
inode
->
i_sb
);
pT
con
=
cifs_sb
->
tcon
;
t
con
=
cifs_sb
->
tcon
;
full_path
=
build_path_from_dentry
(
direntry
);
if
(
full_path
==
NULL
)
{
...
...
@@ -162,6 +173,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
return
-
ENOMEM
;
}
mode
&=
~
current
->
fs
->
umask
;
if
(
nd
&&
(
nd
->
flags
&
LOOKUP_OPEN
))
{
int
oflags
=
nd
->
intent
.
open
.
flags
;
...
...
@@ -196,17 +209,15 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
return
-
ENOMEM
;
}
mode
&=
~
current
->
fs
->
umask
;
/*
* if we're not using unix extensions, see if we need to set
* ATTR_READONLY on the create call
*/
if
(
!
pT
con
->
unix_ext
&&
(
mode
&
S_IWUGO
)
==
0
)
if
(
!
t
con
->
unix_ext
&&
(
mode
&
S_IWUGO
)
==
0
)
create_options
|=
CREATE_OPTION_READONLY
;
if
(
cifs_sb
->
tcon
->
ses
->
capabilities
&
CAP_NT_SMBS
)
rc
=
CIFSSMBOpen
(
xid
,
pT
con
,
full_path
,
disposition
,
rc
=
CIFSSMBOpen
(
xid
,
t
con
,
full_path
,
disposition
,
desiredAccess
,
create_options
,
&
fileHandle
,
&
oplock
,
buf
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
...
...
@@ -215,7 +226,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
if
(
rc
==
-
EIO
)
{
/* old server, retry the open legacy style */
rc
=
SMBLegacyOpen
(
xid
,
pT
con
,
full_path
,
disposition
,
rc
=
SMBLegacyOpen
(
xid
,
t
con
,
full_path
,
disposition
,
desiredAccess
,
create_options
,
&
fileHandle
,
&
oplock
,
buf
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
...
...
@@ -225,7 +236,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
}
else
{
/* If Open reported that we actually created a file
then we now have to set the mode if possible */
if
((
pT
con
->
unix_ext
)
&&
(
oplock
&
CIFS_CREATE_ACTION
))
{
if
((
t
con
->
unix_ext
)
&&
(
oplock
&
CIFS_CREATE_ACTION
))
{
struct
cifs_unix_set_info_args
args
=
{
.
mode
=
mode
,
.
ctime
=
NO_CHANGE_64
,
...
...
@@ -244,20 +255,20 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
args
.
uid
=
NO_CHANGE_64
;
args
.
gid
=
NO_CHANGE_64
;
}
CIFSSMBUnixSetInfo
(
xid
,
pT
con
,
full_path
,
&
args
,
CIFSSMBUnixSetInfo
(
xid
,
t
con
,
full_path
,
&
args
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
{
/* BB implement mode setting via Windows security
descriptors e.g. */
/* CIFSSMBWinSetPerms(xid,
pT
con,path,mode,-1,-1,nls);*/
/* CIFSSMBWinSetPerms(xid,
t
con,path,mode,-1,-1,nls);*/
/* Could set r/o dos attribute if mode & 0222 == 0 */
}
/* server might mask mode so we have to query for it */
if
(
pT
con
->
unix_ext
)
if
(
t
con
->
unix_ext
)
rc
=
cifs_get_inode_info_unix
(
&
newinode
,
full_path
,
inode
->
i_sb
,
xid
);
else
{
...
...
@@ -283,22 +294,17 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
}
if
(
rc
!=
0
)
{
cFYI
(
1
,
(
"Create worked but get_inode_info failed rc = %d"
,
rc
));
}
else
{
if
(
pTcon
->
nocase
)
direntry
->
d_op
=
&
cifs_ci_dentry_ops
;
else
direntry
->
d_op
=
&
cifs_dentry_ops
;
d_instantiate
(
direntry
,
newinode
);
}
cFYI
(
1
,
(
"Create worked, get_inode_info failed rc = %d"
,
rc
));
}
else
setup_cifs_dentry
(
tcon
,
direntry
,
newinode
);
if
((
nd
==
NULL
/* nfsd case - nfs srv does not set nd */
)
||
(
!
(
nd
->
flags
&
LOOKUP_OPEN
)))
{
/* mknod case - do not leave file open */
CIFSSMBClose
(
xid
,
pT
con
,
fileHandle
);
CIFSSMBClose
(
xid
,
t
con
,
fileHandle
);
}
else
if
(
newinode
)
{
pCifsFile
=
struct
cifsFileInfo
*
pCifsFile
=
kzalloc
(
sizeof
(
struct
cifsFileInfo
),
GFP_KERNEL
);
if
(
pCifsFile
==
NULL
)
...
...
@@ -316,7 +322,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
/* set the following in open now
pCifsFile->pfile = file; */
write_lock
(
&
GlobalSMBSeslock
);
list_add
(
&
pCifsFile
->
tlist
,
&
pT
con
->
openFileList
);
list_add
(
&
pCifsFile
->
tlist
,
&
t
con
->
openFileList
);
pCifsInode
=
CIFS_I
(
newinode
);
if
(
pCifsInode
)
{
/* if readable file instance put first in list*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录