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 int skel_chflags(vfs_handle_struct
*handle
, const char *path
,
585 return SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
588 static struct file_id
skel_file_id_create(vfs_handle_struct
*handle
,
589 const SMB_STRUCT_STAT
*sbuf
)
591 return SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
594 struct skel_cc_state
{
595 struct vfs_handle_struct
*handle
;
598 static void skel_copy_chunk_done(struct tevent_req
*subreq
);
600 static struct tevent_req
*skel_copy_chunk_send(struct vfs_handle_struct
*handle
,
602 struct tevent_context
*ev
,
603 struct files_struct
*src_fsp
,
605 struct files_struct
*dest_fsp
,
609 struct tevent_req
*req
;
610 struct tevent_req
*subreq
;
611 struct skel_cc_state
*cc_state
;
613 req
= tevent_req_create(mem_ctx
, &cc_state
, struct skel_cc_state
);
618 cc_state
->handle
= handle
;
619 subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, cc_state
, ev
,
621 dest_fsp
, dest_off
, num
);
622 if (tevent_req_nomem(subreq
, req
)) {
623 return tevent_req_post(req
, ev
);
626 tevent_req_set_callback(subreq
, skel_copy_chunk_done
, req
);
630 static void skel_copy_chunk_done(struct tevent_req
*subreq
)
632 struct tevent_req
*req
= tevent_req_callback_data(
633 subreq
, struct tevent_req
);
634 struct skel_cc_state
*cc_state
635 = tevent_req_data(req
, struct skel_cc_state
);
638 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
642 if (tevent_req_nterror(req
, status
)) {
645 tevent_req_done(req
);
648 static NTSTATUS
skel_copy_chunk_recv(struct vfs_handle_struct
*handle
,
649 struct tevent_req
*req
,
652 struct skel_cc_state
*cc_state
653 = tevent_req_data(req
, struct skel_cc_state
);
656 *copied
= cc_state
->copied
;
657 if (tevent_req_is_nterror(req
, &status
)) {
658 tevent_req_received(req
);
662 tevent_req_received(req
);
666 static NTSTATUS
skel_get_compression(struct vfs_handle_struct
*handle
,
668 struct files_struct
*fsp
,
669 struct smb_filename
*smb_fname
,
670 uint16_t *_compression_fmt
)
672 return SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
676 static NTSTATUS
skel_set_compression(struct vfs_handle_struct
*handle
,
678 struct files_struct
*fsp
,
679 uint16_t compression_fmt
)
681 return SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
685 static NTSTATUS
skel_streaminfo(struct vfs_handle_struct
*handle
,
686 struct files_struct
*fsp
,
689 unsigned int *num_streams
,
690 struct stream_struct
**streams
)
692 return SMB_VFS_NEXT_STREAMINFO(handle
,
694 fname
, mem_ctx
, num_streams
, streams
);
697 static int skel_get_real_filename(struct vfs_handle_struct
*handle
,
700 TALLOC_CTX
*mem_ctx
, char **found_name
)
702 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle
,
703 path
, name
, mem_ctx
, found_name
);
706 static const char *skel_connectpath(struct vfs_handle_struct
*handle
,
707 const char *filename
)
709 return SMB_VFS_NEXT_CONNECTPATH(handle
, filename
);
712 static NTSTATUS
skel_brl_lock_windows(struct vfs_handle_struct
*handle
,
713 struct byte_range_lock
*br_lck
,
714 struct lock_struct
*plock
,
717 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
,
718 br_lck
, plock
, blocking_lock
);
721 static bool skel_brl_unlock_windows(struct vfs_handle_struct
*handle
,
722 struct messaging_context
*msg_ctx
,
723 struct byte_range_lock
*br_lck
,
724 const struct lock_struct
*plock
)
726 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
, plock
);
729 static bool skel_brl_cancel_windows(struct vfs_handle_struct
*handle
,
730 struct byte_range_lock
*br_lck
,
731 struct lock_struct
*plock
)
733 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
736 static bool skel_strict_lock(struct vfs_handle_struct
*handle
,
737 struct files_struct
*fsp
,
738 struct lock_struct
*plock
)
740 return SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
743 static void skel_strict_unlock(struct vfs_handle_struct
*handle
,
744 struct files_struct
*fsp
,
745 struct lock_struct
*plock
)
747 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
750 static NTSTATUS
skel_translate_name(struct vfs_handle_struct
*handle
,
751 const char *mapped_name
,
752 enum vfs_translate_direction direction
,
753 TALLOC_CTX
*mem_ctx
, char **pmapped_name
)
755 return SMB_VFS_NEXT_TRANSLATE_NAME(handle
, mapped_name
, direction
,
756 mem_ctx
, pmapped_name
);
759 static NTSTATUS
skel_fsctl(struct vfs_handle_struct
*handle
,
760 struct files_struct
*fsp
,
763 uint16_t req_flags
, /* Needed for UNICODE ... */
764 const uint8_t *_in_data
,
766 uint8_t ** _out_data
,
767 uint32_t max_out_len
, uint32_t *out_len
)
769 return SMB_VFS_NEXT_FSCTL(handle
,
775 in_len
, _out_data
, max_out_len
, out_len
);
778 static NTSTATUS
skel_readdir_attr(struct vfs_handle_struct
*handle
,
779 const struct smb_filename
*fname
,
781 struct readdir_attr_data
**pattr_data
)
783 return SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
786 static NTSTATUS
skel_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
787 uint32_t security_info
,
789 struct security_descriptor
**ppdesc
)
791 return SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, mem_ctx
,
795 static NTSTATUS
skel_get_nt_acl(vfs_handle_struct
*handle
,
796 const char *name
, uint32_t security_info
,
798 struct security_descriptor
**ppdesc
)
800 return SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, mem_ctx
,
804 static NTSTATUS
skel_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
805 uint32_t security_info_sent
,
806 const struct security_descriptor
*psd
)
808 return SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
811 static int skel_chmod_acl(vfs_handle_struct
*handle
, const char *name
,
814 return SMB_VFS_NEXT_CHMOD_ACL(handle
, name
, mode
);
817 static int skel_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
820 return SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
823 static SMB_ACL_T
skel_sys_acl_get_file(vfs_handle_struct
*handle
,
828 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
, mem_ctx
);
831 static SMB_ACL_T
skel_sys_acl_get_fd(vfs_handle_struct
*handle
,
832 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
834 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
837 static int skel_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
838 const char *path_p
, TALLOC_CTX
*mem_ctx
,
839 char **blob_description
, DATA_BLOB
*blob
)
841 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, path_p
, mem_ctx
,
842 blob_description
, blob
);
845 static int skel_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
846 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
,
847 char **blob_description
, DATA_BLOB
*blob
)
849 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
,
850 blob_description
, blob
);
853 static int skel_sys_acl_set_file(vfs_handle_struct
*handle
, const char *name
,
854 SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
856 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
, theacl
);
859 static int skel_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
862 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
865 static int skel_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
868 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
871 static ssize_t
skel_getxattr(vfs_handle_struct
*handle
, const char *path
,
872 const char *name
, void *value
, size_t size
)
874 return SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
877 static ssize_t
skel_fgetxattr(vfs_handle_struct
*handle
,
878 struct files_struct
*fsp
, const char *name
,
879 void *value
, size_t size
)
881 return SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
884 static ssize_t
skel_listxattr(vfs_handle_struct
*handle
, const char *path
,
885 char *list
, size_t size
)
887 return SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
890 static ssize_t
skel_flistxattr(vfs_handle_struct
*handle
,
891 struct files_struct
*fsp
, char *list
,
894 return SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
897 static int skel_removexattr(vfs_handle_struct
*handle
, const char *path
,
900 return SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
903 static int skel_fremovexattr(vfs_handle_struct
*handle
,
904 struct files_struct
*fsp
, const char *name
)
906 return SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
909 static int skel_setxattr(vfs_handle_struct
*handle
, const char *path
,
910 const char *name
, const void *value
, size_t size
,
913 return SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
, flags
);
916 static int skel_fsetxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
,
917 const char *name
, const void *value
, size_t size
,
920 return SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
923 static bool skel_aio_force(struct vfs_handle_struct
*handle
,
924 struct files_struct
*fsp
)
926 return SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
929 static bool skel_is_offline(struct vfs_handle_struct
*handle
,
930 const struct smb_filename
*fname
,
931 SMB_STRUCT_STAT
*sbuf
)
933 return SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
936 static int skel_set_offline(struct vfs_handle_struct
*handle
,
937 const struct smb_filename
*fname
)
939 return SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
942 /* VFS operations structure */
944 struct vfs_fn_pointers skel_transparent_fns
= {
945 /* Disk operations */
947 .connect_fn
= skel_connect
,
948 .disconnect_fn
= skel_disconnect
,
949 .disk_free_fn
= skel_disk_free
,
950 .get_quota_fn
= skel_get_quota
,
951 .set_quota_fn
= skel_set_quota
,
952 .get_shadow_copy_data_fn
= skel_get_shadow_copy_data
,
953 .statvfs_fn
= skel_statvfs
,
954 .fs_capabilities_fn
= skel_fs_capabilities
,
955 .get_dfs_referrals_fn
= skel_get_dfs_referrals
,
956 .snap_check_path_fn
= skel_snap_check_path
,
957 .snap_create_fn
= skel_snap_create
,
958 .snap_delete_fn
= skel_snap_delete
,
960 /* Directory operations */
962 .opendir_fn
= skel_opendir
,
963 .fdopendir_fn
= skel_fdopendir
,
964 .readdir_fn
= skel_readdir
,
965 .seekdir_fn
= skel_seekdir
,
966 .telldir_fn
= skel_telldir
,
967 .rewind_dir_fn
= skel_rewind_dir
,
968 .mkdir_fn
= skel_mkdir
,
969 .rmdir_fn
= skel_rmdir
,
970 .closedir_fn
= skel_closedir
,
971 .init_search_op_fn
= skel_init_search_op
,
973 /* File operations */
975 .open_fn
= skel_open
,
976 .create_file_fn
= skel_create_file
,
977 .close_fn
= skel_close_fn
,
978 .read_fn
= skel_vfs_read
,
979 .pread_fn
= skel_pread
,
980 .pread_send_fn
= skel_pread_send
,
981 .pread_recv_fn
= skel_pread_recv
,
982 .write_fn
= skel_write
,
983 .pwrite_fn
= skel_pwrite
,
984 .pwrite_send_fn
= skel_pwrite_send
,
985 .pwrite_recv_fn
= skel_pwrite_recv
,
986 .lseek_fn
= skel_lseek
,
987 .sendfile_fn
= skel_sendfile
,
988 .recvfile_fn
= skel_recvfile
,
989 .rename_fn
= skel_rename
,
990 .fsync_fn
= skel_fsync
,
991 .fsync_send_fn
= skel_fsync_send
,
992 .fsync_recv_fn
= skel_fsync_recv
,
993 .stat_fn
= skel_stat
,
994 .fstat_fn
= skel_fstat
,
995 .lstat_fn
= skel_lstat
,
996 .get_alloc_size_fn
= skel_get_alloc_size
,
997 .unlink_fn
= skel_unlink
,
998 .chmod_fn
= skel_chmod
,
999 .fchmod_fn
= skel_fchmod
,
1000 .chown_fn
= skel_chown
,
1001 .fchown_fn
= skel_fchown
,
1002 .lchown_fn
= skel_lchown
,
1003 .chdir_fn
= skel_chdir
,
1004 .getwd_fn
= skel_getwd
,
1005 .ntimes_fn
= skel_ntimes
,
1006 .ftruncate_fn
= skel_ftruncate
,
1007 .fallocate_fn
= skel_fallocate
,
1008 .lock_fn
= skel_lock
,
1009 .kernel_flock_fn
= skel_kernel_flock
,
1010 .linux_setlease_fn
= skel_linux_setlease
,
1011 .getlock_fn
= skel_getlock
,
1012 .symlink_fn
= skel_symlink
,
1013 .readlink_fn
= skel_vfs_readlink
,
1014 .link_fn
= skel_link
,
1015 .mknod_fn
= skel_mknod
,
1016 .realpath_fn
= skel_realpath
,
1017 .chflags_fn
= skel_chflags
,
1018 .file_id_create_fn
= skel_file_id_create
,
1019 .copy_chunk_send_fn
= skel_copy_chunk_send
,
1020 .copy_chunk_recv_fn
= skel_copy_chunk_recv
,
1021 .get_compression_fn
= skel_get_compression
,
1022 .set_compression_fn
= skel_set_compression
,
1024 .streaminfo_fn
= skel_streaminfo
,
1025 .get_real_filename_fn
= skel_get_real_filename
,
1026 .connectpath_fn
= skel_connectpath
,
1027 .brl_lock_windows_fn
= skel_brl_lock_windows
,
1028 .brl_unlock_windows_fn
= skel_brl_unlock_windows
,
1029 .brl_cancel_windows_fn
= skel_brl_cancel_windows
,
1030 .strict_lock_fn
= skel_strict_lock
,
1031 .strict_unlock_fn
= skel_strict_unlock
,
1032 .translate_name_fn
= skel_translate_name
,
1033 .fsctl_fn
= skel_fsctl
,
1034 .readdir_attr_fn
= skel_readdir_attr
,
1036 /* NT ACL operations. */
1038 .fget_nt_acl_fn
= skel_fget_nt_acl
,
1039 .get_nt_acl_fn
= skel_get_nt_acl
,
1040 .fset_nt_acl_fn
= skel_fset_nt_acl
,
1042 /* POSIX ACL operations. */
1044 .chmod_acl_fn
= skel_chmod_acl
,
1045 .fchmod_acl_fn
= skel_fchmod_acl
,
1047 .sys_acl_get_file_fn
= skel_sys_acl_get_file
,
1048 .sys_acl_get_fd_fn
= skel_sys_acl_get_fd
,
1049 .sys_acl_blob_get_file_fn
= skel_sys_acl_blob_get_file
,
1050 .sys_acl_blob_get_fd_fn
= skel_sys_acl_blob_get_fd
,
1051 .sys_acl_set_file_fn
= skel_sys_acl_set_file
,
1052 .sys_acl_set_fd_fn
= skel_sys_acl_set_fd
,
1053 .sys_acl_delete_def_file_fn
= skel_sys_acl_delete_def_file
,
1055 /* EA operations. */
1056 .getxattr_fn
= skel_getxattr
,
1057 .fgetxattr_fn
= skel_fgetxattr
,
1058 .listxattr_fn
= skel_listxattr
,
1059 .flistxattr_fn
= skel_flistxattr
,
1060 .removexattr_fn
= skel_removexattr
,
1061 .fremovexattr_fn
= skel_fremovexattr
,
1062 .setxattr_fn
= skel_setxattr
,
1063 .fsetxattr_fn
= skel_fsetxattr
,
1065 /* aio operations */
1066 .aio_force_fn
= skel_aio_force
,
1068 /* offline operations */
1069 .is_offline_fn
= skel_is_offline
,
1070 .set_offline_fn
= skel_set_offline
1073 NTSTATUS
vfs_skel_transparent_init(void)
1075 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "skel_transparent",
1076 &skel_transparent_fns
);