smbd: add dirfsp arg to SMB_VFS_CREATE_FILE()
[samba.git] / source3 / include / vfs.h
1 /* 
2    Unix SMB/CIFS implementation.
3    VFS structures and parameters
4    Copyright (C) Jeremy Allison                         1999-2005
5    Copyright (C) Tim Potter                             1999
6    Copyright (C) Alexander Bokovoy                      2002-2005
7    Copyright (C) Stefan (metze) Metzmacher              2003
8    Copyright (C) Volker Lendecke                        2009
9
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 3 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program.  If not, see <http://www.gnu.org/licenses/>.
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  * If you change anything here, please also update modules/vfs_full_audit.c.
46  * VL.
47  */
48
49 /*
50  * Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA.
51  * Changed to version 3 for POSIX acl extensions. JRA.
52  * Changed to version 4 for cascaded VFS interface. Alexander Bokovoy.
53  * Changed to version 5 for sendfile addition. JRA.
54  * Changed to version 6 for the new module system, fixed cascading and quota functions. --metze
55  * Changed to version 7 to include the get_nt_acl info parameter. JRA.
56  * Changed to version 8 includes EA calls. JRA.
57  * Changed to version 9 to include the get_shadow_data call. --metze
58  * Changed to version 10 to include pread pwrite calls.
59  * Changed to version 11 to include seekdir telldir rewinddir calls. JRA
60  * Changed to version 12 to add mask and attributes to opendir(). JRA
61  * Also include aio calls. JRA.
62  * Changed to version 13 as the internal structure of files_struct has changed. JRA
63  * Changed to version 14 as we had to change DIR to SMB_STRUCT_DIR. JRA
64  * Changed to version 15 as we added the statvfs call. JRA
65  * Changed to version 16 as we added the getlock call. JRA
66  * Changed to version 17 as we removed redundant connection_struct parameters. --jpeach
67  * Changed to version 18 to add fsp parameter to the open call -- jpeach
68  * Also include kernel_flock call - jmcd
69  * Changed to version 19, kernel change notify has been merged
70  * Also included linux setlease call - jmcd
71  * Changed to version 20, use ntimes call instead of utime (greater
72  * timestamp resolition. JRA.
73  * Changed to version21 to add chflags operation -- jpeach
74  * Changed to version22 to add lchown operation -- jra
75  * Leave at 22 - not yet released. But change set_nt_acl to return an NTSTATUS. jra.
76  * Leave at 22 - not yet released. Add file_id_create operation. --metze
77  * Leave at 22 - not yet released. Change all BOOL parameters (int) to bool. jra.
78  * Leave at 22 - not yet released. Added recvfile.
79  * Leave at 22 - not yet released. Change get_nt_acl to return NTSTATUS - vl
80  * Leave at 22 - not yet released. Change get_nt_acl to *not* take a
81  * files_struct. - obnox.
82  * Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox
83  * Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox
84  * Leave at 22 - not yet released. Remove parameter fd from pread. - obnox
85  * Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox
86  * Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox
87  * Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox
88  * Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox
89  * Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox
90  * Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox
91  * Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox
92  * Leave at 22 - not yet released. Remove parameter fd from lock. - obnox
93  * Leave at 22 - not yet released. Remove parameter fd from kernel_flock. - obnox
94  * Leave at 22 - not yet released. Remove parameter fd from linux_setlease. - obnox
95  * Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox
96  * Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox
97  * Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox
98  * Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox
99  * Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox
100  * Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox
101  * Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox
102  * Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox
103  * Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox
104  * Leave at 22 - not yet released. Remove parameter fd from read. - obnox
105  * Leave at 22 - not yet released. Remove parameter fd from write. - obnox
106  * Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox
107  * Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox
108  * Leave at 22 - not yet released. Additional change: add operations for offline files -- ab
109  * Leave at 22 - not yet released. Add the streaminfo call. -- jpeach, vl
110  * Leave at 22 - not yet released. Remove parameter fd from close_fn. - obnox
111  * Changed to version 23 - remove set_nt_acl call. This can only be done via an
112  *                         open handle. JRA.
113  * Changed to version 24 - make security descriptor const in fset_nt_acl. JRA.
114  * Changed to version 25 - Jelmer's change from SMB_BIG_UINT to uint64_t.
115  * Leave at 25 - not yet released. Add create_file call. -- tprouty.
116  * Leave at 25 - not yet released. Add create time to ntimes. -- tstecher.
117  * Leave at 25 - not yet released. Add get_alloc_size call. -- tprouty.
118  * Leave at 25 - not yet released. Add SMB_STRUCT_STAT to readdir. - sdann
119  * Leave at 25 - not yet released. Add init_search_op call. - sdann
120  * Leave at 25 - not yet released. Add locking calls. -- zkirsch.
121  * Leave at 25 - not yet released. Add strict locking calls. -- drichards.
122  * Changed to version 26 - Plumb struct smb_filename to SMB_VFS_CREATE_FILE,
123  *                         SMB_VFS_OPEN, SMB_VFS_STAT, SMB_VFS_LSTAT,
124  *                         SMB_VFS_RENAME, SMB_VFS_UNLINK, SMB_VFS_NTIMES.
125  * Changed to version 27 - not yet released. Added enum timestamp_set_resolution
126  *                         return to fs_capabilities call. JRA.
127  * Leave at 27 - not yet released. Add translate_name VFS call to convert
128  *               UNIX names to Windows supported names -- asrinivasan.
129  * Changed to version 28 - Add private_flags uint32_t to CREATE call.
130  * Leave at 28 - not yet released. Change realpath to assume NULL and return a
131  *               malloc'ed path. JRA.
132  * Leave at 28 - not yet released. Move posix_fallocate into the VFS
133  *              where it belongs. JRA.
134  * Leave at 28 - not yet released. Rename posix_fallocate to fallocate
135  *              to split out the two possible uses. JRA.
136  * Leave at 28 - not yet released. Add fdopendir. JRA.
137  * Leave at 28 - not yet released. Rename open function to open_fn. - gd
138  * Leave at 28 - not yet released. Make getwd function always return malloced memory. JRA.
139  * Bump to version 29 - Samba 3.6.0 will ship with interface version 28.
140  * Leave at 29 - not yet releases. Add fsctl. Richard Sharpe
141  * Leave at 29 - not yet released. add SMB_VFS_GET_DFS_REFERRAL() - metze
142  * Leave at 29 - not yet released. Remove l{list,get,set,remove}xattr - abartlet
143  * Leave at 29 - not yet released. move to plain off_t - abartlet
144  * Leave at 29 - not yet released. Remove sys_acl functions other than set and get - abartlet
145  * Leave at 29 - not yet released. Added backup_intent bool to files_struct - JRA
146  * Leave at 29 - not yet released. Add durable handle functions - metze obnox
147  * Leave at 29 - not yet released. Added sys_acl_blob_get_file and sys_acl_blob_get_fd
148  * Bump to version 30 - Samba 4.0.0 will ship with interface version 30
149  * Leave at 30 - not yet released. Added conn->cwd to save vfs_GetWd() calls.
150  * Leave at 30 - not yet released. Changed sys_acl_blob_get_file interface to remove type
151  * Bump to version 31 - Samba 4.1.0 will ship with interface version 31
152  * Leave at 31 - not yet released. Make struct vuid_cache_entry in
153  *               connection_struct a pointer.
154  * Leave at 31 - not yet released. Add share_access to vuid_cache_entry.
155  * Leave at 31 - not yet released. add SMB_VFS_COPY_CHUNK()
156  * Leave at 31 - not yet released. Remove the unused
157  *               fsp->pending_break_messages array
158  * Leave at 31 - not yet released. add SMB_VFS_[GET SET]_COMPRESSION()
159  *
160  * Bump to version 32 - Samba 4.2 will ship with that.
161  * Version 32 - Add "lease" to CREATE_FILE operation
162  * Version 32 - Add "lease" to struct files_struct
163  * Version 32 - Add SMB_VFS_READDIR_ATTR()
164  * Version 32 - Add in and out create context blobs to create_file
165  * Version 32 - Remove unnecessary SMB_VFS_DISK_FREE() small_query parameter
166  * Bump to version 33 - Samba 4.3 will ship with that.
167  * Version 33 - change fallocate mode flags param from enum->uint32_t
168  * Version 33 - Add snapshot create delete calls
169  * Version 33 - Add OS X SMB2 AAPL copyfile extension flag to fsp
170  * Version 33 - Remove notify_watch_fn
171  * Bump to version 34 - Samba 4.4 will ship with that
172  * Version 34 - Remove bool posix_open, add uint64_t posix_flags
173  * Version 34 - Added bool posix_pathnames to struct smb_request
174  * Bump to version 35 - Samba 4.5 will ship with that
175  * Version 35 - Change get_nt_acl_fn from const char *, to
176  *              const struct smb_filename *
177  * Version 35 - Change mkdir from const char *, to
178  *              const struct smb_filename *
179  * Version 35 - Change rmdir from const char *, to
180  *              const struct smb_filename *
181  * Version 35 - Change opendir from const char *, to
182  *              const struct smb_filename *
183  * Version 35 - Wrap aio async funtions args in a struct vfs_aio_state
184  * Version 35 - Change chmod from const char *, to
185  *              const struct smb_filename *
186  * Version 35 - Change chmod_acl from const char *, to
187  *              const struct smb_filename *
188  * Version 35 - Change chown from const char *, to
189  *              const struct smb_filename *
190  * Version 35 - Change lchown from const char *, to
191  *              const struct smb_filename *
192  * Version 35 - Change streaminfo from const char *, to
193  *              const struct smb_filename *
194  * Version 35 - Add uint32_t flags to struct smb_filename
195  * Version 35 - Add get set fget fset dos attribute functions.
196  * Version 35 - Add bool use_ofd_locks to struct files_struct
197  * Bump to version 36 - Samba 4.6 will ship with that
198  * Version 36 - Remove is_offline and set_offline
199  * Version 37 - Module init functions now take a TALLOC_CTX * parameter.
200  * Version 37 - Add vfs_copy_chunk_flags for DUP_EXTENTS_TO_FILE
201  * Version 37 - Change sys_acl_delete_def_file from const char *
202  *              to const struct smb_filename *
203  * Version 37 - Change sys_acl_get_file from const char *
204  *              to const struct smb_filename *
205  * Version 37 - Change sys_acl_blob_get_file from const char *
206  *              to const struct smb_filename *
207  * Version 37 - Change sys_acl_set_file from const char *
208  *              to const struct smb_filename *
209  * Version 37 - Change listxattr from const char *
210  *              to const struct smb_filename *
211  * Version 37 - Change removexattr from const char *
212  *              to const struct smb_filename *
213  * Version 37 - Change setxattr from const char *
214  *              to const struct smb_filename *
215  * Version 37 - Change getxattr from const char *
216  *              to const struct smb_filename *
217  * Version 37 - Change mknod from const char * to const struct smb_filename *
218  * Version 37 - Change chflags from const char *
219  *              to const struct smb_filename *
220  * Version 37 - Change disk_free from const char *
221  *              to const struct smb_filename *
222  * Version 37 - Change get_quota from const char *
223  *              to const struct smb_filename *
224  * Version 37 - Change link from const char *
225  *              to const struct smb_filename *
226  * Version 37 - Change statvfs from const char *
227  *              to const struct smb_filename *
228  * Version 37 - Change readlink from const char *
229  *              to const struct smb_filename *
230  * Version 37 - Change symlink from const char *
231  *              to const struct smb_filename *
232  * Version 37 - Change chdir from const char *
233  *              to const struct smb_filename *
234  * Version 37 - Change getwd from char *
235  *              to const struct smb_filename *
236  * Version 37 - Change conn->cwd from char *
237  *              to struct smb_filename *
238  * Version 37 - Change realpath from char *
239  *              to struct smb_filename *
240  * Version 37 - Change connectpath from char *
241  *              to struct smb_filename *
242  * Version 37 - Add SMB_VFS_OFFLOAD_READ_SEND RECV
243  * Version 37 - Rename SMB_VFS_COPY_CHUNK_SEND RECV to
244  *              SMB_VFS_OFFLOAD_READ_SEND RECV
245  * Version 37 - Remove SMB_VFS_STRICT_UNLOCK
246  * Version 37 - Rename SMB_VFS_STRICT_LOCK to
247  *              SMB_VFS_STRICT_LOCK_CHECK
248  * Version 38 - Remove SMB_VFS_INIT_SEARCH_OP
249  * Bump to version 39, Samba 4.9 will ship with that
250  * Version 39 - Remove SMB_VFS_FSYNC
251  *              Only implement async versions.
252  * Version 39 - Remove SMB_VFS_READ
253  *              All users are now pread or async versions.
254  * Version 39 - Remove SMB_VFS_WRITE
255  *              All users are now pwrite or async versions.
256  * Version 39 - Remove SMB_VFS_CHMOD_ACL - no longer used.
257  * Version 39 - Remove SMB_VFS_FCHMOD_ACL - no longer used.
258  * Version 39 - Remove struct dfree_cached_info pointer from
259  *              connection struct
260  * Bump to version 40, Samba 4.10 will ship with that
261  * Version 40 - Add SMB_VFS_GETXATTRAT_SEND RECV
262  * Version 40 - Add SMB_VFS_GET_DOS_ATTRIBUTES_SEND RECV
263  * Bump to version 41, Samba 4.11 will ship with that
264  * Version 41 - Remove SMB_VFS_BRL_CANCEL_WINDOWS
265  * Version 41 - Remove unused st_ex_mask from struct stat_ex
266  * Version 41 - convert struct stat_ex.st_ex_calculated_birthtime to flags
267  * Version 41 - add st_ex_itime to struct stat_ex
268  * Version 41 - add st_ex_file_id to struct stat_ex
269  * Version 41 - add SMB_VFS_FS_FILE_ID
270  * Version 41 - Remove "blocking_lock" parameter from
271  *              SMB_VFS_BRL_LOCK_WINDOWS
272  * Version 41 - Remove "msg_ctx" parameter from SMB_VFS_BRL_UNLOCK_WINDOWS
273  * Bump to version 42, Samba 4.12 will ship with that
274  * Version 42 - Remove share_access member from struct files_struct
275  * Version 42 - Make "lease" a const* in create_file_fn
276  * Version 42 - Move SMB_VFS_RENAME -> SMB_VFS_RENAMEAT
277  * Version 42 - Move SMB_VFS_LINK -> SMB_VFS_LINKAT.
278  * Version 42 - Move SMB_VFS_MKNOD -> SMB_VFS_MKDNODAT.
279  * Version 42 - Move SMB_VFS_READLINK -> SMB_VFS_READLINKAT.
280  * Version 42 - Move SMB_VFS_SYMLINK -> SMB_VFS_SYMLINKAT.
281  * Version 42 - Move SMB_VFS_MKDIR -> SMB_VFS_MKDIRAT.
282  * Version 42 - Move change_to_user() -> change_to_user_and_service()
283  * Version 42 - Move change_to_user_by_fsp() -> change_to_user_and_service_by_fsp()
284  * Version 42 - Move [un]become_user*() -> [un]become_user_without_service*()
285  * Version 42 - Move SMB_VFS_UNLINK -> SMB_VFS_UNLINKAT.
286  * Version 42 - Add SMB_VFS_FCNTL
287  * Version 42 - Remove SMB_VFS_RMDIR.
288  *              Use SMB_VFS_UNLINKAT(.., AT_REMOVEDIR) instead.
289  * Version 42 - Remove SMB_VFS_CHOWN
290  * Version 42 - Remove struct write_cache *wcp from files_struct
291  * Version 42 - SMB_VFS_NTIMES() receives null times based on UTIMES_OMIT
292  * Version 42 - Add SMB_VFS_CREATE_DFS_PATHAT()
293  * Version 42 - Add SMB_VFS_READ_DFS_PATHAT()
294  * Change to Version 43 - will ship with 4.13.
295  * Version 43 - Remove deferred_close from struct files_struct
296  * Version 43 - Remove SMB_VFS_OPENDIR()
297  * Version 43 - Remove original_lcomp from struct smb_filename
298  * Version 43 - files_struct flags:
299  *              bool kernel_share_modes_taken
300  *              bool update_write_time_triggered
301  *              bool update_write_time_on_close
302  *              bool write_time_forced
303  *              bool can_lock
304  *              bool can_read
305  *              bool can_write
306  *              bool modified
307  *              bool is_directory
308  *              bool aio_write_behind
309  *              bool initial_delete_on_close
310  *              bool delete_on_close
311  *              bool is_sparse
312  *              bool backup_intent
313  *              bool use_ofd_locks
314  *              bool closing
315  *              bool lock_failure_seen
316  *              changed to bitfields.
317  * Version 43 - convert SMB_VFS_GET_REAL_FILENAME() arg path
318  *              to be a struct smb_filename
319  * Version 43 - convert link_contents arg of SMB_VFS_SYMLINKAT()
320  *              to struct smb_filename
321  * Version 43 - Move SMB_VFS_GET_NT_ACL() -> SMB_VFS_GET_NT_ACL_AT().
322  * Version 43 - Remove root_dir_fid from SMB_VFS_CREATE_FILE().
323  * Version 43 - Add dirfsp to struct files_struct
324  * Version 43 - Add dirfsp args to SMB_VFS_CREATE_FILE()
325  */
326
327 #define SMB_VFS_INTERFACE_VERSION 43
328
329 /*
330     All intercepted VFS operations must be declared as static functions inside module source
331     in order to keep smbd namespace unpolluted. See source of audit, extd_audit, fake_perms and recycle
332     example VFS modules for more details.
333 */
334
335 /* VFS operations structure */
336
337 struct vfs_handle_struct;
338 struct connection_struct;
339 struct files_struct;
340 struct security_descriptor;
341 struct vfs_statvfs_struct;
342 struct smb_request;
343 struct ea_list;
344 struct smb_file_time;
345 struct smb_filename;
346 struct dfs_GetDFSReferral;
347
348 typedef union unid_t {
349         uid_t uid;
350         gid_t gid;
351 } unid_t;
352
353 struct fd_handle {
354         size_t ref_count;
355         int fd;
356         uint64_t position_information;
357         off_t pos;
358         uint32_t private_options;       /* NT Create options, but we only look at
359                                  * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
360                                  * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB and
361                                  * NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE
362                                  * for print files *only*, where
363                                  * DELETE_ON_CLOSE is not stored in the share
364                                  * mode database.
365                                  */
366         uint64_t gen_id;
367 };
368
369 struct fsp_lease {
370         size_t ref_count;
371         struct smbd_server_connection *sconn;
372         struct tevent_timer *timeout;
373         struct smb2_lease lease;
374 };
375
376 typedef struct files_struct {
377         struct files_struct *next, *prev;
378         uint64_t fnum;
379         struct smbXsrv_open *op;
380         struct connection_struct *conn;
381         struct fd_handle *fh;
382         struct files_struct *dirfsp;
383         unsigned int num_smb_operations;
384         struct file_id file_id;
385         uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */
386         uint16_t file_pid;
387         uint64_t vuid; /* SMB2 compat */
388         struct timeval open_time;
389         uint32_t access_mask;           /* NTCreateX access bits (FILE_READ_DATA etc.) */
390         struct {
391                 bool kernel_share_modes_taken : 1;
392                 bool update_write_time_triggered : 1;
393                 bool update_write_time_on_close : 1;
394                 bool write_time_forced : 1;
395                 bool can_lock : 1;
396                 bool can_read : 1;
397                 bool can_write : 1;
398                 bool modified : 1;
399                 bool is_directory : 1;
400                 bool is_dirfsp : 1;
401                 bool aio_write_behind : 1;
402                 bool initial_delete_on_close : 1;
403                 bool delete_on_close : 1;
404                 bool is_sparse : 1;
405                 bool backup_intent : 1;
406                 bool use_ofd_locks : 1;
407                 bool closing : 1;
408                 bool lock_failure_seen : 1;
409         } fsp_flags;
410
411         struct tevent_timer *update_write_time_event;
412         struct timespec close_write_time;
413
414         int oplock_type;
415
416         /*
417          * Cache of our lease_type, stored as "current_state" in
418          * leases.tdb
419          */
420         int leases_db_seqnum;
421         uint32_t lease_type;
422
423         struct fsp_lease *lease;
424         int sent_oplock_break;
425         struct tevent_timer *oplock_timeout;
426         struct lock_struct last_lock_failure;
427         int current_lock_count; /* Count the number of outstanding locks and pending locks. */
428
429         uint64_t posix_flags;
430         struct smb_filename *fsp_name;
431         uint32_t name_hash;             /* Jenkins hash of full pathname. */
432         uint64_t mid;                   /* Mid of the operation that created us. */
433
434         struct vfs_fsp_data *vfs_extension;
435         struct fake_file_handle *fake_file_handle;
436
437         struct notify_change_buf *notify;
438
439         struct files_struct *base_fsp; /* placeholder for delete on close */
440
441         /*
442          * Cache of share_mode_data->flags
443          */
444         int share_mode_flags_seqnum;
445         uint16_t share_mode_flags;
446
447         /*
448          * Read-only cached brlock record, thrown away when the
449          * brlock.tdb seqnum changes. This avoids fetching data from
450          * the brlock.tdb on every read/write call.
451          */
452         int brlock_seqnum;
453         struct byte_range_lock *brlock_rec;
454
455         struct dptr_struct *dptr;
456
457         /* if not NULL, means this is a print file */
458         struct print_file_data *print_file;
459
460         /*
461          * Optimize the aio_requests array for high performance: Never
462          * shrink it, maintain num_aio_requests separately
463          */
464         unsigned num_aio_requests;
465         struct tevent_req **aio_requests;
466
467         /*
468          * Requests waiting for smb1 byte range locks. They are
469          * generated by smbd_smb1_do_locks_send and are required here,
470          * because lock cancel operations index through reply_lockingX
471          * not based on mid but on the lock type and range.
472          */
473         struct tevent_req **blocked_smb1_lock_reqs;
474
475         /*
476          * SMB1 remembers lock failures and delays repeated blocking
477          * lock attempts on the same offset.
478          */
479         uint64_t lock_failure_offset;
480 } files_struct;
481
482 #define FSP_POSIX_FLAGS_OPEN            0x01
483 #define FSP_POSIX_FLAGS_RENAME          0x02
484 #define FSP_POSIX_FLAGS_PATHNAMES       0x04
485
486 #define FSP_POSIX_FLAGS_ALL                     \
487         (FSP_POSIX_FLAGS_OPEN |                 \
488          FSP_POSIX_FLAGS_PATHNAMES |            \
489          FSP_POSIX_FLAGS_RENAME)
490
491 struct vuid_cache_entry {
492         struct auth_session_info *session_info;
493         uint64_t vuid; /* SMB2 compat */
494         bool read_only;
495         uint32_t share_access;
496 };
497
498 struct vuid_cache {
499         unsigned int next_entry;
500         struct vuid_cache_entry array[VUID_CACHE_SIZE];
501 };
502
503 typedef struct {
504         char *name;
505         bool is_wild;
506 } name_compare_entry;
507
508 struct share_params {
509         int service;
510 };
511
512 typedef struct connection_struct {
513         struct connection_struct *next, *prev;
514         struct smbd_server_connection *sconn; /* can be NULL */
515         struct smbXsrv_tcon *tcon; /* can be NULL */
516         uint32_t cnum; /* an index passed over the wire */
517         struct share_params *params;
518         bool force_user;
519         struct vuid_cache *vuid_cache;
520         bool printer;
521         bool ipc;
522         bool read_only; /* Attributes for the current user of the share. */
523         uint32_t share_access;
524         /* Does this filesystem honor
525            sub second timestamps on files
526            and directories when setting time ? */
527         enum timestamp_set_resolution ts_res;
528         char *connectpath;
529         char *origpath;
530         struct files_struct *cwd_fsp; /* Working directory. */
531         bool tcon_done;
532
533         struct vfs_handle_struct *vfs_handles;          /* for the new plugins */
534
535         /*
536          * This represents the user information on this connection. Depending
537          * on the vuid using this tid, this might change per SMB request.
538          */
539         struct auth_session_info *session_info;
540
541         /*
542          * If the "force group" parameter is set, this is the primary gid that
543          * may be used in the users token, depending on the vuid using this tid.
544          */
545         gid_t force_group_gid;
546
547         uint64_t vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
548
549         time_t lastused;
550         time_t lastused_count;
551         int num_files_open;
552         unsigned int num_smb_operations; /* Count of smb operations on this tree. */
553         int encrypt_level;
554         bool encrypted_tid;
555
556         /* Semantics requested by the client or forced by the server config. */
557         bool case_sensitive;
558         bool case_preserve;
559         bool short_case_preserve;
560
561         /* Semantics provided by the underlying filesystem. */
562         int fs_capabilities;
563         /* Device number of the directory of the share mount.
564            Used to ensure unique FileIndex returns. */
565         SMB_DEV_T base_share_dev;
566
567         name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
568         name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
569         name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */       
570         name_compare_entry *aio_write_behind_list; /* Per-share list of files to use aio write behind on. */       
571         struct trans_state *pending_trans;
572
573         struct rpc_pipe_client *spoolss_pipe;
574
575 } connection_struct;
576
577 struct smbd_smb2_request;
578 struct referral;
579
580 struct smb_request {
581         uint8_t cmd;
582         uint16_t flags2;
583         uint16_t smbpid;
584         uint64_t mid; /* For compatibility with SMB2. */
585         uint32_t seqnum;
586         uint64_t vuid; /* For compatibility with SMB2. */
587         uint32_t tid;
588         uint8_t  wct;
589         const uint16_t *vwv;
590         uint16_t buflen;
591         const uint8_t *buf;
592         const uint8_t *inbuf;
593
594         /*
595          * Async handling in the main smb processing loop is directed by
596          * outbuf: reply_xxx routines indicate sync behaviour by putting their
597          * reply into "outbuf". If they leave it as NULL, they take care of it
598          * themselves, possibly later.
599          *
600          * If async handling is wanted, the reply_xxx routine must make sure
601          * that it talloc_move()s the smb_req somewhere else.
602          */
603         uint8_t *outbuf;
604
605         size_t unread_bytes;
606         bool encrypted;
607         connection_struct *conn;
608         struct smbd_server_connection *sconn;
609         struct smbXsrv_connection *xconn;
610
611         /*
612          * Pointer to session, can be NULL,
613          * eg during negprot and session setup.
614          */
615         struct smbXsrv_session *session;
616
617         struct smb_perfcount_data pcd;
618
619         /*
620          * Chained request handling
621          */
622         struct files_struct *chain_fsp;
623
624         /*
625          * state information for async smb handling
626          */
627         void *async_priv;
628
629         /*
630          * Back pointer to smb2 request.
631          */
632         struct smbd_smb2_request *smb2req;
633
634         /*
635          * Request list for chained requests, we're part of it.
636          */
637         struct smb_request **chain;
638
639         struct timeval request_time;
640
641         bool posix_pathnames;
642 };
643
644 /*
645  * Info about an alternate data stream
646  */
647
648 struct stream_struct {
649         off_t size;
650         off_t alloc_size;
651         char *name;
652 };
653
654 /* time info */
655 struct smb_file_time {
656         struct timespec mtime;
657         struct timespec atime;
658         struct timespec ctime;
659         struct timespec create_time;
660 };
661
662 /*
663  * smb_filename
664  */
665 struct smb_filename {
666         char *base_name;
667         char *stream_name;
668         uint32_t flags;
669         SMB_STRUCT_STAT st;
670         NTTIME twrp;
671 };
672
673 /*
674  * smb_filename flags. Define in terms of the FSP_POSIX_FLAGS_XX
675  * to keep the numeric values consistent.
676  */
677
678 #define SMB_FILENAME_POSIX_PATH         FSP_POSIX_FLAGS_PATHNAMES
679
680 #define VFS_FIND(__fn__) while (handle->fns->__fn__##_fn==NULL) { \
681                                 handle = handle->next; \
682                          }
683
684 enum vfs_translate_direction {
685         vfs_translate_to_unix = 0,
686         vfs_translate_to_windows
687 };
688
689 enum vfs_fallocate_flags {
690         VFS_FALLOCATE_FL_KEEP_SIZE              = 0x0001,
691         VFS_FALLOCATE_FL_PUNCH_HOLE             = 0x0002,
692 };
693
694 struct vfs_aio_state {
695         int error;
696         uint64_t duration;
697 };
698
699 /*
700     Available VFS operations. These values must be in sync with vfs_ops struct
701     (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops).
702     In particular, if new operations are added to vfs_ops, appropriate constants
703     should be added to vfs_op_type so that order of them kept same as in vfs_ops.
704 */
705 struct shadow_copy_data;
706
707 struct vfs_fn_pointers {
708         /* Disk operations */
709
710         int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user);
711         void (*disconnect_fn)(struct vfs_handle_struct *handle);
712         uint64_t (*disk_free_fn)(struct vfs_handle_struct *handle,
713                                 const struct smb_filename *smb_fname,
714                                 uint64_t *bsize,
715                                 uint64_t *dfree,
716                                 uint64_t *dsize);
717         int (*get_quota_fn)(struct vfs_handle_struct *handle,
718                                 const struct smb_filename *smb_fname,
719                                 enum SMB_QUOTA_TYPE qtype,
720                                 unid_t id,
721                                 SMB_DISK_QUOTA *qt);
722         int (*set_quota_fn)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
723         int (*get_shadow_copy_data_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels);
724         int (*statvfs_fn)(struct vfs_handle_struct *handle,
725                                 const struct smb_filename *smb_fname,
726                                 struct vfs_statvfs_struct *statbuf);
727         uint32_t (*fs_capabilities_fn)(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res);
728
729         /*
730          * Note: that "struct dfs_GetDFSReferral *r"
731          * needs to be a valid TALLOC_CTX
732          */
733         NTSTATUS (*get_dfs_referrals_fn)(struct vfs_handle_struct *handle,
734                                          struct dfs_GetDFSReferral *r);
735         NTSTATUS (*create_dfs_pathat_fn)(struct vfs_handle_struct *handle,
736                                 struct files_struct *dirfsp,
737                                 const struct smb_filename *smb_fname,
738                                 const struct referral *reflist,
739                                 size_t referral_count);
740         NTSTATUS (*read_dfs_pathat_fn)(struct vfs_handle_struct *handle,
741                                 TALLOC_CTX *mem_ctx,
742                                 struct files_struct *dirfsp,
743                                 const struct smb_filename *smb_fname,
744                                 struct referral **ppreflist,
745                                 size_t *preferral_count);
746
747         /* Directory operations */
748
749         DIR *(*fdopendir_fn)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attributes);
750         struct dirent *(*readdir_fn)(struct vfs_handle_struct *handle,
751                                          DIR *dirp,
752                                          SMB_STRUCT_STAT *sbuf);
753         void (*seekdir_fn)(struct vfs_handle_struct *handle, DIR *dirp, long offset);
754         long (*telldir_fn)(struct vfs_handle_struct *handle, DIR *dirp);
755         void (*rewind_dir_fn)(struct vfs_handle_struct *handle, DIR *dirp);
756         int (*mkdirat_fn)(struct vfs_handle_struct *handle,
757                         struct files_struct *dirfsp,
758                         const struct smb_filename *smb_fname,
759                         mode_t mode);
760         int (*closedir_fn)(struct vfs_handle_struct *handle, DIR *dir);
761
762         /* File operations */
763
764         int (*open_fn)(struct vfs_handle_struct *handle,
765                        struct smb_filename *smb_fname, files_struct *fsp,
766                        int flags, mode_t mode);
767         NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle,
768                                    struct smb_request *req,
769                                    struct files_struct **dirfsp,
770                                    struct smb_filename *smb_fname,
771                                    uint32_t access_mask,
772                                    uint32_t share_access,
773                                    uint32_t create_disposition,
774                                    uint32_t create_options,
775                                    uint32_t file_attributes,
776                                    uint32_t oplock_request,
777                                    const struct smb2_lease *lease,
778                                    uint64_t allocation_size,
779                                    uint32_t private_flags,
780                                    struct security_descriptor *sd,
781                                    struct ea_list *ea_list,
782                                    files_struct **result,
783                                    int *pinfo,
784                                    const struct smb2_create_blobs *in_context_blobs,
785                                    struct smb2_create_blobs *out_context_blobs);
786         int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
787         ssize_t (*pread_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, off_t offset);
788         struct tevent_req *(*pread_send_fn)(struct vfs_handle_struct *handle,
789                                             TALLOC_CTX *mem_ctx,
790                                             struct tevent_context *ev,
791                                             struct files_struct *fsp,
792                                             void *data,
793                                             size_t n, off_t offset);
794         ssize_t (*pread_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
795         ssize_t (*pwrite_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, off_t offset);
796         struct tevent_req *(*pwrite_send_fn)(struct vfs_handle_struct *handle,
797                                              TALLOC_CTX *mem_ctx,
798                                              struct tevent_context *ev,
799                                              struct files_struct *fsp,
800                                              const void *data,
801                                              size_t n, off_t offset);
802         ssize_t (*pwrite_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
803         off_t (*lseek_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset, int whence);
804         ssize_t (*sendfile_fn)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, off_t offset, size_t count);
805         ssize_t (*recvfile_fn)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t count);
806         int (*renameat_fn)(struct vfs_handle_struct *handle,
807                          struct files_struct *srcdir_fsp,
808                          const struct smb_filename *smb_fname_src,
809                          struct files_struct *dstdir_fsp,
810                          const struct smb_filename *smb_fname_dst);
811         struct tevent_req *(*fsync_send_fn)(struct vfs_handle_struct *handle,
812                                             TALLOC_CTX *mem_ctx,
813                                             struct tevent_context *ev,
814                                             struct files_struct *fsp);
815         int (*fsync_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
816         int (*stat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
817         int (*fstat_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
818         int (*lstat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
819         uint64_t (*get_alloc_size_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
820         int (*unlinkat_fn)(struct vfs_handle_struct *handle,
821                         struct files_struct *srcdir_fsp,
822                         const struct smb_filename *smb_fname,
823                         int flags);
824         int (*chmod_fn)(struct vfs_handle_struct *handle,
825                         const struct smb_filename *smb_fname,
826                         mode_t mode);
827         int (*fchmod_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
828         int (*fchown_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid);
829         int (*lchown_fn)(struct vfs_handle_struct *handle,
830                         const struct smb_filename *smb_fname,
831                         uid_t uid,
832                         gid_t gid);
833         int (*chdir_fn)(struct vfs_handle_struct *handle,
834                          const struct smb_filename *smb_fname);
835         struct smb_filename *(*getwd_fn)(struct vfs_handle_struct *handle,
836                                 TALLOC_CTX *mem_ctx);
837         int (*ntimes_fn)(struct vfs_handle_struct *handle,
838                          const struct smb_filename *smb_fname,
839                          struct smb_file_time *ft);
840         int (*ftruncate_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset);
841         int (*fallocate_fn)(struct vfs_handle_struct *handle,
842                             struct files_struct *fsp,
843                             uint32_t mode,
844                             off_t offset,
845                             off_t len);
846         bool (*lock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, off_t offset, off_t count, int type);
847         int (*kernel_flock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp,
848                                uint32_t share_access, uint32_t access_mask);
849         int (*fcntl_fn)(struct vfs_handle_struct *handle,
850                         struct files_struct *fsp, int cmd, va_list cmd_arg);
851         int (*linux_setlease_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
852         bool (*getlock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
853         int (*symlinkat_fn)(struct vfs_handle_struct *handle,
854                                 const struct smb_filename *link_contents,
855                                 struct files_struct *dirfsp,
856                                 const struct smb_filename *new_smb_fname);
857         int (*readlinkat_fn)(struct vfs_handle_struct *handle,
858                                 struct files_struct *dirfsp,
859                                 const struct smb_filename *smb_fname,
860                                 char *buf,
861                                 size_t bufsiz);
862         int (*linkat_fn)(struct vfs_handle_struct *handle,
863                                 struct files_struct *srcfsp,
864                                 const struct smb_filename *old_smb_fname,
865                                 struct files_struct *dstfsp,
866                                 const struct smb_filename *new_smb_fname,
867                                 int flags);
868         int (*mknodat_fn)(struct vfs_handle_struct *handle,
869                                 struct files_struct *dirfsp,
870                                 const struct smb_filename *smb_fname,
871                                 mode_t mode,
872                                 SMB_DEV_T dev);
873         struct smb_filename *(*realpath_fn)(struct vfs_handle_struct *handle,
874                                 TALLOC_CTX *ctx,
875                                 const struct smb_filename *smb_fname);
876         int (*chflags_fn)(struct vfs_handle_struct *handle,
877                                 const struct smb_filename *smb_fname,
878                                 unsigned int flags);
879         struct file_id (*file_id_create_fn)(struct vfs_handle_struct *handle,
880                                             const SMB_STRUCT_STAT *sbuf);
881         uint64_t (*fs_file_id_fn)(struct vfs_handle_struct *handle,
882                                   const SMB_STRUCT_STAT *sbuf);
883         struct tevent_req *(*offload_read_send_fn)(TALLOC_CTX *mem_ctx,
884                                                    struct tevent_context *ev,
885                                                    struct vfs_handle_struct *handle,
886                                                    struct files_struct *fsp,
887                                                    uint32_t fsctl,
888                                                    uint32_t ttl,
889                                                    off_t offset,
890                                                    size_t to_copy);
891         NTSTATUS (*offload_read_recv_fn)(struct tevent_req *req,
892                                          struct vfs_handle_struct *handle,
893                                          TALLOC_CTX *mem_ctx,
894                                          DATA_BLOB *token_blob);
895         struct tevent_req *(*offload_write_send_fn)(struct vfs_handle_struct *handle,
896                                                     TALLOC_CTX *mem_ctx,
897                                                     struct tevent_context *ev,
898                                                     uint32_t fsctl,
899                                                     DATA_BLOB *token,
900                                                     off_t transfer_offset,
901                                                     struct files_struct *dest_fsp,
902                                                     off_t dest_off,
903                                                     off_t to_copy);
904         NTSTATUS (*offload_write_recv_fn)(struct vfs_handle_struct *handle,
905                                           struct tevent_req *req,
906                                           off_t *copied);
907         NTSTATUS (*get_compression_fn)(struct vfs_handle_struct *handle,
908                                        TALLOC_CTX *mem_ctx,
909                                        struct files_struct *fsp,
910                                        struct smb_filename *smb_fname,
911                                        uint16_t *_compression_fmt);
912         NTSTATUS (*set_compression_fn)(struct vfs_handle_struct *handle,
913                                        TALLOC_CTX *mem_ctx,
914                                        struct files_struct *fsp,
915                                        uint16_t compression_fmt);
916         NTSTATUS (*snap_check_path_fn)(struct vfs_handle_struct *handle,
917                                        TALLOC_CTX *mem_ctx,
918                                        const char *service_path,
919                                        char **base_volume);
920         NTSTATUS (*snap_create_fn)(struct vfs_handle_struct *handle,
921                                    TALLOC_CTX *mem_ctx,
922                                    const char *base_volume,
923                                    time_t *tstamp,
924                                    bool rw,
925                                    char **base_path,
926                                    char **snap_path);
927         NTSTATUS (*snap_delete_fn)(struct vfs_handle_struct *handle,
928                                    TALLOC_CTX *mem_ctx,
929                                    char *base_path,
930                                    char *snap_path);
931
932         NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle,
933                                   struct files_struct *fsp,
934                                   const struct smb_filename *smb_fname,
935                                   TALLOC_CTX *mem_ctx,
936                                   unsigned int *num_streams,
937                                   struct stream_struct **streams);
938
939         int (*get_real_filename_fn)(struct vfs_handle_struct *handle,
940                                     const struct smb_filename *path,
941                                     const char *name,
942                                     TALLOC_CTX *mem_ctx,
943                                     char **found_name);
944
945         const char *(*connectpath_fn)(struct vfs_handle_struct *handle,
946                                       const struct smb_filename *smb_fname);
947
948         NTSTATUS (*brl_lock_windows_fn)(struct vfs_handle_struct *handle,
949                                         struct byte_range_lock *br_lck,
950                                         struct lock_struct *plock);
951
952         bool (*brl_unlock_windows_fn)(struct vfs_handle_struct *handle,
953                                       struct byte_range_lock *br_lck,
954                                       const struct lock_struct *plock);
955
956         bool (*strict_lock_check_fn)(struct vfs_handle_struct *handle,
957                                      struct files_struct *fsp,
958                                      struct lock_struct *plock);
959
960         NTSTATUS (*translate_name_fn)(struct vfs_handle_struct *handle,
961                                       const char *name,
962                                       enum vfs_translate_direction direction,
963                                       TALLOC_CTX *mem_ctx,
964                                       char **mapped_name);
965
966         NTSTATUS (*fsctl_fn)(struct vfs_handle_struct *handle,
967                              struct files_struct *fsp,
968                              TALLOC_CTX *ctx,
969                              uint32_t function,
970                              uint16_t req_flags,
971                              const uint8_t *_in_data,
972                              uint32_t in_len,
973                              uint8_t **_out_data,
974                              uint32_t max_out_len,
975                              uint32_t *out_len); 
976
977         NTSTATUS (*get_dos_attributes_fn)(struct vfs_handle_struct *handle,
978                                           struct smb_filename *smb_fname,
979                                           uint32_t *dosmode);
980
981         NTSTATUS (*fget_dos_attributes_fn)(struct vfs_handle_struct *handle,
982                                            struct files_struct *fsp,
983                                            uint32_t *dosmode);
984
985         NTSTATUS (*set_dos_attributes_fn)(struct vfs_handle_struct *handle,
986                                           const struct smb_filename *smb_fname,
987                                           uint32_t dosmode);
988
989         NTSTATUS (*fset_dos_attributes_fn)(struct vfs_handle_struct *hande,
990                                            struct files_struct *fsp,
991                                            uint32_t dosmode);
992
993         struct tevent_req *(*get_dos_attributes_send_fn)(
994                                 TALLOC_CTX *mem_ctx,
995                                 struct tevent_context *ev,
996                                 struct vfs_handle_struct *handle,
997                                 files_struct *dir_fsp,
998                                 struct smb_filename *smb_fname);
999
1000         NTSTATUS (*get_dos_attributes_recv_fn)(
1001                                 struct tevent_req *req,
1002                                 struct vfs_aio_state *aio_state,
1003                                 uint32_t *dosmode);
1004
1005         /* NT ACL operations. */
1006
1007         NTSTATUS (*fget_nt_acl_fn)(struct vfs_handle_struct *handle,
1008                                    struct files_struct *fsp,
1009                                    uint32_t security_info,
1010                                    TALLOC_CTX *mem_ctx,
1011                                    struct security_descriptor **ppdesc);
1012         NTSTATUS (*get_nt_acl_at_fn)(struct vfs_handle_struct *handle,
1013                                 struct files_struct *dirfsp,
1014                                 const struct smb_filename *smb_fname,
1015                                 uint32_t security_info,
1016                                 TALLOC_CTX *mem_ctx,
1017                                 struct security_descriptor **ppdesc);
1018         NTSTATUS (*fset_nt_acl_fn)(struct vfs_handle_struct *handle,
1019                                    struct files_struct *fsp,
1020                                    uint32_t security_info_sent,
1021                                    const struct security_descriptor *psd);
1022
1023         NTSTATUS (*audit_file_fn)(struct vfs_handle_struct *handle,
1024                                   struct smb_filename *file,
1025                                   struct security_acl *sacl,
1026                                   uint32_t access_requested,
1027                                   uint32_t access_denied);
1028
1029         /* POSIX ACL operations. */
1030
1031         SMB_ACL_T (*sys_acl_get_file_fn)(struct vfs_handle_struct *handle,
1032                                          const struct smb_filename *smb_fname,
1033                                          SMB_ACL_TYPE_T type,
1034                                          TALLOC_CTX *mem_ctx);
1035         SMB_ACL_T (*sys_acl_get_fd_fn)(struct vfs_handle_struct *handle,
1036                                        struct files_struct *fsp,
1037                                        TALLOC_CTX *mem_ctx);
1038         int (*sys_acl_blob_get_file_fn)(struct vfs_handle_struct *handle,
1039                                         const struct smb_filename *smb_fname,
1040                                         TALLOC_CTX *mem_ctx,
1041                                         char **blob_description,
1042                                         DATA_BLOB *blob);
1043         int (*sys_acl_blob_get_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp,
1044                                       TALLOC_CTX *mem_ctx, char **blob_description,
1045                                       DATA_BLOB *blob);
1046         int (*sys_acl_set_file_fn)(struct vfs_handle_struct *handle,
1047                                         const struct smb_filename *smb_fname,
1048                                         SMB_ACL_TYPE_T acltype,
1049                                         SMB_ACL_T theacl);
1050         int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
1051         int (*sys_acl_delete_def_file_fn)(struct vfs_handle_struct *handle,
1052                                         const struct smb_filename *smb_fname);
1053
1054         /* EA operations. */
1055         ssize_t (*getxattr_fn)(struct vfs_handle_struct *handle,
1056                                         const struct smb_filename *smb_fname,
1057                                         const char *name,
1058                                         void *value,
1059                                         size_t size);
1060         struct tevent_req *(*getxattrat_send_fn)(
1061                                 TALLOC_CTX *mem_ctx,
1062                                 struct tevent_context *ev,
1063                                 struct vfs_handle_struct *handle,
1064                                 files_struct *dir_fsp,
1065                                 const struct smb_filename *smb_fname,
1066                                 const char *xattr_name,
1067                                 size_t alloc_hint);
1068         ssize_t (*getxattrat_recv_fn)(struct tevent_req *req,
1069                                       struct vfs_aio_state *aio_state,
1070                                       TALLOC_CTX *mem_ctx,
1071                                       uint8_t **xattr_value);
1072         ssize_t (*fgetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size);
1073         ssize_t (*listxattr_fn)(struct vfs_handle_struct *handle,
1074                                         const struct smb_filename *smb_fname,
1075                                         char *list,
1076                                         size_t size);
1077         ssize_t (*flistxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
1078         int (*removexattr_fn)(struct vfs_handle_struct *handle,
1079                                         const struct smb_filename *smb_fname,
1080                                         const char *name);
1081         int (*fremovexattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
1082         int (*setxattr_fn)(struct vfs_handle_struct *handle,
1083                                         const struct smb_filename *smb_fname,
1084                                         const char *name,
1085                                         const void *value,
1086                                         size_t size,
1087                                         int flags);
1088         int (*fsetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags);
1089
1090         /* aio operations */
1091         bool (*aio_force_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
1092
1093         /* durable handle operations */
1094         NTSTATUS (*durable_cookie_fn)(struct vfs_handle_struct *handle,
1095                                       struct files_struct *fsp,
1096                                       TALLOC_CTX *mem_ctx,
1097                                       DATA_BLOB *cookie);
1098         NTSTATUS (*durable_disconnect_fn)(struct vfs_handle_struct *handle,
1099                                           struct files_struct *fsp,
1100                                           const DATA_BLOB old_cookie,
1101                                           TALLOC_CTX *mem_ctx,
1102                                           DATA_BLOB *new_cookie);
1103         NTSTATUS (*durable_reconnect_fn)(struct vfs_handle_struct *handle,
1104                                          struct smb_request *smb1req,
1105                                          struct smbXsrv_open *op,
1106                                          const DATA_BLOB old_cookie,
1107                                          TALLOC_CTX *mem_ctx,
1108                                          struct files_struct **fsp,
1109                                          DATA_BLOB *new_cookie);
1110
1111         NTSTATUS (*readdir_attr_fn)(struct vfs_handle_struct *handle,
1112                                     const struct smb_filename *fname,
1113                                     TALLOC_CTX *mem_ctx,
1114                                     struct readdir_attr_data **attr_data);
1115 };
1116
1117 /*
1118     VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem,
1119     which describes all operations this module is willing to intercept.
1120     VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs
1121     using this information.
1122 */
1123
1124 typedef struct vfs_handle_struct {
1125         struct vfs_handle_struct  *next, *prev;
1126         const char *param;
1127         struct connection_struct *conn;
1128         const struct vfs_fn_pointers *fns;
1129         void *data;
1130         void (*free_data)(void **data);
1131 } vfs_handle_struct;
1132
1133
1134 typedef struct vfs_statvfs_struct {
1135         /* For undefined recommended transfer size return -1 in that field */
1136         uint32_t OptimalTransferSize;  /* bsize on some os, iosize on other os */
1137         uint32_t BlockSize;
1138
1139         /*
1140          The next three fields are in terms of the block size.
1141          (above). If block size is unknown, 4096 would be a
1142          reasonable block size for a server to report.
1143          Note that returning the blocks/blocksavail removes need
1144          to make a second call (to QFSInfo level 0x103 to get this info.
1145          UserBlockAvail is typically less than or equal to BlocksAvail,
1146          if no distinction is made return the same value in each.
1147         */
1148
1149         uint64_t TotalBlocks;
1150         uint64_t BlocksAvail;       /* bfree */
1151         uint64_t UserBlocksAvail;   /* bavail */
1152
1153         /* For undefined Node fields or FSID return -1 */
1154         uint64_t TotalFileNodes;
1155         uint64_t FreeFileNodes;
1156         uint64_t FsIdentifier;   /* fsid */
1157         /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
1158         /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
1159
1160         int FsCapabilities;
1161 } vfs_statvfs_struct;
1162
1163 /* Add a new FSP extension of the given type. Returns a pointer to the
1164  * extenstion data.
1165  */
1166 #define VFS_ADD_FSP_EXTENSION(handle, fsp, type, destroy_fn)            \
1167     (type *)vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type), (destroy_fn))
1168
1169 /* Return a pointer to the existing FSP extension data. */
1170 #define VFS_FETCH_FSP_EXTENSION(handle, fsp) \
1171     vfs_fetch_fsp_extension(handle, (fsp))
1172
1173 /* Return the talloc context associated with an FSP extension. */
1174 #define VFS_MEMCTX_FSP_EXTENSION(handle, fsp) \
1175     vfs_memctx_fsp_extension(handle, (fsp))
1176
1177 /* Remove and destroy an FSP extension. */
1178 #define VFS_REMOVE_FSP_EXTENSION(handle, fsp) \
1179     vfs_remove_fsp_extension((handle), (fsp))
1180
1181 #define SMB_VFS_HANDLE_GET_DATA(handle, datap, type, ret) { \
1182         if (!(handle)||((datap=(type *)(handle)->data)==NULL)) { \
1183                 DEBUG(0,("%s() failed to get vfs_handle->data!\n",__FUNCTION__)); \
1184                 ret; \
1185         } \
1186 }
1187
1188 #define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \
1189         if (!(handle)) { \
1190                 DEBUG(0,("%s() failed to set handle->data!\n",__FUNCTION__)); \
1191                 ret; \
1192         } else { \
1193                 if ((handle)->free_data) { \
1194                         (handle)->free_data(&(handle)->data); \
1195                 } \
1196                 (handle)->data = (void *)datap; \
1197                 (handle)->free_data = free_fn; \
1198         } \
1199 }
1200
1201 #define SMB_VFS_HANDLE_FREE_DATA(handle) { \
1202         if ((handle) && (handle)->free_data) { \
1203                 (handle)->free_data(&(handle)->data); \
1204         } \
1205 }
1206
1207 /* Check whether module-specific data handle was already allocated or not */
1208 #define SMB_VFS_HANDLE_TEST_DATA(handle)  ( !(handle) || !(handle)->data ? False : True )
1209
1210 #define SMB_VFS_OP(x) ((void *) x)
1211
1212 #define DEFAULT_VFS_MODULE_NAME "/[Default VFS]/"
1213
1214 #include "vfs_macros.h"
1215
1216 int smb_vfs_call_connect(struct vfs_handle_struct *handle,
1217                          const char *service, const char *user);
1218 void smb_vfs_call_disconnect(struct vfs_handle_struct *handle);
1219 uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
1220                                 const struct smb_filename *smb_filename,
1221                                 uint64_t *bsize,
1222                                 uint64_t *dfree,
1223                                 uint64_t *dsize);
1224 int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
1225                                 const struct smb_filename *smb_filename,
1226                                 enum SMB_QUOTA_TYPE qtype,
1227                                 unid_t id,
1228                                 SMB_DISK_QUOTA *qt);
1229 int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,
1230                            enum SMB_QUOTA_TYPE qtype, unid_t id,
1231                            SMB_DISK_QUOTA *qt);
1232 int smb_vfs_call_get_shadow_copy_data(struct vfs_handle_struct *handle,
1233                                       struct files_struct *fsp,
1234                                       struct shadow_copy_data *shadow_copy_data,
1235                                       bool labels);
1236 int smb_vfs_call_statvfs(struct vfs_handle_struct *handle,
1237                         const struct smb_filename *smb_fname,
1238                         struct vfs_statvfs_struct *statbuf);
1239 uint32_t smb_vfs_call_fs_capabilities(struct vfs_handle_struct *handle,
1240                                       enum timestamp_set_resolution *p_ts_res);
1241 /*
1242  * Note: that "struct dfs_GetDFSReferral *r" needs to be a valid TALLOC_CTX
1243  */
1244 NTSTATUS smb_vfs_call_get_dfs_referrals(struct vfs_handle_struct *handle,
1245                                         struct dfs_GetDFSReferral *r);
1246 NTSTATUS smb_vfs_call_create_dfs_pathat(struct vfs_handle_struct *handle,
1247                                 struct files_struct *dirfsp,
1248                                 const struct smb_filename *smb_fname,
1249                                 const struct referral *reflist,
1250                                 size_t referral_count);
1251 NTSTATUS smb_vfs_call_read_dfs_pathat(struct vfs_handle_struct *handle,
1252                                 TALLOC_CTX *mem_ctx,
1253                                 struct files_struct *dirfsp,
1254                                 const struct smb_filename *smb_fname,
1255                                 struct referral **ppreflist,
1256                                 size_t *preferral_count);
1257 DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
1258                                         struct files_struct *fsp,
1259                                         const char *mask,
1260                                         uint32_t attributes);
1261 struct dirent *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
1262                                         DIR *dirp,
1263                                         SMB_STRUCT_STAT *sbuf);
1264 void smb_vfs_call_seekdir(struct vfs_handle_struct *handle,
1265                           DIR *dirp, long offset);
1266 long smb_vfs_call_telldir(struct vfs_handle_struct *handle,
1267                           DIR *dirp);
1268 void smb_vfs_call_rewind_dir(struct vfs_handle_struct *handle,
1269                              DIR *dirp);
1270 int smb_vfs_call_mkdirat(struct vfs_handle_struct *handle,
1271                         struct files_struct *dirfsp,
1272                         const struct smb_filename *smb_fname,
1273                         mode_t mode);
1274 int smb_vfs_call_closedir(struct vfs_handle_struct *handle,
1275                           DIR *dir);
1276 int smb_vfs_call_open(struct vfs_handle_struct *handle,
1277                       struct smb_filename *smb_fname, struct files_struct *fsp,
1278                       int flags, mode_t mode);
1279 NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
1280                                   struct smb_request *req,
1281                                   struct files_struct **dirfsp,
1282                                   struct smb_filename *smb_fname,
1283                                   uint32_t access_mask,
1284                                   uint32_t share_access,
1285                                   uint32_t create_disposition,
1286                                   uint32_t create_options,
1287                                   uint32_t file_attributes,
1288                                   uint32_t oplock_request,
1289                                   const struct smb2_lease *lease,
1290                                   uint64_t allocation_size,
1291                                   uint32_t private_flags,
1292                                   struct security_descriptor *sd,
1293                                   struct ea_list *ea_list,
1294                                   files_struct **result,
1295                                   int *pinfo,
1296                                   const struct smb2_create_blobs *in_context_blobs,
1297                                   struct smb2_create_blobs *out_context_blobs);
1298 int smb_vfs_call_close(struct vfs_handle_struct *handle,
1299                        struct files_struct *fsp);
1300 ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle,
1301                            struct files_struct *fsp, void *data, size_t n,
1302                            off_t offset);
1303 struct tevent_req *smb_vfs_call_pread_send(struct vfs_handle_struct *handle,
1304                                            TALLOC_CTX *mem_ctx,
1305                                            struct tevent_context *ev,
1306                                            struct files_struct *fsp,
1307                                            void *data,
1308                                            size_t n, off_t offset);
1309 ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, struct vfs_aio_state *state);
1310
1311 ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle,
1312                             struct files_struct *fsp, const void *data,
1313                             size_t n, off_t offset);
1314 struct tevent_req *smb_vfs_call_pwrite_send(struct vfs_handle_struct *handle,
1315                                             TALLOC_CTX *mem_ctx,
1316                                             struct tevent_context *ev,
1317                                             struct files_struct *fsp,
1318                                             const void *data,
1319                                             size_t n, off_t offset);
1320 ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, struct vfs_aio_state *state);
1321
1322 off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle,
1323                              struct files_struct *fsp, off_t offset,
1324                              int whence);
1325 ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd,
1326                               files_struct *fromfsp, const DATA_BLOB *header,
1327                               off_t offset, size_t count);
1328 ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd,
1329                               files_struct *tofsp, off_t offset,
1330                               size_t count);
1331 int smb_vfs_call_renameat(struct vfs_handle_struct *handle,
1332                         struct files_struct *srcfsp,
1333                         const struct smb_filename *smb_fname_src,
1334                         struct files_struct *dstfsp,
1335                         const struct smb_filename *smb_fname_dst);
1336
1337 struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
1338                                            TALLOC_CTX *mem_ctx,
1339                                            struct tevent_context *ev,
1340                                            struct files_struct *fsp);
1341 int SMB_VFS_FSYNC_RECV(struct tevent_req *req, struct vfs_aio_state *state);
1342
1343 int smb_vfs_fsync_sync(files_struct *fsp);
1344 int smb_vfs_call_stat(struct vfs_handle_struct *handle,
1345                       struct smb_filename *smb_fname);
1346 int smb_vfs_call_fstat(struct vfs_handle_struct *handle,
1347                        struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
1348 int smb_vfs_call_lstat(struct vfs_handle_struct *handle,
1349                        struct smb_filename *smb_filename);
1350 uint64_t smb_vfs_call_get_alloc_size(struct vfs_handle_struct *handle,
1351                                      struct files_struct *fsp,
1352                                      const SMB_STRUCT_STAT *sbuf);
1353 int smb_vfs_call_unlinkat(struct vfs_handle_struct *handle,
1354                         struct files_struct *dirfsp,
1355                         const struct smb_filename *smb_fname,
1356                         int flags);
1357 int smb_vfs_call_chmod(struct vfs_handle_struct *handle,
1358                         const struct smb_filename *smb_fname,
1359                         mode_t mode);
1360 int smb_vfs_call_fchmod(struct vfs_handle_struct *handle,
1361                         struct files_struct *fsp, mode_t mode);
1362 int smb_vfs_call_fchown(struct vfs_handle_struct *handle,
1363                         struct files_struct *fsp, uid_t uid, gid_t gid);
1364 int smb_vfs_call_lchown(struct vfs_handle_struct *handle,
1365                         const struct smb_filename *smb_fname,
1366                         uid_t uid,
1367                         gid_t gid);
1368 int smb_vfs_call_chdir(struct vfs_handle_struct *handle,
1369                         const struct smb_filename *smb_fname);
1370 struct smb_filename *smb_vfs_call_getwd(struct vfs_handle_struct *handle,
1371                                 TALLOC_CTX *ctx);
1372 int smb_vfs_call_ntimes(struct vfs_handle_struct *handle,
1373                         const struct smb_filename *smb_fname,
1374                         struct smb_file_time *ft);
1375 int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
1376                            struct files_struct *fsp, off_t offset);
1377 int smb_vfs_call_fallocate(struct vfs_handle_struct *handle,
1378                            struct files_struct *fsp,
1379                            uint32_t mode,
1380                            off_t offset,
1381                            off_t len);
1382 bool smb_vfs_call_lock(struct vfs_handle_struct *handle,
1383                        struct files_struct *fsp, int op, off_t offset,
1384                        off_t count, int type);
1385 int smb_vfs_call_kernel_flock(struct vfs_handle_struct *handle,
1386                               struct files_struct *fsp, uint32_t share_access,
1387                               uint32_t access_mask);
1388 int smb_vfs_call_fcntl(struct vfs_handle_struct *handle,
1389                        struct files_struct *fsp, int cmd, ...);
1390 int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle,
1391                                 struct files_struct *fsp, int leasetype);
1392 bool smb_vfs_call_getlock(struct vfs_handle_struct *handle,
1393                           struct files_struct *fsp, off_t *poffset,
1394                           off_t *pcount, int *ptype, pid_t *ppid);
1395 int smb_vfs_call_symlinkat(struct vfs_handle_struct *handle,
1396                         const struct smb_filename *link_contents,
1397                         struct files_struct *dirfsp,
1398                         const struct smb_filename *new_smb_fname);
1399 int smb_vfs_call_readlinkat(struct vfs_handle_struct *handle,
1400                         struct files_struct *dirfsp,
1401                         const struct smb_filename *smb_fname,
1402                         char *buf,
1403                         size_t bufsiz);
1404 int smb_vfs_call_linkat(struct vfs_handle_struct *handle,
1405                         struct files_struct *srcfsp,
1406                         const struct smb_filename *old_smb_fname,
1407                         struct files_struct *dstfsp,
1408                         const struct smb_filename *new_smb_fname,
1409                         int flags);
1410 int smb_vfs_call_mknodat(struct vfs_handle_struct *handle,
1411                         struct files_struct *dirfsp,
1412                         const struct smb_filename *smb_fname,
1413                         mode_t mode,
1414                         SMB_DEV_T dev);
1415 struct smb_filename *smb_vfs_call_realpath(struct vfs_handle_struct *handle,
1416                         TALLOC_CTX *ctx,
1417                         const struct smb_filename *smb_fname);
1418 int smb_vfs_call_chflags(struct vfs_handle_struct *handle,
1419                         const struct smb_filename *smb_fname,
1420                         unsigned int flags);
1421 struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
1422                                            const SMB_STRUCT_STAT *sbuf);
1423 uint64_t smb_vfs_call_fs_file_id(struct vfs_handle_struct *handle,
1424                                  const SMB_STRUCT_STAT *sbuf);
1425 NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
1426                                  struct files_struct *fsp,
1427                                  const struct smb_filename *smb_fname,
1428                                  TALLOC_CTX *mem_ctx,
1429                                  unsigned int *num_streams,
1430                                  struct stream_struct **streams);
1431 int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
1432                                    const struct smb_filename *path,
1433                                    const char *name,
1434                                    TALLOC_CTX *mem_ctx,
1435                                    char **found_name);
1436 const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
1437                                      const struct smb_filename *smb_fname);
1438 NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
1439                                        struct byte_range_lock *br_lck,
1440                                        struct lock_struct *plock);
1441 bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle,
1442                                      struct byte_range_lock *br_lck,
1443                                      const struct lock_struct *plock);
1444 bool smb_vfs_call_strict_lock_check(struct vfs_handle_struct *handle,
1445                                     struct files_struct *fsp,
1446                                     struct lock_struct *plock);
1447 NTSTATUS smb_vfs_call_translate_name(struct vfs_handle_struct *handle,
1448                                      const char *name,
1449                                      enum vfs_translate_direction direction,
1450                                      TALLOC_CTX *mem_ctx,
1451                                      char **mapped_name);
1452 NTSTATUS smb_vfs_call_fsctl(struct vfs_handle_struct *handle,
1453                             struct files_struct *fsp,
1454                             TALLOC_CTX *ctx,
1455                             uint32_t function,
1456                             uint16_t req_flags,
1457                             const uint8_t *_in_data,
1458                             uint32_t in_len,
1459                             uint8_t **_out_data,
1460                             uint32_t max_out_len,
1461                             uint32_t *out_len);
1462 NTSTATUS smb_vfs_call_get_dos_attributes(struct vfs_handle_struct *handle,
1463                                          struct smb_filename *smb_fname,
1464                                          uint32_t *dosmode);
1465 NTSTATUS smb_vfs_call_fget_dos_attributes(struct vfs_handle_struct *handle,
1466                                           struct files_struct *fsp,
1467                                           uint32_t *dosmode);
1468 NTSTATUS smb_vfs_call_set_dos_attributes(struct vfs_handle_struct *handle,
1469                                          const struct smb_filename *smb_fname,
1470                                          uint32_t dosmode);
1471 NTSTATUS smb_vfs_call_fset_dos_attributes(struct vfs_handle_struct *handle,
1472                                           struct files_struct *fsp,
1473                                           uint32_t dosmode);
1474 struct tevent_req *smb_vfs_call_get_dos_attributes_send(
1475                         TALLOC_CTX *mem_ctx,
1476                         struct tevent_context *ev,
1477                         struct vfs_handle_struct *handle,
1478                         files_struct *dir_fsp,
1479                         struct smb_filename *smb_fname);
1480 NTSTATUS smb_vfs_call_get_dos_attributes_recv(
1481                         struct tevent_req *req,
1482                         struct vfs_aio_state *aio_state,
1483                         uint32_t *dosmode);
1484 struct tevent_req *smb_vfs_call_offload_read_send(
1485         TALLOC_CTX *mem_ctx,
1486         struct tevent_context *ev,
1487         struct vfs_handle_struct *handle,
1488         struct files_struct *fsp,
1489         uint32_t fsctl,
1490         uint32_t ttl,
1491         off_t offset,
1492         size_t to_copy);
1493 NTSTATUS smb_vfs_call_offload_read_recv(struct tevent_req *req,
1494                                         struct vfs_handle_struct *handle,
1495                                         TALLOC_CTX *mem_ctx,
1496                                         DATA_BLOB *token_blob);
1497 struct tevent_req *smb_vfs_call_offload_write_send(struct vfs_handle_struct *handle,
1498                                                    TALLOC_CTX *mem_ctx,
1499                                                    struct tevent_context *ev,
1500                                                    uint32_t fsctl,
1501                                                    DATA_BLOB *token,
1502                                                    off_t transfer_offset,
1503                                                    struct files_struct *dest_fsp,
1504                                                    off_t dest_off,
1505                                                    off_t num);
1506 NTSTATUS smb_vfs_call_offload_write_recv(struct vfs_handle_struct *handle,
1507                                          struct tevent_req *req,
1508                                          off_t *copied);
1509 NTSTATUS smb_vfs_call_get_compression(struct vfs_handle_struct *handle,
1510                                       TALLOC_CTX *mem_ctx,
1511                                       struct files_struct *fsp,
1512                                       struct smb_filename *smb_fname,
1513                                       uint16_t *_compression_fmt);
1514 NTSTATUS smb_vfs_call_set_compression(struct vfs_handle_struct *handle,
1515                                       TALLOC_CTX *mem_ctx,
1516                                       struct files_struct *fsp,
1517                                       uint16_t compression_fmt);
1518 NTSTATUS smb_vfs_call_snap_check_path(vfs_handle_struct *handle,
1519                                       TALLOC_CTX *mem_ctx,
1520                                       const char *service_path,
1521                                       char **base_volume);
1522 NTSTATUS smb_vfs_call_snap_create(struct vfs_handle_struct *handle,
1523                                   TALLOC_CTX *mem_ctx,
1524                                   const char *base_volume,
1525                                   time_t *tstamp,
1526                                   bool rw,
1527                                   char **base_path,
1528                                   char **snap_path);
1529 NTSTATUS smb_vfs_call_snap_delete(struct vfs_handle_struct *handle,
1530                                   TALLOC_CTX *mem_ctx,
1531                                   char *base_path,
1532                                   char *snap_path);
1533 NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
1534                                   struct files_struct *fsp,
1535                                   uint32_t security_info,
1536                                   TALLOC_CTX *mem_ctx,
1537                                   struct security_descriptor **ppdesc);
1538 NTSTATUS smb_vfs_call_get_nt_acl_at(struct vfs_handle_struct *handle,
1539                                 struct files_struct *dirfsp,
1540                                 const struct smb_filename *smb_fname,
1541                                 uint32_t security_info,
1542                                 TALLOC_CTX *mem_ctx,
1543                                 struct security_descriptor **ppdesc);
1544 NTSTATUS smb_vfs_call_fset_nt_acl(struct vfs_handle_struct *handle,
1545                                   struct files_struct *fsp,
1546                                   uint32_t security_info_sent,
1547                                   const struct security_descriptor *psd);
1548 NTSTATUS smb_vfs_call_audit_file(struct vfs_handle_struct *handle,
1549                                  struct smb_filename *file,
1550                                  struct security_acl *sacl,
1551                                  uint32_t access_requested,
1552                                  uint32_t access_denied);
1553 int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle,
1554                                 const struct smb_filename *file,
1555                                 mode_t mode);
1556 SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
1557                                         const struct smb_filename *smb_fname,
1558                                         SMB_ACL_TYPE_T type,
1559                                         TALLOC_CTX *mem_ctx);
1560 SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
1561                                       struct files_struct *fsp,
1562                                       TALLOC_CTX *mem_ctx);
1563 int smb_vfs_call_sys_acl_blob_get_file(struct vfs_handle_struct *handle,
1564                                        const struct smb_filename *smb_fname,
1565                                        TALLOC_CTX *mem_ctx,
1566                                        char **blob_description,
1567                                        DATA_BLOB *blob);
1568 int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
1569                                      struct files_struct *fsp,  
1570                                      TALLOC_CTX *mem_ctx,
1571                                      char **blob_description,
1572                                      DATA_BLOB *blob);
1573 int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
1574                                 const struct smb_filename *smb_fname,
1575                                 SMB_ACL_TYPE_T acltype,
1576                                 SMB_ACL_T theacl);
1577 int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
1578                                 struct files_struct *fsp, SMB_ACL_T theacl);
1579 int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
1580                                 const struct smb_filename *smb_fname);
1581 ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
1582                                 const struct smb_filename *smb_fname,
1583                                 const char *name,
1584                                 void *value,
1585                                 size_t size);
1586 struct tevent_req *smb_vfs_call_getxattrat_send(
1587                         TALLOC_CTX *mem_ctx,
1588                         struct tevent_context *ev,
1589                         struct vfs_handle_struct *handle,
1590                         files_struct *dir_fsp,
1591                         const struct smb_filename *smb_fname,
1592                         const char *xattr_name,
1593                         size_t alloc_hint);
1594 ssize_t smb_vfs_call_getxattrat_recv(struct tevent_req *req,
1595                                      struct vfs_aio_state *aio_state,
1596                                      TALLOC_CTX *mem_ctx,
1597                                      uint8_t **xattr_value);
1598 ssize_t smb_vfs_call_fgetxattr(struct vfs_handle_struct *handle,
1599                                struct files_struct *fsp, const char *name,
1600                                void *value, size_t size);
1601 ssize_t smb_vfs_call_listxattr(struct vfs_handle_struct *handle,
1602                                 const struct smb_filename *smb_fname,
1603                                 char *list,
1604                                 size_t size);
1605 ssize_t smb_vfs_call_flistxattr(struct vfs_handle_struct *handle,
1606                                 struct files_struct *fsp, char *list,
1607                                 size_t size);
1608 int smb_vfs_call_removexattr(struct vfs_handle_struct *handle,
1609                                 const struct smb_filename *smb_fname,
1610                                 const char *name);
1611 int smb_vfs_call_fremovexattr(struct vfs_handle_struct *handle,
1612                               struct files_struct *fsp, const char *name);
1613 int smb_vfs_call_setxattr(struct vfs_handle_struct *handle,
1614                                 const struct smb_filename *smb_fname,
1615                                 const char *name,
1616                                 const void *value,
1617                                 size_t size,
1618                                 int flags);
1619 int smb_vfs_call_lsetxattr(struct vfs_handle_struct *handle, const char *path,
1620                            const char *name, const void *value, size_t size,
1621                            int flags);
1622 int smb_vfs_call_fsetxattr(struct vfs_handle_struct *handle,
1623                            struct files_struct *fsp, const char *name,
1624                            const void *value, size_t size, int flags);
1625 bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle,
1626                             struct files_struct *fsp);
1627 NTSTATUS smb_vfs_call_durable_cookie(struct vfs_handle_struct *handle,
1628                                      struct files_struct *fsp,
1629                                      TALLOC_CTX *mem_ctx,
1630                                      DATA_BLOB *cookie);
1631 NTSTATUS smb_vfs_call_durable_disconnect(struct vfs_handle_struct *handle,
1632                                          struct files_struct *fsp,
1633                                          const DATA_BLOB old_cookie,
1634                                          TALLOC_CTX *mem_ctx,
1635                                          DATA_BLOB *new_cookie);
1636 NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle,
1637                                         struct smb_request *smb1req,
1638                                         struct smbXsrv_open *op,
1639                                         const DATA_BLOB old_cookie,
1640                                         TALLOC_CTX *mem_ctx,
1641                                         struct files_struct **fsp,
1642                                         DATA_BLOB *new_cookie);
1643 NTSTATUS smb_vfs_call_readdir_attr(struct vfs_handle_struct *handle,
1644                                    const struct smb_filename *fname,
1645                                    TALLOC_CTX *mem_ctx,
1646                                    struct readdir_attr_data **attr_data);
1647
1648 NTSTATUS smb_register_vfs(int version, const char *name,
1649                           const struct vfs_fn_pointers *fns);
1650 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
1651                                    files_struct *fsp, size_t ext_size,
1652                                    void (*destroy_fn)(void *p_data));
1653 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
1654 void vfs_remove_all_fsp_extensions(struct files_struct *fsp);
1655 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
1656 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
1657
1658 void smb_vfs_assert_all_fns(const struct vfs_fn_pointers* fns,
1659                             const char *module);
1660
1661 /*
1662  * Helper functions from source3/modules/vfs_not_implemented.c
1663  */
1664 int vfs_not_implemented_connect(
1665                         vfs_handle_struct *handle,
1666                         const char *service,
1667                         const char *user);
1668 void vfs_not_implemented_disconnect(vfs_handle_struct *handle);
1669 uint64_t vfs_not_implemented_disk_free(vfs_handle_struct *handle,
1670                                 const struct smb_filename *smb_fname,
1671                                 uint64_t *bsize,
1672                                 uint64_t *dfree,
1673                                 uint64_t *dsize);
1674 int vfs_not_implemented_get_quota(vfs_handle_struct *handle,
1675                                 const struct smb_filename *smb_fname,
1676                                 enum SMB_QUOTA_TYPE qtype,
1677                                 unid_t id,
1678                                 SMB_DISK_QUOTA *dq);
1679 int vfs_not_implemented_set_quota(vfs_handle_struct *handle,
1680                                   enum SMB_QUOTA_TYPE qtype,
1681                                   unid_t id, SMB_DISK_QUOTA *dq);
1682 int vfs_not_implemented_get_shadow_copy_data(vfs_handle_struct *handle,
1683                                 files_struct *fsp,
1684                                 struct shadow_copy_data *shadow_copy_data,
1685                                 bool labels);
1686 int vfs_not_implemented_statvfs(struct vfs_handle_struct *handle,
1687                                 const struct smb_filename *smb_fname,
1688                                 struct vfs_statvfs_struct *statbuf);
1689 uint32_t vfs_not_implemented_fs_capabilities(struct vfs_handle_struct *handle,
1690                                 enum timestamp_set_resolution *p_ts_res);
1691 NTSTATUS vfs_not_implemented_get_dfs_referrals(struct vfs_handle_struct *handle,
1692                                                struct dfs_GetDFSReferral *r);
1693 NTSTATUS vfs_not_implemented_create_dfs_pathat(struct vfs_handle_struct *handle,
1694                                 struct files_struct *dirfsp,
1695                                 const struct smb_filename *smb_fname,
1696                                 const struct referral *reflist,
1697                                 size_t referral_count);
1698 NTSTATUS vfs_not_implemented_read_dfs_pathat(struct vfs_handle_struct *handle,
1699                                 TALLOC_CTX *mem_ctx,
1700                                 struct files_struct *dirfsp,
1701                                 const struct smb_filename *smb_fname,
1702                                 struct referral **ppreflist,
1703                                 size_t *preferral_count);
1704 NTSTATUS vfs_not_implemented_snap_check_path(struct vfs_handle_struct *handle,
1705                                 TALLOC_CTX *mem_ctx,
1706                                 const char *service_path,
1707                                 char **base_volume);
1708 NTSTATUS vfs_not_implemented_snap_create(struct vfs_handle_struct *handle,
1709                                          TALLOC_CTX *mem_ctx,
1710                                          const char *base_volume,
1711                                          time_t *tstamp,
1712                                          bool rw,
1713                                          char **base_path,
1714                                          char **snap_path);
1715 NTSTATUS vfs_not_implemented_snap_delete(struct vfs_handle_struct *handle,
1716                                          TALLOC_CTX *mem_ctx,
1717                                          char *base_path,
1718                                          char *snap_path);
1719 DIR *vfs_not_implemented_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
1720                                    const char *mask, uint32_t attr);
1721 struct dirent *vfs_not_implemented_readdir(vfs_handle_struct *handle,
1722                                            DIR *dirp, SMB_STRUCT_STAT *sbuf);
1723 void vfs_not_implemented_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset);
1724 long vfs_not_implemented_telldir(vfs_handle_struct *handle, DIR *dirp);
1725 void vfs_not_implemented_rewind_dir(vfs_handle_struct *handle, DIR *dirp);
1726 int vfs_not_implemented_mkdirat(vfs_handle_struct *handle,
1727                 struct files_struct *dirfsp,
1728                 const struct smb_filename *smb_fname,
1729                 mode_t mode);
1730 int vfs_not_implemented_closedir(vfs_handle_struct *handle, DIR *dir);
1731 int vfs_not_implemented_open(vfs_handle_struct *handle,
1732                              struct smb_filename *smb_fname,
1733                              files_struct *fsp, int flags, mode_t mode);
1734 NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
1735                                 struct smb_request *req,
1736                                 struct files_struct **dirfsp,
1737                                 struct smb_filename *smb_fname,
1738                                 uint32_t access_mask,
1739                                 uint32_t share_access,
1740                                 uint32_t create_disposition,
1741                                 uint32_t create_options,
1742                                 uint32_t file_attributes,
1743                                 uint32_t oplock_request,
1744                                 const struct smb2_lease *lease,
1745                                 uint64_t allocation_size,
1746                                 uint32_t private_flags,
1747                                 struct security_descriptor *sd,
1748                                 struct ea_list *ea_list,
1749                                 files_struct **result, int *pinfo,
1750                                 const struct smb2_create_blobs *in_context_blobs,
1751                                 struct smb2_create_blobs *out_context_blobs);
1752 int vfs_not_implemented_close_fn(vfs_handle_struct *handle, files_struct *fsp);
1753 ssize_t vfs_not_implemented_pread(vfs_handle_struct *handle, files_struct *fsp,
1754                                   void *data, size_t n, off_t offset);
1755 struct tevent_req *vfs_not_implemented_pread_send(struct vfs_handle_struct *handle,
1756                                                   TALLOC_CTX *mem_ctx,
1757                                                   struct tevent_context *ev,
1758                                                   struct files_struct *fsp,
1759                                                   void *data, size_t n, off_t offset);
1760 ssize_t vfs_not_implemented_pread_recv(struct tevent_req *req,
1761                                        struct vfs_aio_state *vfs_aio_state);
1762 ssize_t vfs_not_implemented_pwrite(vfs_handle_struct *handle, files_struct *fsp,
1763                                    const void *data, size_t n, off_t offset);
1764 struct tevent_req *vfs_not_implemented_pwrite_send(struct vfs_handle_struct *handle,
1765                                                    TALLOC_CTX *mem_ctx,
1766                                                    struct tevent_context *ev,
1767                                                    struct files_struct *fsp,
1768                                                    const void *data,
1769                                                    size_t n, off_t offset);
1770 ssize_t vfs_not_implemented_pwrite_recv(struct tevent_req *req,
1771                                 struct vfs_aio_state *vfs_aio_state);
1772 off_t vfs_not_implemented_lseek(vfs_handle_struct *handle, files_struct *fsp,
1773                         off_t offset, int whence);
1774 ssize_t vfs_not_implemented_sendfile(vfs_handle_struct *handle, int tofd,
1775                                      files_struct *fromfsp, const DATA_BLOB *hdr,
1776                                      off_t offset, size_t n);
1777 ssize_t vfs_not_implemented_recvfile(vfs_handle_struct *handle, int fromfd,
1778                                      files_struct *tofsp, off_t offset, size_t n);
1779 int vfs_not_implemented_renameat(vfs_handle_struct *handle,
1780                                files_struct *srcfsp,
1781                                const struct smb_filename *smb_fname_src,
1782                                files_struct *dstfsp,
1783                                const struct smb_filename *smb_fname_dst);
1784 struct tevent_req *vfs_not_implemented_fsync_send(struct vfs_handle_struct *handle,
1785                                                   TALLOC_CTX *mem_ctx,
1786                                                   struct tevent_context *ev,
1787                                                   struct files_struct *fsp);
1788 int vfs_not_implemented_fsync_recv(struct tevent_req *req,
1789                                    struct vfs_aio_state *vfs_aio_state);
1790 int vfs_not_implemented_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname);
1791 int vfs_not_implemented_fstat(vfs_handle_struct *handle, files_struct *fsp,
1792                         SMB_STRUCT_STAT *sbuf);
1793 int vfs_not_implemented_lstat(vfs_handle_struct *handle,
1794                               struct smb_filename *smb_fname);
1795 uint64_t vfs_not_implemented_get_alloc_size(struct vfs_handle_struct *handle,
1796                                             struct files_struct *fsp,
1797                                             const SMB_STRUCT_STAT *sbuf);
1798 int vfs_not_implemented_unlinkat(vfs_handle_struct *handle,
1799                                 struct files_struct *dirfsp,
1800                                 const struct smb_filename *smb_fname,
1801                                 int flags);
1802 int vfs_not_implemented_chmod(vfs_handle_struct *handle,
1803                               const struct smb_filename *smb_fname,
1804                               mode_t mode);
1805 int vfs_not_implemented_fchmod(vfs_handle_struct *handle, files_struct *fsp,
1806                                mode_t mode);
1807 int vfs_not_implemented_fchown(vfs_handle_struct *handle, files_struct *fsp,
1808                                uid_t uid, gid_t gid);
1809 int vfs_not_implemented_lchown(vfs_handle_struct *handle,
1810                                const struct smb_filename *smb_fname,
1811                                uid_t uid,
1812                                gid_t gid);
1813 int vfs_not_implemented_chdir(vfs_handle_struct *handle,
1814                               const struct smb_filename *smb_fname);
1815 struct smb_filename *vfs_not_implemented_getwd(vfs_handle_struct *handle,
1816                                                TALLOC_CTX *ctx);
1817 int vfs_not_implemented_ntimes(vfs_handle_struct *handle,
1818                                const struct smb_filename *smb_fname,
1819                                struct smb_file_time *ft);
1820 int vfs_not_implemented_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
1821                                   off_t offset);
1822 int vfs_not_implemented_fallocate(vfs_handle_struct *handle, files_struct *fsp,
1823                                   uint32_t mode, off_t offset, off_t len);
1824 bool vfs_not_implemented_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
1825                               off_t offset, off_t count, int type);
1826 int vfs_not_implemented_kernel_flock(struct vfs_handle_struct *handle,
1827                                      struct files_struct *fsp,
1828                                      uint32_t share_access, uint32_t access_mask);
1829 int vfs_not_implemented_fcntl(struct vfs_handle_struct *handle,
1830                               struct files_struct *fsp, int cmd, va_list cmd_arg);
1831 int vfs_not_implemented_linux_setlease(struct vfs_handle_struct *handle,
1832                                        struct files_struct *fsp, int leasetype);
1833 bool vfs_not_implemented_getlock(vfs_handle_struct *handle, files_struct *fsp,
1834                                  off_t *poffset, off_t *pcount, int *ptype,
1835                                  pid_t *ppid);
1836 int vfs_not_implemented_symlinkat(vfs_handle_struct *handle,
1837                                 const struct smb_filename *link_contents,
1838                                 struct files_struct *dirfsp,
1839                                 const struct smb_filename *new_smb_fname);
1840 int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle,
1841                         struct files_struct *dirfsp,
1842                         const struct smb_filename *smb_fname,
1843                         char *buf,
1844                         size_t bufsiz);
1845 int vfs_not_implemented_linkat(vfs_handle_struct *handle,
1846                         struct files_struct *srcfsp,
1847                         const struct smb_filename *old_smb_fname,
1848                         struct files_struct *dstfsp,
1849                         const struct smb_filename *new_smb_fname,
1850                         int flags);
1851 int vfs_not_implemented_mknodat(vfs_handle_struct *handle,
1852                         struct files_struct *dirfsp,
1853                         const struct smb_filename *smb_fname,
1854                         mode_t mode,
1855                         SMB_DEV_T dev);
1856 struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
1857                                                   TALLOC_CTX *ctx,
1858                                                   const struct smb_filename *smb_fname);
1859 int vfs_not_implemented_chflags(vfs_handle_struct *handle,
1860                                 const struct smb_filename *smb_fname,
1861                                 uint flags);
1862 struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
1863                                                   const SMB_STRUCT_STAT *sbuf);
1864 uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
1865                                         const SMB_STRUCT_STAT *sbuf);
1866 struct tevent_req *vfs_not_implemented_offload_read_send(
1867                         TALLOC_CTX *mem_ctx,
1868                         struct tevent_context *ev,
1869                         struct vfs_handle_struct *handle,
1870                         struct files_struct *fsp,
1871                         uint32_t fsctl,
1872                         uint32_t ttl,
1873                         off_t offset,
1874                         size_t to_copy);
1875 NTSTATUS vfs_not_implemented_offload_read_recv(struct tevent_req *req,
1876                                        struct vfs_handle_struct *handle,
1877                                        TALLOC_CTX *mem_ctx,
1878                                        DATA_BLOB *_token_blob);
1879 struct tevent_req *vfs_not_implemented_offload_write_send(
1880                         struct vfs_handle_struct *handle,
1881                         TALLOC_CTX *mem_ctx,
1882                         struct tevent_context *ev,
1883                         uint32_t fsctl,
1884                         DATA_BLOB *token,
1885                         off_t transfer_offset,
1886                         struct files_struct *dest_fsp,
1887                         off_t dest_off,
1888                         off_t num);
1889 NTSTATUS vfs_not_implemented_offload_write_recv(struct vfs_handle_struct *handle,
1890                                                 struct tevent_req *req,
1891                                                 off_t *copied);
1892 NTSTATUS vfs_not_implemented_get_compression(struct vfs_handle_struct *handle,
1893                                              TALLOC_CTX *mem_ctx,
1894                                              struct files_struct *fsp,
1895                                              struct smb_filename *smb_fname,
1896                                              uint16_t *_compression_fmt);
1897 NTSTATUS vfs_not_implemented_set_compression(struct vfs_handle_struct *handle,
1898                                              TALLOC_CTX *mem_ctx,
1899                                              struct files_struct *fsp,
1900                                              uint16_t compression_fmt);
1901 NTSTATUS vfs_not_implemented_streaminfo(struct vfs_handle_struct *handle,
1902                                         struct files_struct *fsp,
1903                                         const struct smb_filename *smb_fname,
1904                                         TALLOC_CTX *mem_ctx,
1905                                         unsigned int *num_streams,
1906                                         struct stream_struct **streams);
1907 int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
1908                                           const struct smb_filename *path,
1909                                           const char *name,
1910                                           TALLOC_CTX *mem_ctx,
1911                                           char **found_name);
1912 const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
1913                                             const struct smb_filename *smb_fname);
1914 NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
1915                                               struct byte_range_lock *br_lck,
1916                                               struct lock_struct *plock);
1917 bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
1918                                             struct byte_range_lock *br_lck,
1919                                             const struct lock_struct *plock);
1920 bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,
1921                                            struct files_struct *fsp,
1922                                            struct lock_struct *plock);
1923 NTSTATUS vfs_not_implemented_translate_name(struct vfs_handle_struct *handle,
1924                                             const char *mapped_name,
1925                                             enum vfs_translate_direction direction,
1926                                             TALLOC_CTX *mem_ctx, char **pmapped_name);
1927 NTSTATUS vfs_not_implemented_fsctl(struct vfs_handle_struct *handle,
1928                                    struct files_struct *fsp,
1929                                    TALLOC_CTX *ctx,
1930                                    uint32_t function,
1931                                    uint16_t req_flags,  /* Needed for UNICODE ... */
1932                                    const uint8_t *_in_data,
1933                                    uint32_t in_len,
1934                                    uint8_t **_out_data,
1935                                    uint32_t max_out_len, uint32_t *out_len);
1936 NTSTATUS vfs_not_implemented_readdir_attr(struct vfs_handle_struct *handle,
1937                                           const struct smb_filename *fname,
1938                                           TALLOC_CTX *mem_ctx,
1939                                           struct readdir_attr_data **pattr_data);
1940 NTSTATUS vfs_not_implemented_get_dos_attributes(struct vfs_handle_struct *handle,
1941                                                 struct smb_filename *smb_fname,
1942                                                 uint32_t *dosmode);
1943 struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
1944                         TALLOC_CTX *mem_ctx,
1945                         struct tevent_context *ev,
1946                         struct vfs_handle_struct *handle,
1947                         files_struct *dir_fsp,
1948                         struct smb_filename *smb_fname);
1949 NTSTATUS vfs_not_implemented_get_dos_attributes_recv(
1950                         struct tevent_req *req,
1951                         struct vfs_aio_state *aio_state,
1952                         uint32_t *dosmode);
1953 NTSTATUS vfs_not_implemented_fget_dos_attributes(struct vfs_handle_struct *handle,
1954                                                  struct files_struct *fsp,
1955                                                  uint32_t *dosmode);
1956 NTSTATUS vfs_not_implemented_set_dos_attributes(struct vfs_handle_struct *handle,
1957                                                 const struct smb_filename *smb_fname,
1958                                                 uint32_t dosmode);
1959 NTSTATUS vfs_not_implemented_fset_dos_attributes(struct vfs_handle_struct *handle,
1960                                                  struct files_struct *fsp,
1961                                                  uint32_t dosmode);
1962 NTSTATUS vfs_not_implemented_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
1963                                          uint32_t security_info,
1964                                          TALLOC_CTX *mem_ctx,
1965                                          struct security_descriptor **ppdesc);
1966 NTSTATUS vfs_not_implemented_get_nt_acl_at(vfs_handle_struct *handle,
1967                         struct files_struct *dirfsp,
1968                         const struct smb_filename *smb_fname,
1969                         uint32_t security_info,
1970                         TALLOC_CTX *mem_ctx,
1971                         struct security_descriptor **ppdesc);
1972 NTSTATUS vfs_not_implemented_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
1973                                          uint32_t security_info_sent,
1974                                          const struct security_descriptor *psd);
1975 SMB_ACL_T vfs_not_implemented_sys_acl_get_file(vfs_handle_struct *handle,
1976                                                const struct smb_filename *smb_fname,
1977                                                SMB_ACL_TYPE_T type,
1978                                                TALLOC_CTX *mem_ctx);
1979 SMB_ACL_T vfs_not_implemented_sys_acl_get_fd(vfs_handle_struct *handle,
1980                                              files_struct *fsp, TALLOC_CTX *mem_ctx);
1981 int vfs_not_implemented_sys_acl_blob_get_file(vfs_handle_struct *handle,
1982                                 const struct smb_filename *smb_fname,
1983                                 TALLOC_CTX *mem_ctx,
1984                                 char **blob_description,
1985                                 DATA_BLOB *blob);
1986 int vfs_not_implemented_sys_acl_blob_get_fd(vfs_handle_struct *handle,
1987                                 files_struct *fsp, TALLOC_CTX *mem_ctx,
1988                                 char **blob_description, DATA_BLOB *blob);
1989 int vfs_not_implemented_sys_acl_set_file(vfs_handle_struct *handle,
1990                                 const struct smb_filename *smb_fname,
1991                                 SMB_ACL_TYPE_T acltype,
1992                                 SMB_ACL_T theacl);
1993 int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
1994                                        SMB_ACL_T theacl);
1995 int vfs_not_implemented_sys_acl_delete_def_file(vfs_handle_struct *handle,
1996                                         const struct smb_filename *smb_fname);
1997 ssize_t vfs_not_implemented_getxattr(vfs_handle_struct *handle,
1998                                 const struct smb_filename *smb_fname,
1999                                 const char *name,
2000                                 void *value,
2001                                 size_t size);
2002 struct tevent_req *vfs_not_implemented_getxattrat_send(
2003                         TALLOC_CTX *mem_ctx,
2004                         struct tevent_context *ev,
2005                         struct vfs_handle_struct *handle,
2006                         files_struct *dir_fsp,
2007                         const struct smb_filename *smb_fname,
2008                         const char *xattr_name,
2009                         size_t alloc_hint);
2010 ssize_t vfs_not_implemented_getxattrat_recv(struct tevent_req *req,
2011                                     struct vfs_aio_state *aio_state,
2012                                     TALLOC_CTX *mem_ctx,
2013                                     uint8_t **xattr_value);
2014 ssize_t vfs_not_implemented_fgetxattr(vfs_handle_struct *handle,
2015                               struct files_struct *fsp, const char *name,
2016                               void *value, size_t size);
2017 ssize_t vfs_not_implemented_listxattr(vfs_handle_struct *handle,
2018                                       const struct smb_filename *smb_fname,
2019                                       char *list,
2020                                       size_t size);
2021 ssize_t vfs_not_implemented_flistxattr(vfs_handle_struct *handle,
2022                                        struct files_struct *fsp, char *list,
2023                                        size_t size);
2024 int vfs_not_implemented_removexattr(vfs_handle_struct *handle,
2025                                     const struct smb_filename *smb_fname,
2026                                     const char *name);
2027 int vfs_not_implemented_fremovexattr(vfs_handle_struct *handle,
2028                                      struct files_struct *fsp, const char *name);
2029 int vfs_not_implemented_setxattr(vfs_handle_struct *handle,
2030                                  const struct smb_filename *smb_fname,
2031                                  const char *name,
2032                                  const void *value,
2033                                  size_t size,
2034                                  int flags);
2035 int vfs_not_implemented_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
2036                                   const char *name, const void *value, size_t size,
2037                                   int flags);
2038 bool vfs_not_implemented_aio_force(struct vfs_handle_struct *handle,
2039                                    struct files_struct *fsp);
2040 NTSTATUS vfs_not_implemented_audit_file(struct vfs_handle_struct *handle,
2041                                         struct smb_filename *file,
2042                                         struct security_acl *sacl,
2043                                         uint32_t access_requested,
2044                                         uint32_t access_denied);
2045 NTSTATUS vfs_not_implemented_durable_cookie(struct vfs_handle_struct *handle,
2046                                             struct files_struct *fsp,
2047                                             TALLOC_CTX *mem_ctx,
2048                                             DATA_BLOB *cookie);
2049 NTSTATUS vfs_not_implemented_durable_disconnect(struct vfs_handle_struct *handle,
2050                                                 struct files_struct *fsp,
2051                                                 const DATA_BLOB old_cookie,
2052                                                 TALLOC_CTX *mem_ctx,
2053                                                 DATA_BLOB *new_cookie);
2054 NTSTATUS vfs_not_implemented_durable_reconnect(struct vfs_handle_struct *handle,
2055                                                struct smb_request *smb1req,
2056                                                struct smbXsrv_open *op,
2057                                                const DATA_BLOB old_cookie,
2058                                                TALLOC_CTX *mem_ctx,
2059                                                struct files_struct **fsp,
2060                                                DATA_BLOB *new_cookie);
2061 #endif /* _VFS_H */