summaryrefslogtreecommitdiff
path: root/source4/ntvfs/ntvfs_base.c
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/ntvfs_base.c
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/ntvfs_base.c')
-rw-r--r--source4/ntvfs/ntvfs_base.c54
1 files changed, 37 insertions, 17 deletions
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;
}