summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@www.linux.org.uk>2004-09-21 02:52:24 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-09-21 02:52:24 -0700
commit53cb19c46568c821448022aebb0566f02640ea23 (patch)
treeda28d5bf3fda55b41a22f1507580a21f58699b8f
parentbc837c2a27d95056cbf81c15cd0f5eb61a8e8e21 (diff)
[PATCH] cifs: annotate smb_hdr
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/cifs/cifsencrypt.c4
-rw-r--r--fs/cifs/cifspdu.h10
-rw-r--r--fs/cifs/cifssmb.c8
-rw-r--r--fs/cifs/connect.c2
-rw-r--r--fs/cifs/misc.c7
-rw-r--r--fs/cifs/netmisc.c11
-rw-r--r--fs/cifs/transport.c5
7 files changed, 15 insertions, 32 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index c93a6c2a23c7..123b64eafc33 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -107,13 +107,11 @@ int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key,
if(memcmp(cifs_pdu->Signature.SecuritySignature,"BSRSPYL ",8)==0)
cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command));
- expected_sequence_number = cpu_to_le32(expected_sequence_number);
-
/* save off the origiginal signature so we can modify the smb and check
its signature against what the server sent */
memcpy(server_response_sig,cifs_pdu->Signature.SecuritySignature,8);
- cifs_pdu->Signature.Sequence.SequenceNumber = expected_sequence_number;
+ cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(expected_sequence_number);
cifs_pdu->Signature.Sequence.Reserved = 0;
rc = cifs_calculate_signature(cifs_pdu, mac_key,
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index e821c34813ee..a6cd2b9afe1a 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -303,23 +303,23 @@ struct smb_hdr {
struct {
__u8 ErrorClass;
__u8 Reserved;
- __u16 Error; /* note: treated as little endian (le) on wire */
+ __le16 Error;
} DosError;
- __u32 CifsError; /* note: le */
+ __le32 CifsError;
} Status;
__u8 Flags;
__u16 Flags2; /* note: le */
- __u16 PidHigh; /* note: le */
+ __le16 PidHigh;
union {
struct {
- __u32 SequenceNumber; /* le */
+ __le32 SequenceNumber; /* le */
__u32 Reserved; /* zero */
} Sequence;
__u8 SecuritySignature[8]; /* le */
} Signature;
__u8 pad[2];
__u16 Tid;
- __u16 Pid; /* note: le */
+ __le16 Pid;
__u16 Uid;
__u16 Mid;
__u8 WordCount;
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 28626b5e50d5..de302b51a462 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2612,7 +2612,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
struct file_end_of_file_info *parm_data;
int rc = 0;
int bytes_returned = 0;
- __u32 tmp;
__u16 params, param_offset, offset, byte_count, count;
cFYI(1, ("SetFileSize (via SetFileInfo) %lld",
@@ -2622,11 +2621,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
if (rc)
return rc;
- tmp = cpu_to_le32(pid_of_opener); /* override pid of current process
- so network fid will be valid */
- pSMB->hdr.Pid = tmp & 0xFFFF;
- tmp >>= 16;
- pSMB->hdr.PidHigh = tmp & 0xFFFF;
+ pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
+ pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
params = 6;
pSMB->MaxSetupCount = 0;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e67f9c1c25e2..ce5f365aac7d 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2158,7 +2158,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
&bytes_returned, 1);
if (smb_buffer_response->Status.CifsError ==
- (NT_STATUS_MORE_PROCESSING_REQUIRED))
+ cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))
rc = 0;
if (rc) {
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index ca63201a7571..92a6ef7831d5 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -189,7 +189,6 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
)
{
int i;
- __u32 tmp;
struct list_head* temp_item;
struct cifsSesInfo * ses;
char *temp = (char *) buffer;
@@ -211,10 +210,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
buffer->Command = smb_command;
buffer->Flags = 0x00; /* case sensitive */
buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES;
- tmp = cpu_to_le32(current->tgid);
- buffer->Pid = tmp & 0xFFFF;
- tmp >>= 16;
- buffer->PidHigh = tmp & 0xFFFF;
+ buffer->Pid = cpu_to_le16((__u16)current->tgid);
+ buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16));
spin_lock(&GlobalMid_Lock);
GlobalMid++;
buffer->Mid = GlobalMid;
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index c8d1a56fee57..865bbf6524c3 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -810,16 +810,13 @@ map_smb_to_linux_error(struct smb_hdr *smb)
if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
/* translate the newer STATUS codes to old style errors and then to POSIX errors */
- smb->Status.CifsError = le32_to_cpu(smb->Status.CifsError);
+ __u32 err = le32_to_cpu(smb->Status.CifsError);
if(cifsFYI)
- cifs_print_status(smb->Status.CifsError);
- ntstatus_to_dos(smb->Status.CifsError, &smberrclass,
- &smberrcode);
+ cifs_print_status(err);
+ ntstatus_to_dos(err, &smberrclass, &smberrcode);
} else {
smberrclass = smb->Status.DosError.ErrorClass;
- smb->Status.DosError.Error =
- le16_to_cpu(smb->Status.DosError.Error);
- smberrcode = smb->Status.DosError.Error;
+ smberrcode = le16_to_cpu(smb->Status.DosError.Error);
}
/* old style errors */
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 188d48c2a97f..9e1842b5ff34 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -385,11 +385,6 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
if (out_buf->smb_buf_length > 12)
out_buf->Flags2 = le16_to_cpu(out_buf->Flags2);
- if (out_buf->smb_buf_length > 28)
- out_buf->Pid = le16_to_cpu(out_buf->Pid);
- if (out_buf->smb_buf_length > 28)
- out_buf->PidHigh =
- le16_to_cpu(out_buf->PidHigh);
*pbytes_returned = out_buf->smb_buf_length;