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