Commit 74f4d62a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate WRITE_{REQ,RESP}

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 23eb45fe
...@@ -670,17 +670,17 @@ typedef struct smb_com_write_req { ...@@ -670,17 +670,17 @@ typedef struct smb_com_write_req {
struct smb_hdr hdr; /* wct = 14 */ struct smb_hdr hdr; /* wct = 14 */
__u8 AndXCommand; __u8 AndXCommand;
__u8 AndXReserved; __u8 AndXReserved;
__u16 AndXOffset; __le16 AndXOffset;
__u16 Fid; __u16 Fid;
__u32 OffsetLow; __le32 OffsetLow;
__u32 Reserved; __u32 Reserved;
__u16 WriteMode; __le16 WriteMode;
__u16 Remaining; __le16 Remaining;
__u16 DataLengthHigh; __le16 DataLengthHigh;
__u16 DataLengthLow; __le16 DataLengthLow;
__u16 DataOffset; __le16 DataOffset;
__u32 OffsetHigh; __le32 OffsetHigh;
__u16 ByteCount; __le16 ByteCount;
__u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
char Data[1]; char Data[1];
} WRITE_REQ; } WRITE_REQ;
...@@ -689,10 +689,10 @@ typedef struct smb_com_write_rsp { ...@@ -689,10 +689,10 @@ typedef struct smb_com_write_rsp {
struct smb_hdr hdr; /* wct = 6 */ struct smb_hdr hdr; /* wct = 6 */
__u8 AndXCommand; __u8 AndXCommand;
__u8 AndXReserved; __u8 AndXReserved;
__u16 AndXOffset; __le16 AndXOffset;
__u16 Count; __le16 Count;
__u16 Remaining; __le16 Remaining;
__u32 Reserved; __le32 Reserved;
__u16 ByteCount; __u16 ByteCount;
} WRITE_RSP; } WRITE_RSP;
......
...@@ -739,6 +739,8 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, ...@@ -739,6 +739,8 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
WRITE_REQ *pSMB = NULL; WRITE_REQ *pSMB = NULL;
WRITE_RSP *pSMBr = NULL; WRITE_RSP *pSMBr = NULL;
int bytes_returned; int bytes_returned;
unsigned bytes_sent;
__u16 byte_count;
rc = smb_init(SMB_COM_WRITE_ANDX, 14, tcon, (void **) &pSMB, rc = smb_init(SMB_COM_WRITE_ANDX, 14, tcon, (void **) &pSMB,
(void **) &pSMBr); (void **) &pSMBr);
...@@ -753,21 +755,20 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, ...@@ -753,21 +755,20 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
pSMB->OffsetHigh = cpu_to_le32(offset >> 32); pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
pSMB->Remaining = 0; pSMB->Remaining = 0;
if (count > ((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00)) bytes_sent = (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & ~0xFF;
pSMB->DataLengthLow = if (bytes_sent > count)
(tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00; bytes_sent = count;
else
pSMB->DataLengthLow = count;
pSMB->DataLengthHigh = 0; pSMB->DataLengthHigh = 0;
pSMB->DataOffset = pSMB->DataOffset =
cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4); cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4);
memcpy(pSMB->Data,buf,pSMB->DataLengthLow); memcpy(pSMB->Data,buf,bytes_sent);
pSMB->ByteCount += pSMB->DataLengthLow + 1 /* pad */ ; byte_count = bytes_sent + 1 /* pad */ ;
pSMB->DataLengthLow = cpu_to_le16(pSMB->DataLengthLow); pSMB->DataLengthLow = cpu_to_le16(bytes_sent);
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->DataLengthHigh = 0;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, long_op); (struct smb_hdr *) pSMBr, &bytes_returned, long_op);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment