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

vlendec at samba.org vlendec at samba.org
Wed Aug 8 19:05:31 GMT 2007


Author: vlendec
Date: 2007-08-08 19:05:30 +0000 (Wed, 08 Aug 2007)
New Revision: 24279

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

Log:
Remove reply_prep_legacy from reply_write_and_X
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-08 18:40:26 UTC (rev 24278)
+++ branches/SAMBA_3_2/source/smbd/aio.c	2007-08-08 19:05:30 UTC (rev 24279)
@@ -284,11 +284,10 @@
 *****************************************************************************/
 
 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 @@
 
 	/* 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 @@
 			  "(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 @@
 	/* 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_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;
 }

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/reply.c	2007-08-08 18:40:26 UTC (rev 24278)
+++ branches/SAMBA_3_2/source/smbd/reply.c	2007-08-08 19:05:30 UTC (rev 24279)
@@ -3284,9 +3284,6 @@
 	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 @@
 		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 @@
 		 * 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 @@
 #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 @@
 		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 @@
 		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 @@
 		return;
 	}
 
-	reply_post_legacy(req, smb_len(req->outbuf));
-
 	END_PROFILE(SMBwriteX);
 	chain_reply_new(req);
 	return;



More information about the samba-cvs mailing list