summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-09-29 13:17:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:30 -0500
commitdcad0f6fd492506efd9a69b4e32c7bbfa5da90e5 (patch)
tree5dd39ae343981c37d3a735abf0cb799a86b1245b /source4/ntvfs
parentcd5326a44ee1f83ff9a1d96d50b56db9a2eb0d94 (diff)
downloadsamba-dcad0f6fd492506efd9a69b4e32c7bbfa5da90e5.tar.gz
samba-dcad0f6fd492506efd9a69b4e32c7bbfa5da90e5.tar.bz2
samba-dcad0f6fd492506efd9a69b4e32c7bbfa5da90e5.zip
r2751: this is a new ntvfs design which tries to solve:
- the stacking of modules - finding the modules private data - hide the ntvfs details from the calling layer - I set NTVFS_INTERFACE_VERSION 0 till we are closer to release (because we need to solve some async problems with the module stacking) metze (This used to be commit 3ff03b5cb21bb79afdd3b1609be9635f6688a539)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c139
-rw-r--r--source4/ntvfs/config.mk1
-rw-r--r--source4/ntvfs/ipc/vfs_ipc.c131
-rw-r--r--source4/ntvfs/nbench/vfs_nbench.c235
-rw-r--r--source4/ntvfs/ntvfs.h117
-rw-r--r--source4/ntvfs/ntvfs_base.c54
-rw-r--r--source4/ntvfs/ntvfs_generic.c18
-rw-r--r--source4/ntvfs/ntvfs_interface.c566
-rw-r--r--source4/ntvfs/posix/pvfs_fsinfo.c7
-rw-r--r--source4/ntvfs/posix/pvfs_mkdir.c10
-rw-r--r--source4/ntvfs/posix/pvfs_open.c29
-rw-r--r--source4/ntvfs/posix/pvfs_qfileinfo.c16
-rw-r--r--source4/ntvfs/posix/pvfs_read.c7
-rw-r--r--source4/ntvfs/posix/pvfs_rename.c5
-rw-r--r--source4/ntvfs/posix/pvfs_search.c29
-rw-r--r--source4/ntvfs/posix/pvfs_setfileinfo.c7
-rw-r--r--source4/ntvfs/posix/pvfs_unlink.c5
-rw-r--r--source4/ntvfs/posix/pvfs_write.c9
-rw-r--r--source4/ntvfs/posix/vfs_posix.c38
-rw-r--r--source4/ntvfs/posix/vfs_posix.h2
-rw-r--r--source4/ntvfs/print/vfs_print.c12
-rw-r--r--source4/ntvfs/simple/svfs.h2
-rw-r--r--source4/ntvfs/simple/svfs_util.c12
-rw-r--r--source4/ntvfs/simple/vfs_simple.c142
24 files changed, 1178 insertions, 415 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index c0160e6852..65a7c7a206 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;
+ /*const struct ntvfs_ops *ops;*/
};
@@ -89,7 +89,8 @@ static void cifs_socket_handler(struct event_context *ev, struct fd_event *fde,
/*
connect to a share - used when a tree_connect operation comes in.
*/
-static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct smbsrv_tcon *tcon = req->tcon;
NTSTATUS status;
@@ -120,7 +121,7 @@ static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename,
}
ZERO_STRUCTP(private);
- ntvfs_set_private(req->tcon, depth, private);
+ ntvfs->private_data = private;
status = smbcli_tree_full_connection(private,
&private->tree,
@@ -137,7 +138,7 @@ static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename,
private->transport = private->tree->session->transport;
private->tree->session->pid = SVAL(req->in.hdr, HDR_PID);
private->tcon = req->tcon;
- private->ops = ntvfs_backend_byname("cifs", NTVFS_DISK);
+ /*private->ops = ntvfs_backend_byname("cifs", NTVFS_DISK);*/
tcon->fs_type = talloc_strdup(tcon, "NTFS");
tcon->dev_type = talloc_strdup(tcon, "A:");
@@ -158,9 +159,10 @@ static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename,
/*
disconnect from a share
*/
-static NTSTATUS cvfs_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS cvfs_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
- struct cvfs_private *private = tcon->ntvfs_private_list[depth];
+ struct cvfs_private *private = ntvfs->private_data;
smb_tree_disconnect(private->tree);
talloc_free(private->tree);
@@ -204,9 +206,10 @@ static void async_simple(struct smbcli_request *c_req)
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-static NTSTATUS cvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS cvfs_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
/* see if the front end will allow us to perform this
@@ -234,9 +237,10 @@ static void async_ioctl(struct smbcli_request *c_req)
/*
ioctl interface
*/
-static NTSTATUS cvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS cvfs_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
/* see if the front end will allow us to perform this
@@ -253,9 +257,10 @@ static NTSTATUS cvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
/*
check if a directory exists
*/
-static NTSTATUS cvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS cvfs_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -281,9 +286,10 @@ static void async_qpathinfo(struct smbcli_request *c_req)
/*
return info on a pathname
*/
-static NTSTATUS cvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS cvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -309,9 +315,10 @@ static void async_qfileinfo(struct smbcli_request *c_req)
/*
query info on a open file
*/
-static NTSTATUS cvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS cvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -327,9 +334,10 @@ static NTSTATUS cvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *i
/*
set info on a pathname
*/
-static NTSTATUS cvfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS cvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -356,9 +364,10 @@ static void async_open(struct smbcli_request *c_req)
/*
open a file
*/
-static NTSTATUS cvfs_open(struct smbsrv_request *req, union smb_open *io)
+static NTSTATUS cvfs_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -373,9 +382,10 @@ static NTSTATUS cvfs_open(struct smbsrv_request *req, union smb_open *io)
/*
create a directory
*/
-static NTSTATUS cvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS cvfs_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -390,9 +400,10 @@ static NTSTATUS cvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
/*
remove a directory
*/
-static NTSTATUS cvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS cvfs_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -406,9 +417,10 @@ static NTSTATUS cvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
/*
rename a set of files
*/
-static NTSTATUS cvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS cvfs_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -423,7 +435,8 @@ static NTSTATUS cvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
/*
copy a set of files
*/
-static NTSTATUS cvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS cvfs_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -442,9 +455,10 @@ static void async_read(struct smbcli_request *c_req)
/*
read from a file
*/
-static NTSTATUS cvfs_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS cvfs_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -470,9 +484,10 @@ static void async_write(struct smbcli_request *c_req)
/*
write to a file
*/
-static NTSTATUS cvfs_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS cvfs_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -487,7 +502,8 @@ static NTSTATUS cvfs_write(struct smbsrv_request *req, union smb_write *wr)
/*
seek in a file
*/
-static NTSTATUS cvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS cvfs_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -495,7 +511,8 @@ static NTSTATUS cvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
/*
flush a file
*/
-static NTSTATUS cvfs_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS cvfs_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
return NT_STATUS_OK;
}
@@ -503,9 +520,10 @@ static NTSTATUS cvfs_flush(struct smbsrv_request *req, struct smb_flush *io)
/*
close a file
*/
-static NTSTATUS cvfs_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS cvfs_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -520,9 +538,10 @@ static NTSTATUS cvfs_close(struct smbsrv_request *req, union smb_close *io)
/*
exit - closing files open by the pid
*/
-static NTSTATUS cvfs_exit(struct smbsrv_request *req)
+static NTSTATUS cvfs_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -537,7 +556,8 @@ static NTSTATUS cvfs_exit(struct smbsrv_request *req)
/*
logoff - closing files open by the user
*/
-static NTSTATUS cvfs_logoff(struct smbsrv_request *req)
+static NTSTATUS cvfs_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
/* we can't do this right in the cifs backend .... */
return NT_STATUS_OK;
@@ -546,9 +566,10 @@ static NTSTATUS cvfs_logoff(struct smbsrv_request *req)
/*
lock a byte range
*/
-static NTSTATUS cvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS cvfs_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -562,10 +583,11 @@ static NTSTATUS cvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
/*
set info on a open file
*/
-static NTSTATUS cvfs_setfileinfo(struct smbsrv_request *req,
+static NTSTATUS cvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
union smb_setfileinfo *info)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -591,9 +613,10 @@ static void async_fsinfo(struct smbcli_request *c_req)
/*
return filesystem space info
*/
-static NTSTATUS cvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS cvfs_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -608,7 +631,8 @@ static NTSTATUS cvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
/*
return print queue info
*/
-static NTSTATUS cvfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS cvfs_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -616,29 +640,32 @@ static NTSTATUS cvfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
/*
list files in a directory matching a wildcard pattern
*/
-static NTSTATUS cvfs_search_first(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
return smb_raw_search_first(private->tree, req, io, search_private, callback);
}
/* continue a search */
-static NTSTATUS cvfs_search_next(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS cvfs_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
return smb_raw_search_next(private->tree, req, io, search_private, callback);
}
/* close a search */
-static NTSTATUS cvfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS cvfs_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
return smb_raw_search_close(private->tree, io);
}
@@ -655,9 +682,10 @@ static void async_trans2(struct smbcli_request *c_req)
}
/* raw trans2 */
-static NTSTATUS cvfs_trans2(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS cvfs_trans2(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
@@ -671,7 +699,8 @@ static NTSTATUS cvfs_trans2(struct smbsrv_request *req, struct smb_trans2 *trans
/* SMBtrans - not used on file shares */
-static NTSTATUS cvfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS cvfs_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -721,7 +750,7 @@ NTSTATUS ntvfs_cifs_init(void)
ops.logoff = cvfs_logoff;
if (lp_parm_bool(-1, "cifs", "maptrans2", False)) {
- ops.trans2 = cvfs_trans2;
+ ops.trans2 = cvfs_trans2;
}
/* register ourselves with the NTVFS subsystem. We register
diff --git a/source4/ntvfs/config.mk b/source4/ntvfs/config.mk
index d00cc2b1f4..e2320e0684 100644
--- a/source4/ntvfs/config.mk
+++ b/source4/ntvfs/config.mk
@@ -55,6 +55,7 @@ INIT_OBJ_FILES = \
ntvfs/ntvfs_base.o
ADD_OBJ_FILES = \
ntvfs/ntvfs_generic.o \
+ ntvfs/ntvfs_interface.o \
ntvfs/ntvfs_util.o
#
# End SUBSYSTEM NTVFS
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c
index 59da6faea5..69fed6f86f 100644
--- a/source4/ntvfs/ipc/vfs_ipc.c
+++ b/source4/ntvfs/ipc/vfs_ipc.c
@@ -110,7 +110,8 @@ static struct pipe_state *pipe_state_find(struct ipc_private *private, uint16_t
/*
connect to a share - always works
*/
-static NTSTATUS ipc_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS ipc_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct smbsrv_tcon *tcon = req->tcon;
struct ipc_private *private;
@@ -123,7 +124,7 @@ static NTSTATUS ipc_connect(struct smbsrv_request *req, const char *sharename, i
if (!private) {
return NT_STATUS_NO_MEMORY;
}
- ntvfs_set_private(tcon, depth, private);
+ ntvfs->private_data = private;
private->pipe_list = NULL;
private->next_fnum = 1;
@@ -135,9 +136,10 @@ static NTSTATUS ipc_connect(struct smbsrv_request *req, const char *sharename, i
/*
disconnect from a share
*/
-static NTSTATUS ipc_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS ipc_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
- struct ipc_private *private = tcon->ntvfs_private_list[depth];
+ struct ipc_private *private = ntvfs->private_data;
/* close any pipes that are open. Discard any unread data */
while (private->pipe_list) {
@@ -150,7 +152,8 @@ static NTSTATUS ipc_disconnect(struct smbsrv_tcon *tcon, int depth)
/*
delete a file
*/
-static NTSTATUS ipc_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS ipc_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -159,7 +162,8 @@ static NTSTATUS ipc_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
/*
ioctl interface - we don't do any
*/
-static NTSTATUS ipc_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS ipc_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -167,7 +171,8 @@ static NTSTATUS ipc_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
/*
check if a directory exists
*/
-static NTSTATUS ipc_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS ipc_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -175,7 +180,8 @@ static NTSTATUS ipc_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
/*
return info on a pathname
*/
-static NTSTATUS ipc_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS ipc_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -183,7 +189,8 @@ static NTSTATUS ipc_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *in
/*
set info on a pathname
*/
-static NTSTATUS ipc_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS ipc_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -193,14 +200,15 @@ static NTSTATUS ipc_setpathinfo(struct smbsrv_request *req, union smb_setfileinf
/*
open a file backend - used for MSRPC pipes
*/
-static NTSTATUS ipc_open_generic(struct smbsrv_request *req, const char *fname,
+static NTSTATUS ipc_open_generic(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *fname,
struct pipe_state **ps)
{
struct pipe_state *p;
NTSTATUS status;
struct dcesrv_ep_description ep_description;
struct auth_session_info *session_info = NULL;
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
p = talloc_p(private, struct pipe_state);
if (!p) {
@@ -270,12 +278,13 @@ static NTSTATUS ipc_open_generic(struct smbsrv_request *req, const char *fname,
/*
open a file with ntcreatex - used for MSRPC pipes
*/
-static NTSTATUS ipc_open_ntcreatex(struct smbsrv_request *req, union smb_open *oi)
+static NTSTATUS ipc_open_ntcreatex(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
{
struct pipe_state *p;
NTSTATUS status;
- status = ipc_open_generic(req, oi->ntcreatex.in.fname, &p);
+ status = ipc_open_generic(ntvfs, req, oi->ntcreatex.in.fname, &p);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -290,7 +299,8 @@ static NTSTATUS ipc_open_ntcreatex(struct smbsrv_request *req, union smb_open *o
/*
open a file with openx - used for MSRPC pipes
*/
-static NTSTATUS ipc_open_openx(struct smbsrv_request *req, union smb_open *oi)
+static NTSTATUS ipc_open_openx(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
{
struct pipe_state *p;
NTSTATUS status;
@@ -302,7 +312,7 @@ static NTSTATUS ipc_open_openx(struct smbsrv_request *req, union smb_open *oi)
fname += 4;
- status = ipc_open_generic(req, fname, &p);
+ status = ipc_open_generic(ntvfs, req, fname, &p);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -318,16 +328,17 @@ static NTSTATUS ipc_open_openx(struct smbsrv_request *req, union smb_open *oi)
/*
open a file - used for MSRPC pipes
*/
-static NTSTATUS ipc_open(struct smbsrv_request *req, union smb_open *oi)
+static NTSTATUS ipc_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
{
NTSTATUS status;
switch (oi->generic.level) {
case RAW_OPEN_NTCREATEX:
- status = ipc_open_ntcreatex(req, oi);
+ status = ipc_open_ntcreatex(ntvfs, req, oi);
break;
case RAW_OPEN_OPENX:
- status = ipc_open_openx(req, oi);
+ status = ipc_open_openx(ntvfs, req, oi);
break;
default:
status = NT_STATUS_NOT_SUPPORTED;
@@ -340,7 +351,8 @@ static NTSTATUS ipc_open(struct smbsrv_request *req, union smb_open *oi)
/*
create a directory
*/
-static NTSTATUS ipc_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS ipc_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -348,7 +360,8 @@ static NTSTATUS ipc_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
/*
remove a directory
*/
-static NTSTATUS ipc_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS ipc_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -356,7 +369,8 @@ static NTSTATUS ipc_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
/*
rename a set of files
*/
-static NTSTATUS ipc_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS ipc_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -364,7 +378,8 @@ static NTSTATUS ipc_rename(struct smbsrv_request *req, union smb_rename *ren)
/*
copy a set of files
*/
-static NTSTATUS ipc_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS ipc_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -372,9 +387,10 @@ static NTSTATUS ipc_copy(struct smbsrv_request *req, struct smb_copy *cp)
/*
read from a file
*/
-static NTSTATUS ipc_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS ipc_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
DATA_BLOB data;
uint16_t fnum;
struct pipe_state *p;
@@ -424,9 +440,10 @@ static NTSTATUS ipc_read(struct smbsrv_request *req, union smb_read *rd)
/*
write to a file
*/
-static NTSTATUS ipc_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS ipc_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
DATA_BLOB data;
uint16_t fnum;
struct pipe_state *p;
@@ -477,7 +494,8 @@ static NTSTATUS ipc_write(struct smbsrv_request *req, union smb_write *wr)
/*
seek in a file
*/
-static NTSTATUS ipc_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS ipc_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -485,7 +503,8 @@ static NTSTATUS ipc_seek(struct smbsrv_request *req, struct smb_seek *io)
/*
flush a file
*/
-static NTSTATUS ipc_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS ipc_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -493,9 +512,10 @@ static NTSTATUS ipc_flush(struct smbsrv_request *req, struct smb_flush *io)
/*
close a file
*/
-static NTSTATUS ipc_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS ipc_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p;
if (io->generic.level != RAW_CLOSE_CLOSE) {
@@ -516,9 +536,10 @@ static NTSTATUS ipc_close(struct smbsrv_request *req, union smb_close *io)
/*
exit - closing files
*/
-static NTSTATUS ipc_exit(struct smbsrv_request *req)
+static NTSTATUS ipc_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p, *next;
for (p=private->pipe_list; p; p=next) {
@@ -534,9 +555,10 @@ static NTSTATUS ipc_exit(struct smbsrv_request *req)
/*
logoff - closing files open by the user
*/
-static NTSTATUS ipc_logoff(struct smbsrv_request *req)
+static NTSTATUS ipc_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p, *next;
for (p=private->pipe_list; p; p=next) {
@@ -552,7 +574,8 @@ static NTSTATUS ipc_logoff(struct smbsrv_request *req)
/*
lock a byte range
*/
-static NTSTATUS ipc_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS ipc_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -560,7 +583,8 @@ static NTSTATUS ipc_lock(struct smbsrv_request *req, union smb_lock *lck)
/*
set info on a open file
*/
-static NTSTATUS ipc_setfileinfo(struct smbsrv_request *req, union smb_setfileinfo *info)
+static NTSTATUS ipc_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *info)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -568,7 +592,8 @@ static NTSTATUS ipc_setfileinfo(struct smbsrv_request *req, union smb_setfileinf
/*
query info on a open file
*/
-static NTSTATUS ipc_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS ipc_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -577,7 +602,8 @@ static NTSTATUS ipc_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *in
/*
return filesystem info
*/
-static NTSTATUS ipc_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS ipc_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -585,7 +611,8 @@ static NTSTATUS ipc_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
/*
return print queue info
*/
-static NTSTATUS ipc_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS ipc_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -593,7 +620,8 @@ static NTSTATUS ipc_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
/*
list files in a directory matching a wildcard pattern
*/
-NTSTATUS ipc_search_first(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS ipc_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
@@ -603,7 +631,8 @@ NTSTATUS ipc_search_first(struct smbsrv_request *req, union smb_search_first *io
/*
continue listing files in a directory
*/
-NTSTATUS ipc_search_next(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS ipc_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
@@ -613,17 +642,19 @@ NTSTATUS ipc_search_next(struct smbsrv_request *req, union smb_search_next *io,
/*
end listing files in a directory
*/
-NTSTATUS ipc_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS ipc_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
return NT_STATUS_ACCESS_DENIED;
}
/* SMBtrans - handle a DCERPC command */
-static NTSTATUS ipc_dcerpc_cmd(struct smbsrv_request *req, struct smb_trans2 *trans)
+static NTSTATUS ipc_dcerpc_cmd(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
{
struct pipe_state *p;
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
NTSTATUS status;
/* the fnum is in setup[1] */
@@ -665,9 +696,10 @@ static NTSTATUS ipc_dcerpc_cmd(struct smbsrv_request *req, struct smb_trans2 *tr
/* SMBtrans - set named pipe state */
-static NTSTATUS ipc_set_nm_pipe_state(struct smbsrv_request *req, struct smb_trans2 *trans)
+static NTSTATUS ipc_set_nm_pipe_state(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p;
/* the fnum is in setup[1] */
@@ -691,7 +723,8 @@ static NTSTATUS ipc_set_nm_pipe_state(struct smbsrv_request *req, struct smb_tra
/* SMBtrans - used to provide access to SMB pipes */
-static NTSTATUS ipc_trans(struct smbsrv_request *req, struct smb_trans2 *trans)
+static NTSTATUS ipc_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
{
NTSTATUS status;
@@ -704,10 +737,10 @@ static NTSTATUS ipc_trans(struct smbsrv_request *req, struct smb_trans2 *trans)
switch (trans->in.setup[0]) {
case TRANSACT_SETNAMEDPIPEHANDLESTATE:
- status = ipc_set_nm_pipe_state(req, trans);
+ status = ipc_set_nm_pipe_state(ntvfs, req, trans);
break;
case TRANSACT_DCERPCCMD:
- status = ipc_dcerpc_cmd(req, trans);
+ status = ipc_dcerpc_cmd(ntvfs, req, trans);
break;
default:
status = NT_STATUS_INVALID_PARAMETER;
diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c
index 90b5d43bd6..06c237afb5 100644
--- a/source4/ntvfs/nbench/vfs_nbench.c
+++ b/source4/ntvfs/nbench/vfs_nbench.c
@@ -28,11 +28,9 @@
/* this is stored in ntvfs_private */
struct nbench_private {
- const struct ntvfs_ops *passthru_ops;
int log_fd;
};
-
/*
log one request to the nbench log
*/
@@ -53,12 +51,6 @@ static void nbench_log(struct nbench_private *private,
free(s);
}
-
-/*
- this is used to call the next module in the ntvfs chain
-*/
-#define PASS_THRU(tcon, op, args) private->passthru_ops->op args;
-
/*
this pass through macro operates on request contexts, and disables
async calls.
@@ -66,12 +58,10 @@ static void nbench_log(struct nbench_private *private,
async calls are a pain for the nbench module as it makes pulling the
status code and any result parameters much harder.
*/
-#define PASS_THRU_REQ(req, op, args) do { \
+#define PASS_THRU_REQ(ntvfs, req, op, args) do { \
void *send_fn_saved = req->async.send_fn; \
req->async.send_fn = NULL; \
- req->ntvfs_depth++; \
- status = PASS_THRU(req->tcon, op, args); \
- req->ntvfs_depth--; \
+ status = ntvfs_next_##op args; \
req->async.send_fn = send_fn_saved; \
} while (0)
@@ -79,21 +69,20 @@ static void nbench_log(struct nbench_private *private,
/*
connect to a share - used when a tree_connect operation comes in.
*/
-static NTSTATUS nbench_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS nbench_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct nbench_private *private;
- const char *passthru;
NTSTATUS status;
char *logname = NULL;
- const char **handlers = lp_ntvfs_handler(req->tcon->service);
private = talloc_p(req->tcon, struct nbench_private);
if (!private) {
return NT_STATUS_NO_MEMORY;
}
- asprintf(&logname, "/tmp/nbenchlog%d.%u", depth, getpid());
- private->log_fd = open(logname, O_WRONLY|O_CREAT|O_APPEND, 0644);
+ asprintf(&logname, "/tmp/nbenchlog%d.%u", ntvfs->depth, getpid());
+ private->log_fd = sys_open(logname, O_WRONLY|O_CREAT|O_APPEND, 0644);
free(logname);
if (private->log_fd == -1) {
@@ -101,16 +90,9 @@ static NTSTATUS nbench_connect(struct smbsrv_request *req, const char *sharename
return NT_STATUS_UNSUCCESSFUL;
}
- private->passthru_ops = ntvfs_backend_byname(handlers[depth+1], NTVFS_DISK);
+ ntvfs->private_data = private;
- if (!private->passthru_ops) {
- DEBUG(0,("Unable to connect to '%s' pass through backend\n", passthru));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- ntvfs_set_private(req->tcon, depth, private);
-
- status = PASS_THRU(req->tcon, connect, (req, sharename, depth+1));
+ status = ntvfs_next_connect(ntvfs, req, sharename);
return status;
}
@@ -118,15 +100,16 @@ static NTSTATUS nbench_connect(struct smbsrv_request *req, const char *sharename
/*
disconnect from a share
*/
-static NTSTATUS nbench_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS nbench_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
- struct nbench_private *private = tcon->ntvfs_private_list[depth];
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
close(private->log_fd);
- status = PASS_THRU(tcon, disconnect, (tcon, depth+1));
-
+ status = ntvfs_next_disconnect(ntvfs, tcon);
+
return status;
}
@@ -134,12 +117,13 @@ static NTSTATUS nbench_disconnect(struct smbsrv_tcon *tcon, int depth)
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-static NTSTATUS nbench_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS nbench_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, unlink, (req, unl));
+ PASS_THRU_REQ(ntvfs, req, unlink, (ntvfs, req, unl));
nbench_log(private, "Unlink \"%s\" 0x%x %s\n",
unl->in.pattern, unl->in.attrib,
@@ -151,12 +135,13 @@ static NTSTATUS nbench_unlink(struct smbsrv_request *req, struct smb_unlink *unl
/*
ioctl interface
*/
-static NTSTATUS nbench_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS nbench_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, ioctl, (req, io));
+ PASS_THRU_REQ(ntvfs, req, ioctl, (ntvfs, req, io));
nbench_log(private, "Ioctl - NOT HANDLED\n");
@@ -166,12 +151,13 @@ static NTSTATUS nbench_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
/*
check if a directory exists
*/
-static NTSTATUS nbench_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS nbench_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, chkpath, (req, cp));
+ PASS_THRU_REQ(ntvfs, req, chkpath, (ntvfs, req, cp));
nbench_log(private, "Chkpath \"%s\" %s\n",
cp->in.path,
@@ -183,12 +169,13 @@ static NTSTATUS nbench_chkpath(struct smbsrv_request *req, struct smb_chkpath *c
/*
return info on a pathname
*/
-static NTSTATUS nbench_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS nbench_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, qpathinfo, (req, info));
+ PASS_THRU_REQ(ntvfs, req, qpathinfo, (ntvfs, req, info));
nbench_log(private, "QUERY_PATH_INFORMATION \"%s\" %d %s\n",
info->generic.in.fname,
@@ -201,12 +188,13 @@ static NTSTATUS nbench_qpathinfo(struct smbsrv_request *req, union smb_fileinfo
/*
query info on a open file
*/
-static NTSTATUS nbench_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS nbench_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, qfileinfo, (req, info));
+ PASS_THRU_REQ(ntvfs, req, qfileinfo, (ntvfs, req, info));
nbench_log(private, "QUERY_FILE_INFORMATION %d %d %s\n",
info->generic.in.fnum,
@@ -220,12 +208,13 @@ static NTSTATUS nbench_qfileinfo(struct smbsrv_request *req, union smb_fileinfo
/*
set info on a pathname
*/
-static NTSTATUS nbench_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS nbench_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, setpathinfo, (req, st));
+ PASS_THRU_REQ(ntvfs, req, setpathinfo, (ntvfs, req, st));
nbench_log(private, "SET_PATH_INFORMATION \"%s\" %d %s\n",
st->generic.file.fname,
@@ -238,12 +227,15 @@ static NTSTATUS nbench_setpathinfo(struct smbsrv_request *req, union smb_setfile
/*
open a file
*/
-static NTSTATUS nbench_open(struct smbsrv_request *req, union smb_open *io)
+static NTSTATUS nbench_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, open, (req, io));
+ PASS_THRU_REQ(ntvfs, req, open, (ntvfs, req, io));
+
+ DEBUG(0,("%d: %s\n", ntvfs->depth, get_nt_error_c_code(status)));
switch (io->generic.level) {
case RAW_OPEN_NTCREATEX:
@@ -267,12 +259,13 @@ static NTSTATUS nbench_open(struct smbsrv_request *req, union smb_open *io)
/*
create a directory
*/
-static NTSTATUS nbench_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS nbench_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, mkdir, (req, md));
+ PASS_THRU_REQ(ntvfs, req, mkdir, (ntvfs, req, md));
nbench_log(private, "Mkdir - NOT HANDLED\n");
@@ -282,12 +275,13 @@ static NTSTATUS nbench_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
/*
remove a directory
*/
-static NTSTATUS nbench_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS nbench_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, rmdir, (req, rd));
+ PASS_THRU_REQ(ntvfs, req, rmdir, (ntvfs, req, rd));
nbench_log(private, "Rmdir \"%s\" %s\n",
rd->in.path,
@@ -299,12 +293,13 @@ static NTSTATUS nbench_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
/*
rename a set of files
*/
-static NTSTATUS nbench_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS nbench_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, rename, (req, ren));
+ PASS_THRU_REQ(ntvfs, req, rename, (ntvfs, req, ren));
switch (ren->generic.level) {
case RAW_RENAME_RENAME:
@@ -326,12 +321,13 @@ static NTSTATUS nbench_rename(struct smbsrv_request *req, union smb_rename *ren)
/*
copy a set of files
*/
-static NTSTATUS nbench_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS nbench_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, copy, (req, cp));
+ PASS_THRU_REQ(ntvfs, req, copy, (ntvfs, req, cp));
nbench_log(private, "Copy - NOT HANDLED\n");
@@ -341,12 +337,13 @@ static NTSTATUS nbench_copy(struct smbsrv_request *req, struct smb_copy *cp)
/*
read from a file
*/
-static NTSTATUS nbench_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS nbench_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, read, (req, rd));
+ PASS_THRU_REQ(ntvfs, req, read, (ntvfs, req, rd));
switch (rd->generic.level) {
case RAW_READ_READX:
@@ -369,12 +366,13 @@ static NTSTATUS nbench_read(struct smbsrv_request *req, union smb_read *rd)
/*
write to a file
*/
-static NTSTATUS nbench_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS nbench_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, write, (req, wr));
+ PASS_THRU_REQ(ntvfs, req, write, (ntvfs, req, wr));
switch (wr->generic.level) {
case RAW_WRITE_WRITEX:
@@ -407,12 +405,13 @@ static NTSTATUS nbench_write(struct smbsrv_request *req, union smb_write *wr)
/*
seek in a file
*/
-static NTSTATUS nbench_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS nbench_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, seek, (req, io));
+ PASS_THRU_REQ(ntvfs, req, seek, (ntvfs, req, io));
nbench_log(private, "Seek - NOT HANDLED\n");
@@ -422,12 +421,13 @@ static NTSTATUS nbench_seek(struct smbsrv_request *req, struct smb_seek *io)
/*
flush a file
*/
-static NTSTATUS nbench_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS nbench_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, flush, (req, io));
+ PASS_THRU_REQ(ntvfs, req, flush, (ntvfs, req, io));
nbench_log(private, "Flush %d %s\n",
io->in.fnum,
@@ -439,12 +439,13 @@ static NTSTATUS nbench_flush(struct smbsrv_request *req, struct smb_flush *io)
/*
close a file
*/
-static NTSTATUS nbench_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS nbench_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, close, (req, io));
+ PASS_THRU_REQ(ntvfs, req, close, (ntvfs, req, io));
switch (io->generic.level) {
case RAW_CLOSE_CLOSE:
@@ -465,12 +466,12 @@ static NTSTATUS nbench_close(struct smbsrv_request *req, union smb_close *io)
/*
exit - closing files
*/
-static NTSTATUS nbench_exit(struct smbsrv_request *req)
+static NTSTATUS nbench_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
NTSTATUS status;
- PASS_THRU_REQ(req, exit, (req));
+ PASS_THRU_REQ(ntvfs, req, exit, (ntvfs, req));
return status;
}
@@ -478,12 +479,12 @@ static NTSTATUS nbench_exit(struct smbsrv_request *req)
/*
logoff - closing files
*/
-static NTSTATUS nbench_logoff(struct smbsrv_request *req)
+static NTSTATUS nbench_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
NTSTATUS status;
- PASS_THRU_REQ(req, logoff, (req));
+ PASS_THRU_REQ(ntvfs, req, logoff, (ntvfs, req));
return status;
}
@@ -491,12 +492,13 @@ static NTSTATUS nbench_logoff(struct smbsrv_request *req)
/*
lock a byte range
*/
-static NTSTATUS nbench_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS nbench_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, lock, (req, lck));
+ PASS_THRU_REQ(ntvfs, req, lock, (ntvfs, req, lck));
if (lck->generic.level == RAW_LOCK_LOCKX &&
lck->lockx.in.lock_cnt == 1 &&
@@ -523,13 +525,14 @@ static NTSTATUS nbench_lock(struct smbsrv_request *req, union smb_lock *lck)
/*
set info on a open file
*/
-static NTSTATUS nbench_setfileinfo(struct smbsrv_request *req,
- union smb_setfileinfo *info)
+static NTSTATUS nbench_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
+ union smb_setfileinfo *info)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, setfileinfo, (req, info));
+ PASS_THRU_REQ(ntvfs, req, setfileinfo, (ntvfs, req, info));
nbench_log(private, "SET_FILE_INFORMATION %d %d %s\n",
info->generic.file.fnum,
@@ -543,12 +546,13 @@ static NTSTATUS nbench_setfileinfo(struct smbsrv_request *req,
/*
return filesystem space info
*/
-static NTSTATUS nbench_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS nbench_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, fsinfo, (req, fs));
+ PASS_THRU_REQ(ntvfs, req, fsinfo, (ntvfs, req, fs));
nbench_log(private, "QUERY_FS_INFORMATION %d %s\n",
fs->generic.level,
@@ -560,12 +564,13 @@ static NTSTATUS nbench_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
/*
return print queue info
*/
-static NTSTATUS nbench_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS nbench_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, lpq, (req, lpq));
+ PASS_THRU_REQ(ntvfs, req, lpq, (ntvfs, req, lpq));
nbench_log(private, "Lpq-%d - NOT HANDLED\n", lpq->generic.level);
@@ -575,14 +580,15 @@ static NTSTATUS nbench_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
/*
list files in a directory matching a wildcard pattern
*/
-static NTSTATUS nbench_search_first(struct smbsrv_request *req, union smb_search_first *io,
- void *search_private,
- BOOL (*callback)(void *, union smb_search_data *))
+static NTSTATUS nbench_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
+ void *search_private,
+ BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, search_first, (req, io, search_private, callback));
+ PASS_THRU_REQ(ntvfs, req, search_first, (ntvfs, req, io, search_private, callback));
switch (io->generic.level) {
case RAW_SEARCH_BOTH_DIRECTORY_INFO:
@@ -603,14 +609,15 @@ static NTSTATUS nbench_search_first(struct smbsrv_request *req, union smb_search
}
/* continue a search */
-static NTSTATUS nbench_search_next(struct smbsrv_request *req, union smb_search_next *io,
- void *search_private,
- BOOL (*callback)(void *, union smb_search_data *))
+static NTSTATUS nbench_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
+ void *search_private,
+ BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, search_next, (req, io, search_private, callback));
+ PASS_THRU_REQ(ntvfs, req, search_next, (ntvfs, req, io, search_private, callback));
nbench_log(private, "Searchnext-%d - NOT HANDLED\n", io->generic.level);
@@ -618,12 +625,13 @@ static NTSTATUS nbench_search_next(struct smbsrv_request *req, union smb_search_
}
/* close a search */
-static NTSTATUS nbench_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS nbench_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, search_close, (req, io));
+ PASS_THRU_REQ(ntvfs, req, search_close, (ntvfs, req, io));
nbench_log(private, "Searchclose-%d - NOT HANDLED\n", io->generic.level);
@@ -631,12 +639,13 @@ static NTSTATUS nbench_search_close(struct smbsrv_request *req, union smb_search
}
/* SMBtrans - not used on file shares */
-static NTSTATUS nbench_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS nbench_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, trans, (req,trans2));
+ PASS_THRU_REQ(ntvfs, req, trans, (ntvfs, req, trans2));
nbench_log(private, "Trans - NOT HANDLED\n");
diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h
index 96434f44e2..bee10e3c38 100644
--- a/source4/ntvfs/ntvfs.h
+++ b/source4/ntvfs/ntvfs.h
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
NTVFS structures and defines
Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Stefan Metzmacher 2004
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,9 +20,15 @@
*/
/* modules can use the following to determine if the interface has changed */
-#define NTVFS_INTERFACE_VERSION 1
+/* version 1 -> 0 - make module stacking easier -- metze */
+#define NTVFS_INTERFACE_VERSION 0
+struct ntvfs_module_context;
+/* each backend has to be one one of the following 3 basic types. In
+ * earlier versions of Samba backends needed to handle all types, now
+ * we implement them separately. */
+enum ntvfs_type {NTVFS_DISK, NTVFS_PRINT, NTVFS_IPC};
/* the ntvfs operations structure - contains function pointers to
the backend implementations of each operation */
@@ -30,65 +37,105 @@ struct ntvfs_ops {
enum ntvfs_type type;
/* initial setup */
- NTSTATUS (*connect)(struct smbsrv_request *req, const char *sharename, int depth);
- NTSTATUS (*disconnect)(struct smbsrv_tcon *tcon, int depth);
+ NTSTATUS (*connect)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename);
+ NTSTATUS (*disconnect)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon);
/* path operations */
- NTSTATUS (*unlink)(struct smbsrv_request *req, struct smb_unlink *unl);
- NTSTATUS (*chkpath)(struct smbsrv_request *req, struct smb_chkpath *cp);
- NTSTATUS (*qpathinfo)(struct smbsrv_request *req, union smb_fileinfo *st);
- NTSTATUS (*setpathinfo)(struct smbsrv_request *req, union smb_setfileinfo *st);
- NTSTATUS (*open)(struct smbsrv_request *req, union smb_open *oi);
- NTSTATUS (*mkdir)(struct smbsrv_request *req, union smb_mkdir *md);
- NTSTATUS (*rmdir)(struct smbsrv_request *req, struct smb_rmdir *rd);
- NTSTATUS (*rename)(struct smbsrv_request *req, union smb_rename *ren);
- NTSTATUS (*copy)(struct smbsrv_request *req, struct smb_copy *cp);
+ NTSTATUS (*unlink)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl);
+ NTSTATUS (*chkpath)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp);
+ NTSTATUS (*qpathinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *st);
+ NTSTATUS (*setpathinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st);
+ NTSTATUS (*open)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi);
+ NTSTATUS (*mkdir)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md);
+ NTSTATUS (*rmdir)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd);
+ NTSTATUS (*rename)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren);
+ NTSTATUS (*copy)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp);
/* directory search */
- NTSTATUS (*search_first)(struct smbsrv_request *req, union smb_search_first *io, void *private,
+ NTSTATUS (*search_first)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io, void *private,
BOOL (*callback)(void *private, union smb_search_data *file));
- NTSTATUS (*search_next)(struct smbsrv_request *req, union smb_search_next *io, void *private,
+ NTSTATUS (*search_next)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io, void *private,
BOOL (*callback)(void *private, union smb_search_data *file));
- NTSTATUS (*search_close)(struct smbsrv_request *req, union smb_search_close *io);
+ NTSTATUS (*search_close)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io);
/* operations on open files */
- NTSTATUS (*ioctl)(struct smbsrv_request *req, union smb_ioctl *io);
- NTSTATUS (*read)(struct smbsrv_request *req, union smb_read *io);
- NTSTATUS (*write)(struct smbsrv_request *req, union smb_write *io);
- NTSTATUS (*seek)(struct smbsrv_request *req, struct smb_seek *io);
- NTSTATUS (*flush)(struct smbsrv_request *req, struct smb_flush *flush);
- NTSTATUS (*close)(struct smbsrv_request *req, union smb_close *io);
- NTSTATUS (*exit)(struct smbsrv_request *req);
- NTSTATUS (*lock)(struct smbsrv_request *req, union smb_lock *lck);
- NTSTATUS (*setfileinfo)(struct smbsrv_request *req, union smb_setfileinfo *info);
- NTSTATUS (*qfileinfo)(struct smbsrv_request *req, union smb_fileinfo *info);
+ NTSTATUS (*ioctl)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io);
+ NTSTATUS (*read)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *io);
+ NTSTATUS (*write)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *io);
+ NTSTATUS (*seek)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io);
+ NTSTATUS (*flush)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *flush);
+ NTSTATUS (*close)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io);
+ NTSTATUS (*exit)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req);
+ NTSTATUS (*lock)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck);
+ NTSTATUS (*setfileinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *info);
+ NTSTATUS (*qfileinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info);
/* filesystem operations */
- NTSTATUS (*fsinfo)(struct smbsrv_request *req, union smb_fsinfo *fs);
+ NTSTATUS (*fsinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs);
/* printing specific operations */
- NTSTATUS (*lpq)(struct smbsrv_request *req, union smb_lpq *lpq);
+ NTSTATUS (*lpq)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq);
/* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
- NTSTATUS (*trans2)(struct smbsrv_request *req, struct smb_trans2 *trans2);
+ NTSTATUS (*trans2)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2);
/* trans interface - used by IPC backend for pipes and RAP calls */
- NTSTATUS (*trans)(struct smbsrv_request *req, struct smb_trans2 *trans);
+ NTSTATUS (*trans)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans);
/* logoff - called when a vuid is closed */
- NTSTATUS (*logoff)(struct smbsrv_request *req);
+ NTSTATUS (*logoff)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req);
};
+struct ntvfs_module_context {
+ struct ntvfs_module_context *prev, *next;
+ void *private_data;
+ const struct ntvfs_ops *ops;
+ int depth;
+};
+
+struct ntvfs_context {
+ enum ntvfs_type type;
+ /*
+ * linked list of module contexts
+ */
+ struct ntvfs_module_context *modules;
+};
/* this structure is used by backends to determine the size of some critical types */
struct ntvfs_critical_sizes {
int interface_version;
+ int sizeof_ntvfs_context;
+ int sizeof_ntvfs_module_context;
int sizeof_ntvfs_ops;
- int sizeof_SMB_OFF_T;
int sizeof_smbsrv_tcon;
int sizeof_smbsrv_request;
};
-
-/* useful macro for backends */
-#define NTVFS_GET_PRIVATE(struct_name, name, req) \
- struct struct_name *name = req->tcon->ntvfs_private_list[req->ntvfs_depth]
diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c
index 72f4759cd5..acbd02d915 100644
--- a/source4/ntvfs/ntvfs_base.c
+++ b/source4/ntvfs/ntvfs_base.c
@@ -100,8 +100,9 @@ const struct ntvfs_critical_sizes *ntvfs_interface_version(void)
{
static const struct ntvfs_critical_sizes critical_sizes = {
NTVFS_INTERFACE_VERSION,
+ sizeof(struct ntvfs_context),
+ sizeof(struct ntvfs_module_context),
sizeof(struct ntvfs_ops),
- sizeof(SMB_OFF_T),
sizeof(struct smbsrv_tcon),
sizeof(struct smbsrv_request),
};
@@ -133,28 +134,47 @@ BOOL ntvfs_init(void)
/*
initialise a connection structure to point at a NTVFS backend
*/
-NTSTATUS ntvfs_init_connection(struct smbsrv_request *req)
+NTSTATUS ntvfs_init_connection(struct smbsrv_request *req, enum ntvfs_type type)
{
const char **handlers = lp_ntvfs_handler(req->tcon->service);
+ int i;
+ struct ntvfs_context *ctx;
- req->tcon->ntvfs_ops = ntvfs_backend_byname(handlers[0], req->tcon->type);
+ if (!handlers) {
+ return NT_STATUS_FOOBAR;
+ }
- if (!req->tcon->ntvfs_ops) {
- DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handlers[0], req->tcon->type));
- return NT_STATUS_UNSUCCESSFUL;
+ ctx = talloc_p(req->tcon, struct ntvfs_context);
+ if (!ctx) {
+ return NT_STATUS_NO_MEMORY;
}
+ ctx->type = type;
+ ctx->modules = NULL;
- return NT_STATUS_OK;
-}
+ for (i=0; handlers[i]; i++) {
+ struct ntvfs_module_context *ntvfs;
+ ntvfs = talloc_p(ctx, struct ntvfs_module_context);
+ if (!ntvfs) {
+ return NT_STATUS_NO_MEMORY;
+ }
-/*
- set the private pointer for a backend
-*/
-void ntvfs_set_private(struct smbsrv_tcon *tcon, int depth, void *value)
-{
- tcon->ntvfs_private_list = talloc_realloc_p(tcon,
- tcon->ntvfs_private_list,
- void *, depth+1);
- tcon->ntvfs_private_list[depth] = value;
+ ntvfs->ops = ntvfs_backend_byname(handlers[i], ctx->type);
+ if (!ntvfs->ops) {
+ DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n",
+ handlers[i], ctx->type));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ ntvfs->depth = i;
+ DLIST_ADD_END(ctx->modules, ntvfs, struct ntvfs_module_context *);
+ }
+
+ if (!ctx->modules) {
+ talloc_free(ctx);
+ return NT_STATUS_FOOBAR;
+ }
+
+ req->tcon->ntvfs_ctx = ctx;
+
+ return NT_STATUS_OK;
}
diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c
index 731e91f5c9..9e1d653465 100644
--- a/source4/ntvfs/ntvfs_generic.c
+++ b/source4/ntvfs/ntvfs_generic.c
@@ -58,7 +58,7 @@ static BOOL is_exe_file(const char *fname)
NTVFS open generic to any mapper
*/
NTSTATUS ntvfs_map_open(struct smbsrv_request *req, union smb_open *io,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_open io2;
@@ -146,7 +146,7 @@ NTSTATUS ntvfs_map_open(struct smbsrv_request *req, union smb_open *io,
io2.generic.in.file_attr = io->openx.in.file_attrs;
io2.generic.in.fname = io->openx.in.fname;
- status = ops->open(req, &io2);
+ status = ntvfs->ops->open(ntvfs, req, &io2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -228,7 +228,7 @@ NTSTATUS ntvfs_map_open(struct smbsrv_request *req, union smb_open *io,
DEBUG(9,("ntvfs_map_open(OPEN): mapped flags=0x%x to access_mask=0x%x and share_access=0x%x\n",
io->open.in.flags, io2.generic.in.access_mask, io2.generic.in.share_access));
- status = ops->open(req, &io2);
+ status = ntvfs->ops->open(ntvfs, req, &io2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -251,7 +251,7 @@ NTSTATUS ntvfs_map_open(struct smbsrv_request *req, union smb_open *io,
NTVFS fsinfo generic to any mapper
*/
NTSTATUS ntvfs_map_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_fsinfo fs2;
@@ -263,7 +263,7 @@ NTSTATUS ntvfs_map_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs,
/* ask the backend for the generic info */
fs2.generic.level = RAW_QFS_GENERIC;
- status = ops->fsinfo(req, &fs2);
+ status = ntvfs->ops->fsinfo(ntvfs, req, &fs2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -593,7 +593,7 @@ NTSTATUS ntvfs_map_fileinfo(struct smbsrv_request *req, union smb_fileinfo *info
NTVFS fileinfo generic to any mapper
*/
NTSTATUS ntvfs_map_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_fileinfo info2;
@@ -606,7 +606,7 @@ NTSTATUS ntvfs_map_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *inf
info2.generic.level = RAW_FILEINFO_GENERIC;
info2.generic.in.fnum = info->generic.in.fnum;
- status = ops->qfileinfo(req, &info2);
+ status = ntvfs->ops->qfileinfo(ntvfs, req, &info2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -617,7 +617,7 @@ NTSTATUS ntvfs_map_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *inf
NTVFS pathinfo generic to any mapper
*/
NTSTATUS ntvfs_map_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_fileinfo info2;
@@ -630,7 +630,7 @@ NTSTATUS ntvfs_map_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *inf
info2.generic.level = RAW_FILEINFO_GENERIC;
info2.generic.in.fname = info->generic.in.fname;
- status = ops->qpathinfo(req, &info2);
+ status = ntvfs->ops->qpathinfo(ntvfs, req, &info2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
diff --git a/source4/ntvfs/ntvfs_interface.c b/source4/ntvfs/ntvfs_interface.c
new file mode 100644
index 0000000000..06cda11000
--- /dev/null
+++ b/source4/ntvfs/ntvfs_interface.c
@@ -0,0 +1,566 @@
+/*
+ Unix SMB/CIFS implementation.
+ NTVFS interface functions
+
+ Copyright (C) Stefan (metze) Metzmacher 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+/* connect/disconnect */
+NTSTATUS ntvfs_connect(struct smbsrv_request *req, const char *sharename)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->connect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->connect(ntvfs, req, sharename);
+}
+
+NTSTATUS ntvfs_disconnect(struct smbsrv_tcon *tcon)
+{
+ struct ntvfs_module_context *ntvfs = tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->disconnect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->disconnect(ntvfs, tcon);
+}
+
+/* path operations */
+NTSTATUS ntvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->unlink) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->unlink(ntvfs, req, unl);
+}
+
+NTSTATUS ntvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->chkpath) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->chkpath(ntvfs, req, cp);
+}
+
+NTSTATUS ntvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *st)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->qpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->qpathinfo(ntvfs, req, st);
+}
+
+NTSTATUS ntvfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->setpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->setpathinfo(ntvfs, req, st);
+}
+
+NTSTATUS ntvfs_open(struct smbsrv_request *req, union smb_open *oi)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->open) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->open(ntvfs, req, oi);
+}
+
+NTSTATUS ntvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->mkdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->mkdir(ntvfs, req, md);
+}
+
+NTSTATUS ntvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->rmdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->rmdir(ntvfs, req, rd);
+}
+
+NTSTATUS ntvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->rename) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->rename(ntvfs, req, ren);
+}
+
+NTSTATUS ntvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->copy) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->copy(ntvfs, req, cp);
+}
+
+/* directory search */
+NTSTATUS ntvfs_search_first(struct smbsrv_request *req, union smb_search_first *io, void *private,
+ BOOL ntvfs_callback(void *private, union smb_search_data *file))
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->search_first) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->search_first(ntvfs, req, io, private, ntvfs_callback);
+}
+
+NTSTATUS ntvfs_search_next(struct smbsrv_request *req, union smb_search_next *io, void *private,
+ BOOL ntvfs_callback(void *private, union smb_search_data *file))
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->search_next) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->search_next(ntvfs, req, io, private, ntvfs_callback);
+}
+
+NTSTATUS ntvfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->search_close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->search_close(ntvfs, req, io);
+}
+
+/* operations on open files */
+NTSTATUS ntvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->ioctl) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->ioctl(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_read(struct smbsrv_request *req, union smb_read *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->read) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->read(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_write(struct smbsrv_request *req, union smb_write *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->write) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->write(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->seek) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->seek(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_flush(struct smbsrv_request *req, struct smb_flush *flush)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->flush) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->flush(ntvfs, req, flush);
+}
+
+NTSTATUS ntvfs_close(struct smbsrv_request *req, union smb_close *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->close(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_exit(struct smbsrv_request *req)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->exit) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->exit(ntvfs, req);
+}
+
+NTSTATUS ntvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->lock) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->lock(ntvfs, req, lck);
+}
+
+NTSTATUS ntvfs_setfileinfo(struct smbsrv_request *req, union smb_setfileinfo *info)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->setfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->setfileinfo(ntvfs, req, info);
+}
+
+NTSTATUS ntvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->qfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->qfileinfo(ntvfs, req, info);
+}
+
+/* filesystem operations */
+NTSTATUS ntvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->fsinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->fsinfo(ntvfs, req, fs);
+}
+
+/* printing specific operations */
+NTSTATUS ntvfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->lpq) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->lpq(ntvfs, req, lpq);
+}
+
+/* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
+NTSTATUS ntvfs_trans2(struct smbsrv_request *req, struct smb_trans2 *trans2)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->trans2) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->trans2(ntvfs, req, trans2);
+}
+
+/* trans interface - used by IPC backend for pipes and RAP calls */
+NTSTATUS ntvfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->trans) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->trans(ntvfs, req, trans);
+}
+
+/* logoff - called when a vuid is closed */
+NTSTATUS ntvfs_logoff(struct smbsrv_request *req)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->logoff) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->logoff(ntvfs, req);
+}
+
+/* initial setup */
+NTSTATUS ntvfs_next_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->connect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->connect(ntvfs->next, req, sharename);
+}
+
+NTSTATUS ntvfs_next_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->disconnect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->disconnect(ntvfs->next, tcon);
+}
+
+/* path operations */
+NTSTATUS ntvfs_next_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->unlink) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->unlink(ntvfs->next, req, unl);
+}
+
+NTSTATUS ntvfs_next_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->chkpath) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->chkpath(ntvfs->next, req, cp);
+}
+
+NTSTATUS ntvfs_next_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *st)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->qpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->qpathinfo(ntvfs->next, req, st);
+}
+
+NTSTATUS ntvfs_next_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->setpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->setpathinfo(ntvfs->next, req, st);
+}
+
+NTSTATUS ntvfs_next_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->open) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->open(ntvfs->next, req, oi);
+}
+
+NTSTATUS ntvfs_next_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->mkdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->mkdir(ntvfs->next, req, md);
+}
+
+NTSTATUS ntvfs_next_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->rmdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->rmdir(ntvfs->next, req, rd);
+}
+
+NTSTATUS ntvfs_next_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->rename) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->rename(ntvfs->next, req, ren);
+}
+
+NTSTATUS ntvfs_next_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->copy) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->copy(ntvfs->next, req, cp);
+}
+
+/* directory search */
+NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io, void *private,
+ BOOL (*callback)(void *private, union smb_search_data *file))
+{
+ if (!ntvfs->next || !ntvfs->next->ops->search_first) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->search_first(ntvfs->next, req, io, private, callback);
+}
+
+NTSTATUS ntvfs_next_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io, void *private,
+ BOOL (*callback)(void *private, union smb_search_data *file))
+{
+ if (!ntvfs->next || !ntvfs->next->ops->search_next) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->search_next(ntvfs->next, req, io, private, callback);
+}
+
+NTSTATUS ntvfs_next_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->search_close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->search_close(ntvfs->next, req, io);
+}
+
+/* operations on open files */
+NTSTATUS ntvfs_next_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->ioctl) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->ioctl(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->read) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->read(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->write) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->write(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->seek) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->seek(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *flush)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->flush) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->flush(ntvfs->next, req, flush);
+}
+
+NTSTATUS ntvfs_next_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->close(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->exit) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->exit(ntvfs->next, req);
+}
+
+NTSTATUS ntvfs_next_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->lock) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->lock(ntvfs->next, req, lck);
+}
+
+NTSTATUS ntvfs_next_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *info)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->setfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->setfileinfo(ntvfs->next, req, info);
+}
+
+NTSTATUS ntvfs_next_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->qfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->qfileinfo(ntvfs->next, req, info);
+}
+
+/* filesystem operations */
+NTSTATUS ntvfs_next_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->fsinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->fsinfo(ntvfs->next, req, fs);
+}
+
+/* printing specific operations */
+NTSTATUS ntvfs_next_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->lpq) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->lpq(ntvfs->next, req, lpq);
+}
+
+/* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
+NTSTATUS ntvfs_next_trans2(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->trans2) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->trans2(ntvfs->next, req, trans2);
+}
+
+/* trans interface - used by IPC backend for pipes and RAP calls */
+NTSTATUS ntvfs_next_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->trans) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->trans(ntvfs->next, req, trans);
+}
+
+/* logoff - called when a vuid is closed */
+NTSTATUS ntvfs_next_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->logoff) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->logoff(ntvfs->next, req);
+}
diff --git a/source4/ntvfs/posix/pvfs_fsinfo.c b/source4/ntvfs/posix/pvfs_fsinfo.c
index f1c42e8920..a9153b4c19 100644
--- a/source4/ntvfs/posix/pvfs_fsinfo.c
+++ b/source4/ntvfs/posix/pvfs_fsinfo.c
@@ -27,13 +27,14 @@
/*
return filesystem space info
*/
-NTSTATUS pvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+NTSTATUS pvfs_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct stat st;
if (fs->generic.level != RAW_QFS_GENERIC) {
- return ntvfs_map_fsinfo(req, fs, pvfs->ops);
+ return ntvfs_map_fsinfo(req, fs, ntvfs);
}
if (sys_fsusage(pvfs->base_directory,
diff --git a/source4/ntvfs/posix/pvfs_mkdir.c b/source4/ntvfs/posix/pvfs_mkdir.c
index de51d2e8fd..d7dcc7dd50 100644
--- a/source4/ntvfs/posix/pvfs_mkdir.c
+++ b/source4/ntvfs/posix/pvfs_mkdir.c
@@ -26,9 +26,10 @@
/*
create a directory
*/
-NTSTATUS pvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
NTSTATUS status;
struct pvfs_filename *name;
@@ -60,9 +61,10 @@ NTSTATUS pvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
/*
remove a directory
*/
-NTSTATUS pvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+NTSTATUS pvfs_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
NTSTATUS status;
struct pvfs_filename *name;
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index f3bec4085e..560d194a34 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -27,9 +27,9 @@
/*
find open file handle given fnum
*/
-struct pvfs_file *pvfs_find_fd(struct smbsrv_request *req, uint16_t fnum)
+struct pvfs_file *pvfs_find_fd(struct pvfs_state *pvfs,
+ struct smbsrv_request *req, uint16_t fnum)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
struct pvfs_file *f;
for (f=pvfs->open_files;f;f=f->next) {
if (f->fnum == fnum) {
@@ -63,16 +63,17 @@ static int pvfs_fd_destructor(void *p)
TODO: this is a temporary implementation derived from the simple backend
its purpose is to allow other tests to run
*/
-NTSTATUS pvfs_open(struct smbsrv_request *req, union smb_open *io)
+NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
int fd, flags;
struct pvfs_filename *name;
struct pvfs_file *f;
NTSTATUS status;
if (io->generic.level != RAW_OPEN_GENERIC) {
- return ntvfs_map_open(req, io, pvfs->ops);
+ return ntvfs_map_open(req, io, ntvfs);
}
/* resolve the cifs name to a posix name */
@@ -179,9 +180,10 @@ do_open:
/*
close a file
*/
-NTSTATUS pvfs_close(struct smbsrv_request *req, union smb_close *io)
+NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f;
NTSTATUS status;
@@ -190,7 +192,7 @@ NTSTATUS pvfs_close(struct smbsrv_request *req, union smb_close *io)
return NT_STATUS_INVALID_LEVEL;
}
- f = pvfs_find_fd(req, io->close.in.fnum);
+ f = pvfs_find_fd(pvfs, req, io->close.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -213,9 +215,10 @@ NTSTATUS pvfs_close(struct smbsrv_request *req, union smb_close *io)
/*
logoff - close all file descriptors open by a vuid
*/
-NTSTATUS pvfs_logoff(struct smbsrv_request *req)
+NTSTATUS pvfs_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f, *next;
for (f=pvfs->open_files;f;f=next) {
@@ -234,9 +237,10 @@ NTSTATUS pvfs_logoff(struct smbsrv_request *req)
/*
exit - close files for the current pid
*/
-NTSTATUS pvfs_exit(struct smbsrv_request *req)
+NTSTATUS pvfs_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f, *next;
for (f=pvfs->open_files;f;f=next) {
@@ -250,4 +254,3 @@ NTSTATUS pvfs_exit(struct smbsrv_request *req)
return NT_STATUS_OK;
}
-
diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c
index 81706bcfe8..30390722d1 100644
--- a/source4/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_qfileinfo.c
@@ -78,14 +78,15 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
/*
return info on a pathname
*/
-NTSTATUS pvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_filename *name;
NTSTATUS status;
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qpathinfo(req, info, pvfs->ops);
+ return ntvfs_map_qpathinfo(req, info, ntvfs);
}
/* resolve the cifs name to a posix name */
@@ -104,17 +105,18 @@ NTSTATUS pvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
/*
query info on a open file
*/
-NTSTATUS pvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f;
NTSTATUS status;
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qfileinfo(req, info, pvfs->ops);
+ return ntvfs_map_qfileinfo(req, info, ntvfs);
}
- f = pvfs_find_fd(req, info->generic.in.fnum);
+ f = pvfs_find_fd(pvfs, req, info->generic.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c
index 72ac00a32d..e0c7e0b1f2 100644
--- a/source4/ntvfs/posix/pvfs_read.c
+++ b/source4/ntvfs/posix/pvfs_read.c
@@ -26,9 +26,10 @@
/*
read from a file
*/
-NTSTATUS pvfs_read(struct smbsrv_request *req, union smb_read *rd)
+NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
ssize_t ret;
struct pvfs_file *f;
@@ -37,7 +38,7 @@ NTSTATUS pvfs_read(struct smbsrv_request *req, union smb_read *rd)
}
- f = pvfs_find_fd(req, rd->readx.in.fnum);
+ f = pvfs_find_fd(pvfs, req, rd->readx.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c
index a58a1e9c6e..51393c9499 100644
--- a/source4/ntvfs/posix/pvfs_rename.c
+++ b/source4/ntvfs/posix/pvfs_rename.c
@@ -26,9 +26,10 @@
/*
rename a set of files
*/
-NTSTATUS pvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+NTSTATUS pvfs_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
NTSTATUS status;
struct pvfs_filename *name1, *name2;
diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c
index 414b010263..f8d538bab2 100644
--- a/source4/ntvfs/posix/pvfs_search.c
+++ b/source4/ntvfs/posix/pvfs_search.c
@@ -250,12 +250,13 @@ again:
/*
list files in a directory matching a wildcard pattern - old SMBsearch interface
*/
-static NTSTATUS pvfs_search_first_old(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS pvfs_search_first_old(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct pvfs_dir *dir;
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib;
@@ -327,11 +328,12 @@ static NTSTATUS pvfs_search_first_old(struct smbsrv_request *req, union smb_sear
}
/* continue a old style search */
-static NTSTATUS pvfs_search_next_old(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS pvfs_search_next_old(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count, max_count;
@@ -374,12 +376,13 @@ static NTSTATUS pvfs_search_next_old(struct smbsrv_request *req, union smb_searc
/*
list files in a directory matching a wildcard pattern
*/
-NTSTATUS pvfs_search_first(struct smbsrv_request *req, union smb_search_first *io,
+NTSTATUS pvfs_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct pvfs_dir *dir;
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib, max_count;
@@ -388,7 +391,7 @@ NTSTATUS pvfs_search_first(struct smbsrv_request *req, union smb_search_first *i
struct pvfs_filename *name;
if (io->generic.level >= RAW_SEARCH_SEARCH) {
- return pvfs_search_first_old(req, io, search_private, callback);
+ return pvfs_search_first_old(ntvfs, req, io, search_private, callback);
}
search_attrib = io->t2ffirst.in.search_attrib;
@@ -466,11 +469,12 @@ NTSTATUS pvfs_search_first(struct smbsrv_request *req, union smb_search_first *i
}
/* continue a search */
-NTSTATUS pvfs_search_next(struct smbsrv_request *req, union smb_search_next *io,
+NTSTATUS pvfs_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count;
@@ -479,7 +483,7 @@ NTSTATUS pvfs_search_next(struct smbsrv_request *req, union smb_search_next *io,
int i;
if (io->generic.level >= RAW_SEARCH_SEARCH) {
- return pvfs_search_next_old(req, io, search_private, callback);
+ return pvfs_search_next_old(ntvfs, req, io, search_private, callback);
}
handle = io->t2fnext.in.handle;
@@ -545,9 +549,10 @@ found:
}
/* close a search */
-NTSTATUS pvfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+NTSTATUS pvfs_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
uint16_t handle;
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c
index 2ea2fdaf8e..f1d5d14089 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -26,14 +26,15 @@
/*
set info on a open file
*/
-NTSTATUS pvfs_setfileinfo(struct smbsrv_request *req,
+NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
union smb_setfileinfo *info)
{
- NTVFS_GET_PRIVATE(pvfs_private, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct utimbuf unix_times;
struct pvfs_file *f;
- f = pvfs_find_fd(req, info->generic.file.fnum);
+ f = pvfs_find_fd(pvfs, req, info->generic.file.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c
index 9e0353c041..0f4ff8b148 100644
--- a/source4/ntvfs/posix/pvfs_unlink.c
+++ b/source4/ntvfs/posix/pvfs_unlink.c
@@ -61,9 +61,10 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-NTSTATUS pvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_dir *dir;
NTSTATUS status;
uint32_t i, total_deleted=0;
diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c
index 02ba1b8228..a49f4fe947 100644
--- a/source4/ntvfs/posix/pvfs_write.c
+++ b/source4/ntvfs/posix/pvfs_write.c
@@ -27,15 +27,16 @@
/*
write to a file
*/
-NTSTATUS pvfs_write(struct smbsrv_request *req, union smb_write *wr)
+NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
ssize_t ret;
struct pvfs_file *f;
switch (wr->generic.level) {
case RAW_WRITE_WRITEX:
- f = pvfs_find_fd(req, wr->writex.in.fnum);
+ f = pvfs_find_fd(pvfs, req, wr->writex.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -53,7 +54,7 @@ NTSTATUS pvfs_write(struct smbsrv_request *req, union smb_write *wr)
return NT_STATUS_OK;
case RAW_WRITE_WRITE:
- f = pvfs_find_fd(req, wr->write.in.fnum);
+ f = pvfs_find_fd(pvfs, req, wr->write.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index 7ae7c6759a..44875f1879 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -50,7 +50,8 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
directory exists (tho it doesn't need to be accessible by the user,
that comes later)
*/
-static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct smbsrv_tcon *tcon = req->tcon;
struct pvfs_state *pvfs;
@@ -71,7 +72,6 @@ static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename,
pvfs->tcon = tcon;
pvfs->base_directory = base_directory;
- pvfs->ops = ntvfs_backend_byname("posix", NTVFS_DISK);
/* the directory must exist. Note that we deliberately don't
check that it is readable */
@@ -84,7 +84,7 @@ static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename,
tcon->fs_type = talloc_strdup(tcon, "NTFS");
tcon->dev_type = talloc_strdup(tcon, "A:");
- ntvfs_set_private(tcon, depth, pvfs);
+ ntvfs->private_data = pvfs;
pvfs_setup_options(pvfs);
@@ -94,7 +94,8 @@ static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename,
/*
disconnect from a share
*/
-static NTSTATUS pvfs_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS pvfs_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
@@ -102,7 +103,8 @@ static NTSTATUS pvfs_disconnect(struct smbsrv_tcon *tcon, int depth)
/*
ioctl interface - we don't do any
*/
-static NTSTATUS pvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS pvfs_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
return NT_STATUS_INVALID_PARAMETER;
}
@@ -110,9 +112,10 @@ static NTSTATUS pvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
/*
check if a directory exists
*/
-static NTSTATUS pvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS pvfs_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_filename *name;
NTSTATUS status;
@@ -136,7 +139,8 @@ static NTSTATUS pvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
/*
copy a set of files
*/
-static NTSTATUS pvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS pvfs_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
DEBUG(0,("pvfs_copy not implemented\n"));
return NT_STATUS_NOT_SUPPORTED;
@@ -145,7 +149,8 @@ static NTSTATUS pvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
/*
seek in a file
*/
-static NTSTATUS pvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS pvfs_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
DEBUG(0,("pvfs_seek not implemented\n"));
return NT_STATUS_NOT_SUPPORTED;
@@ -154,7 +159,8 @@ static NTSTATUS pvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
/*
flush a file
*/
-static NTSTATUS pvfs_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS pvfs_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
DEBUG(0,("pvfs_flush not implemented\n"));
return NT_STATUS_NOT_IMPLEMENTED;
@@ -163,7 +169,8 @@ static NTSTATUS pvfs_flush(struct smbsrv_request *req, struct smb_flush *io)
/*
lock a byte range
*/
-static NTSTATUS pvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
DEBUG(0,("pvfs_lock not implemented\n"));
return NT_STATUS_NOT_IMPLEMENTED;
@@ -172,7 +179,8 @@ static NTSTATUS pvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
/*
set info on a pathname
*/
-static NTSTATUS pvfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
DEBUG(0,("pvfs_setpathinfo not implemented\n"));
return NT_STATUS_NOT_SUPPORTED;
@@ -181,13 +189,15 @@ static NTSTATUS pvfs_setpathinfo(struct smbsrv_request *req, union smb_setfilein
/*
return print queue info
*/
-static NTSTATUS pvfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS pvfs_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_NOT_SUPPORTED;
}
/* SMBtrans - not used on file shares */
-static NTSTATUS pvfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS pvfs_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
return NT_STATUS_ACCESS_DENIED;
}
diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h
index 96ab7f85b2..0daacf2c33 100644
--- a/source4/ntvfs/posix/vfs_posix.h
+++ b/source4/ntvfs/posix/vfs_posix.h
@@ -49,8 +49,6 @@ struct pvfs_state {
} search;
struct pvfs_file *open_files;
-
- const struct ntvfs_ops *ops;
};
diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c
index 0e6824a14e..d487392e6f 100644
--- a/source4/ntvfs/print/vfs_print.c
+++ b/source4/ntvfs/print/vfs_print.c
@@ -29,7 +29,8 @@
in. For printing shares this should check that the spool directory
is available
*/
-static NTSTATUS print_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
return NT_STATUS_OK;
}
@@ -37,7 +38,8 @@ static NTSTATUS print_connect(struct smbsrv_request *req, const char *sharename,
/*
disconnect from a share
*/
-static NTSTATUS print_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS print_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
@@ -45,7 +47,8 @@ static NTSTATUS print_disconnect(struct smbsrv_tcon *tcon, int depth)
/*
lots of operations are not allowed on printing shares - mostly return NT_STATUS_ACCESS_DENIED
*/
-static NTSTATUS print_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS print_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
return NT_STATUS_ACCESS_DENIED;
}
@@ -54,7 +57,8 @@ static NTSTATUS print_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
/*
ioctl - used for job query
*/
-static NTSTATUS print_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
char *p;
diff --git a/source4/ntvfs/simple/svfs.h b/source4/ntvfs/simple/svfs.h
index d3bafb42e3..8e462d99f4 100644
--- a/source4/ntvfs/simple/svfs.h
+++ b/source4/ntvfs/simple/svfs.h
@@ -10,8 +10,6 @@ struct svfs_private {
uint16_t next_search_handle;
struct svfs_file *open_files;
-
- const struct ntvfs_ops *ops;
};
struct svfs_dir {
diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c
index b6b7171487..2ac12b1918 100644
--- a/source4/ntvfs/simple/svfs_util.c
+++ b/source4/ntvfs/simple/svfs_util.c
@@ -29,9 +29,10 @@
/*
convert a windows path to a unix path - don't do any manging or case sensitive handling
*/
-char *svfs_unix_path(struct smbsrv_request *req, const char *name)
+char *svfs_unix_path(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *name)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
char *ret;
if (*name != '\\') {
@@ -135,14 +136,15 @@ struct svfs_dir *svfs_list_unix(TALLOC_CTX *mem_ctx, struct smbsrv_request *req,
returned names are separate unix and DOS names. The returned names
are relative to the directory
*/
-struct svfs_dir *svfs_list(TALLOC_CTX *mem_ctx, struct smbsrv_request *req, const char *pattern)
+struct svfs_dir *svfs_list(struct ntvfs_module_context *ntvfs, struct smbsrv_request *req, const char *pattern)
{
+ struct svfs_private *private = ntvfs->private_data;
char *unix_path;
- unix_path = svfs_unix_path(req, pattern);
+ unix_path = svfs_unix_path(ntvfs, req, pattern);
if (!unix_path) { return NULL; }
- return svfs_list_unix(mem_ctx, req, unix_path);
+ return svfs_list_unix(private, req, unix_path);
}
diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c
index f60646ed77..7f5d447a09 100644
--- a/source4/ntvfs/simple/vfs_simple.c
+++ b/source4/ntvfs/simple/vfs_simple.c
@@ -61,7 +61,8 @@ static ssize_t pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offs
directory exists (tho it doesn't need to be accessible by the user,
that comes later)
*/
-static NTSTATUS svfs_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct stat st;
struct smbsrv_tcon *tcon = req->tcon;
@@ -72,7 +73,6 @@ static NTSTATUS svfs_connect(struct smbsrv_request *req, const char *sharename,
private->next_search_handle = 0;
private->connectpath = talloc_strdup(tcon, lp_pathname(tcon->service));
private->open_files = NULL;
- private->ops = ntvfs_backend_byname("simple", NTVFS_DISK);
private->search = NULL;
/* the directory must exist */
@@ -85,7 +85,7 @@ static NTSTATUS svfs_connect(struct smbsrv_request *req, const char *sharename,
tcon->fs_type = talloc_strdup(tcon, "NTFS");
tcon->dev_type = talloc_strdup(tcon, "A:");
- ntvfs_set_private(tcon, depth, private);
+ ntvfs->private_data = private;
DEBUG(0,("WARNING: ntvfs simple: connect to share [%s] with ROOT privileges!!!\n",sharename));
@@ -95,7 +95,8 @@ static NTSTATUS svfs_connect(struct smbsrv_request *req, const char *sharename,
/*
disconnect from a share
*/
-static NTSTATUS svfs_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS svfs_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
@@ -118,13 +119,14 @@ static struct svfs_file *find_fd(struct svfs_private *private, int fd)
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-static NTSTATUS svfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS svfs_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
char *unix_path;
CHECK_READ_ONLY(req);
- unix_path = svfs_unix_path(req, unl->in.pattern);
+ unix_path = svfs_unix_path(ntvfs, req, unl->in.pattern);
/* ignoring wildcards ... */
if (unlink(unix_path) == -1) {
@@ -138,7 +140,8 @@ static NTSTATUS svfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
/*
ioctl interface - we don't do any
*/
-static NTSTATUS svfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS svfs_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
return NT_STATUS_INVALID_PARAMETER;
}
@@ -146,12 +149,13 @@ static NTSTATUS svfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
/*
check if a directory exists
*/
-static NTSTATUS svfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS svfs_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
char *unix_path;
struct stat st;
- unix_path = svfs_unix_path(req, cp->in.path);
+ unix_path = svfs_unix_path(ntvfs, req, cp->in.path);
if (stat(unix_path, &st) == -1) {
return map_nt_error_from_unix(errno);
@@ -167,7 +171,8 @@ static NTSTATUS svfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
/*
approximately map a struct stat to a generic fileinfo struct
*/
-static NTSTATUS svfs_map_fileinfo(struct smbsrv_request *req, union smb_fileinfo *info,
+static NTSTATUS svfs_map_fileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info,
struct stat *st, const char *unix_path)
{
struct svfs_dir *dir = NULL;
@@ -242,18 +247,18 @@ static NTSTATUS svfs_map_fileinfo(struct smbsrv_request *req, union smb_fileinfo
/*
return info on a pathname
*/
-static NTSTATUS svfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS svfs_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
char *unix_path;
struct stat st;
DEBUG(19,("svfs_qpathinfo: file %s level 0x%x\n", info->generic.in.fname, info->generic.level));
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qpathinfo(req, info, private->ops);
+ return ntvfs_map_qpathinfo(req, info, ntvfs);
}
- unix_path = svfs_unix_path(req, info->generic.in.fname);
+ unix_path = svfs_unix_path(ntvfs, req, info->generic.in.fname);
DEBUG(19,("svfs_qpathinfo: file %s\n", unix_path));
if (stat(unix_path, &st) == -1) {
DEBUG(19,("svfs_qpathinfo: file %s errno=%d\n", unix_path, errno));
@@ -262,20 +267,21 @@ static NTSTATUS svfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *i
return map_nt_error_from_unix(errno);
}
DEBUG(19,("svfs_qpathinfo: file %s, stat done\n", unix_path));
- return svfs_map_fileinfo(req, info, &st, unix_path);
+ return svfs_map_fileinfo(ntvfs, req, info, &st, unix_path);
}
/*
query info on a open file
*/
-static NTSTATUS svfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS svfs_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct svfs_file *f;
struct stat st;
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qfileinfo(req, info, private->ops);
+ return ntvfs_map_qfileinfo(req, info, ntvfs);
}
f = find_fd(private, info->generic.in.fnum);
@@ -289,16 +295,17 @@ static NTSTATUS svfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *i
return map_nt_error_from_unix(errno);
}
- return svfs_map_fileinfo(req, info, &st, f->name);
+ return svfs_map_fileinfo(ntvfs, req,info, &st, f->name);
}
/*
open a file
*/
-static NTSTATUS svfs_open(struct smbsrv_request *req, union smb_open *io)
+static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
char *unix_path;
struct stat st;
int fd, flags;
@@ -306,7 +313,7 @@ static NTSTATUS svfs_open(struct smbsrv_request *req, union smb_open *io)
int create_flags, rdwr_flags;
if (io->generic.level != RAW_OPEN_GENERIC) {
- return ntvfs_map_open(req, io, private->ops);
+ return ntvfs_map_open(req, io, ntvfs);
}
if (lp_readonly(req->tcon->service)) {
@@ -317,7 +324,7 @@ static NTSTATUS svfs_open(struct smbsrv_request *req, union smb_open *io)
rdwr_flags = O_RDWR;
}
- unix_path = svfs_unix_path(req, io->ntcreatex.in.fname);
+ unix_path = svfs_unix_path(ntvfs, req, io->ntcreatex.in.fname);
switch (io->generic.in.open_disposition) {
case NTCREATEX_DISP_SUPERSEDE:
@@ -402,7 +409,8 @@ do_open:
/*
create a directory
*/
-static NTSTATUS svfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS svfs_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
char *unix_path;
@@ -412,7 +420,7 @@ static NTSTATUS svfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
return NT_STATUS_INVALID_LEVEL;
}
- unix_path = svfs_unix_path(req, md->mkdir.in.path);
+ unix_path = svfs_unix_path(ntvfs, req, md->mkdir.in.path);
if (mkdir(unix_path, 0777) == -1) {
return map_nt_error_from_unix(errno);
@@ -424,13 +432,14 @@ static NTSTATUS svfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
/*
remove a directory
*/
-static NTSTATUS svfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS svfs_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
char *unix_path;
CHECK_READ_ONLY(req);
- unix_path = svfs_unix_path(req, rd->in.path);
+ unix_path = svfs_unix_path(ntvfs, req, rd->in.path);
if (rmdir(unix_path) == -1) {
return map_nt_error_from_unix(errno);
@@ -442,7 +451,8 @@ static NTSTATUS svfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
/*
rename a set of files
*/
-static NTSTATUS svfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS svfs_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
char *unix_path1, *unix_path2;
@@ -452,8 +462,8 @@ static NTSTATUS svfs_rename(struct smbsrv_request *req, union smb_rename *ren)
return NT_STATUS_INVALID_LEVEL;
}
- unix_path1 = svfs_unix_path(req, ren->rename.in.pattern1);
- unix_path2 = svfs_unix_path(req, ren->rename.in.pattern2);
+ unix_path1 = svfs_unix_path(ntvfs, req, ren->rename.in.pattern1);
+ unix_path2 = svfs_unix_path(ntvfs, req, ren->rename.in.pattern2);
if (rename(unix_path1, unix_path2) != 0) {
return map_nt_error_from_unix(errno);
@@ -465,7 +475,8 @@ static NTSTATUS svfs_rename(struct smbsrv_request *req, union smb_rename *ren)
/*
copy a set of files
*/
-static NTSTATUS svfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS svfs_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -473,7 +484,8 @@ static NTSTATUS svfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
/*
read from a file
*/
-static NTSTATUS svfs_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS svfs_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
ssize_t ret;
@@ -499,7 +511,8 @@ static NTSTATUS svfs_read(struct smbsrv_request *req, union smb_read *rd)
/*
write to a file
*/
-static NTSTATUS svfs_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
ssize_t ret;
@@ -545,7 +558,8 @@ static NTSTATUS svfs_write(struct smbsrv_request *req, union smb_write *wr)
/*
seek in a file
*/
-static NTSTATUS svfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS svfs_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -553,7 +567,8 @@ static NTSTATUS svfs_seek(struct smbsrv_request *req, struct smb_seek *io)
/*
flush a file
*/
-static NTSTATUS svfs_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS svfs_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
fsync(io->in.fnum);
return NT_STATUS_OK;
@@ -562,9 +577,10 @@ static NTSTATUS svfs_flush(struct smbsrv_request *req, struct smb_flush *io)
/*
close a file
*/
-static NTSTATUS svfs_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS svfs_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct svfs_file *f;
if (io->generic.level != RAW_CLOSE_CLOSE) {
@@ -591,7 +607,8 @@ static NTSTATUS svfs_close(struct smbsrv_request *req, union smb_close *io)
/*
exit - closing files
*/
-static NTSTATUS svfs_exit(struct smbsrv_request *req)
+static NTSTATUS svfs_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -599,7 +616,8 @@ static NTSTATUS svfs_exit(struct smbsrv_request *req)
/*
logoff - closing files
*/
-static NTSTATUS svfs_logoff(struct smbsrv_request *req)
+static NTSTATUS svfs_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -607,7 +625,8 @@ static NTSTATUS svfs_logoff(struct smbsrv_request *req)
/*
lock a byte range
*/
-static NTSTATUS svfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS svfs_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
DEBUG(0,("REWRITE: not doing byte range locking!\n"));
return NT_STATUS_OK;
@@ -616,7 +635,8 @@ static NTSTATUS svfs_lock(struct smbsrv_request *req, union smb_lock *lck)
/*
set info on a pathname
*/
-static NTSTATUS svfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS svfs_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
CHECK_READ_ONLY(req);
@@ -626,7 +646,8 @@ static NTSTATUS svfs_setpathinfo(struct smbsrv_request *req, union smb_setfilein
/*
set info on a open file
*/
-static NTSTATUS svfs_setfileinfo(struct smbsrv_request *req,
+static NTSTATUS svfs_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
union smb_setfileinfo *info)
{
struct utimbuf unix_times;
@@ -669,13 +690,14 @@ static NTSTATUS svfs_setfileinfo(struct smbsrv_request *req,
/*
return filesystem space info
*/
-static NTSTATUS svfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS svfs_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct stat st;
if (fs->generic.level != RAW_QFS_GENERIC) {
- return ntvfs_map_fsinfo(req, fs, private->ops);
+ return ntvfs_map_fsinfo(req, fs, ntvfs);
}
if (sys_fsusage(private->connectpath,
@@ -710,13 +732,14 @@ static NTSTATUS svfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
/*
return filesystem attribute info
*/
-static NTSTATUS svfs_fsattr(struct smbsrv_request *req, union smb_fsattr *fs)
+static NTSTATUS svfs_fsattr(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsattr *fs)
{
struct stat st;
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
if (fs->generic.level != RAW_FSATTR_GENERIC) {
- return ntvfs_map_fsattr(req, fs);
+ return ntvfs_map_fsattr(req, fs, ntvfs);
}
if (stat(private->connectpath, &st) != 0) {
@@ -741,7 +764,8 @@ static NTSTATUS svfs_fsattr(struct smbsrv_request *req, union smb_fsattr *fs)
/*
return print queue info
*/
-static NTSTATUS svfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS svfs_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_NOT_SUPPORTED;
}
@@ -749,13 +773,14 @@ static NTSTATUS svfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
/*
list files in a directory matching a wildcard pattern
*/
-static NTSTATUS svfs_search_first(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct svfs_dir *dir;
int i;
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct search_state *search;
union smb_search_data file;
uint_t max_count;
@@ -771,7 +796,7 @@ static NTSTATUS svfs_search_first(struct smbsrv_request *req, union smb_search_f
max_count = io->t2ffirst.in.max_count;
- dir = svfs_list(private, req, io->t2ffirst.in.pattern);
+ dir = svfs_list(ntvfs, req, io->t2ffirst.in.pattern);
if (!dir) {
return NT_STATUS_FOOBAR;
}
@@ -818,13 +843,14 @@ static NTSTATUS svfs_search_first(struct smbsrv_request *req, union smb_search_f
}
/* continue a search */
-static NTSTATUS svfs_search_next(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS svfs_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct svfs_dir *dir;
int i;
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct search_state *search;
union smb_search_data file;
uint_t max_count;
@@ -905,9 +931,10 @@ found:
}
/* close a search */
-static NTSTATUS svfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS svfs_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct search_state *search;
for (search=private->search; search; search = search->next) {
@@ -926,7 +953,8 @@ static NTSTATUS svfs_search_close(struct smbsrv_request *req, union smb_search_c
}
/* SMBtrans - not used on file shares */
-static NTSTATUS svfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS svfs_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
return NT_STATUS_ACCESS_DENIED;
}