aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-05-04 08:05:26 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-19 10:10:53 -0400
commit820a803ffac3ef591e597bc107f8e289a823a29c (patch)
tree246451259a7efc5027647de639a69cb121b889e0 /fs/cifs/transport.c
parent0e6e37a7a81f370d9aafafdf88aca13977f6fb5f (diff)
cifs: keep BCC in little-endian format
This is the same patch as originally posted, just with some merge conflicts fixed up... Currently, the ByteCount is usually converted to host-endian on receive. This is confusing however, as we need to keep two sets of routines for accessing it, and keep track of when to use each routine. Munging received packets like this also limits when the signature can be calulated. Simplify the code by keeping the received ByteCount in little-endian format. This allows us to eliminate a set of routines for accessing it and we can now drop the *_le suffixes from the accessor functions since that's now implied. While we're at it, switch all of the places that read the ByteCount directly to use the get_bcc inline which should also clean up some unaligned accesses. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 19df0e5af122..f2513fb8c391 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -484,7 +484,7 @@ send_nt_cancel(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
484 in_buf->smb_buf_length = cpu_to_be32(sizeof(struct smb_hdr) - 4 + 2); 484 in_buf->smb_buf_length = cpu_to_be32(sizeof(struct smb_hdr) - 4 + 2);
485 in_buf->Command = SMB_COM_NT_CANCEL; 485 in_buf->Command = SMB_COM_NT_CANCEL;
486 in_buf->WordCount = 0; 486 in_buf->WordCount = 0;
487 put_bcc_le(0, in_buf); 487 put_bcc(0, in_buf);
488 488
489 mutex_lock(&server->srv_mutex); 489 mutex_lock(&server->srv_mutex);
490 rc = cifs_sign_smb(in_buf, server, &mid->sequence_number); 490 rc = cifs_sign_smb(in_buf, server, &mid->sequence_number);
@@ -644,11 +644,6 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
644 rc = map_smb_to_linux_error(midQ->resp_buf, 644 rc = map_smb_to_linux_error(midQ->resp_buf,
645 flags & CIFS_LOG_ERROR); 645 flags & CIFS_LOG_ERROR);
646 646
647 /* convert ByteCount if necessary */
648 if (receive_len >= sizeof(struct smb_hdr) - 4
649 /* do not count RFC1001 header */ +
650 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ )
651 put_bcc(get_bcc_le(midQ->resp_buf), midQ->resp_buf);
652 if ((flags & CIFS_NO_RESP) == 0) 647 if ((flags & CIFS_NO_RESP) == 0)
653 midQ->resp_buf = NULL; /* mark it so buf will 648 midQ->resp_buf = NULL; /* mark it so buf will
654 not be freed by 649 not be freed by
@@ -798,12 +793,6 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
798 793
799 /* BB special case reconnect tid and uid here? */ 794 /* BB special case reconnect tid and uid here? */
800 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ ); 795 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ );
801
802 /* convert ByteCount if necessary */
803 if (receive_len >= sizeof(struct smb_hdr) - 4
804 /* do not count RFC1001 header */ +
805 (2 * out_buf->WordCount) + 2 /* bcc */ )
806 put_bcc(get_bcc_le(midQ->resp_buf), midQ->resp_buf);
807 } else { 796 } else {
808 rc = -EIO; 797 rc = -EIO;
809 cERROR(1, "Bad MID state?"); 798 cERROR(1, "Bad MID state?");
@@ -1012,12 +1001,6 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
1012 /* BB special case reconnect tid and uid here? */ 1001 /* BB special case reconnect tid and uid here? */
1013 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ ); 1002 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ );
1014 1003
1015 /* convert ByteCount if necessary */
1016 if (receive_len >= sizeof(struct smb_hdr) - 4
1017 /* do not count RFC1001 header */ +
1018 (2 * out_buf->WordCount) + 2 /* bcc */ )
1019 put_bcc(get_bcc_le(out_buf), out_buf);
1020
1021out: 1004out:
1022 delete_mid(midQ); 1005 delete_mid(midQ);
1023 if (rstart && rc == -EACCES) 1006 if (rstart && rc == -EACCES)