mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r24279: Remove reply_prep_legacy from reply_write_and_X
This commit is contained in:
parent
de143d5fa6
commit
f18b7a9a28
@ -284,11 +284,10 @@ BOOL schedule_aio_read_and_X(connection_struct *conn,
|
||||
*****************************************************************************/
|
||||
|
||||
BOOL schedule_aio_write_and_X(connection_struct *conn,
|
||||
char *inbuf, char *outbuf,
|
||||
int length, int len_outbuf,
|
||||
files_struct *fsp, char *data,
|
||||
SMB_OFF_T startpos,
|
||||
size_t numtowrite)
|
||||
struct smb_request *req,
|
||||
files_struct *fsp, char *data,
|
||||
SMB_OFF_T startpos,
|
||||
size_t numtowrite)
|
||||
{
|
||||
struct aio_extra *aio_ex;
|
||||
SMB_STRUCT_AIOCB *a;
|
||||
@ -306,7 +305,7 @@ BOOL schedule_aio_write_and_X(connection_struct *conn,
|
||||
|
||||
/* Only do this on non-chained and non-chaining reads not using the
|
||||
* write cache. */
|
||||
if (chain_size !=0 || (CVAL(inbuf,smb_vwv0) != 0xFF)
|
||||
if (chain_size !=0 || (CVAL(req->inbuf,smb_vwv0) != 0xFF)
|
||||
|| (lp_write_cache_size(SNUM(conn)) != 0) ) {
|
||||
return False;
|
||||
}
|
||||
@ -320,23 +319,25 @@ BOOL schedule_aio_write_and_X(connection_struct *conn,
|
||||
"(mid = %u)\n",
|
||||
fsp->fsp_name, (double)startpos,
|
||||
(unsigned int)numtowrite,
|
||||
(unsigned int)SVAL(inbuf,smb_mid) ));
|
||||
(unsigned int)req->mid ));
|
||||
return False;
|
||||
}
|
||||
|
||||
inbufsize = smb_len(inbuf) + 4;
|
||||
outbufsize = smb_len(outbuf) + 4;
|
||||
inbufsize = smb_len(req->inbuf) + 4;
|
||||
reply_outbuf(req, 6, 0);
|
||||
outbufsize = smb_len(req->outbuf) + 4;
|
||||
if (!(aio_ex = create_aio_ex_write(fsp, inbufsize, outbufsize,
|
||||
SVAL(inbuf,smb_mid)))) {
|
||||
req->mid))) {
|
||||
DEBUG(0,("schedule_aio_write_and_X: malloc fail.\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* Copy the SMB header already setup in outbuf. */
|
||||
memcpy(aio_ex->inbuf, inbuf, inbufsize);
|
||||
memcpy(aio_ex->inbuf, req->inbuf, inbufsize);
|
||||
|
||||
/* Copy the SMB header already setup in outbuf. */
|
||||
memcpy(aio_ex->outbuf, outbuf, outbufsize);
|
||||
memcpy(aio_ex->outbuf, req->outbuf, outbufsize);
|
||||
TALLOC_FREE(req->outbuf);
|
||||
SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */
|
||||
|
||||
a = &aio_ex->acb;
|
||||
@ -344,7 +345,7 @@ BOOL schedule_aio_write_and_X(connection_struct *conn,
|
||||
/* Now set up the aio record for the write call. */
|
||||
|
||||
a->aio_fildes = fsp->fh->fd;
|
||||
a->aio_buf = aio_ex->inbuf + (PTR_DIFF(data, inbuf));
|
||||
a->aio_buf = aio_ex->inbuf + (PTR_DIFF(data, req->inbuf));
|
||||
a->aio_nbytes = numtowrite;
|
||||
a->aio_offset = startpos;
|
||||
a->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
|
||||
@ -633,11 +634,10 @@ BOOL schedule_aio_read_and_X(connection_struct *conn,
|
||||
}
|
||||
|
||||
BOOL schedule_aio_write_and_X(connection_struct *conn,
|
||||
char *inbuf, char *outbuf,
|
||||
int length, int len_outbuf,
|
||||
files_struct *fsp, char *data,
|
||||
SMB_OFF_T startpos,
|
||||
size_t numtowrite)
|
||||
struct smb_request *req,
|
||||
files_struct *fsp, char *data,
|
||||
SMB_OFF_T startpos,
|
||||
size_t numtowrite)
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
@ -3284,9 +3284,6 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
|
||||
BOOL large_writeX;
|
||||
NTSTATUS status;
|
||||
|
||||
char *inbuf, *outbuf;
|
||||
int length, bufsize;
|
||||
|
||||
START_PROFILE(SMBwriteX);
|
||||
|
||||
if ((req->wct != 12) && (req->wct != 14)) {
|
||||
@ -3333,22 +3330,14 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) {
|
||||
reply_nterror(req, NT_STATUS_NO_MEMORY);
|
||||
END_PROFILE(SMBwriteX);
|
||||
return;
|
||||
}
|
||||
data = smb_base(req->inbuf) + smb_doff;
|
||||
|
||||
set_message(inbuf, outbuf, 6, 0, True);
|
||||
|
||||
data = smb_base(inbuf) + smb_doff;
|
||||
|
||||
if(CVAL(inbuf,smb_wct) == 14) {
|
||||
if(req->wct == 14) {
|
||||
#ifdef LARGE_SMB_OFF_T
|
||||
/*
|
||||
* This is a large offset (64 bit) write.
|
||||
*/
|
||||
startpos |= (((SMB_OFF_T)IVAL(inbuf,smb_vwv12)) << 32);
|
||||
startpos |= (((SMB_OFF_T)IVAL(req->inbuf,smb_vwv12)) << 32);
|
||||
|
||||
#else /* !LARGE_SMB_OFF_T */
|
||||
|
||||
@ -3356,7 +3345,7 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
|
||||
* Ensure we haven't been sent a >32 bit offset.
|
||||
*/
|
||||
|
||||
if(IVAL(inbuf,smb_vwv12) != 0) {
|
||||
if(IVAL(req->inbuf,smb_vwv12) != 0) {
|
||||
DEBUG(0,("reply_write_and_X - large offset (%x << 32) "
|
||||
"used and we don't support 64 bit offsets.\n",
|
||||
(unsigned int)IVAL(inbuf,smb_vwv12) ));
|
||||
@ -3368,7 +3357,7 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
|
||||
#endif /* LARGE_SMB_OFF_T */
|
||||
}
|
||||
|
||||
if (is_locked(fsp,(uint32)SVAL(inbuf,smb_pid),
|
||||
if (is_locked(fsp,(uint32)req->smbpid,
|
||||
(SMB_BIG_UINT)numtowrite,
|
||||
(SMB_BIG_UINT)startpos, WRITE_LOCK)) {
|
||||
reply_doserror(req, ERRDOS, ERRlock);
|
||||
@ -3385,14 +3374,14 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
|
||||
nwritten = 0;
|
||||
} else {
|
||||
|
||||
if (schedule_aio_write_and_X(conn, inbuf, outbuf, length, bufsize,
|
||||
fsp,data,startpos,numtowrite)) {
|
||||
reply_post_legacy(req, -1);
|
||||
if (schedule_aio_write_and_X(conn, req, fsp, data, startpos,
|
||||
numtowrite)) {
|
||||
END_PROFILE(SMBwriteX);
|
||||
return;
|
||||
}
|
||||
|
||||
nwritten = write_file(fsp,data,startpos,numtowrite);
|
||||
reply_outbuf(req, 6, 0);
|
||||
}
|
||||
|
||||
if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) {
|
||||
@ -3401,13 +3390,13 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
|
||||
return;
|
||||
}
|
||||
|
||||
SSVAL(outbuf,smb_vwv2,nwritten);
|
||||
SSVAL(req->outbuf,smb_vwv2,nwritten);
|
||||
if (large_writeX)
|
||||
SSVAL(outbuf,smb_vwv4,(nwritten>>16)&1);
|
||||
SSVAL(req->outbuf,smb_vwv4,(nwritten>>16)&1);
|
||||
|
||||
if (nwritten < (ssize_t)numtowrite) {
|
||||
SCVAL(outbuf,smb_rcls,ERRHRD);
|
||||
SSVAL(outbuf,smb_err,ERRdiskfull);
|
||||
SCVAL(req->outbuf,smb_rcls,ERRHRD);
|
||||
SSVAL(req->outbuf,smb_err,ERRdiskfull);
|
||||
}
|
||||
|
||||
DEBUG(3,("writeX fnum=%d num=%d wrote=%d\n",
|
||||
@ -3422,8 +3411,6 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
|
||||
return;
|
||||
}
|
||||
|
||||
reply_post_legacy(req, smb_len(req->outbuf));
|
||||
|
||||
END_PROFILE(SMBwriteX);
|
||||
chain_reply_new(req);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user