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
ee922546
Commit
ee922546
authored
May 03, 2004
by
Steve French
Committed by
Steve French
May 03, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add smb copy function
parent
2ef7ad37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
5 deletions
+76
-5
fs/cifs/cifsproto.h
fs/cifs/cifsproto.h
+5
-4
fs/cifs/cifssmb.c
fs/cifs/cifssmb.c
+71
-1
No files found.
fs/cifs/cifsproto.h
View file @
ee922546
...
...
@@ -239,8 +239,9 @@ extern int CIFSSMBSeek(int xid,
int
whence
,
unsigned
long
offset
,
long
long
*
newoffset
);
extern
int
CIFSSMBCopy
(
int
xid
,
struct
cifsTconInfo
*
ftcon
,
char
*
fromName
,
struct
cifsTconInfo
*
ttcon
,
char
*
toName
,
int
ofun
,
int
flags
);
struct
cifsTconInfo
*
source_tcon
,
const
char
*
fromName
,
const
__u16
target_tid
,
const
char
*
toName
,
const
int
flags
,
const
struct
nls_table
*
nls_codepage
);
#endif
/* _CIFSPROTO_H */
fs/cifs/cifssmb.c
View file @
ee922546
...
...
@@ -892,7 +892,6 @@ CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
}
pSMB
->
ByteCount
=
1
/* 1st signature byte */
+
name_len
+
name_len2
;
/* we could also set search attributes but not needed */
pSMB
->
hdr
.
smb_buf_length
+=
pSMB
->
ByteCount
;
pSMB
->
ByteCount
=
cpu_to_le16
(
pSMB
->
ByteCount
);
...
...
@@ -986,6 +985,77 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
return
rc
;
}
int
CIFSSMBCopy
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
char
*
fromName
,
const
__u16
target_tid
,
const
char
*
toName
,
const
int
flags
,
const
struct
nls_table
*
nls_codepage
)
{
int
rc
=
0
;
COPY_REQ
*
pSMB
=
NULL
;
COPY_RSP
*
pSMBr
=
NULL
;
int
bytes_returned
;
int
name_len
,
name_len2
;
cFYI
(
1
,
(
"In CIFSSMBCopy"
));
copyRetry:
rc
=
smb_init
(
SMB_COM_COPY
,
1
,
tcon
,
(
void
**
)
&
pSMB
,
(
void
**
)
&
pSMBr
);
if
(
rc
)
return
rc
;
pSMB
->
BufferFormat
=
0x04
;
pSMB
->
Tid2
=
target_tid
;
if
(
flags
&
COPY_TREE
)
pSMB
->
Flags
|=
COPY_TREE
;
pSMB
->
Flags
=
cpu_to_le16
(
pSMB
->
Flags
);
if
(
pSMB
->
hdr
.
Flags2
&
SMBFLG2_UNICODE
)
{
name_len
=
cifs_strtoUCS
((
wchar_t
*
)
pSMB
->
OldFileName
,
fromName
,
530
/* find define for this maxpathcomponent */
,
nls_codepage
);
name_len
++
;
/* trailing null */
name_len
*=
2
;
pSMB
->
OldFileName
[
name_len
]
=
0x04
;
/* pad */
/* protocol requires ASCII signature byte on Unicode string */
pSMB
->
OldFileName
[
name_len
+
1
]
=
0x00
;
name_len2
=
cifs_strtoUCS
((
wchar_t
*
)
&
pSMB
->
OldFileName
[
name_len
+
2
],
toName
,
530
,
nls_codepage
);
name_len2
+=
1
/* trailing null */
+
1
/* Signature word */
;
name_len2
*=
2
;
/* convert to bytes */
}
else
{
/* BB improve the check for buffer overruns BB */
name_len
=
strnlen
(
fromName
,
530
);
name_len
++
;
/* trailing null */
strncpy
(
pSMB
->
OldFileName
,
fromName
,
name_len
);
name_len2
=
strnlen
(
toName
,
530
);
name_len2
++
;
/* trailing null */
pSMB
->
OldFileName
[
name_len
]
=
0x04
;
/* 2nd buffer format */
strncpy
(
&
pSMB
->
OldFileName
[
name_len
+
1
],
toName
,
name_len2
);
name_len2
++
;
/* trailing null */
name_len2
++
;
/* signature byte */
}
pSMB
->
ByteCount
=
1
/* 1st signature byte */
+
name_len
+
name_len2
;
pSMB
->
hdr
.
smb_buf_length
+=
pSMB
->
ByteCount
;
pSMB
->
ByteCount
=
cpu_to_le16
(
pSMB
->
ByteCount
);
rc
=
SendReceive
(
xid
,
tcon
->
ses
,
(
struct
smb_hdr
*
)
pSMB
,
(
struct
smb_hdr
*
)
pSMBr
,
&
bytes_returned
,
0
);
if
(
rc
)
{
cFYI
(
1
,
(
"Send error in copy = %d with %d files copied"
,
rc
,
pSMBr
->
CopyCount
));
}
if
(
pSMB
)
cifs_buf_release
(
pSMB
);
if
(
rc
==
-
EAGAIN
)
goto
copyRetry
;
return
rc
;
}
int
CIFSUnixCreateSymLink
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
...
...
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