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
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.
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.
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.
23 This work was sponsored by Optifacio Software Services, Inc.
29 /* Avoid conflict with an AIX include file */
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...
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
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 #define SMB_VFS_INTERFACE_VERSION 9
57 /* to bug old modules witch are trying to compile with the old functions */
58 #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 };
59 #define lp_parm_string __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string { \
60 __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string };
61 #define lp_vfs_options __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead { \
62 __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead };
65 All intercepted VFS operations must be declared as static functions inside module source
66 in order to keep smbd namespace unpolluted. See source of audit, extd_audit, fake_perms and recycle
67 example VFS modules for more details.
70 /* VFS operations structure */
72 struct vfs_handle_struct
;
73 struct connection_struct
;
75 struct security_descriptor_info
;
78 Available VFS operations. These values must be in sync with vfs_ops struct
79 (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops).
80 In particular, if new operations are added to vfs_ops, appropriate constants
81 should be added to vfs_op_type so that order of them kept same as in vfs_ops.
84 typedef enum _vfs_op_type
{
89 SMB_VFS_OP_CONNECT
= 0,
90 SMB_VFS_OP_DISCONNECT
,
94 SMB_VFS_OP_GET_SHADOW_COPY_DATA
,
97 /* Directory operations */
105 /* File operations */
126 SMB_VFS_OP_FTRUNCATE
,
134 /* NT ACL operations. */
136 SMB_VFS_OP_FGET_NT_ACL
,
137 SMB_VFS_OP_GET_NT_ACL
,
138 SMB_VFS_OP_FSET_NT_ACL
,
139 SMB_VFS_OP_SET_NT_ACL
,
141 /* POSIX ACL operations. */
143 SMB_VFS_OP_CHMOD_ACL
,
144 SMB_VFS_OP_FCHMOD_ACL
,
146 SMB_VFS_OP_SYS_ACL_GET_ENTRY
,
147 SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
,
148 SMB_VFS_OP_SYS_ACL_GET_PERMSET
,
149 SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
,
150 SMB_VFS_OP_SYS_ACL_GET_FILE
,
151 SMB_VFS_OP_SYS_ACL_GET_FD
,
152 SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
,
153 SMB_VFS_OP_SYS_ACL_ADD_PERM
,
154 SMB_VFS_OP_SYS_ACL_TO_TEXT
,
155 SMB_VFS_OP_SYS_ACL_INIT
,
156 SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
,
157 SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
,
158 SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
,
159 SMB_VFS_OP_SYS_ACL_SET_PERMSET
,
160 SMB_VFS_OP_SYS_ACL_VALID
,
161 SMB_VFS_OP_SYS_ACL_SET_FILE
,
162 SMB_VFS_OP_SYS_ACL_SET_FD
,
163 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
164 SMB_VFS_OP_SYS_ACL_GET_PERM
,
165 SMB_VFS_OP_SYS_ACL_FREE_TEXT
,
166 SMB_VFS_OP_SYS_ACL_FREE_ACL
,
167 SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
,
171 SMB_VFS_OP_LGETXATTR
,
172 SMB_VFS_OP_FGETXATTR
,
173 SMB_VFS_OP_LISTXATTR
,
174 SMB_VFS_OP_LLISTXATTR
,
175 SMB_VFS_OP_FLISTXATTR
,
176 SMB_VFS_OP_REMOVEXATTR
,
177 SMB_VFS_OP_LREMOVEXATTR
,
178 SMB_VFS_OP_FREMOVEXATTR
,
180 SMB_VFS_OP_LSETXATTR
,
181 SMB_VFS_OP_FSETXATTR
,
183 /* This should always be last enum value */
189 Please keep vfs_op_type, struct vfs_fn_pointers and struct vfs_handles_pointers in sync.
192 struct vfs_fn_pointers
{
193 /* Disk operations */
195 int (*connect
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *service
, const char *user
);
196 void (*disconnect
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
);
197 SMB_BIG_UINT (*disk_free
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, BOOL small_query
, SMB_BIG_UINT
*bsize
,
198 SMB_BIG_UINT
*dfree
, SMB_BIG_UINT
*dsize
);
199 int (*get_quota
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*qt
);
200 int (*set_quota
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*qt
);
201 int (*get_shadow_copy_data
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SHADOW_COPY_DATA
*shadow_copy_data
, BOOL labels
);
203 /* Directory operations */
205 DIR *(*opendir
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *fname
);
206 struct dirent
*(*readdir
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, DIR *dirp
);
207 int (*mkdir
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, mode_t mode
);
208 int (*rmdir
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
);
209 int (*closedir
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, DIR *dir
);
211 /* File operations */
213 int (*open
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *fname
, int flags
, mode_t mode
);
214 int (*close
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
);
215 ssize_t (*read
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, void *data
, size_t n
);
216 ssize_t (*write
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, const void *data
, size_t n
);
217 SMB_OFF_T (*lseek
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, SMB_OFF_T offset
, int whence
);
218 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
);
219 int (*rename
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *old
, const char *new);
220 int (*fsync
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
);
221 int (*stat
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *fname
, SMB_STRUCT_STAT
*sbuf
);
222 int (*fstat
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, SMB_STRUCT_STAT
*sbuf
);
223 int (*lstat
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, SMB_STRUCT_STAT
*sbuf
);
224 int (*unlink
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
);
225 int (*chmod
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, mode_t mode
);
226 int (*fchmod
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, mode_t mode
);
227 int (*chown
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, uid_t uid
, gid_t gid
);
228 int (*fchown
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, uid_t uid
, gid_t gid
);
229 int (*chdir
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
);
230 char *(*getwd
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, char *buf
);
231 int (*utime
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, struct utimbuf
*times
);
232 int (*ftruncate
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, SMB_OFF_T offset
);
233 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
);
234 int (*symlink
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *oldpath
, const char *newpath
);
235 int (*readlink
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, char *buf
, size_t bufsiz
);
236 int (*link
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *oldpath
, const char *newpath
);
237 int (*mknod
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, mode_t mode
, SMB_DEV_T dev
);
238 char *(*realpath
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
, char *resolved_path
);
240 /* NT ACL operations. */
242 size_t (*fget_nt_acl
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, uint32 security_info
, struct security_descriptor_info
**ppdesc
);
243 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
);
244 BOOL (*fset_nt_acl
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, uint32 security_info_sent
, struct security_descriptor_info
*psd
);
245 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
);
247 /* POSIX ACL operations. */
249 int (*chmod_acl
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *name
, mode_t mode
);
250 int (*fchmod_acl
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, mode_t mode
);
252 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
);
253 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
);
254 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
);
255 void * (*sys_acl_get_qualifier
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_ENTRY_T entry_d
);
256 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
);
257 SMB_ACL_T (*sys_acl_get_fd
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
);
258 int (*sys_acl_clear_perms
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_PERMSET_T permset
);
259 int (*sys_acl_add_perm
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
);
260 char * (*sys_acl_to_text
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_T theacl
, ssize_t
*plen
);
261 SMB_ACL_T (*sys_acl_init
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, int count
);
262 int (*sys_acl_create_entry
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_T
*pacl
, SMB_ACL_ENTRY_T
*pentry
);
263 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
);
264 int (*sys_acl_set_qualifier
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_ENTRY_T entry
, void *qual
);
265 int (*sys_acl_set_permset
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_ENTRY_T entry
, SMB_ACL_PERMSET_T permset
);
266 int (*sys_acl_valid
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_T theacl
);
267 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
);
268 int (*sys_acl_set_fd
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int fd
, SMB_ACL_T theacl
);
269 int (*sys_acl_delete_def_file
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, const char *path
);
270 int (*sys_acl_get_perm
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
);
271 int (*sys_acl_free_text
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, char *text
);
272 int (*sys_acl_free_acl
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, SMB_ACL_T posix_acl
);
273 int (*sys_acl_free_qualifier
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, void *qualifier
, SMB_ACL_TAG_T tagtype
);
276 ssize_t (*getxattr
)(struct vfs_handle_struct
*handle
,struct connection_struct
*conn
,const char *path
, const char *name
, void *value
, size_t size
);
277 ssize_t (*lgetxattr
)(struct vfs_handle_struct
*handle
,struct connection_struct
*conn
,const char *path
, const char *name
, void *value
, size_t size
);
278 ssize_t (*fgetxattr
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int fd
, const char *name
, void *value
, size_t size
);
279 ssize_t (*listxattr
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, char *list
, size_t size
);
280 ssize_t (*llistxattr
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, char *list
, size_t size
);
281 ssize_t (*flistxattr
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int fd
, char *list
, size_t size
);
282 int (*removexattr
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, const char *name
);
283 int (*lremovexattr
)(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, const char *name
);
284 int (*fremovexattr
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int filedes
, const char *name
);
285 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
);
286 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
);
287 int (*fsetxattr
)(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int filedes
, const char *name
, const void *value
, size_t size
, int flags
);
291 struct vfs_handles_pointers
{
292 /* Disk operations */
294 struct vfs_handle_struct
*connect
;
295 struct vfs_handle_struct
*disconnect
;
296 struct vfs_handle_struct
*disk_free
;
297 struct vfs_handle_struct
*get_quota
;
298 struct vfs_handle_struct
*set_quota
;
299 struct vfs_handle_struct
*get_shadow_copy_data
;
301 /* Directory operations */
303 struct vfs_handle_struct
*opendir
;
304 struct vfs_handle_struct
*readdir
;
305 struct vfs_handle_struct
*mkdir
;
306 struct vfs_handle_struct
*rmdir
;
307 struct vfs_handle_struct
*closedir
;
309 /* File operations */
311 struct vfs_handle_struct
*open
;
312 struct vfs_handle_struct
*close
;
313 struct vfs_handle_struct
*read
;
314 struct vfs_handle_struct
*write
;
315 struct vfs_handle_struct
*lseek
;
316 struct vfs_handle_struct
*sendfile
;
317 struct vfs_handle_struct
*rename
;
318 struct vfs_handle_struct
*fsync
;
319 struct vfs_handle_struct
*stat
;
320 struct vfs_handle_struct
*fstat
;
321 struct vfs_handle_struct
*lstat
;
322 struct vfs_handle_struct
*unlink
;
323 struct vfs_handle_struct
*chmod
;
324 struct vfs_handle_struct
*fchmod
;
325 struct vfs_handle_struct
*chown
;
326 struct vfs_handle_struct
*fchown
;
327 struct vfs_handle_struct
*chdir
;
328 struct vfs_handle_struct
*getwd
;
329 struct vfs_handle_struct
*utime
;
330 struct vfs_handle_struct
*ftruncate
;
331 struct vfs_handle_struct
*lock
;
332 struct vfs_handle_struct
*symlink
;
333 struct vfs_handle_struct
*readlink
;
334 struct vfs_handle_struct
*link
;
335 struct vfs_handle_struct
*mknod
;
336 struct vfs_handle_struct
*realpath
;
338 /* NT ACL operations. */
340 struct vfs_handle_struct
*fget_nt_acl
;
341 struct vfs_handle_struct
*get_nt_acl
;
342 struct vfs_handle_struct
*fset_nt_acl
;
343 struct vfs_handle_struct
*set_nt_acl
;
345 /* POSIX ACL operations. */
347 struct vfs_handle_struct
*chmod_acl
;
348 struct vfs_handle_struct
*fchmod_acl
;
350 struct vfs_handle_struct
*sys_acl_get_entry
;
351 struct vfs_handle_struct
*sys_acl_get_tag_type
;
352 struct vfs_handle_struct
*sys_acl_get_permset
;
353 struct vfs_handle_struct
*sys_acl_get_qualifier
;
354 struct vfs_handle_struct
*sys_acl_get_file
;
355 struct vfs_handle_struct
*sys_acl_get_fd
;
356 struct vfs_handle_struct
*sys_acl_clear_perms
;
357 struct vfs_handle_struct
*sys_acl_add_perm
;
358 struct vfs_handle_struct
*sys_acl_to_text
;
359 struct vfs_handle_struct
*sys_acl_init
;
360 struct vfs_handle_struct
*sys_acl_create_entry
;
361 struct vfs_handle_struct
*sys_acl_set_tag_type
;
362 struct vfs_handle_struct
*sys_acl_set_qualifier
;
363 struct vfs_handle_struct
*sys_acl_set_permset
;
364 struct vfs_handle_struct
*sys_acl_valid
;
365 struct vfs_handle_struct
*sys_acl_set_file
;
366 struct vfs_handle_struct
*sys_acl_set_fd
;
367 struct vfs_handle_struct
*sys_acl_delete_def_file
;
368 struct vfs_handle_struct
*sys_acl_get_perm
;
369 struct vfs_handle_struct
*sys_acl_free_text
;
370 struct vfs_handle_struct
*sys_acl_free_acl
;
371 struct vfs_handle_struct
*sys_acl_free_qualifier
;
374 struct vfs_handle_struct
*getxattr
;
375 struct vfs_handle_struct
*lgetxattr
;
376 struct vfs_handle_struct
*fgetxattr
;
377 struct vfs_handle_struct
*listxattr
;
378 struct vfs_handle_struct
*llistxattr
;
379 struct vfs_handle_struct
*flistxattr
;
380 struct vfs_handle_struct
*removexattr
;
381 struct vfs_handle_struct
*lremovexattr
;
382 struct vfs_handle_struct
*fremovexattr
;
383 struct vfs_handle_struct
*setxattr
;
384 struct vfs_handle_struct
*lsetxattr
;
385 struct vfs_handle_struct
*fsetxattr
;
391 Possible VFS operation layers (per-operation)
393 These values are used by VFS subsystem when building vfs_ops for connection
394 from multiple VFS modules. Internally, Samba differentiates only opaque and
395 transparent layers at this process. Other types are used for providing better
396 diagnosing facilities.
398 Most modules will provide transparent layers. Opaque layer is for modules
399 which implement actual file system calls (like DB-based VFS). For example,
400 default POSIX VFS which is built in into Samba is an opaque VFS module.
402 Other layer types (audit, splitter, scanner) were designed to provide different
403 degree of transparency and for diagnosing VFS module behaviour.
405 Each module can implement several layers at the same time provided that only
406 one layer is used per each operation.
410 typedef enum _vfs_op_layer
{
411 SMB_VFS_LAYER_NOOP
= -1, /* - For using in VFS module to indicate end of array */
412 /* of operations description */
413 SMB_VFS_LAYER_OPAQUE
= 0, /* - Final level, does not call anything beyond itself */
414 SMB_VFS_LAYER_TRANSPARENT
, /* - Normal operation, calls underlying layer after */
415 /* possibly changing passed data */
416 SMB_VFS_LAYER_LOGGER
, /* - Logs data, calls underlying layer, logging may not */
418 SMB_VFS_LAYER_SPLITTER
, /* - Splits operation, calls underlying layer _and_ own facility, */
419 /* then combines result */
420 SMB_VFS_LAYER_SCANNER
/* - Checks data and possibly initiates additional */
421 /* file activity like logging to files _inside_ samba VFS */
425 VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem,
426 which describes all operations this module is willing to intercept.
427 VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs
428 using this information.
431 typedef struct _vfs_op_tuple
{
438 typedef struct vfs_handle_struct
{
439 struct vfs_handle_struct
*next
, *prev
;
441 struct vfs_ops vfs_next
;
442 struct connection_struct
*conn
;
444 void (*free_data
)(void **data
);
448 #define SMB_VFS_HANDLE_GET_DATA(handle, datap, type, ret) { \
449 if (!(handle)||((datap=(type *)(handle)->data)==NULL)) { \
450 DEBUG(0,("%s() failed to get vfs_handle->data!\n",FUNCTION_MACRO)); \
455 #define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \
457 DEBUG(0,("%s() failed to set handle->data!\n",FUNCTION_MACRO)); \
460 if ((handle)->free_data) { \
461 (handle)->free_data(&(handle)->data); \
463 (handle)->data = (void *)datap; \
464 (handle)->free_data = free_fn; \
468 #define SMB_VFS_HANDLE_FREE_DATA(handle) { \
469 if ((handle) && (handle)->free_data) { \
470 (handle)->free_data(&(handle)->data); \
474 /* Check whether module-specific data handle was already allocated or not */
475 #define SMB_VFS_HANDLE_TEST_DATA(handle) ( !(handle) || !(handle)->data ? False : True )
477 #define SMB_VFS_OP(x) ((void *) x)
480 #include "vfs_macros.h"