svn commit: samba r24332 - in branches/SAMBA_3_2/source/smbd: .

vlendec at samba.org vlendec at samba.org
Sat Aug 11 16:28:10 GMT 2007


Author: vlendec
Date: 2007-08-11 16:28:10 +0000 (Sat, 11 Aug 2007)
New Revision: 24332

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24332

Log:
schedule_aio_read_and_X does not need InBuf/OutBuf

Modified:
   branches/SAMBA_3_2/source/smbd/aio.c
   branches/SAMBA_3_2/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/aio.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/aio.c	2007-08-11 16:20:27 UTC (rev 24331)
+++ branches/SAMBA_3_2/source/smbd/aio.c	2007-08-11 16:28:10 UTC (rev 24332)
@@ -51,7 +51,7 @@
 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 @@
 *****************************************************************************/
 
 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 @@
 
 	/* 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 @@
 		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 */
 
-	if ((aio_ex = create_aio_ex_read(fsp, bufsize,
-					 SVAL(inbuf,smb_mid), inbuf)) == NULL) {
+	bufsize = smb_size + 12 * 2 + smb_maxcnt;
+
+	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 @@
 }
 
 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)
 {

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/reply.c	2007-08-11 16:20:27 UTC (rev 24331)
+++ branches/SAMBA_3_2/source/smbd/reply.c	2007-08-11 16:28:10 UTC (rev 24332)
@@ -2960,22 +2960,21 @@
 		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. */



More information about the samba-cvs mailing list