summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-03-18 11:10:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:58:41 -0500
commit61fa658ebcaf2856d543d376b120932ad5a082f0 (patch)
treea527dab5ff010d4ec836ffc37ea0466d34499a83 /source4/ntvfs
parent75140d6150264ba50a47e104c3ce1ae40bd3f0c8 (diff)
downloadsamba-61fa658ebcaf2856d543d376b120932ad5a082f0.tar.gz
samba-61fa658ebcaf2856d543d376b120932ad5a082f0.tar.bz2
samba-61fa658ebcaf2856d543d376b120932ad5a082f0.zip
r14541: separate smbsrv_request and ntvfs_request,
with this it's now possible to write a ntvfs_test programm like the vfstest in samba3 also smb2 support will be possible later metze (This used to be commit 7253153691e35cd206346fbd4e9b9f95c042f602)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/ntvfs.h26
-rw-r--r--source4/ntvfs/ntvfs_util.c41
2 files changed, 62 insertions, 5 deletions
diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h
index 09c5b9bdcb..13147d5c19 100644
--- a/source4/ntvfs/ntvfs.h
+++ b/source4/ntvfs/ntvfs.h
@@ -24,8 +24,7 @@
#define NTVFS_INTERFACE_VERSION 0
struct ntvfs_module_context;
-
-#define ntvfs_request smbsrv_request
+struct ntvfs_request;
/* 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
@@ -231,6 +230,29 @@ struct ntvfs_async_state {
struct ntvfs_module_context *ntvfs;
};
+struct ntvfs_request {
+ /* the ntvfs_context this requests belongs to */
+ struct ntvfs_context *ctx;
+
+ /* ntvfs per request async states */
+ struct ntvfs_async_state *async_states;
+
+ /* the session_info, with security_token and maybe delegated credentials */
+ struct auth_session_info *session_info;
+
+ /* the smb pid is needed for locking contexts */
+ uint16_t smbpid;
+
+ /* the smb mid is needed for matching requests */
+ uint16_t smbmid;
+
+ /* some statictics for the management tools */
+ struct {
+ /* the system time when the request arrived */
+ struct timeval request_time;
+ } statistics;
+};
+
/* this structure is used by backends to determine the size of some critical types */
struct ntvfs_critical_sizes {
int interface_version;
diff --git a/source4/ntvfs/ntvfs_util.c b/source4/ntvfs/ntvfs_util.c
index c7b99d3d24..a6d1ccd3f3 100644
--- a/source4/ntvfs/ntvfs_util.c
+++ b/source4/ntvfs/ntvfs_util.c
@@ -27,6 +27,43 @@
#include "ntvfs/ntvfs.h"
+_PUBLIC_ struct ntvfs_request *ntvfs_request_create(struct ntvfs_context *ctx, TALLOC_CTX *mem_ctx,
+ struct auth_session_info *session_info,
+ uint16_t smbpid, uint16_t smbmid,
+ struct timeval request_time,
+ void *private_data,
+ void (*send_fn)(struct ntvfs_request *),
+ uint32_t state)
+{
+ struct ntvfs_request *req;
+ struct ntvfs_async_state *async;
+
+ req = talloc(mem_ctx, struct ntvfs_request);
+ if (!req) return NULL;
+ req->ctx = ctx;
+ req->async_states = NULL;
+ req->session_info = session_info;
+ req->smbpid = smbpid;
+ req->smbmid = smbmid;
+ req->statistics.request_time = request_time;
+
+ async = talloc(req, struct ntvfs_async_state);
+ if (!async) goto failed;
+
+ async->state = state;
+ async->private_data = private_data;
+ async->send_fn = send_fn;
+ async->status = NT_STATUS_INTERNAL_ERROR;
+ async->ntvfs = NULL;
+
+ DLIST_ADD(req->async_states, async);
+
+ return req;
+
+failed:
+ return NULL;
+}
+
_PUBLIC_ NTSTATUS ntvfs_async_state_push(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req,
void *private_data,
@@ -35,9 +72,7 @@ _PUBLIC_ NTSTATUS ntvfs_async_state_push(struct ntvfs_module_context *ntvfs,
struct ntvfs_async_state *async;
async = talloc(req, struct ntvfs_async_state);
- if (!async) {
- return NT_STATUS_NO_MEMORY;
- }
+ NT_STATUS_HAVE_NO_MEMORY(async);
async->state = req->async_states->state;
async->private_data = private_data;