better child synchronisation at startup in NBENCH
[kai/samba.git] / source4 / include / ntvfs.h
1 /* 
2    Unix SMB/CIFS implementation.
3    NTVFS structures and defines
4    Copyright (C) Andrew Tridgell                        2003
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 /* modules can use the following to determine if the interface has changed */
22 #define NTVFS_INTERFACE_VERSION 1
23
24
25
26 /* each backend has to be one one of the following 3 basic types. In
27  * earlier versions of Samba backends needed to handle all types, now
28  * we implement them separately. */
29 enum ntvfs_type {NTVFS_DISK, NTVFS_PRINT, NTVFS_IPC};
30
31
32 /* the ntvfs operations structure - contains function pointers to 
33    the backend implementations of each operation */
34 struct ntvfs_ops {
35         /* initial setup */
36         NTSTATUS (*connect)(struct request_context *req, const char *sharename);
37         NTSTATUS (*disconnect)(struct tcon_context *conn);
38
39         /* path operations */
40         NTSTATUS (*unlink)(struct request_context *req, struct smb_unlink *unl);
41         NTSTATUS (*chkpath)(struct request_context *req, struct smb_chkpath *cp);
42         NTSTATUS (*qpathinfo)(struct request_context *req, union smb_fileinfo *st);
43         NTSTATUS (*setpathinfo)(struct request_context *req, union smb_setfileinfo *st);
44         NTSTATUS (*open)(struct request_context *req, union smb_open *oi);
45         NTSTATUS (*mkdir)(struct request_context *req, union smb_mkdir *md);
46         NTSTATUS (*rmdir)(struct request_context *req, struct smb_rmdir *rd);
47         NTSTATUS (*rename)(struct request_context *req, union smb_rename *ren);
48         NTSTATUS (*copy)(struct request_context *req, struct smb_copy *cp);
49
50         /* directory search */
51         NTSTATUS (*search_first)(struct request_context *req, union smb_search_first *io, void *private,
52                                  BOOL (*callback)(void *private, union smb_search_data *file));
53         NTSTATUS (*search_next)(struct request_context *req, union smb_search_next *io, void *private,
54                                  BOOL (*callback)(void *private, union smb_search_data *file));
55         NTSTATUS (*search_close)(struct request_context *req, union smb_search_close *io);
56
57         /* operations on open files */
58         NTSTATUS (*ioctl)(struct request_context *req, struct smb_ioctl *io);
59         NTSTATUS (*read)(struct request_context *req, union smb_read *io);
60         NTSTATUS (*write)(struct request_context *req, union smb_write *io);
61         NTSTATUS (*seek)(struct request_context *req, struct smb_seek *io);
62         NTSTATUS (*flush)(struct request_context *req, struct smb_flush *flush);
63         NTSTATUS (*close)(struct request_context *req, union smb_close *io);
64         NTSTATUS (*exit)(struct request_context *req);
65         NTSTATUS (*lock)(struct request_context *req, union smb_lock *lck);
66         NTSTATUS (*setfileinfo)(struct request_context *req, union smb_setfileinfo *info);
67         NTSTATUS (*qfileinfo)(struct request_context *req, union smb_fileinfo *info);
68
69         /* filesystem operations */
70         NTSTATUS (*fsinfo)(struct request_context *req, union smb_fsinfo *fs);
71
72         /* printing specific operations */
73         NTSTATUS (*lpq)(struct request_context *req, union smb_lpq *lpq);
74
75         /* trans interfaces - only used by CIFS backend to prover complete passthru for testing */
76         NTSTATUS (*trans2)(struct request_context *req, struct smb_trans2 *trans2);
77 };
78
79
80 /* this structure is used by backends to determine the size of some critical types */
81 struct ntvfs_critical_sizes {
82         int sizeof_ntvfs_ops;
83         int sizeof_SMB_OFF_T;
84         int sizeof_tcon_context;
85         int sizeof_request_context;
86 };