summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-11 16:28:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:30 -0500
commit921fbb25eb4a6097a1e960abadc4dc4b11d32cf6 (patch)
treebb264bb4be703daea814ee143cb19a031bac93e4 /source3/smbd
parentef6c3a3c7a62188112561781449f05e25ccee58e (diff)
downloadsamba-921fbb25eb4a6097a1e960abadc4dc4b11d32cf6.tar.gz
samba-921fbb25eb4a6097a1e960abadc4dc4b11d32cf6.tar.bz2
samba-921fbb25eb4a6097a1e960abadc4dc4b11d32cf6.zip
r24332: schedule_aio_read_and_X does not need InBuf/OutBuf
(This used to be commit 9ad91bd20592850d7b6393e1ac7f0e0919d69668)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/aio.c25
-rw-r--r--source3/smbd/reply.c15
2 files changed, 19 insertions, 21 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 0ba857e2e5..49855796b7 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -51,7 +51,7 @@ static struct aio_extra *aio_list_head;
static struct aio_extra *create_aio_ex_read(files_struct *fsp,
size_t buflen,
uint16 mid,
- const char *inbuf)
+ const uint8 *inbuf)
{
struct aio_extra *aio_ex = SMB_MALLOC_P(struct aio_extra);
@@ -203,8 +203,7 @@ void initialize_async_io_handler(void)
*****************************************************************************/
BOOL schedule_aio_read_and_X(connection_struct *conn,
- char *inbuf, char *outbuf,
- int length, int len_outbuf,
+ struct smb_request *req,
files_struct *fsp, SMB_OFF_T startpos,
size_t smb_maxcnt)
{
@@ -224,7 +223,7 @@ BOOL schedule_aio_read_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;
}
@@ -236,18 +235,19 @@ BOOL schedule_aio_read_and_X(connection_struct *conn,
return False;
}
- /* The following is safe from integer wrap as we've already
- checked smb_maxcnt is 128k or less. */
- bufsize = PTR_DIFF(smb_buf(outbuf),outbuf) + smb_maxcnt;
+ /* The following is safe from integer wrap as we've already checked
+ smb_maxcnt is 128k or less. Wct is 12 for read replies */
+
+ bufsize = smb_size + 12 * 2 + smb_maxcnt;
- if ((aio_ex = create_aio_ex_read(fsp, bufsize,
- SVAL(inbuf,smb_mid), inbuf)) == NULL) {
+ if (!(aio_ex = create_aio_ex_read(fsp, bufsize, req->mid,
+ req->inbuf))) {
DEBUG(10,("schedule_aio_read_and_X: malloc fail.\n"));
return False;
}
- /* Copy the SMB header already setup in outbuf. */
- memcpy(aio_ex->outbuf, outbuf, smb_buf(outbuf) - outbuf);
+ construct_reply_common((char *)req->inbuf, aio_ex->outbuf);
+ set_message((char *)req->inbuf, aio_ex->outbuf, 12, 0, True);
SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */
a = &aio_ex->acb;
@@ -625,8 +625,7 @@ int process_aio_queue(void)
}
BOOL schedule_aio_read_and_X(connection_struct *conn,
- char *inbuf, char *outbuf,
- int length, int len_outbuf,
+ struct smb_request *req,
files_struct *fsp, SMB_OFF_T startpos,
size_t smb_maxcnt)
{
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 7b981e1c8a..a62b54550e 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2960,22 +2960,21 @@ void reply_read_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);
+ if (!big_readX
+ && schedule_aio_read_and_X(conn, req, fsp, startpos, smb_maxcnt)) {
END_PROFILE(SMBreadX);
+ reply_post_legacy(req, -1);
return;
}
- set_message(inbuf,outbuf,12,0,True);
-
- if (!big_readX
- && schedule_aio_read_and_X(conn, inbuf, outbuf, length, bufsize,
- fsp, startpos, smb_maxcnt)) {
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
END_PROFILE(SMBreadX);
- reply_post_legacy(req, -1);
return;
}
+ set_message(inbuf,outbuf,12,0,True);
+
nread = send_file_readX(conn, inbuf, outbuf, length, bufsize, fsp,
startpos, smb_maxcnt);
/* Only call chain_reply if not an error. */