summaryrefslogtreecommitdiff
path: root/source4/ntvfs/ntvfs.h
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.h
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.h')
-rw-r--r--source4/ntvfs/ntvfs.h117
1 files changed, 82 insertions, 35 deletions
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]