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