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
,
52 bool small_query
, uint64_t *bsize
,
53 uint64_t *dfree
, uint64_t *dsize
)
55 return SMB_VFS_NEXT_DISK_FREE(handle
, path
, small_query
, bsize
,
59 static int skel_get_quota(vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
,
60 unid_t id
, SMB_DISK_QUOTA
*dq
)
62 return SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, dq
);
65 static int skel_set_quota(vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
,
66 unid_t id
, SMB_DISK_QUOTA
*dq
)
68 return SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, dq
);
71 static int skel_get_shadow_copy_data(vfs_handle_struct
*handle
,
73 struct shadow_copy_data
*shadow_copy_data
,
76 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
,
80 static int skel_statvfs(struct vfs_handle_struct
*handle
, const char *path
,
81 struct vfs_statvfs_struct
*statbuf
)
83 return SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
86 static uint32_t skel_fs_capabilities(struct vfs_handle_struct
*handle
,
87 enum timestamp_set_resolution
*p_ts_res
)
89 return SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
92 static NTSTATUS
skel_get_dfs_referrals(struct vfs_handle_struct
*handle
,
93 struct dfs_GetDFSReferral
*r
)
95 return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle
, r
);
98 static DIR *skel_opendir(vfs_handle_struct
*handle
, const char *fname
,
99 const char *mask
, uint32 attr
)
101 return SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
104 static DIR *skel_fdopendir(vfs_handle_struct
*handle
, files_struct
*fsp
,
105 const char *mask
, uint32 attr
)
107 return SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
110 static struct dirent
*skel_readdir(vfs_handle_struct
*handle
,
111 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
113 return SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
116 static void skel_seekdir(vfs_handle_struct
*handle
, DIR *dirp
, long offset
)
118 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
121 static long skel_telldir(vfs_handle_struct
*handle
, DIR *dirp
)
123 return SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
126 static void skel_rewind_dir(vfs_handle_struct
*handle
, DIR *dirp
)
128 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
131 static int skel_mkdir(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
133 return SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
136 static int skel_rmdir(vfs_handle_struct
*handle
, const char *path
)
138 return SMB_VFS_NEXT_RMDIR(handle
, path
);
141 static int skel_closedir(vfs_handle_struct
*handle
, DIR *dir
)
143 return SMB_VFS_NEXT_CLOSEDIR(handle
, dir
);
146 static void skel_init_search_op(struct vfs_handle_struct
*handle
, DIR *dirp
)
148 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
151 static int skel_open(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
,
152 files_struct
*fsp
, int flags
, mode_t mode
)
154 return SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
157 static NTSTATUS
skel_create_file(struct vfs_handle_struct
*handle
,
158 struct smb_request
*req
,
159 uint16_t root_dir_fid
,
160 struct smb_filename
*smb_fname
,
161 uint32_t access_mask
,
162 uint32_t share_access
,
163 uint32_t create_disposition
,
164 uint32_t create_options
,
165 uint32_t file_attributes
,
166 uint32_t oplock_request
,
167 struct smb2_lease
*lease
,
168 uint64_t allocation_size
,
169 uint32_t private_flags
,
170 struct security_descriptor
*sd
,
171 struct ea_list
*ea_list
,
172 files_struct
** result
, int *pinfo
,
173 const struct smb2_create_blobs
*in_context_blobs
,
174 struct smb2_create_blobs
*out_context_blobs
)
176 return SMB_VFS_NEXT_CREATE_FILE(handle
,
189 sd
, ea_list
, result
, pinfo
,
190 in_context_blobs
, out_context_blobs
);
193 static int skel_close_fn(vfs_handle_struct
*handle
, files_struct
*fsp
)
195 return SMB_VFS_NEXT_CLOSE(handle
, fsp
);
198 static ssize_t
skel_vfs_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
199 void *data
, size_t n
)
201 return SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
204 static ssize_t
skel_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
205 void *data
, size_t n
, off_t offset
)
207 return SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
210 struct skel_pread_state
{
215 static void skel_pread_done(struct tevent_req
*subreq
);
217 static struct tevent_req
*skel_pread_send(struct vfs_handle_struct
*handle
,
219 struct tevent_context
*ev
,
220 struct files_struct
*fsp
,
221 void *data
, size_t n
, off_t offset
)
223 struct tevent_req
*req
, *subreq
;
224 struct skel_pread_state
*state
;
226 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pread_state
);
230 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
232 if (tevent_req_nomem(subreq
, req
)) {
233 return tevent_req_post(req
, ev
);
235 tevent_req_set_callback(subreq
, skel_pread_done
, req
);
239 static void skel_pread_done(struct tevent_req
*subreq
)
241 struct tevent_req
*req
=
242 tevent_req_callback_data(subreq
, struct tevent_req
);
243 struct skel_pread_state
*state
=
244 tevent_req_data(req
, struct skel_pread_state
);
246 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
248 tevent_req_done(req
);
251 static ssize_t
skel_pread_recv(struct tevent_req
*req
, int *err
)
253 struct skel_pread_state
*state
=
254 tevent_req_data(req
, struct skel_pread_state
);
256 if (tevent_req_is_unix_error(req
, err
)) {
263 static ssize_t
skel_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
264 const void *data
, size_t n
)
266 return SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
269 static ssize_t
skel_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
270 const void *data
, size_t n
, off_t offset
)
272 return SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
275 struct skel_pwrite_state
{
280 static void skel_pwrite_done(struct tevent_req
*subreq
);
282 static struct tevent_req
*skel_pwrite_send(struct vfs_handle_struct
*handle
,
284 struct tevent_context
*ev
,
285 struct files_struct
*fsp
,
287 size_t n
, off_t offset
)
289 struct tevent_req
*req
, *subreq
;
290 struct skel_pwrite_state
*state
;
292 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pwrite_state
);
296 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
298 if (tevent_req_nomem(subreq
, req
)) {
299 return tevent_req_post(req
, ev
);
301 tevent_req_set_callback(subreq
, skel_pwrite_done
, req
);
305 static void skel_pwrite_done(struct tevent_req
*subreq
)
307 struct tevent_req
*req
=
308 tevent_req_callback_data(subreq
, struct tevent_req
);
309 struct skel_pwrite_state
*state
=
310 tevent_req_data(req
, struct skel_pwrite_state
);
312 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->err
);
314 tevent_req_done(req
);
317 static ssize_t
skel_pwrite_recv(struct tevent_req
*req
, int *err
)
319 struct skel_pwrite_state
*state
=
320 tevent_req_data(req
, struct skel_pwrite_state
);
322 if (tevent_req_is_unix_error(req
, err
)) {
329 static off_t
skel_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
330 off_t offset
, int whence
)
332 return SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
335 static ssize_t
skel_sendfile(vfs_handle_struct
*handle
, int tofd
,
336 files_struct
*fromfsp
, const DATA_BLOB
*hdr
,
337 off_t offset
, size_t n
)
339 return SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
342 static ssize_t
skel_recvfile(vfs_handle_struct
*handle
, int fromfd
,
343 files_struct
*tofsp
, off_t offset
, size_t n
)
345 return SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
348 static int skel_rename(vfs_handle_struct
*handle
,
349 const struct smb_filename
*smb_fname_src
,
350 const struct smb_filename
*smb_fname_dst
)
352 return SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
355 static int skel_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
357 return SMB_VFS_NEXT_FSYNC(handle
, fsp
);
360 struct skel_fsync_state
{
365 static void skel_fsync_done(struct tevent_req
*subreq
);
367 static struct tevent_req
*skel_fsync_send(struct vfs_handle_struct
*handle
,
369 struct tevent_context
*ev
,
370 struct files_struct
*fsp
)
372 struct tevent_req
*req
, *subreq
;
373 struct skel_fsync_state
*state
;
375 req
= tevent_req_create(mem_ctx
, &state
, struct skel_fsync_state
);
379 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
380 if (tevent_req_nomem(subreq
, req
)) {
381 return tevent_req_post(req
, ev
);
383 tevent_req_set_callback(subreq
, skel_fsync_done
, req
);
387 static void skel_fsync_done(struct tevent_req
*subreq
)
389 struct tevent_req
*req
=
390 tevent_req_callback_data(subreq
, struct tevent_req
);
391 struct skel_fsync_state
*state
=
392 tevent_req_data(req
, struct skel_fsync_state
);
394 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->err
);
396 tevent_req_done(req
);
399 static int skel_fsync_recv(struct tevent_req
*req
, int *err
)
401 struct skel_fsync_state
*state
=
402 tevent_req_data(req
, struct skel_fsync_state
);
404 if (tevent_req_is_unix_error(req
, err
)) {
411 static int skel_stat(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
)
413 return SMB_VFS_NEXT_STAT(handle
, smb_fname
);
416 static int skel_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
417 SMB_STRUCT_STAT
*sbuf
)
419 return SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
422 static int skel_lstat(vfs_handle_struct
*handle
,
423 struct smb_filename
*smb_fname
)
425 return SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
428 static uint64_t skel_get_alloc_size(struct vfs_handle_struct
*handle
,
429 struct files_struct
*fsp
,
430 const SMB_STRUCT_STAT
*sbuf
)
432 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
435 static int skel_unlink(vfs_handle_struct
*handle
,
436 const struct smb_filename
*smb_fname
)
438 return SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
441 static int skel_chmod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
443 return SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
446 static int skel_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
449 return SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
452 static int skel_chown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
,
455 return SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
458 static int skel_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
459 uid_t uid
, gid_t gid
)
461 return SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
464 static int skel_lchown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
,
467 return SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
470 static int skel_chdir(vfs_handle_struct
*handle
, const char *path
)
472 return SMB_VFS_NEXT_CHDIR(handle
, path
);
475 static char *skel_getwd(vfs_handle_struct
*handle
)
477 return SMB_VFS_NEXT_GETWD(handle
);
480 static int skel_ntimes(vfs_handle_struct
*handle
,
481 const struct smb_filename
*smb_fname
,
482 struct smb_file_time
*ft
)
484 return SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
487 static int skel_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
490 return SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, offset
);
493 static int skel_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
494 enum vfs_fallocate_mode mode
, off_t offset
, off_t len
)
496 return SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
499 static bool skel_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int op
,
500 off_t offset
, off_t count
, int type
)
502 return SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
505 static int skel_kernel_flock(struct vfs_handle_struct
*handle
,
506 struct files_struct
*fsp
, uint32 share_mode
,
509 return SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
512 static int skel_linux_setlease(struct vfs_handle_struct
*handle
,
513 struct files_struct
*fsp
, int leasetype
)
515 return SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
518 static bool skel_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
519 off_t
*poffset
, off_t
*pcount
, int *ptype
,
522 return SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
525 static int skel_symlink(vfs_handle_struct
*handle
, const char *oldpath
,
528 return SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
531 static int skel_vfs_readlink(vfs_handle_struct
*handle
, const char *path
,
532 char *buf
, size_t bufsiz
)
534 return SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
537 static int skel_link(vfs_handle_struct
*handle
, const char *oldpath
,
540 return SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
543 static int skel_mknod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
,
546 return SMB_VFS_NEXT_MKNOD(handle
, path
, mode
, dev
);
549 static char *skel_realpath(vfs_handle_struct
*handle
, const char *path
)
551 return SMB_VFS_NEXT_REALPATH(handle
, path
);
554 static NTSTATUS
skel_notify_watch(struct vfs_handle_struct
*handle
,
555 struct sys_notify_context
*ctx
,
558 uint32_t *subdir_filter
,
559 void (*callback
) (struct sys_notify_context
*ctx
,
561 struct notify_event
*ev
),
562 void *private_data
, void *handle_p
)
564 return SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
565 filter
, subdir_filter
, callback
,
566 private_data
, handle_p
);
569 static int skel_chflags(vfs_handle_struct
*handle
, const char *path
,
572 return SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
575 static struct file_id
skel_file_id_create(vfs_handle_struct
*handle
,
576 const SMB_STRUCT_STAT
*sbuf
)
578 return SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
581 struct skel_cc_state
{
582 struct vfs_handle_struct
*handle
;
585 static void skel_copy_chunk_done(struct tevent_req
*subreq
);
587 static struct tevent_req
*skel_copy_chunk_send(struct vfs_handle_struct
*handle
,
589 struct tevent_context
*ev
,
590 struct files_struct
*src_fsp
,
592 struct files_struct
*dest_fsp
,
596 struct tevent_req
*req
;
597 struct tevent_req
*subreq
;
598 struct skel_cc_state
*cc_state
;
600 req
= tevent_req_create(mem_ctx
, &cc_state
, struct skel_cc_state
);
605 cc_state
->handle
= handle
;
606 subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, cc_state
, ev
,
608 dest_fsp
, dest_off
, num
);
609 if (tevent_req_nomem(subreq
, req
)) {
610 return tevent_req_post(req
, ev
);
613 tevent_req_set_callback(subreq
, skel_copy_chunk_done
, req
);
617 static void skel_copy_chunk_done(struct tevent_req
*subreq
)
619 struct tevent_req
*req
= tevent_req_callback_data(
620 subreq
, struct tevent_req
);
621 struct skel_cc_state
*cc_state
622 = tevent_req_data(req
, struct skel_cc_state
);
625 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
629 if (tevent_req_nterror(req
, status
)) {
632 tevent_req_done(req
);
635 static NTSTATUS
skel_copy_chunk_recv(struct vfs_handle_struct
*handle
,
636 struct tevent_req
*req
,
639 struct skel_cc_state
*cc_state
640 = tevent_req_data(req
, struct skel_cc_state
);
643 *copied
= cc_state
->copied
;
644 if (tevent_req_is_nterror(req
, &status
)) {
645 tevent_req_received(req
);
649 tevent_req_received(req
);
653 static NTSTATUS
skel_get_compression(struct vfs_handle_struct
*handle
,
655 struct files_struct
*fsp
,
656 struct smb_filename
*smb_fname
,
657 uint16_t *_compression_fmt
)
659 return SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
663 static NTSTATUS
skel_set_compression(struct vfs_handle_struct
*handle
,
665 struct files_struct
*fsp
,
666 uint16_t compression_fmt
)
668 return SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
672 static NTSTATUS
skel_streaminfo(struct vfs_handle_struct
*handle
,
673 struct files_struct
*fsp
,
676 unsigned int *num_streams
,
677 struct stream_struct
**streams
)
679 return SMB_VFS_NEXT_STREAMINFO(handle
,
681 fname
, mem_ctx
, num_streams
, streams
);
684 static int skel_get_real_filename(struct vfs_handle_struct
*handle
,
687 TALLOC_CTX
*mem_ctx
, char **found_name
)
689 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle
,
690 path
, name
, mem_ctx
, found_name
);
693 static const char *skel_connectpath(struct vfs_handle_struct
*handle
,
694 const char *filename
)
696 return SMB_VFS_NEXT_CONNECTPATH(handle
, filename
);
699 static NTSTATUS
skel_brl_lock_windows(struct vfs_handle_struct
*handle
,
700 struct byte_range_lock
*br_lck
,
701 struct lock_struct
*plock
,
704 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
,
705 br_lck
, plock
, blocking_lock
);
708 static bool skel_brl_unlock_windows(struct vfs_handle_struct
*handle
,
709 struct messaging_context
*msg_ctx
,
710 struct byte_range_lock
*br_lck
,
711 const struct lock_struct
*plock
)
713 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
, plock
);
716 static bool skel_brl_cancel_windows(struct vfs_handle_struct
*handle
,
717 struct byte_range_lock
*br_lck
,
718 struct lock_struct
*plock
)
720 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
723 static bool skel_strict_lock(struct vfs_handle_struct
*handle
,
724 struct files_struct
*fsp
,
725 struct lock_struct
*plock
)
727 return SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
730 static void skel_strict_unlock(struct vfs_handle_struct
*handle
,
731 struct files_struct
*fsp
,
732 struct lock_struct
*plock
)
734 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
737 static NTSTATUS
skel_translate_name(struct vfs_handle_struct
*handle
,
738 const char *mapped_name
,
739 enum vfs_translate_direction direction
,
740 TALLOC_CTX
*mem_ctx
, char **pmapped_name
)
742 return SMB_VFS_NEXT_TRANSLATE_NAME(handle
, mapped_name
, direction
,
743 mem_ctx
, pmapped_name
);
746 static NTSTATUS
skel_fsctl(struct vfs_handle_struct
*handle
,
747 struct files_struct
*fsp
,
750 uint16_t req_flags
, /* Needed for UNICODE ... */
751 const uint8_t *_in_data
,
753 uint8_t ** _out_data
,
754 uint32_t max_out_len
, uint32_t *out_len
)
756 return SMB_VFS_NEXT_FSCTL(handle
,
762 in_len
, _out_data
, max_out_len
, out_len
);
765 static NTSTATUS
skel_readdir_attr(struct vfs_handle_struct
*handle
,
766 const struct smb_filename
*fname
,
768 struct readdir_attr_data
**pattr_data
)
770 return SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
773 static NTSTATUS
skel_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
774 uint32 security_info
,
776 struct security_descriptor
**ppdesc
)
778 return SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, mem_ctx
,
782 static NTSTATUS
skel_get_nt_acl(vfs_handle_struct
*handle
,
783 const char *name
, uint32 security_info
,
785 struct security_descriptor
**ppdesc
)
787 return SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, mem_ctx
,
791 static NTSTATUS
skel_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
792 uint32 security_info_sent
,
793 const struct security_descriptor
*psd
)
795 return SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
798 static int skel_chmod_acl(vfs_handle_struct
*handle
, const char *name
,
801 return SMB_VFS_NEXT_CHMOD_ACL(handle
, name
, mode
);
804 static int skel_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
807 return SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
810 static SMB_ACL_T
skel_sys_acl_get_file(vfs_handle_struct
*handle
,
815 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
, mem_ctx
);
818 static SMB_ACL_T
skel_sys_acl_get_fd(vfs_handle_struct
*handle
,
819 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
821 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
824 static int skel_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
825 const char *path_p
, TALLOC_CTX
*mem_ctx
,
826 char **blob_description
, DATA_BLOB
*blob
)
828 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, path_p
, mem_ctx
,
829 blob_description
, blob
);
832 static int skel_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
833 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
,
834 char **blob_description
, DATA_BLOB
*blob
)
836 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
,
837 blob_description
, blob
);
840 static int skel_sys_acl_set_file(vfs_handle_struct
*handle
, const char *name
,
841 SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
843 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
, theacl
);
846 static int skel_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
849 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
852 static int skel_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
855 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
858 static ssize_t
skel_getxattr(vfs_handle_struct
*handle
, const char *path
,
859 const char *name
, void *value
, size_t size
)
861 return SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
864 static ssize_t
skel_fgetxattr(vfs_handle_struct
*handle
,
865 struct files_struct
*fsp
, const char *name
,
866 void *value
, size_t size
)
868 return SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
871 static ssize_t
skel_listxattr(vfs_handle_struct
*handle
, const char *path
,
872 char *list
, size_t size
)
874 return SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
877 static ssize_t
skel_flistxattr(vfs_handle_struct
*handle
,
878 struct files_struct
*fsp
, char *list
,
881 return SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
884 static int skel_removexattr(vfs_handle_struct
*handle
, const char *path
,
887 return SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
890 static int skel_fremovexattr(vfs_handle_struct
*handle
,
891 struct files_struct
*fsp
, const char *name
)
893 return SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
896 static int skel_setxattr(vfs_handle_struct
*handle
, const char *path
,
897 const char *name
, const void *value
, size_t size
,
900 return SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
, flags
);
903 static int skel_fsetxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
,
904 const char *name
, const void *value
, size_t size
,
907 return SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
910 static bool skel_aio_force(struct vfs_handle_struct
*handle
,
911 struct files_struct
*fsp
)
913 return SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
916 static bool skel_is_offline(struct vfs_handle_struct
*handle
,
917 const struct smb_filename
*fname
,
918 SMB_STRUCT_STAT
*sbuf
)
920 return SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
923 static int skel_set_offline(struct vfs_handle_struct
*handle
,
924 const struct smb_filename
*fname
)
926 return SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
929 /* VFS operations structure */
931 struct vfs_fn_pointers skel_transparent_fns
= {
932 /* Disk operations */
934 .connect_fn
= skel_connect
,
935 .disconnect_fn
= skel_disconnect
,
936 .disk_free_fn
= skel_disk_free
,
937 .get_quota_fn
= skel_get_quota
,
938 .set_quota_fn
= skel_set_quota
,
939 .get_shadow_copy_data_fn
= skel_get_shadow_copy_data
,
940 .statvfs_fn
= skel_statvfs
,
941 .fs_capabilities_fn
= skel_fs_capabilities
,
942 .get_dfs_referrals_fn
= skel_get_dfs_referrals
,
944 /* Directory operations */
946 .opendir_fn
= skel_opendir
,
947 .fdopendir_fn
= skel_fdopendir
,
948 .readdir_fn
= skel_readdir
,
949 .seekdir_fn
= skel_seekdir
,
950 .telldir_fn
= skel_telldir
,
951 .rewind_dir_fn
= skel_rewind_dir
,
952 .mkdir_fn
= skel_mkdir
,
953 .rmdir_fn
= skel_rmdir
,
954 .closedir_fn
= skel_closedir
,
955 .init_search_op_fn
= skel_init_search_op
,
957 /* File operations */
959 .open_fn
= skel_open
,
960 .create_file_fn
= skel_create_file
,
961 .close_fn
= skel_close_fn
,
962 .read_fn
= skel_vfs_read
,
963 .pread_fn
= skel_pread
,
964 .pread_send_fn
= skel_pread_send
,
965 .pread_recv_fn
= skel_pread_recv
,
966 .write_fn
= skel_write
,
967 .pwrite_fn
= skel_pwrite
,
968 .pwrite_send_fn
= skel_pwrite_send
,
969 .pwrite_recv_fn
= skel_pwrite_recv
,
970 .lseek_fn
= skel_lseek
,
971 .sendfile_fn
= skel_sendfile
,
972 .recvfile_fn
= skel_recvfile
,
973 .rename_fn
= skel_rename
,
974 .fsync_fn
= skel_fsync
,
975 .fsync_send_fn
= skel_fsync_send
,
976 .fsync_recv_fn
= skel_fsync_recv
,
977 .stat_fn
= skel_stat
,
978 .fstat_fn
= skel_fstat
,
979 .lstat_fn
= skel_lstat
,
980 .get_alloc_size_fn
= skel_get_alloc_size
,
981 .unlink_fn
= skel_unlink
,
982 .chmod_fn
= skel_chmod
,
983 .fchmod_fn
= skel_fchmod
,
984 .chown_fn
= skel_chown
,
985 .fchown_fn
= skel_fchown
,
986 .lchown_fn
= skel_lchown
,
987 .chdir_fn
= skel_chdir
,
988 .getwd_fn
= skel_getwd
,
989 .ntimes_fn
= skel_ntimes
,
990 .ftruncate_fn
= skel_ftruncate
,
991 .fallocate_fn
= skel_fallocate
,
992 .lock_fn
= skel_lock
,
993 .kernel_flock_fn
= skel_kernel_flock
,
994 .linux_setlease_fn
= skel_linux_setlease
,
995 .getlock_fn
= skel_getlock
,
996 .symlink_fn
= skel_symlink
,
997 .readlink_fn
= skel_vfs_readlink
,
998 .link_fn
= skel_link
,
999 .mknod_fn
= skel_mknod
,
1000 .realpath_fn
= skel_realpath
,
1001 .notify_watch_fn
= skel_notify_watch
,
1002 .chflags_fn
= skel_chflags
,
1003 .file_id_create_fn
= skel_file_id_create
,
1004 .copy_chunk_send_fn
= skel_copy_chunk_send
,
1005 .copy_chunk_recv_fn
= skel_copy_chunk_recv
,
1006 .get_compression_fn
= skel_get_compression
,
1007 .set_compression_fn
= skel_set_compression
,
1009 .streaminfo_fn
= skel_streaminfo
,
1010 .get_real_filename_fn
= skel_get_real_filename
,
1011 .connectpath_fn
= skel_connectpath
,
1012 .brl_lock_windows_fn
= skel_brl_lock_windows
,
1013 .brl_unlock_windows_fn
= skel_brl_unlock_windows
,
1014 .brl_cancel_windows_fn
= skel_brl_cancel_windows
,
1015 .strict_lock_fn
= skel_strict_lock
,
1016 .strict_unlock_fn
= skel_strict_unlock
,
1017 .translate_name_fn
= skel_translate_name
,
1018 .fsctl_fn
= skel_fsctl
,
1019 .readdir_attr_fn
= skel_readdir_attr
,
1021 /* NT ACL operations. */
1023 .fget_nt_acl_fn
= skel_fget_nt_acl
,
1024 .get_nt_acl_fn
= skel_get_nt_acl
,
1025 .fset_nt_acl_fn
= skel_fset_nt_acl
,
1027 /* POSIX ACL operations. */
1029 .chmod_acl_fn
= skel_chmod_acl
,
1030 .fchmod_acl_fn
= skel_fchmod_acl
,
1032 .sys_acl_get_file_fn
= skel_sys_acl_get_file
,
1033 .sys_acl_get_fd_fn
= skel_sys_acl_get_fd
,
1034 .sys_acl_blob_get_file_fn
= skel_sys_acl_blob_get_file
,
1035 .sys_acl_blob_get_fd_fn
= skel_sys_acl_blob_get_fd
,
1036 .sys_acl_set_file_fn
= skel_sys_acl_set_file
,
1037 .sys_acl_set_fd_fn
= skel_sys_acl_set_fd
,
1038 .sys_acl_delete_def_file_fn
= skel_sys_acl_delete_def_file
,
1040 /* EA operations. */
1041 .getxattr_fn
= skel_getxattr
,
1042 .fgetxattr_fn
= skel_fgetxattr
,
1043 .listxattr_fn
= skel_listxattr
,
1044 .flistxattr_fn
= skel_flistxattr
,
1045 .removexattr_fn
= skel_removexattr
,
1046 .fremovexattr_fn
= skel_fremovexattr
,
1047 .setxattr_fn
= skel_setxattr
,
1048 .fsetxattr_fn
= skel_fsetxattr
,
1050 /* aio operations */
1051 .aio_force_fn
= skel_aio_force
,
1053 /* offline operations */
1054 .is_offline_fn
= skel_is_offline
,
1055 .set_offline_fn
= skel_set_offline
1058 NTSTATUS
vfs_skel_transparent_init(void)
1060 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "skel_transparent",
1061 &skel_transparent_fns
);