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