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