svn commit: samba r3082 - in branches/SAMBA_4_0/source: include ntvfs/cifs

tridge at samba.org tridge at samba.org
Wed Oct 20 11:08:59 GMT 2004


Author: tridge
Date: 2004-10-20 11:08:58 +0000 (Wed, 20 Oct 2004)
New Revision: 3082

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=3082&nolog=1

Log:
added a "cifs:mapgeneric" option, which tells the cifs backend to use
the ntvfs_generic mapping functions rather than sending the exact
function asked for. This allows the generic mapping functions to be
tested by comparing the behaviour of smbtorture against two cifs
backend shares, one using "cifs:mapgeneric = true" and the other
"cifs:mapgeneric = False"


Modified:
   branches/SAMBA_4_0/source/include/smb_interfaces.h
   branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c


Changeset:
Modified: branches/SAMBA_4_0/source/include/smb_interfaces.h
===================================================================
--- branches/SAMBA_4_0/source/include/smb_interfaces.h	2004-10-20 08:28:31 UTC (rev 3081)
+++ branches/SAMBA_4_0/source/include/smb_interfaces.h	2004-10-20 11:08:58 UTC (rev 3082)
@@ -1327,7 +1327,8 @@
 
 
 enum smb_write_level {RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE, 
-		      RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE, RAW_WRITE_SPLWRITE};
+		      RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE, 
+		      RAW_WRITE_SPLWRITE};
 
 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
 

Modified: branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c	2004-10-20 08:28:31 UTC (rev 3081)
+++ branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c	2004-10-20 11:08:58 UTC (rev 3082)
@@ -32,7 +32,7 @@
 	struct smbcli_tree *tree;
 	struct smbcli_transport *transport;
 	struct smbsrv_tcon *tcon;
-	/*const struct ntvfs_ops *ops;*/
+	BOOL map_generic;
 };
 
 
@@ -152,6 +152,8 @@
 	private->transport->event.ctx = event_context_merge(tcon->smb_conn->connection->event.ctx,
 							    private->transport->event.ctx);
 	talloc_reference(private, private->transport->event.ctx);
+	private->map_generic = lp_parm_bool(req->tcon->service, 
+					    "cifs", "mapgeneric", False);
 
 	return NT_STATUS_OK;
 }
@@ -370,6 +372,11 @@
 	struct cvfs_private *private = ntvfs->private_data;
 	struct smbcli_request *c_req;
 
+	if (io->generic.level != RAW_OPEN_GENERIC &&
+	    private->map_generic) {
+		return ntvfs_map_open(req, io, ntvfs);
+	}
+
 	if (!(req->control_flags & REQ_CONTROL_MAY_ASYNC)) {
 		return smb_raw_open(private->tree, req, io);
 	}
@@ -461,6 +468,11 @@
 	struct cvfs_private *private = ntvfs->private_data;
 	struct smbcli_request *c_req;
 
+	if (rd->generic.level != RAW_READ_GENERIC &&
+	    private->map_generic) {
+		return ntvfs_map_read(req, rd, ntvfs);
+	}
+
 	if (!(req->control_flags & REQ_CONTROL_MAY_ASYNC)) {
 		return smb_raw_read(private->tree, rd);
 	}
@@ -490,6 +502,11 @@
 	struct cvfs_private *private = ntvfs->private_data;
 	struct smbcli_request *c_req;
 
+	if (wr->generic.level != RAW_WRITE_GENERIC &&
+	    private->map_generic) {
+		return ntvfs_map_write(req, wr, ntvfs);
+	}
+
 	if (!(req->control_flags & REQ_CONTROL_MAY_ASYNC)) {
 		return smb_raw_write(private->tree, wr);
 	}
@@ -503,18 +520,36 @@
   seek in a file
 */
 static NTSTATUS cvfs_seek(struct ntvfs_module_context *ntvfs, 
-				struct smbsrv_request *req, struct smb_seek *io)
+			  struct smbsrv_request *req, struct smb_seek *io)
 {
-	return NT_STATUS_NOT_SUPPORTED;
+	struct cvfs_private *private = ntvfs->private_data;
+	struct smbcli_request *c_req;
+
+	if (!(req->control_flags & REQ_CONTROL_MAY_ASYNC)) {
+		return smb_raw_seek(private->tree, io);
+	}
+
+	c_req = smb_raw_seek_send(private->tree, io);
+
+	SIMPLE_ASYNC_TAIL;
 }
 
 /*
   flush a file
 */
 static NTSTATUS cvfs_flush(struct ntvfs_module_context *ntvfs, 
-				struct smbsrv_request *req, struct smb_flush *io)
+			   struct smbsrv_request *req, struct smb_flush *io)
 {
-	return NT_STATUS_OK;
+	struct cvfs_private *private = ntvfs->private_data;
+	struct smbcli_request *c_req;
+
+	if (!(req->control_flags & REQ_CONTROL_MAY_ASYNC)) {
+		return smb_raw_flush(private->tree, io);
+	}
+
+	c_req = smb_raw_flush_send(private->tree, io);
+
+	SIMPLE_ASYNC_TAIL;
 }
 
 /*
@@ -526,6 +561,11 @@
 	struct cvfs_private *private = ntvfs->private_data;
 	struct smbcli_request *c_req;
 
+	if (io->generic.level != RAW_CLOSE_GENERIC &&
+	    private->map_generic) {
+		return ntvfs_map_close(req, io, ntvfs);
+	}
+
 	if (!(req->control_flags & REQ_CONTROL_MAY_ASYNC)) {
 		return smb_raw_close(private->tree, io);
 	}
@@ -582,6 +622,11 @@
 	struct cvfs_private *private = ntvfs->private_data;
 	struct smbcli_request *c_req;
 
+	if (lck->generic.level != RAW_LOCK_GENERIC &&
+	    private->map_generic) {
+		return ntvfs_map_lock(req, lck, ntvfs);
+	}
+
 	if (!(req->control_flags & REQ_CONTROL_MAY_ASYNC)) {
 		return smb_raw_lock(private->tree, lck);
 	}



More information about the samba-cvs mailing list