aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-08-30 23:58:07 -0400
committerSteve French <sfrench@us.ibm.com>2005-08-30 23:58:07 -0400
commit1c9551878c4629ca78dfe12ed23b9dc8d97770cc (patch)
tree4d9df5ad22d88dd0f62ab9f44d761f1df6a77d55 /fs/cifs/cifssmb.c
parentcb8be64084e6294fcb9e558188fe104050b94f0b (diff)
[CIFS] Add support for legacy servers part 4
Fix WriteX support for old servers which do not support large files. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index c8ae3ef422ba..74733851cfad 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1082,12 +1082,20 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
1082 int rc = -EACCES; 1082 int rc = -EACCES;
1083 WRITE_REQ *pSMB = NULL; 1083 WRITE_REQ *pSMB = NULL;
1084 WRITE_RSP *pSMBr = NULL; 1084 WRITE_RSP *pSMBr = NULL;
1085 int bytes_returned; 1085 int bytes_returned, wct;
1086 __u32 bytes_sent; 1086 __u32 bytes_sent;
1087 __u16 byte_count; 1087 __u16 byte_count;
1088 1088
1089 /* cFYI(1,("write at %lld %d bytes",offset,count));*/ 1089 /* cFYI(1,("write at %lld %d bytes",offset,count));*/
1090 rc = smb_init(SMB_COM_WRITE_ANDX, 14, tcon, (void **) &pSMB, 1090 if(tcon->ses == NULL)
1091 return -ECONNABORTED;
1092
1093 if(tcon->ses->capabilities & CAP_LARGE_FILES)
1094 wct = 14;
1095 else
1096 wct = 12;
1097
1098 rc = smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB,
1091 (void **) &pSMBr); 1099 (void **) &pSMBr);
1092 if (rc) 1100 if (rc)
1093 return rc; 1101 return rc;
@@ -1098,7 +1106,11 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
1098 pSMB->AndXCommand = 0xFF; /* none */ 1106 pSMB->AndXCommand = 0xFF; /* none */
1099 pSMB->Fid = netfid; 1107 pSMB->Fid = netfid;
1100 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); 1108 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1101 pSMB->OffsetHigh = cpu_to_le32(offset >> 32); 1109 if(wct == 14)
1110 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1111 else if((offset >> 32) > 0) /* can not handle this big offset for old */
1112 return -EIO;
1113
1102 pSMB->Reserved = 0xFFFFFFFF; 1114 pSMB->Reserved = 0xFFFFFFFF;
1103 pSMB->WriteMode = 0; 1115 pSMB->WriteMode = 0;
1104 pSMB->Remaining = 0; 1116 pSMB->Remaining = 0;
@@ -1135,7 +1147,14 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
1135 pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF); 1147 pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF);
1136 pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16); 1148 pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16);
1137 pSMB->hdr.smb_buf_length += bytes_sent+1; 1149 pSMB->hdr.smb_buf_length += bytes_sent+1;
1138 pSMB->ByteCount = cpu_to_le16(byte_count); 1150
1151 if(wct == 14)
1152 pSMB->ByteCount = cpu_to_le16(byte_count);
1153 else { /* old style write has byte count 4 bytes earlier */
1154 struct smb_com_writex_req * pSMBW =
1155 (struct smb_com_writex_req *)pSMB;
1156 pSMBW->ByteCount = cpu_to_le16(byte_count);
1157 }
1139 1158
1140 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1159 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1141 (struct smb_hdr *) pSMBr, &bytes_returned, long_op); 1160 (struct smb_hdr *) pSMBr, &bytes_returned, long_op);