Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
f818dd55
Commit
f818dd55
authored
Jan 19, 2009
by
Steve French
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CIFS] some cleanup to dir.c prior to addition of posix_open
Signed-off-by:
Steve French
<
sfrench@us.ibm.com
>
parent
42c24544
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
25 deletions
+31
-25
fs/cifs/dir.c
fs/cifs/dir.c
+31
-25
No files found.
fs/cifs/dir.c
View file @
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*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment