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 {
struct smb_hdr hdr; /* wct = 14 */
__u8 AndXCommand;
__u8 AndXReserved;
__u16 AndXOffset;
__le16 AndXOffset;
__u16 Fid;
__u32 OffsetLow;
__le32 OffsetLow;
__u32 Reserved;
__u16 WriteMode;
__u16 Remaining;
__u16 DataLengthHigh;
__u16 DataLengthLow;
__u16 DataOffset;
__u32 OffsetHigh;
__u16 ByteCount;
__le16 WriteMode;
__le16 Remaining;
__le16 DataLengthHigh;
__le16 DataLengthLow;
__le16 DataOffset;
__le32 OffsetHigh;
__le16 ByteCount;
__u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
char Data[1];
} WRITE_REQ;
......@@ -689,10 +689,10 @@ typedef struct smb_com_write_rsp {
struct smb_hdr hdr; /* wct = 6 */
__u8 AndXCommand;
__u8 AndXReserved;
__u16 AndXOffset;
__u16 Count;
__u16 Remaining;
__u32 Reserved;
__le16 AndXOffset;
__le16 Count;
__le16 Remaining;
__le32 Reserved;
__u16 ByteCount;
} WRITE_RSP;
......
......@@ -739,6 +739,8 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
WRITE_REQ *pSMB = NULL;
WRITE_RSP *pSMBr = NULL;
int bytes_returned;
unsigned bytes_sent;
__u16 byte_count;
rc = smb_init(SMB_COM_WRITE_ANDX, 14, tcon, (void **) &pSMB,
(void **) &pSMBr);
......@@ -753,21 +755,20 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
pSMB->Remaining = 0;
if (count > ((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00))
pSMB->DataLengthLow =
(tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00;
else
pSMB->DataLengthLow = count;
bytes_sent = (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & ~0xFF;
if (bytes_sent > count)
bytes_sent = count;
pSMB->DataLengthHigh = 0;
pSMB->DataOffset =
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 */ ;
pSMB->DataLengthLow = cpu_to_le16(pSMB->DataLengthLow);
pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
byte_count = bytes_sent + 1 /* pad */ ;
pSMB->DataLengthLow = cpu_to_le16(bytes_sent);
pSMB->DataLengthHigh = 0;
pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(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