Patch based on work from James Peach <jpeach@sgi.com> to convert over to
[samba.git] / source3 / include / vfs.h
1 /* 
2    Unix SMB/CIFS implementation.
3    VFS structures and parameters
4    Copyright (C) Jeremy Allison                         1999-2003
5    Copyright (C) Tim Potter                             1999
6    Copyright (C) Alexander Bokovoy                      2002
7    Copyright (C) Stefan (metze) Metzmacher              2003
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23    This work was sponsored by Optifacio Software Services, Inc.
24 */
25
26 #ifndef _VFS_H
27 #define _VFS_H
28
29 /* Avoid conflict with an AIX include file */
30
31 #ifdef vfs_ops
32 #undef vfs_ops
33 #endif
34
35 /*
36  * As we're now (thanks Andrew ! :-) using file_structs and connection
37  * structs in the vfs - then anyone writing a vfs must include includes.h...
38  */
39
40 /*
41  * This next constant specifies the version number of the VFS interface
42  * this smbd will load. Increment this if *ANY* changes are made to the
43  * vfs_ops below. JRA.
44  */
45
46 /* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */
47 /* Changed to version 3 for POSIX acl extensions. JRA. */
48 /* Changed to version 4 for cascaded VFS interface. Alexander Bokovoy. */
49 /* Changed to version 5 for sendfile addition. JRA. */
50 /* Changed to version 6 for the new module system, fixed cascading and quota functions. --metze */
51 /* Changed to version 7 to include the get_nt_acl info parameter. JRA. */
52 /* Changed to version 8 includes EA calls. JRA. */
53 /* Changed to version 9 to include the get_shadow_data call. --metze */
54 /* Changed to version 10 to include pread/pwrite calls. */
55 #define SMB_VFS_INTERFACE_VERSION 10
56
57
58 /* to bug old modules witch are trying to compile with the old functions */
59 #define vfs_init __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore(void) { __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore };
60 #define lp_parm_string __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string { \
61   __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string };
62 #define lp_vfs_options __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead { \
63   __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead };
64
65 /*
66     All intercepted VFS operations must be declared as static functions inside module source
67     in order to keep smbd namespace unpolluted. See source of audit, extd_audit, fake_perms and recycle
68     example VFS modules for more details.
69 */
70
71 /* VFS operations structure */
72
73 struct vfs_handle_struct;
74 struct connection_struct;
75 struct files_struct;
76 struct security_descriptor_info;
77
78 /*
79     Available VFS operations. These values must be in sync with vfs_ops struct
80     (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops). 
81     In particular, if new operations are added to vfs_ops, appropriate constants
82     should be added to vfs_op_type so that order of them kept same as in vfs_ops.
83 */
84
85 typedef enum _vfs_op_type {
86         SMB_VFS_OP_NOOP = -1,
87         
88         /* Disk operations */
89
90         SMB_VFS_OP_CONNECT = 0,
91         SMB_VFS_OP_DISCONNECT,
92         SMB_VFS_OP_DISK_FREE,
93         SMB_VFS_OP_GET_QUOTA,
94         SMB_VFS_OP_SET_QUOTA,
95         SMB_VFS_OP_GET_SHADOW_COPY_DATA,
96
97
98         /* Directory operations */
99
100         SMB_VFS_OP_OPENDIR,
101         SMB_VFS_OP_READDIR,
102         SMB_VFS_OP_MKDIR,
103         SMB_VFS_OP_RMDIR,
104         SMB_VFS_OP_CLOSEDIR,
105
106         /* File operations */
107
108         SMB_VFS_OP_OPEN,
109         SMB_VFS_OP_CLOSE,
110         SMB_VFS_OP_READ,
111         SMB_VFS_OP_PREAD,
112         SMB_VFS_OP_WRITE,
113         SMB_VFS_OP_PWRITE,
114         SMB_VFS_OP_LSEEK,
115         SMB_VFS_OP_SENDFILE,
116         SMB_VFS_OP_RENAME,
117         SMB_VFS_OP_FSYNC,
118         SMB_VFS_OP_STAT,
119         SMB_VFS_OP_FSTAT,
120         SMB_VFS_OP_LSTAT,
121         SMB_VFS_OP_UNLINK,
122         SMB_VFS_OP_CHMOD,
123         SMB_VFS_OP_FCHMOD,
124         SMB_VFS_OP_CHOWN,
125         SMB_VFS_OP_FCHOWN,
126         SMB_VFS_OP_CHDIR,
127         SMB_VFS_OP_GETWD,
128         SMB_VFS_OP_UTIME,
129         SMB_VFS_OP_FTRUNCATE,
130         SMB_VFS_OP_LOCK,
131         SMB_VFS_OP_SYMLINK,
132         SMB_VFS_OP_READLINK,
133         SMB_VFS_OP_LINK,
134         SMB_VFS_OP_MKNOD,
135         SMB_VFS_OP_REALPATH,
136
137         /* NT ACL operations. */
138
139         SMB_VFS_OP_FGET_NT_ACL,
140         SMB_VFS_OP_GET_NT_ACL,
141         SMB_VFS_OP_FSET_NT_ACL,
142         SMB_VFS_OP_SET_NT_ACL,
143
144         /* POSIX ACL operations. */
145
146         SMB_VFS_OP_CHMOD_ACL,
147         SMB_VFS_OP_FCHMOD_ACL,
148
149         SMB_VFS_OP_SYS_ACL_GET_ENTRY,
150         SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE,
151         SMB_VFS_OP_SYS_ACL_GET_PERMSET,
152         SMB_VFS_OP_SYS_ACL_GET_QUALIFIER,
153         SMB_VFS_OP_SYS_ACL_GET_FILE,
154         SMB_VFS_OP_SYS_ACL_GET_FD,
155         SMB_VFS_OP_SYS_ACL_CLEAR_PERMS,
156         SMB_VFS_OP_SYS_ACL_ADD_PERM,
157         SMB_VFS_OP_SYS_ACL_TO_TEXT,
158         SMB_VFS_OP_SYS_ACL_INIT,
159         SMB_VFS_OP_SYS_ACL_CREATE_ENTRY,
160         SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE,
161         SMB_VFS_OP_SYS_ACL_SET_QUALIFIER,
162         SMB_VFS_OP_SYS_ACL_SET_PERMSET,
163         SMB_VFS_OP_SYS_ACL_VALID,
164         SMB_VFS_OP_SYS_ACL_SET_FILE,
165         SMB_VFS_OP_SYS_ACL_SET_FD,
166         SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
167         SMB_VFS_OP_SYS_ACL_GET_PERM,
168         SMB_VFS_OP_SYS_ACL_FREE_TEXT,
169         SMB_VFS_OP_SYS_ACL_FREE_ACL,
170         SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,
171         
172         /* EA operations. */
173         SMB_VFS_OP_GETXATTR,
174         SMB_VFS_OP_LGETXATTR,
175         SMB_VFS_OP_FGETXATTR,
176         SMB_VFS_OP_LISTXATTR,
177         SMB_VFS_OP_LLISTXATTR,
178         SMB_VFS_OP_FLISTXATTR,
179         SMB_VFS_OP_REMOVEXATTR,
180         SMB_VFS_OP_LREMOVEXATTR,
181         SMB_VFS_OP_FREMOVEXATTR,
182         SMB_VFS_OP_SETXATTR,
183         SMB_VFS_OP_LSETXATTR,
184         SMB_VFS_OP_FSETXATTR,
185
186         /* This should always be last enum value */
187         
188         SMB_VFS_OP_LAST
189 } vfs_op_type;
190
191 /*
192     Please keep vfs_op_type, struct vfs_fn_pointers and struct vfs_handles_pointers in sync.
193 */
194 struct vfs_ops {
195         struct vfs_fn_pointers {
196                 /* Disk operations */
197                 
198                 int (*connect)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *service, const char *user);
199                 void (*disconnect)(struct vfs_handle_struct *handle, struct connection_struct *conn);
200                 SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, 
201                         SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
202                 int (*get_quota)(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
203                 int (*set_quota)(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
204                 int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
205                 
206                 /* Directory operations */
207                 
208                 DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname);
209                 struct dirent *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
210                 int (*mkdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode);
211                 int (*rmdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path);
212                 int (*closedir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dir);
213                 
214                 /* File operations */
215                 
216                 int (*open)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, int flags, mode_t mode);
217                 int (*close)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
218                 ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n);
219                 ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset);
220                 ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n);
221                 ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset);
222                 SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence);
223                 ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
224                 int (*rename)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *old, const char *new);
225                 int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
226                 int (*stat)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf);
227                 int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
228                 int (*lstat)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf);
229                 int (*unlink)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path);
230                 int (*chmod)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode);
231                 int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
232                 int (*chown)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, uid_t uid, gid_t gid);
233                 int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
234                 int (*chdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path);
235                 char *(*getwd)(struct vfs_handle_struct *handle, struct connection_struct *conn, char *buf);
236                 int (*utime)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct utimbuf *times);
237                 int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset);
238                 BOOL (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
239                 int (*symlink)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *oldpath, const char *newpath);
240                 int (*readlink)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, char *buf, size_t bufsiz);
241                 int (*link)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *oldpath, const char *newpath);
242                 int (*mknod)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev);
243                 char *(*realpath)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, char *resolved_path);
244                 
245                 /* NT ACL operations. */
246                 
247                 size_t (*fget_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd,  uint32 security_info, struct security_descriptor_info **ppdesc);
248                 size_t (*get_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name,  uint32 security_info, struct security_descriptor_info **ppdesc);
249                 BOOL (*fset_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd);
250                 BOOL (*set_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd);
251                 
252                 /* POSIX ACL operations. */
253                 
254                 int (*chmod_acl)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *name, mode_t mode);
255                 int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
256                 
257                 int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
258                 int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
259                 int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
260                 void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d);
261                 SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type);
262                 SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
263                 int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_PERMSET_T permset);
264                 int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
265                 char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen);
266                 SMB_ACL_T (*sys_acl_init)(struct vfs_handle_struct *handle, struct connection_struct *conn, int count);
267                 int (*sys_acl_create_entry)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
268                 int (*sys_acl_set_tag_type)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
269                 int (*sys_acl_set_qualifier)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual);
270                 int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
271                 int (*sys_acl_valid)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T theacl );
272                 int (*sys_acl_set_file)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
273                 int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_ACL_T theacl);
274                 int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path);
275                 int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
276                 int (*sys_acl_free_text)(struct vfs_handle_struct *handle, struct connection_struct *conn, char *text);
277                 int (*sys_acl_free_acl)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T posix_acl);
278                 int (*sys_acl_free_qualifier)(struct vfs_handle_struct *handle, struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype);
279
280                 /* EA operations. */
281                 ssize_t (*getxattr)(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size);
282                 ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size);
283                 ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size);
284                 ssize_t (*listxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size);
285                 ssize_t (*llistxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size);
286                 ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size);
287                 int (*removexattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name);
288                 int (*lremovexattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name);
289                 int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name);
290                 int (*setxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags);
291                 int (*lsetxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags);
292                 int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags);
293
294         } ops;
295
296         struct vfs_handles_pointers {
297                 /* Disk operations */
298
299                 struct vfs_handle_struct *connect;
300                 struct vfs_handle_struct *disconnect;
301                 struct vfs_handle_struct *disk_free;
302                 struct vfs_handle_struct *get_quota;
303                 struct vfs_handle_struct *set_quota;
304                 struct vfs_handle_struct *get_shadow_copy_data;
305
306                 /* Directory operations */
307
308                 struct vfs_handle_struct *opendir;
309                 struct vfs_handle_struct *readdir;
310                 struct vfs_handle_struct *mkdir;
311                 struct vfs_handle_struct *rmdir;
312                 struct vfs_handle_struct *closedir;
313
314                 /* File operations */
315
316                 struct vfs_handle_struct *open;
317                 struct vfs_handle_struct *close;
318                 struct vfs_handle_struct *read;
319                 struct vfs_handle_struct *pread;
320                 struct vfs_handle_struct *write;
321                 struct vfs_handle_struct *pwrite;
322                 struct vfs_handle_struct *lseek;
323                 struct vfs_handle_struct *sendfile;
324                 struct vfs_handle_struct *rename;
325                 struct vfs_handle_struct *fsync;
326                 struct vfs_handle_struct *stat;
327                 struct vfs_handle_struct *fstat;
328                 struct vfs_handle_struct *lstat;
329                 struct vfs_handle_struct *unlink;
330                 struct vfs_handle_struct *chmod;
331                 struct vfs_handle_struct *fchmod;
332                 struct vfs_handle_struct *chown;
333                 struct vfs_handle_struct *fchown;
334                 struct vfs_handle_struct *chdir;
335                 struct vfs_handle_struct *getwd;
336                 struct vfs_handle_struct *utime;
337                 struct vfs_handle_struct *ftruncate;
338                 struct vfs_handle_struct *lock;
339                 struct vfs_handle_struct *symlink;
340                 struct vfs_handle_struct *readlink;
341                 struct vfs_handle_struct *link;
342                 struct vfs_handle_struct *mknod;
343                 struct vfs_handle_struct *realpath;
344
345                 /* NT ACL operations. */
346
347                 struct vfs_handle_struct *fget_nt_acl;
348                 struct vfs_handle_struct *get_nt_acl;
349                 struct vfs_handle_struct *fset_nt_acl;
350                 struct vfs_handle_struct *set_nt_acl;
351
352                 /* POSIX ACL operations. */
353
354                 struct vfs_handle_struct *chmod_acl;
355                 struct vfs_handle_struct *fchmod_acl;
356
357                 struct vfs_handle_struct *sys_acl_get_entry;
358                 struct vfs_handle_struct *sys_acl_get_tag_type;
359                 struct vfs_handle_struct *sys_acl_get_permset;
360                 struct vfs_handle_struct *sys_acl_get_qualifier;
361                 struct vfs_handle_struct *sys_acl_get_file;
362                 struct vfs_handle_struct *sys_acl_get_fd;
363                 struct vfs_handle_struct *sys_acl_clear_perms;
364                 struct vfs_handle_struct *sys_acl_add_perm;
365                 struct vfs_handle_struct *sys_acl_to_text;
366                 struct vfs_handle_struct *sys_acl_init;
367                 struct vfs_handle_struct *sys_acl_create_entry;
368                 struct vfs_handle_struct *sys_acl_set_tag_type;
369                 struct vfs_handle_struct *sys_acl_set_qualifier;
370                 struct vfs_handle_struct *sys_acl_set_permset;
371                 struct vfs_handle_struct *sys_acl_valid;
372                 struct vfs_handle_struct *sys_acl_set_file;
373                 struct vfs_handle_struct *sys_acl_set_fd;
374                 struct vfs_handle_struct *sys_acl_delete_def_file;
375                 struct vfs_handle_struct *sys_acl_get_perm;
376                 struct vfs_handle_struct *sys_acl_free_text;
377                 struct vfs_handle_struct *sys_acl_free_acl;
378                 struct vfs_handle_struct *sys_acl_free_qualifier;
379
380                 /* EA operations. */
381                 struct vfs_handle_struct *getxattr;
382                 struct vfs_handle_struct *lgetxattr;
383                 struct vfs_handle_struct *fgetxattr;
384                 struct vfs_handle_struct *listxattr;
385                 struct vfs_handle_struct *llistxattr;
386                 struct vfs_handle_struct *flistxattr;
387                 struct vfs_handle_struct *removexattr;
388                 struct vfs_handle_struct *lremovexattr;
389                 struct vfs_handle_struct *fremovexattr;
390                 struct vfs_handle_struct *setxattr;
391                 struct vfs_handle_struct *lsetxattr;
392                 struct vfs_handle_struct *fsetxattr;
393
394         } handles;
395 };
396
397 /*
398     Possible VFS operation layers (per-operation)
399     
400     These values are used by VFS subsystem when building vfs_ops for connection
401     from multiple VFS modules. Internally, Samba differentiates only opaque and
402     transparent layers at this process. Other types are used for providing better
403     diagnosing facilities.
404     
405     Most modules will provide transparent layers. Opaque layer is for modules
406     which implement actual file system calls (like DB-based VFS). For example,
407     default POSIX VFS which is built in into Samba is an opaque VFS module.
408     
409     Other layer types (audit, splitter, scanner) were designed to provide different 
410     degree of transparency and for diagnosing VFS module behaviour.
411     
412     Each module can implement several layers at the same time provided that only
413     one layer is used per each operation.
414     
415 */
416
417 typedef enum _vfs_op_layer {
418         SMB_VFS_LAYER_NOOP = -1,        /* - For using in VFS module to indicate end of array */
419                                         /*   of operations description */
420         SMB_VFS_LAYER_OPAQUE = 0,       /* - Final level, does not call anything beyond itself */
421         SMB_VFS_LAYER_TRANSPARENT,      /* - Normal operation, calls underlying layer after */
422                                         /*   possibly changing passed data */
423         SMB_VFS_LAYER_LOGGER,           /* - Logs data, calls underlying layer, logging may not */
424                                         /*   use Samba VFS */
425         SMB_VFS_LAYER_SPLITTER,         /* - Splits operation, calls underlying layer _and_ own facility, */
426                                         /*   then combines result */
427         SMB_VFS_LAYER_SCANNER           /* - Checks data and possibly initiates additional */
428                                         /*   file activity like logging to files _inside_ samba VFS */
429 } vfs_op_layer;
430
431 /*
432     VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem,
433     which describes all operations this module is willing to intercept. 
434     VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs
435     using this information.
436 */
437
438 typedef struct _vfs_op_tuple {
439         void* op;
440         vfs_op_type type;
441         vfs_op_layer layer;
442 } vfs_op_tuple;
443
444
445 typedef struct vfs_handle_struct {
446         struct vfs_handle_struct  *next, *prev;
447         const char *param;
448         struct vfs_ops vfs_next;
449         struct connection_struct *conn;
450         void *data;
451         void (*free_data)(void **data);
452 } vfs_handle_struct;
453
454
455 #define SMB_VFS_HANDLE_GET_DATA(handle, datap, type, ret) { \
456         if (!(handle)||((datap=(type *)(handle)->data)==NULL)) { \
457                 DEBUG(0,("%s() failed to get vfs_handle->data!\n",FUNCTION_MACRO)); \
458                 ret; \
459         } \
460 }
461
462 #define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \
463         if (!(handle)) { \
464                 DEBUG(0,("%s() failed to set handle->data!\n",FUNCTION_MACRO)); \
465                 ret; \
466         } else { \
467                 if ((handle)->free_data) { \
468                         (handle)->free_data(&(handle)->data); \
469                 } \
470                 (handle)->data = (void *)datap; \
471                 (handle)->free_data = free_fn; \
472         } \
473 }
474
475 #define SMB_VFS_HANDLE_FREE_DATA(handle) { \
476         if ((handle) && (handle)->free_data) { \
477                 (handle)->free_data(&(handle)->data); \
478         } \
479 }
480
481 /* Check whether module-specific data handle was already allocated or not */
482 #define SMB_VFS_HANDLE_TEST_DATA(handle)  ( !(handle) || !(handle)->data ? False : True )
483
484 #define SMB_VFS_OP(x) ((void *) x)
485
486
487 #include "vfs_macros.h"
488
489 #endif /* _VFS_H */