summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-20 11:08:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:01:57 -0500
commit4b14c8a09f009e2fae6af601fb3effd200c06196 (patch)
tree4921e84c794896ae56ee46971ceb7ffb6b1d9a50 /source4
parent20d17b80571f0d0265c99c1ccdc21910c2eed043 (diff)
downloadsamba-4b14c8a09f009e2fae6af601fb3effd200c06196.tar.gz
samba-4b14c8a09f009e2fae6af601fb3effd200c06196.tar.bz2
samba-4b14c8a09f009e2fae6af601fb3effd200c06196.zip
r3082: 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" (This used to be commit c240c6bca5e10f1acbff45b0ed41c4c1ebcaae96)
Diffstat (limited to 'source4')
-rw-r--r--source4/include/smb_interfaces.h3
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c55
2 files changed, 52 insertions, 6 deletions
diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h
index 7a369a04cb..7f0133bbd7 100644
--- a/source4/include/smb_interfaces.h
+++ b/source4/include/smb_interfaces.h
@@ -1327,7 +1327,8 @@ union smb_read {
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
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index feacc063b4..07cfb912bd 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -32,7 +32,7 @@ struct cvfs_private {
struct smbcli_tree *tree;
struct smbcli_transport *transport;
struct smbsrv_tcon *tcon;
- /*const struct ntvfs_ops *ops;*/
+ BOOL map_generic;
};
@@ -152,6 +152,8 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
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 @@ static NTSTATUS cvfs_open(struct ntvfs_module_context *ntvfs,
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 @@ static NTSTATUS cvfs_read(struct ntvfs_module_context *ntvfs,
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 @@ static NTSTATUS cvfs_write(struct ntvfs_module_context *ntvfs,
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 @@ static NTSTATUS cvfs_write(struct ntvfs_module_context *ntvfs,
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 @@ static NTSTATUS cvfs_close(struct ntvfs_module_context *ntvfs,
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 @@ static NTSTATUS cvfs_lock(struct ntvfs_module_context *ntvfs,
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);
}