1
0
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:
Volker Lendecke 2007-08-08 19:05:30 +00:00 committed by Gerald (Jerry) Carter
parent de143d5fa6
commit f18b7a9a28
2 changed files with 30 additions and 43 deletions

View File

@ -284,11 +284,10 @@ BOOL schedule_aio_read_and_X(connection_struct *conn,
*****************************************************************************/ *****************************************************************************/
BOOL schedule_aio_write_and_X(connection_struct *conn, BOOL schedule_aio_write_and_X(connection_struct *conn,
char *inbuf, char *outbuf, struct smb_request *req,
int length, int len_outbuf, files_struct *fsp, char *data,
files_struct *fsp, char *data, SMB_OFF_T startpos,
SMB_OFF_T startpos, size_t numtowrite)
size_t numtowrite)
{ {
struct aio_extra *aio_ex; struct aio_extra *aio_ex;
SMB_STRUCT_AIOCB *a; 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 /* Only do this on non-chained and non-chaining reads not using the
* write cache. */ * 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) ) { || (lp_write_cache_size(SNUM(conn)) != 0) ) {
return False; return False;
} }
@ -320,23 +319,25 @@ BOOL schedule_aio_write_and_X(connection_struct *conn,
"(mid = %u)\n", "(mid = %u)\n",
fsp->fsp_name, (double)startpos, fsp->fsp_name, (double)startpos,
(unsigned int)numtowrite, (unsigned int)numtowrite,
(unsigned int)SVAL(inbuf,smb_mid) )); (unsigned int)req->mid ));
return False; return False;
} }
inbufsize = smb_len(inbuf) + 4; inbufsize = smb_len(req->inbuf) + 4;
outbufsize = smb_len(outbuf) + 4; reply_outbuf(req, 6, 0);
outbufsize = smb_len(req->outbuf) + 4;
if (!(aio_ex = create_aio_ex_write(fsp, inbufsize, outbufsize, 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")); DEBUG(0,("schedule_aio_write_and_X: malloc fail.\n"));
return False; return False;
} }
/* Copy the SMB header already setup in outbuf. */ /* 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. */ /* 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. */ SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */
a = &aio_ex->acb; 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. */ /* Now set up the aio record for the write call. */
a->aio_fildes = fsp->fh->fd; 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_nbytes = numtowrite;
a->aio_offset = startpos; a->aio_offset = startpos;
a->aio_sigevent.sigev_notify = SIGEV_SIGNAL; 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, BOOL schedule_aio_write_and_X(connection_struct *conn,
char *inbuf, char *outbuf, struct smb_request *req,
int length, int len_outbuf, files_struct *fsp, char *data,
files_struct *fsp, char *data, SMB_OFF_T startpos,
SMB_OFF_T startpos, size_t numtowrite)
size_t numtowrite)
{ {
return False; return False;
} }

View File

@ -3284,9 +3284,6 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
BOOL large_writeX; BOOL large_writeX;
NTSTATUS status; NTSTATUS status;
char *inbuf, *outbuf;
int length, bufsize;
START_PROFILE(SMBwriteX); START_PROFILE(SMBwriteX);
if ((req->wct != 12) && (req->wct != 14)) { if ((req->wct != 12) && (req->wct != 14)) {
@ -3333,22 +3330,14 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
return; return;
} }
if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) { data = smb_base(req->inbuf) + smb_doff;
reply_nterror(req, NT_STATUS_NO_MEMORY);
END_PROFILE(SMBwriteX);
return;
}
set_message(inbuf, outbuf, 6, 0, True); if(req->wct == 14) {
data = smb_base(inbuf) + smb_doff;
if(CVAL(inbuf,smb_wct) == 14) {
#ifdef LARGE_SMB_OFF_T #ifdef LARGE_SMB_OFF_T
/* /*
* This is a large offset (64 bit) write. * 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 */ #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. * 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) " DEBUG(0,("reply_write_and_X - large offset (%x << 32) "
"used and we don't support 64 bit offsets.\n", "used and we don't support 64 bit offsets.\n",
(unsigned int)IVAL(inbuf,smb_vwv12) )); (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 */ #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)numtowrite,
(SMB_BIG_UINT)startpos, WRITE_LOCK)) { (SMB_BIG_UINT)startpos, WRITE_LOCK)) {
reply_doserror(req, ERRDOS, ERRlock); reply_doserror(req, ERRDOS, ERRlock);
@ -3385,14 +3374,14 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
nwritten = 0; nwritten = 0;
} else { } else {
if (schedule_aio_write_and_X(conn, inbuf, outbuf, length, bufsize, if (schedule_aio_write_and_X(conn, req, fsp, data, startpos,
fsp,data,startpos,numtowrite)) { numtowrite)) {
reply_post_legacy(req, -1);
END_PROFILE(SMBwriteX); END_PROFILE(SMBwriteX);
return; return;
} }
nwritten = write_file(fsp,data,startpos,numtowrite); nwritten = write_file(fsp,data,startpos,numtowrite);
reply_outbuf(req, 6, 0);
} }
if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 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; return;
} }
SSVAL(outbuf,smb_vwv2,nwritten); SSVAL(req->outbuf,smb_vwv2,nwritten);
if (large_writeX) if (large_writeX)
SSVAL(outbuf,smb_vwv4,(nwritten>>16)&1); SSVAL(req->outbuf,smb_vwv4,(nwritten>>16)&1);
if (nwritten < (ssize_t)numtowrite) { if (nwritten < (ssize_t)numtowrite) {
SCVAL(outbuf,smb_rcls,ERRHRD); SCVAL(req->outbuf,smb_rcls,ERRHRD);
SSVAL(outbuf,smb_err,ERRdiskfull); SSVAL(req->outbuf,smb_err,ERRdiskfull);
} }
DEBUG(3,("writeX fnum=%d num=%d wrote=%d\n", 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; return;
} }
reply_post_legacy(req, smb_len(req->outbuf));
END_PROFILE(SMBwriteX); END_PROFILE(SMBwriteX);
chain_reply_new(req); chain_reply_new(req);
return; return;