2 * Skeleton VFS module. Implements passthrough operation of all VFS
3 * calls to disk functions.
5 * Copyright (C) Tim Potter, 1999-2000
6 * Copyright (C) Alexander Bokovoy, 2002
7 * Copyright (C) Stefan (metze) Metzmacher, 2003
8 * Copyright (C) Jeremy Allison 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/>.
24 #include "../source3/include/includes.h"
25 #include "lib/util/tevent_unix.h"
26 #include "lib/util/tevent_ntstatus.h"
28 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE
29 SAMBA DEVELOPERS GUIDE!!!!!!
32 /* If you take this file as template for your module
33 * please make sure that you remove all skel_XXX() functions you don't
34 * want to implement!! The passthrough operations are not
35 * neccessary in a real module.
40 static int skel_connect(vfs_handle_struct
*handle
, const char *service
,
43 return SMB_VFS_NEXT_CONNECT(handle
, service
, user
);
46 static void skel_disconnect(vfs_handle_struct
*handle
)
48 SMB_VFS_NEXT_DISCONNECT(handle
);
51 static uint64_t skel_disk_free(vfs_handle_struct
*handle
, const char *path
,
53 uint64_t *dfree
, uint64_t *dsize
)
55 return SMB_VFS_NEXT_DISK_FREE(handle
, path
, bsize
, dfree
, dsize
);
58 static int skel_get_quota(vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
,
59 unid_t id
, SMB_DISK_QUOTA
*dq
)
61 return SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, dq
);
64 static int skel_set_quota(vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
,
65 unid_t id
, SMB_DISK_QUOTA
*dq
)
67 return SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, dq
);
70 static int skel_get_shadow_copy_data(vfs_handle_struct
*handle
,
72 struct shadow_copy_data
*shadow_copy_data
,
75 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
,
79 static int skel_statvfs(struct vfs_handle_struct
*handle
, const char *path
,
80 struct vfs_statvfs_struct
*statbuf
)
82 return SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
85 static uint32_t skel_fs_capabilities(struct vfs_handle_struct
*handle
,
86 enum timestamp_set_resolution
*p_ts_res
)
88 return SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
91 static NTSTATUS
skel_get_dfs_referrals(struct vfs_handle_struct
*handle
,
92 struct dfs_GetDFSReferral
*r
)
94 return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle
, r
);
97 static DIR *skel_opendir(vfs_handle_struct
*handle
, const char *fname
,
98 const char *mask
, uint32_t attr
)
100 return SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
103 static NTSTATUS
skel_snap_check_path(struct vfs_handle_struct
*handle
,
105 const char *service_path
,
108 return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle
, mem_ctx
, service_path
,
112 static NTSTATUS
skel_snap_create(struct vfs_handle_struct
*handle
,
114 const char *base_volume
,
120 return SMB_VFS_NEXT_SNAP_CREATE(handle
, mem_ctx
, base_volume
, tstamp
,
121 rw
, base_path
, snap_path
);
124 static NTSTATUS
skel_snap_delete(struct vfs_handle_struct
*handle
,
129 return SMB_VFS_NEXT_SNAP_DELETE(handle
, mem_ctx
, base_path
, snap_path
);
132 static DIR *skel_fdopendir(vfs_handle_struct
*handle
, files_struct
*fsp
,
133 const char *mask
, uint32_t attr
)
135 return SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
138 static struct dirent
*skel_readdir(vfs_handle_struct
*handle
,
139 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
141 return SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
144 static void skel_seekdir(vfs_handle_struct
*handle
, DIR *dirp
, long offset
)
146 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
149 static long skel_telldir(vfs_handle_struct
*handle
, DIR *dirp
)
151 return SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
154 static void skel_rewind_dir(vfs_handle_struct
*handle
, DIR *dirp
)
156 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
159 static int skel_mkdir(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
161 return SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
164 static int skel_rmdir(vfs_handle_struct
*handle
, const char *path
)
166 return SMB_VFS_NEXT_RMDIR(handle
, path
);
169 static int skel_closedir(vfs_handle_struct
*handle
, DIR *dir
)
171 return SMB_VFS_NEXT_CLOSEDIR(handle
, dir
);
174 static void skel_init_search_op(struct vfs_handle_struct
*handle
, DIR *dirp
)
176 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
179 static int skel_open(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
,
180 files_struct
*fsp
, int flags
, mode_t mode
)
182 return SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
185 static NTSTATUS
skel_create_file(struct vfs_handle_struct
*handle
,
186 struct smb_request
*req
,
187 uint16_t root_dir_fid
,
188 struct smb_filename
*smb_fname
,
189 uint32_t access_mask
,
190 uint32_t share_access
,
191 uint32_t create_disposition
,
192 uint32_t create_options
,
193 uint32_t file_attributes
,
194 uint32_t oplock_request
,
195 struct smb2_lease
*lease
,
196 uint64_t allocation_size
,
197 uint32_t private_flags
,
198 struct security_descriptor
*sd
,
199 struct ea_list
*ea_list
,
200 files_struct
** result
, int *pinfo
,
201 const struct smb2_create_blobs
*in_context_blobs
,
202 struct smb2_create_blobs
*out_context_blobs
)
204 return SMB_VFS_NEXT_CREATE_FILE(handle
,
217 sd
, ea_list
, result
, pinfo
,
218 in_context_blobs
, out_context_blobs
);
221 static int skel_close_fn(vfs_handle_struct
*handle
, files_struct
*fsp
)
223 return SMB_VFS_NEXT_CLOSE(handle
, fsp
);
226 static ssize_t
skel_vfs_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
227 void *data
, size_t n
)
229 return SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
232 static ssize_t
skel_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
233 void *data
, size_t n
, off_t offset
)
235 return SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
238 struct skel_pread_state
{
243 static void skel_pread_done(struct tevent_req
*subreq
);
245 static struct tevent_req
*skel_pread_send(struct vfs_handle_struct
*handle
,
247 struct tevent_context
*ev
,
248 struct files_struct
*fsp
,
249 void *data
, size_t n
, off_t offset
)
251 struct tevent_req
*req
, *subreq
;
252 struct skel_pread_state
*state
;
254 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pread_state
);
258 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
260 if (tevent_req_nomem(subreq
, req
)) {
261 return tevent_req_post(req
, ev
);
263 tevent_req_set_callback(subreq
, skel_pread_done
, req
);
267 static void skel_pread_done(struct tevent_req
*subreq
)
269 struct tevent_req
*req
=
270 tevent_req_callback_data(subreq
, struct tevent_req
);
271 struct skel_pread_state
*state
=
272 tevent_req_data(req
, struct skel_pread_state
);
274 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
276 tevent_req_done(req
);
279 static ssize_t
skel_pread_recv(struct tevent_req
*req
, int *err
)
281 struct skel_pread_state
*state
=
282 tevent_req_data(req
, struct skel_pread_state
);
284 if (tevent_req_is_unix_error(req
, err
)) {
291 static ssize_t
skel_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
292 const void *data
, size_t n
)
294 return SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
297 static ssize_t
skel_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
298 const void *data
, size_t n
, off_t offset
)
300 return SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
303 struct skel_pwrite_state
{
308 static void skel_pwrite_done(struct tevent_req
*subreq
);
310 static struct tevent_req
*skel_pwrite_send(struct vfs_handle_struct
*handle
,
312 struct tevent_context
*ev
,
313 struct files_struct
*fsp
,
315 size_t n
, off_t offset
)
317 struct tevent_req
*req
, *subreq
;
318 struct skel_pwrite_state
*state
;
320 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pwrite_state
);
324 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
326 if (tevent_req_nomem(subreq
, req
)) {
327 return tevent_req_post(req
, ev
);
329 tevent_req_set_callback(subreq
, skel_pwrite_done
, req
);
333 static void skel_pwrite_done(struct tevent_req
*subreq
)
335 struct tevent_req
*req
=
336 tevent_req_callback_data(subreq
, struct tevent_req
);
337 struct skel_pwrite_state
*state
=
338 tevent_req_data(req
, struct skel_pwrite_state
);
340 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->err
);
342 tevent_req_done(req
);
345 static ssize_t
skel_pwrite_recv(struct tevent_req
*req
, int *err
)
347 struct skel_pwrite_state
*state
=
348 tevent_req_data(req
, struct skel_pwrite_state
);
350 if (tevent_req_is_unix_error(req
, err
)) {
357 static off_t
skel_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
358 off_t offset
, int whence
)
360 return SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
363 static ssize_t
skel_sendfile(vfs_handle_struct
*handle
, int tofd
,
364 files_struct
*fromfsp
, const DATA_BLOB
*hdr
,
365 off_t offset
, size_t n
)
367 return SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
370 static ssize_t
skel_recvfile(vfs_handle_struct
*handle
, int fromfd
,
371 files_struct
*tofsp
, off_t offset
, size_t n
)
373 return SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
376 static int skel_rename(vfs_handle_struct
*handle
,
377 const struct smb_filename
*smb_fname_src
,
378 const struct smb_filename
*smb_fname_dst
)
380 return SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
383 static int skel_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
385 return SMB_VFS_NEXT_FSYNC(handle
, fsp
);
388 struct skel_fsync_state
{
393 static void skel_fsync_done(struct tevent_req
*subreq
);
395 static struct tevent_req
*skel_fsync_send(struct vfs_handle_struct
*handle
,
397 struct tevent_context
*ev
,
398 struct files_struct
*fsp
)
400 struct tevent_req
*req
, *subreq
;
401 struct skel_fsync_state
*state
;
403 req
= tevent_req_create(mem_ctx
, &state
, struct skel_fsync_state
);
407 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
408 if (tevent_req_nomem(subreq
, req
)) {
409 return tevent_req_post(req
, ev
);
411 tevent_req_set_callback(subreq
, skel_fsync_done
, req
);
415 static void skel_fsync_done(struct tevent_req
*subreq
)
417 struct tevent_req
*req
=
418 tevent_req_callback_data(subreq
, struct tevent_req
);
419 struct skel_fsync_state
*state
=
420 tevent_req_data(req
, struct skel_fsync_state
);
422 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->err
);
424 tevent_req_done(req
);
427 static int skel_fsync_recv(struct tevent_req
*req
, int *err
)
429 struct skel_fsync_state
*state
=
430 tevent_req_data(req
, struct skel_fsync_state
);
432 if (tevent_req_is_unix_error(req
, err
)) {
439 static int skel_stat(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
)
441 return SMB_VFS_NEXT_STAT(handle
, smb_fname
);
444 static int skel_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
445 SMB_STRUCT_STAT
*sbuf
)
447 return SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
450 static int skel_lstat(vfs_handle_struct
*handle
,
451 struct smb_filename
*smb_fname
)
453 return SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
456 static uint64_t skel_get_alloc_size(struct vfs_handle_struct
*handle
,
457 struct files_struct
*fsp
,
458 const SMB_STRUCT_STAT
*sbuf
)
460 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
463 static int skel_unlink(vfs_handle_struct
*handle
,
464 const struct smb_filename
*smb_fname
)
466 return SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
469 static int skel_chmod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
471 return SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
474 static int skel_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
477 return SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
480 static int skel_chown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
,
483 return SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
486 static int skel_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
487 uid_t uid
, gid_t gid
)
489 return SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
492 static int skel_lchown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
,
495 return SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
498 static int skel_chdir(vfs_handle_struct
*handle
, const char *path
)
500 return SMB_VFS_NEXT_CHDIR(handle
, path
);
503 static char *skel_getwd(vfs_handle_struct
*handle
)
505 return SMB_VFS_NEXT_GETWD(handle
);
508 static int skel_ntimes(vfs_handle_struct
*handle
,
509 const struct smb_filename
*smb_fname
,
510 struct smb_file_time
*ft
)
512 return SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
515 static int skel_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
518 return SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, offset
);
521 static int skel_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
522 uint32_t mode
, off_t offset
, off_t len
)
524 return SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
527 static bool skel_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int op
,
528 off_t offset
, off_t count
, int type
)
530 return SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
533 static int skel_kernel_flock(struct vfs_handle_struct
*handle
,
534 struct files_struct
*fsp
, uint32_t share_mode
,
535 uint32_t access_mask
)
537 return SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
540 static int skel_linux_setlease(struct vfs_handle_struct
*handle
,
541 struct files_struct
*fsp
, int leasetype
)
543 return SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
546 static bool skel_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
547 off_t
*poffset
, off_t
*pcount
, int *ptype
,
550 return SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
553 static int skel_symlink(vfs_handle_struct
*handle
, const char *oldpath
,
556 return SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
559 static int skel_vfs_readlink(vfs_handle_struct
*handle
, const char *path
,
560 char *buf
, size_t bufsiz
)
562 return SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
565 static int skel_link(vfs_handle_struct
*handle
, const char *oldpath
,
568 return SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
571 static int skel_mknod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
,
574 return SMB_VFS_NEXT_MKNOD(handle
, path
, mode
, dev
);
577 static char *skel_realpath(vfs_handle_struct
*handle
, const char *path
)
579 return SMB_VFS_NEXT_REALPATH(handle
, path
);
582 static NTSTATUS
skel_notify_watch(struct vfs_handle_struct
*handle
,
583 struct sys_notify_context
*ctx
,
586 uint32_t *subdir_filter
,
587 void (*callback
) (struct sys_notify_context
*ctx
,
589 struct notify_event
*ev
),
590 void *private_data
, void *handle_p
)
592 return SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
593 filter
, subdir_filter
, callback
,
594 private_data
, handle_p
);
597 static int skel_chflags(vfs_handle_struct
*handle
, const char *path
,
600 return SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
603 static struct file_id
skel_file_id_create(vfs_handle_struct
*handle
,
604 const SMB_STRUCT_STAT
*sbuf
)
606 return SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
609 struct skel_cc_state
{
610 struct vfs_handle_struct
*handle
;
613 static void skel_copy_chunk_done(struct tevent_req
*subreq
);
615 static struct tevent_req
*skel_copy_chunk_send(struct vfs_handle_struct
*handle
,
617 struct tevent_context
*ev
,
618 struct files_struct
*src_fsp
,
620 struct files_struct
*dest_fsp
,
624 struct tevent_req
*req
;
625 struct tevent_req
*subreq
;
626 struct skel_cc_state
*cc_state
;
628 req
= tevent_req_create(mem_ctx
, &cc_state
, struct skel_cc_state
);
633 cc_state
->handle
= handle
;
634 subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, cc_state
, ev
,
636 dest_fsp
, dest_off
, num
);
637 if (tevent_req_nomem(subreq
, req
)) {
638 return tevent_req_post(req
, ev
);
641 tevent_req_set_callback(subreq
, skel_copy_chunk_done
, req
);
645 static void skel_copy_chunk_done(struct tevent_req
*subreq
)
647 struct tevent_req
*req
= tevent_req_callback_data(
648 subreq
, struct tevent_req
);
649 struct skel_cc_state
*cc_state
650 = tevent_req_data(req
, struct skel_cc_state
);
653 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
657 if (tevent_req_nterror(req
, status
)) {
660 tevent_req_done(req
);
663 static NTSTATUS
skel_copy_chunk_recv(struct vfs_handle_struct
*handle
,
664 struct tevent_req
*req
,
667 struct skel_cc_state
*cc_state
668 = tevent_req_data(req
, struct skel_cc_state
);
671 *copied
= cc_state
->copied
;
672 if (tevent_req_is_nterror(req
, &status
)) {
673 tevent_req_received(req
);
677 tevent_req_received(req
);
681 static NTSTATUS
skel_get_compression(struct vfs_handle_struct
*handle
,
683 struct files_struct
*fsp
,
684 struct smb_filename
*smb_fname
,
685 uint16_t *_compression_fmt
)
687 return SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
691 static NTSTATUS
skel_set_compression(struct vfs_handle_struct
*handle
,
693 struct files_struct
*fsp
,
694 uint16_t compression_fmt
)
696 return SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
700 static NTSTATUS
skel_streaminfo(struct vfs_handle_struct
*handle
,
701 struct files_struct
*fsp
,
704 unsigned int *num_streams
,
705 struct stream_struct
**streams
)
707 return SMB_VFS_NEXT_STREAMINFO(handle
,
709 fname
, mem_ctx
, num_streams
, streams
);
712 static int skel_get_real_filename(struct vfs_handle_struct
*handle
,
715 TALLOC_CTX
*mem_ctx
, char **found_name
)
717 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle
,
718 path
, name
, mem_ctx
, found_name
);
721 static const char *skel_connectpath(struct vfs_handle_struct
*handle
,
722 const char *filename
)
724 return SMB_VFS_NEXT_CONNECTPATH(handle
, filename
);
727 static NTSTATUS
skel_brl_lock_windows(struct vfs_handle_struct
*handle
,
728 struct byte_range_lock
*br_lck
,
729 struct lock_struct
*plock
,
732 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
,
733 br_lck
, plock
, blocking_lock
);
736 static bool skel_brl_unlock_windows(struct vfs_handle_struct
*handle
,
737 struct messaging_context
*msg_ctx
,
738 struct byte_range_lock
*br_lck
,
739 const struct lock_struct
*plock
)
741 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
, plock
);
744 static bool skel_brl_cancel_windows(struct vfs_handle_struct
*handle
,
745 struct byte_range_lock
*br_lck
,
746 struct lock_struct
*plock
)
748 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
751 static bool skel_strict_lock(struct vfs_handle_struct
*handle
,
752 struct files_struct
*fsp
,
753 struct lock_struct
*plock
)
755 return SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
758 static void skel_strict_unlock(struct vfs_handle_struct
*handle
,
759 struct files_struct
*fsp
,
760 struct lock_struct
*plock
)
762 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
765 static NTSTATUS
skel_translate_name(struct vfs_handle_struct
*handle
,
766 const char *mapped_name
,
767 enum vfs_translate_direction direction
,
768 TALLOC_CTX
*mem_ctx
, char **pmapped_name
)
770 return SMB_VFS_NEXT_TRANSLATE_NAME(handle
, mapped_name
, direction
,
771 mem_ctx
, pmapped_name
);
774 static NTSTATUS
skel_fsctl(struct vfs_handle_struct
*handle
,
775 struct files_struct
*fsp
,
778 uint16_t req_flags
, /* Needed for UNICODE ... */
779 const uint8_t *_in_data
,
781 uint8_t ** _out_data
,
782 uint32_t max_out_len
, uint32_t *out_len
)
784 return SMB_VFS_NEXT_FSCTL(handle
,
790 in_len
, _out_data
, max_out_len
, out_len
);
793 static NTSTATUS
skel_readdir_attr(struct vfs_handle_struct
*handle
,
794 const struct smb_filename
*fname
,
796 struct readdir_attr_data
**pattr_data
)
798 return SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
801 static NTSTATUS
skel_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
802 uint32_t security_info
,
804 struct security_descriptor
**ppdesc
)
806 return SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, mem_ctx
,
810 static NTSTATUS
skel_get_nt_acl(vfs_handle_struct
*handle
,
811 const char *name
, uint32_t security_info
,
813 struct security_descriptor
**ppdesc
)
815 return SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, mem_ctx
,
819 static NTSTATUS
skel_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
820 uint32_t security_info_sent
,
821 const struct security_descriptor
*psd
)
823 return SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
826 static int skel_chmod_acl(vfs_handle_struct
*handle
, const char *name
,
829 return SMB_VFS_NEXT_CHMOD_ACL(handle
, name
, mode
);
832 static int skel_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
835 return SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
838 static SMB_ACL_T
skel_sys_acl_get_file(vfs_handle_struct
*handle
,
843 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
, mem_ctx
);
846 static SMB_ACL_T
skel_sys_acl_get_fd(vfs_handle_struct
*handle
,
847 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
849 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
852 static int skel_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
853 const char *path_p
, TALLOC_CTX
*mem_ctx
,
854 char **blob_description
, DATA_BLOB
*blob
)
856 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, path_p
, mem_ctx
,
857 blob_description
, blob
);
860 static int skel_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
861 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
,
862 char **blob_description
, DATA_BLOB
*blob
)
864 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
,
865 blob_description
, blob
);
868 static int skel_sys_acl_set_file(vfs_handle_struct
*handle
, const char *name
,
869 SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
871 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
, theacl
);
874 static int skel_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
877 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
880 static int skel_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
883 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
886 static ssize_t
skel_getxattr(vfs_handle_struct
*handle
, const char *path
,
887 const char *name
, void *value
, size_t size
)
889 return SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
892 static ssize_t
skel_fgetxattr(vfs_handle_struct
*handle
,
893 struct files_struct
*fsp
, const char *name
,
894 void *value
, size_t size
)
896 return SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
899 static ssize_t
skel_listxattr(vfs_handle_struct
*handle
, const char *path
,
900 char *list
, size_t size
)
902 return SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
905 static ssize_t
skel_flistxattr(vfs_handle_struct
*handle
,
906 struct files_struct
*fsp
, char *list
,
909 return SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
912 static int skel_removexattr(vfs_handle_struct
*handle
, const char *path
,
915 return SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
918 static int skel_fremovexattr(vfs_handle_struct
*handle
,
919 struct files_struct
*fsp
, const char *name
)
921 return SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
924 static int skel_setxattr(vfs_handle_struct
*handle
, const char *path
,
925 const char *name
, const void *value
, size_t size
,
928 return SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
, flags
);
931 static int skel_fsetxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
,
932 const char *name
, const void *value
, size_t size
,
935 return SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
938 static bool skel_aio_force(struct vfs_handle_struct
*handle
,
939 struct files_struct
*fsp
)
941 return SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
944 static bool skel_is_offline(struct vfs_handle_struct
*handle
,
945 const struct smb_filename
*fname
,
946 SMB_STRUCT_STAT
*sbuf
)
948 return SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
951 static int skel_set_offline(struct vfs_handle_struct
*handle
,
952 const struct smb_filename
*fname
)
954 return SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
957 /* VFS operations structure */
959 struct vfs_fn_pointers skel_transparent_fns
= {
960 /* Disk operations */
962 .connect_fn
= skel_connect
,
963 .disconnect_fn
= skel_disconnect
,
964 .disk_free_fn
= skel_disk_free
,
965 .get_quota_fn
= skel_get_quota
,
966 .set_quota_fn
= skel_set_quota
,
967 .get_shadow_copy_data_fn
= skel_get_shadow_copy_data
,
968 .statvfs_fn
= skel_statvfs
,
969 .fs_capabilities_fn
= skel_fs_capabilities
,
970 .get_dfs_referrals_fn
= skel_get_dfs_referrals
,
971 .snap_check_path_fn
= skel_snap_check_path
,
972 .snap_create_fn
= skel_snap_create
,
973 .snap_delete_fn
= skel_snap_delete
,
975 /* Directory operations */
977 .opendir_fn
= skel_opendir
,
978 .fdopendir_fn
= skel_fdopendir
,
979 .readdir_fn
= skel_readdir
,
980 .seekdir_fn
= skel_seekdir
,
981 .telldir_fn
= skel_telldir
,
982 .rewind_dir_fn
= skel_rewind_dir
,
983 .mkdir_fn
= skel_mkdir
,
984 .rmdir_fn
= skel_rmdir
,
985 .closedir_fn
= skel_closedir
,
986 .init_search_op_fn
= skel_init_search_op
,
988 /* File operations */
990 .open_fn
= skel_open
,
991 .create_file_fn
= skel_create_file
,
992 .close_fn
= skel_close_fn
,
993 .read_fn
= skel_vfs_read
,
994 .pread_fn
= skel_pread
,
995 .pread_send_fn
= skel_pread_send
,
996 .pread_recv_fn
= skel_pread_recv
,
997 .write_fn
= skel_write
,
998 .pwrite_fn
= skel_pwrite
,
999 .pwrite_send_fn
= skel_pwrite_send
,
1000 .pwrite_recv_fn
= skel_pwrite_recv
,
1001 .lseek_fn
= skel_lseek
,
1002 .sendfile_fn
= skel_sendfile
,
1003 .recvfile_fn
= skel_recvfile
,
1004 .rename_fn
= skel_rename
,
1005 .fsync_fn
= skel_fsync
,
1006 .fsync_send_fn
= skel_fsync_send
,
1007 .fsync_recv_fn
= skel_fsync_recv
,
1008 .stat_fn
= skel_stat
,
1009 .fstat_fn
= skel_fstat
,
1010 .lstat_fn
= skel_lstat
,
1011 .get_alloc_size_fn
= skel_get_alloc_size
,
1012 .unlink_fn
= skel_unlink
,
1013 .chmod_fn
= skel_chmod
,
1014 .fchmod_fn
= skel_fchmod
,
1015 .chown_fn
= skel_chown
,
1016 .fchown_fn
= skel_fchown
,
1017 .lchown_fn
= skel_lchown
,
1018 .chdir_fn
= skel_chdir
,
1019 .getwd_fn
= skel_getwd
,
1020 .ntimes_fn
= skel_ntimes
,
1021 .ftruncate_fn
= skel_ftruncate
,
1022 .fallocate_fn
= skel_fallocate
,
1023 .lock_fn
= skel_lock
,
1024 .kernel_flock_fn
= skel_kernel_flock
,
1025 .linux_setlease_fn
= skel_linux_setlease
,
1026 .getlock_fn
= skel_getlock
,
1027 .symlink_fn
= skel_symlink
,
1028 .readlink_fn
= skel_vfs_readlink
,
1029 .link_fn
= skel_link
,
1030 .mknod_fn
= skel_mknod
,
1031 .realpath_fn
= skel_realpath
,
1032 .notify_watch_fn
= skel_notify_watch
,
1033 .chflags_fn
= skel_chflags
,
1034 .file_id_create_fn
= skel_file_id_create
,
1035 .copy_chunk_send_fn
= skel_copy_chunk_send
,
1036 .copy_chunk_recv_fn
= skel_copy_chunk_recv
,
1037 .get_compression_fn
= skel_get_compression
,
1038 .set_compression_fn
= skel_set_compression
,
1040 .streaminfo_fn
= skel_streaminfo
,
1041 .get_real_filename_fn
= skel_get_real_filename
,
1042 .connectpath_fn
= skel_connectpath
,
1043 .brl_lock_windows_fn
= skel_brl_lock_windows
,
1044 .brl_unlock_windows_fn
= skel_brl_unlock_windows
,
1045 .brl_cancel_windows_fn
= skel_brl_cancel_windows
,
1046 .strict_lock_fn
= skel_strict_lock
,
1047 .strict_unlock_fn
= skel_strict_unlock
,
1048 .translate_name_fn
= skel_translate_name
,
1049 .fsctl_fn
= skel_fsctl
,
1050 .readdir_attr_fn
= skel_readdir_attr
,
1052 /* NT ACL operations. */
1054 .fget_nt_acl_fn
= skel_fget_nt_acl
,
1055 .get_nt_acl_fn
= skel_get_nt_acl
,
1056 .fset_nt_acl_fn
= skel_fset_nt_acl
,
1058 /* POSIX ACL operations. */
1060 .chmod_acl_fn
= skel_chmod_acl
,
1061 .fchmod_acl_fn
= skel_fchmod_acl
,
1063 .sys_acl_get_file_fn
= skel_sys_acl_get_file
,
1064 .sys_acl_get_fd_fn
= skel_sys_acl_get_fd
,
1065 .sys_acl_blob_get_file_fn
= skel_sys_acl_blob_get_file
,
1066 .sys_acl_blob_get_fd_fn
= skel_sys_acl_blob_get_fd
,
1067 .sys_acl_set_file_fn
= skel_sys_acl_set_file
,
1068 .sys_acl_set_fd_fn
= skel_sys_acl_set_fd
,
1069 .sys_acl_delete_def_file_fn
= skel_sys_acl_delete_def_file
,
1071 /* EA operations. */
1072 .getxattr_fn
= skel_getxattr
,
1073 .fgetxattr_fn
= skel_fgetxattr
,
1074 .listxattr_fn
= skel_listxattr
,
1075 .flistxattr_fn
= skel_flistxattr
,
1076 .removexattr_fn
= skel_removexattr
,
1077 .fremovexattr_fn
= skel_fremovexattr
,
1078 .setxattr_fn
= skel_setxattr
,
1079 .fsetxattr_fn
= skel_fsetxattr
,
1081 /* aio operations */
1082 .aio_force_fn
= skel_aio_force
,
1084 /* offline operations */
1085 .is_offline_fn
= skel_is_offline
,
1086 .set_offline_fn
= skel_set_offline
1089 NTSTATUS
vfs_skel_transparent_init(void)
1091 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "skel_transparent",
1092 &skel_transparent_fns
);