diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-05-04 08:05:26 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-05-19 10:10:53 -0400 |
commit | 820a803ffac3ef591e597bc107f8e289a823a29c (patch) | |
tree | 246451259a7efc5027647de639a69cb121b889e0 /fs/cifs/cifspdu.h | |
parent | 0e6e37a7a81f370d9aafafdf88aca13977f6fb5f (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/cifspdu.h')
-rw-r--r-- | fs/cifs/cifspdu.h | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index eac95e26d696..291d735abaac 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -435,36 +435,18 @@ struct smb_hdr { | |||
435 | /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ | 435 | /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ |
436 | #define pByteArea(smb_var) (BCC(smb_var) + 2) | 436 | #define pByteArea(smb_var) (BCC(smb_var) + 2) |
437 | 437 | ||
438 | /* get the converted ByteCount for a SMB packet and return it */ | ||
439 | static inline __u16 | ||
440 | get_bcc(struct smb_hdr *hdr) | ||
441 | { | ||
442 | __u16 *bc_ptr = (__u16 *)BCC(hdr); | ||
443 | |||
444 | return get_unaligned(bc_ptr); | ||
445 | } | ||
446 | |||
447 | /* get the unconverted ByteCount for a SMB packet and return it */ | 438 | /* get the unconverted ByteCount for a SMB packet and return it */ |
448 | static inline __u16 | 439 | static inline __u16 |
449 | get_bcc_le(struct smb_hdr *hdr) | 440 | get_bcc(struct smb_hdr *hdr) |
450 | { | 441 | { |
451 | __le16 *bc_ptr = (__le16 *)BCC(hdr); | 442 | __le16 *bc_ptr = (__le16 *)BCC(hdr); |
452 | 443 | ||
453 | return get_unaligned_le16(bc_ptr); | 444 | return get_unaligned_le16(bc_ptr); |
454 | } | 445 | } |
455 | 446 | ||
456 | /* set the ByteCount for a SMB packet in host-byte order */ | ||
457 | static inline void | ||
458 | put_bcc(__u16 count, struct smb_hdr *hdr) | ||
459 | { | ||
460 | __u16 *bc_ptr = (__u16 *)BCC(hdr); | ||
461 | |||
462 | put_unaligned(count, bc_ptr); | ||
463 | } | ||
464 | |||
465 | /* set the ByteCount for a SMB packet in little-endian */ | 447 | /* set the ByteCount for a SMB packet in little-endian */ |
466 | static inline void | 448 | static inline void |
467 | put_bcc_le(__u16 count, struct smb_hdr *hdr) | 449 | put_bcc(__u16 count, struct smb_hdr *hdr) |
468 | { | 450 | { |
469 | __le16 *bc_ptr = (__le16 *)BCC(hdr); | 451 | __le16 *bc_ptr = (__le16 *)BCC(hdr); |
470 | 452 | ||