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