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 */
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 */
COPY_RSP *pSMBr = NULL;
int bytes_returned;
int name_len, name_len2;
+ __u16 count;
cFYI(1, ("In CIFSSMBCopy"));
copyRetry:
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,
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);