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