Commit 661975dc authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix

missing le16_to_cpu() in debugging printk
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f50a21f7
......@@ -787,9 +787,9 @@ typedef struct smb_com_rename_req {
typedef struct smb_com_copy_req {
struct smb_hdr hdr; /* wct = 3 */
__u16 Tid2;
__u16 OpenFunction;
__u16 Flags;
__u16 ByteCount;
__le16 OpenFunction;
__le16 Flags;
__le16 ByteCount;
__u8 BufferFormat; /* 4 = ASCII or Unicode */
unsigned char OldFileName[1];
/* followed by __u8 BufferFormat2 */
......@@ -798,7 +798,7 @@ typedef struct smb_com_copy_req {
typedef struct smb_com_copy_rsp {
struct smb_hdr hdr; /* wct = 1 */
__u16 CopyCount; /* number of files copied */
__le16 CopyCount; /* number of files copied */
__u16 ByteCount; /* may be zero */
__u8 BufferFormat; /* 0x04 - only present if errored file follows */
unsigned char ErrorFileName[1]; /* only present if error in copy */
......
......@@ -1056,6 +1056,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
COPY_RSP *pSMBr = NULL;
int bytes_returned;
int name_len, name_len2;
__u16 count;
cFYI(1, ("In CIFSSMBCopy"));
copyRetry:
......@@ -1067,9 +1068,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
pSMB->BufferFormat = 0x04;
pSMB->Tid2 = target_tid;
if(flags & COPY_TREE)
pSMB->Flags |= COPY_TREE;
pSMB->Flags = cpu_to_le16(pSMB->Flags);
pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName,
......@@ -1098,15 +1097,15 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
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);
count = 1 /* 1st signature byte */ + name_len + name_len2;
pSMB->hdr.smb_buf_length += count;
pSMB->ByteCount = cpu_to_le16(count);
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));
rc, le16_to_cpu(pSMBr->CopyCount)));
}
if (pSMB)
cifs_buf_release(pSMB);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment