]> git.hungrycats.org Git - linux/commitdiff
[PATCH] cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix
authorAlexander Viro <viro@www.linux.org.uk>
Tue, 21 Sep 2004 09:49:05 +0000 (02:49 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 21 Sep 2004 09:49:05 +0000 (02:49 -0700)
missing le16_to_cpu() in debugging printk

Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/cifs/cifspdu.h
fs/cifs/cifssmb.c

index 7ede48570cf47a11d916367a93dd43b2d2d9c607..b48703f00d01f278c6bfaf2020cf38a88d442124 100644 (file)
@@ -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 */
index a2b115686f36286c35ea066f28fc1b0ac05d275e..6f3b8baf16e0bea0523001ad008ab74a681efc2e 100644 (file)
@@ -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 @@ 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, 
@@ -1098,15 +1097,15 @@ copyRetry:
                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);