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 { ...@@ -787,9 +787,9 @@ typedef struct smb_com_rename_req {
typedef struct smb_com_copy_req { typedef struct smb_com_copy_req {
struct smb_hdr hdr; /* wct = 3 */ struct smb_hdr hdr; /* wct = 3 */
__u16 Tid2; __u16 Tid2;
__u16 OpenFunction; __le16 OpenFunction;
__u16 Flags; __le16 Flags;
__u16 ByteCount; __le16 ByteCount;
__u8 BufferFormat; /* 4 = ASCII or Unicode */ __u8 BufferFormat; /* 4 = ASCII or Unicode */
unsigned char OldFileName[1]; unsigned char OldFileName[1];
/* followed by __u8 BufferFormat2 */ /* followed by __u8 BufferFormat2 */
...@@ -798,7 +798,7 @@ typedef struct smb_com_copy_req { ...@@ -798,7 +798,7 @@ typedef struct smb_com_copy_req {
typedef struct smb_com_copy_rsp { typedef struct smb_com_copy_rsp {
struct smb_hdr hdr; /* wct = 1 */ struct smb_hdr hdr; /* wct = 1 */
__u16 CopyCount; /* number of files copied */ __le16 CopyCount; /* number of files copied */
__u16 ByteCount; /* may be zero */ __u16 ByteCount; /* may be zero */
__u8 BufferFormat; /* 0x04 - only present if errored file follows */ __u8 BufferFormat; /* 0x04 - only present if errored file follows */
unsigned char ErrorFileName[1]; /* only present if error in copy */ unsigned char ErrorFileName[1]; /* only present if error in copy */
......
...@@ -1056,6 +1056,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, ...@@ -1056,6 +1056,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
COPY_RSP *pSMBr = NULL; COPY_RSP *pSMBr = NULL;
int bytes_returned; int bytes_returned;
int name_len, name_len2; int name_len, name_len2;
__u16 count;
cFYI(1, ("In CIFSSMBCopy")); cFYI(1, ("In CIFSSMBCopy"));
copyRetry: copyRetry:
...@@ -1067,9 +1068,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, ...@@ -1067,9 +1068,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
pSMB->BufferFormat = 0x04; pSMB->BufferFormat = 0x04;
pSMB->Tid2 = target_tid; pSMB->Tid2 = target_tid;
if(flags & COPY_TREE) pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
pSMB->Flags |= COPY_TREE;
pSMB->Flags = cpu_to_le16(pSMB->Flags);
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName,
...@@ -1098,15 +1097,15 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, ...@@ -1098,15 +1097,15 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
name_len2++; /* signature byte */ name_len2++; /* signature byte */
} }
pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; count = 1 /* 1st signature byte */ + name_len + name_len2;
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->hdr.smb_buf_length += count;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->ByteCount = cpu_to_le16(count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) { if (rc) {
cFYI(1, ("Send error in copy = %d with %d files copied", cFYI(1, ("Send error in copy = %d with %d files copied",
rc, pSMBr->CopyCount)); rc, le16_to_cpu(pSMBr->CopyCount)));
} }
if (pSMB) if (pSMB)
cifs_buf_release(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