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 attr
)
100 return SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
103 static DIR *skel_fdopendir(vfs_handle_struct
*handle
, files_struct
*fsp
,
104 const char *mask
, uint32 attr
)
106 return SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
109 static struct dirent
*skel_readdir(vfs_handle_struct
*handle
,
110 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
112 return SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
115 static void skel_seekdir(vfs_handle_struct
*handle
, DIR *dirp
, long offset
)
117 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
120 static long skel_telldir(vfs_handle_struct
*handle
, DIR *dirp
)
122 return SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
125 static void skel_rewind_dir(vfs_handle_struct
*handle
, DIR *dirp
)
127 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
130 static int skel_mkdir(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
132 return SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
135 static int skel_rmdir(vfs_handle_struct
*handle
, const char *path
)
137 return SMB_VFS_NEXT_RMDIR(handle
, path
);
140 static int skel_closedir(vfs_handle_struct
*handle
, DIR *dir
)
142 return SMB_VFS_NEXT_CLOSEDIR(handle
, dir
);
145 static void skel_init_search_op(struct vfs_handle_struct
*handle
, DIR *dirp
)
147 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
150 static int skel_open(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
,
151 files_struct
*fsp
, int flags
, mode_t mode
)
153 return SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
156 static NTSTATUS
skel_create_file(struct vfs_handle_struct
*handle
,
157 struct smb_request
*req
,
158 uint16_t root_dir_fid
,
159 struct smb_filename
*smb_fname
,
160 uint32_t access_mask
,
161 uint32_t share_access
,
162 uint32_t create_disposition
,
163 uint32_t create_options
,
164 uint32_t file_attributes
,
165 uint32_t oplock_request
,
166 struct smb2_lease
*lease
,
167 uint64_t allocation_size
,
168 uint32_t private_flags
,
169 struct security_descriptor
*sd
,
170 struct ea_list
*ea_list
,
171 files_struct
** result
, int *pinfo
,
172 const struct smb2_create_blobs
*in_context_blobs
,
173 struct smb2_create_blobs
*out_context_blobs
)
175 return SMB_VFS_NEXT_CREATE_FILE(handle
,
188 sd
, ea_list
, result
, pinfo
,
189 in_context_blobs
, out_context_blobs
);
192 static int skel_close_fn(vfs_handle_struct
*handle
, files_struct
*fsp
)
194 return SMB_VFS_NEXT_CLOSE(handle
, fsp
);
197 static ssize_t
skel_vfs_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
198 void *data
, size_t n
)
200 return SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
203 static ssize_t
skel_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
204 void *data
, size_t n
, off_t offset
)
206 return SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
209 struct skel_pread_state
{
214 static void skel_pread_done(struct tevent_req
*subreq
);
216 static struct tevent_req
*skel_pread_send(struct vfs_handle_struct
*handle
,
218 struct tevent_context
*ev
,
219 struct files_struct
*fsp
,
220 void *data
, size_t n
, off_t offset
)
222 struct tevent_req
*req
, *subreq
;
223 struct skel_pread_state
*state
;
225 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pread_state
);
229 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
231 if (tevent_req_nomem(subreq
, req
)) {
232 return tevent_req_post(req
, ev
);
234 tevent_req_set_callback(subreq
, skel_pread_done
, req
);
238 static void skel_pread_done(struct tevent_req
*subreq
)
240 struct tevent_req
*req
=
241 tevent_req_callback_data(subreq
, struct tevent_req
);
242 struct skel_pread_state
*state
=
243 tevent_req_data(req
, struct skel_pread_state
);
245 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
247 tevent_req_done(req
);
250 static ssize_t
skel_pread_recv(struct tevent_req
*req
, int *err
)
252 struct skel_pread_state
*state
=
253 tevent_req_data(req
, struct skel_pread_state
);
255 if (tevent_req_is_unix_error(req
, err
)) {
262 static ssize_t
skel_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
263 const void *data
, size_t n
)
265 return SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
268 static ssize_t
skel_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
269 const void *data
, size_t n
, off_t offset
)
271 return SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
274 struct skel_pwrite_state
{
279 static void skel_pwrite_done(struct tevent_req
*subreq
);
281 static struct tevent_req
*skel_pwrite_send(struct vfs_handle_struct
*handle
,
283 struct tevent_context
*ev
,
284 struct files_struct
*fsp
,
286 size_t n
, off_t offset
)
288 struct tevent_req
*req
, *subreq
;
289 struct skel_pwrite_state
*state
;
291 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pwrite_state
);
295 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
297 if (tevent_req_nomem(subreq
, req
)) {
298 return tevent_req_post(req
, ev
);
300 tevent_req_set_callback(subreq
, skel_pwrite_done
, req
);
304 static void skel_pwrite_done(struct tevent_req
*subreq
)
306 struct tevent_req
*req
=
307 tevent_req_callback_data(subreq
, struct tevent_req
);
308 struct skel_pwrite_state
*state
=
309 tevent_req_data(req
, struct skel_pwrite_state
);
311 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->err
);
313 tevent_req_done(req
);
316 static ssize_t
skel_pwrite_recv(struct tevent_req
*req
, int *err
)
318 struct skel_pwrite_state
*state
=
319 tevent_req_data(req
, struct skel_pwrite_state
);
321 if (tevent_req_is_unix_error(req
, err
)) {
328 static off_t
skel_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
329 off_t offset
, int whence
)
331 return SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
334 static ssize_t
skel_sendfile(vfs_handle_struct
*handle
, int tofd
,
335 files_struct
*fromfsp
, const DATA_BLOB
*hdr
,
336 off_t offset
, size_t n
)
338 return SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
341 static ssize_t
skel_recvfile(vfs_handle_struct
*handle
, int fromfd
,
342 files_struct
*tofsp
, off_t offset
, size_t n
)
344 return SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
347 static int skel_rename(vfs_handle_struct
*handle
,
348 const struct smb_filename
*smb_fname_src
,
349 const struct smb_filename
*smb_fname_dst
)
351 return SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
354 static int skel_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
356 return SMB_VFS_NEXT_FSYNC(handle
, fsp
);
359 struct skel_fsync_state
{
364 static void skel_fsync_done(struct tevent_req
*subreq
);
366 static struct tevent_req
*skel_fsync_send(struct vfs_handle_struct
*handle
,
368 struct tevent_context
*ev
,
369 struct files_struct
*fsp
)
371 struct tevent_req
*req
, *subreq
;
372 struct skel_fsync_state
*state
;
374 req
= tevent_req_create(mem_ctx
, &state
, struct skel_fsync_state
);
378 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
379 if (tevent_req_nomem(subreq
, req
)) {
380 return tevent_req_post(req
, ev
);
382 tevent_req_set_callback(subreq
, skel_fsync_done
, req
);
386 static void skel_fsync_done(struct tevent_req
*subreq
)
388 struct tevent_req
*req
=
389 tevent_req_callback_data(subreq
, struct tevent_req
);
390 struct skel_fsync_state
*state
=
391 tevent_req_data(req
, struct skel_fsync_state
);
393 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->err
);
395 tevent_req_done(req
);
398 static int skel_fsync_recv(struct tevent_req
*req
, int *err
)
400 struct skel_fsync_state
*state
=
401 tevent_req_data(req
, struct skel_fsync_state
);
403 if (tevent_req_is_unix_error(req
, err
)) {
410 static int skel_stat(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
)
412 return SMB_VFS_NEXT_STAT(handle
, smb_fname
);
415 static int skel_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
416 SMB_STRUCT_STAT
*sbuf
)
418 return SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
421 static int skel_lstat(vfs_handle_struct
*handle
,
422 struct smb_filename
*smb_fname
)
424 return SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
427 static uint64_t skel_get_alloc_size(struct vfs_handle_struct
*handle
,
428 struct files_struct
*fsp
,
429 const SMB_STRUCT_STAT
*sbuf
)
431 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
434 static int skel_unlink(vfs_handle_struct
*handle
,
435 const struct smb_filename
*smb_fname
)
437 return SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
440 static int skel_chmod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
442 return SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
445 static int skel_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
448 return SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
451 static int skel_chown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
,
454 return SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
457 static int skel_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
458 uid_t uid
, gid_t gid
)
460 return SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
463 static int skel_lchown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
,
466 return SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
469 static int skel_chdir(vfs_handle_struct
*handle
, const char *path
)
471 return SMB_VFS_NEXT_CHDIR(handle
, path
);
474 static char *skel_getwd(vfs_handle_struct
*handle
)
476 return SMB_VFS_NEXT_GETWD(handle
);
479 static int skel_ntimes(vfs_handle_struct
*handle
,
480 const struct smb_filename
*smb_fname
,
481 struct smb_file_time
*ft
)
483 return SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
486 static int skel_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
489 return SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, offset
);
492 static int skel_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
493 enum vfs_fallocate_mode mode
, off_t offset
, off_t len
)
495 return SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
498 static bool skel_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int op
,
499 off_t offset
, off_t count
, int type
)
501 return SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
504 static int skel_kernel_flock(struct vfs_handle_struct
*handle
,
505 struct files_struct
*fsp
, uint32 share_mode
,
508 return SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
511 static int skel_linux_setlease(struct vfs_handle_struct
*handle
,
512 struct files_struct
*fsp
, int leasetype
)
514 return SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
517 static bool skel_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
518 off_t
*poffset
, off_t
*pcount
, int *ptype
,
521 return SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
524 static int skel_symlink(vfs_handle_struct
*handle
, const char *oldpath
,
527 return SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
530 static int skel_vfs_readlink(vfs_handle_struct
*handle
, const char *path
,
531 char *buf
, size_t bufsiz
)
533 return SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
536 static int skel_link(vfs_handle_struct
*handle
, const char *oldpath
,
539 return SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
542 static int skel_mknod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
,
545 return SMB_VFS_NEXT_MKNOD(handle
, path
, mode
, dev
);
548 static char *skel_realpath(vfs_handle_struct
*handle
, const char *path
)
550 return SMB_VFS_NEXT_REALPATH(handle
, path
);
553 static NTSTATUS
skel_notify_watch(struct vfs_handle_struct
*handle
,
554 struct sys_notify_context
*ctx
,
557 uint32_t *subdir_filter
,
558 void (*callback
) (struct sys_notify_context
*ctx
,
560 struct notify_event
*ev
),
561 void *private_data
, void *handle_p
)
563 return SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
564 filter
, subdir_filter
, callback
,
565 private_data
, handle_p
);
568 static int skel_chflags(vfs_handle_struct
*handle
, const char *path
,
571 return SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
574 static struct file_id
skel_file_id_create(vfs_handle_struct
*handle
,
575 const SMB_STRUCT_STAT
*sbuf
)
577 return SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
580 struct skel_cc_state
{
581 struct vfs_handle_struct
*handle
;
584 static void skel_copy_chunk_done(struct tevent_req
*subreq
);
586 static struct tevent_req
*skel_copy_chunk_send(struct vfs_handle_struct
*handle
,
588 struct tevent_context
*ev
,
589 struct files_struct
*src_fsp
,
591 struct files_struct
*dest_fsp
,
595 struct tevent_req
*req
;
596 struct tevent_req
*subreq
;
597 struct skel_cc_state
*cc_state
;
599 req
= tevent_req_create(mem_ctx
, &cc_state
, struct skel_cc_state
);
604 cc_state
->handle
= handle
;
605 subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, cc_state
, ev
,
607 dest_fsp
, dest_off
, num
);
608 if (tevent_req_nomem(subreq
, req
)) {
609 return tevent_req_post(req
, ev
);
612 tevent_req_set_callback(subreq
, skel_copy_chunk_done
, req
);
616 static void skel_copy_chunk_done(struct tevent_req
*subreq
)
618 struct tevent_req
*req
= tevent_req_callback_data(
619 subreq
, struct tevent_req
);
620 struct skel_cc_state
*cc_state
621 = tevent_req_data(req
, struct skel_cc_state
);
624 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
628 if (tevent_req_nterror(req
, status
)) {
631 tevent_req_done(req
);
634 static NTSTATUS
skel_copy_chunk_recv(struct vfs_handle_struct
*handle
,
635 struct tevent_req
*req
,
638 struct skel_cc_state
*cc_state
639 = tevent_req_data(req
, struct skel_cc_state
);
642 *copied
= cc_state
->copied
;
643 if (tevent_req_is_nterror(req
, &status
)) {
644 tevent_req_received(req
);
648 tevent_req_received(req
);
652 static NTSTATUS
skel_get_compression(struct vfs_handle_struct
*handle
,
654 struct files_struct
*fsp
,
655 struct smb_filename
*smb_fname
,
656 uint16_t *_compression_fmt
)
658 return SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
662 static NTSTATUS
skel_set_compression(struct vfs_handle_struct
*handle
,
664 struct files_struct
*fsp
,
665 uint16_t compression_fmt
)
667 return SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
671 static NTSTATUS
skel_streaminfo(struct vfs_handle_struct
*handle
,
672 struct files_struct
*fsp
,
675 unsigned int *num_streams
,
676 struct stream_struct
**streams
)
678 return SMB_VFS_NEXT_STREAMINFO(handle
,
680 fname
, mem_ctx
, num_streams
, streams
);
683 static int skel_get_real_filename(struct vfs_handle_struct
*handle
,
686 TALLOC_CTX
*mem_ctx
, char **found_name
)
688 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle
,
689 path
, name
, mem_ctx
, found_name
);
692 static const char *skel_connectpath(struct vfs_handle_struct
*handle
,
693 const char *filename
)
695 return SMB_VFS_NEXT_CONNECTPATH(handle
, filename
);
698 static NTSTATUS
skel_brl_lock_windows(struct vfs_handle_struct
*handle
,
699 struct byte_range_lock
*br_lck
,
700 struct lock_struct
*plock
,
703 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
,
704 br_lck
, plock
, blocking_lock
);
707 static bool skel_brl_unlock_windows(struct vfs_handle_struct
*handle
,
708 struct messaging_context
*msg_ctx
,
709 struct byte_range_lock
*br_lck
,
710 const struct lock_struct
*plock
)
712 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
, plock
);
715 static bool skel_brl_cancel_windows(struct vfs_handle_struct
*handle
,
716 struct byte_range_lock
*br_lck
,
717 struct lock_struct
*plock
)
719 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
722 static bool skel_strict_lock(struct vfs_handle_struct
*handle
,
723 struct files_struct
*fsp
,
724 struct lock_struct
*plock
)
726 return SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
729 static void skel_strict_unlock(struct vfs_handle_struct
*handle
,
730 struct files_struct
*fsp
,
731 struct lock_struct
*plock
)
733 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
736 static NTSTATUS
skel_translate_name(struct vfs_handle_struct
*handle
,
737 const char *mapped_name
,
738 enum vfs_translate_direction direction
,
739 TALLOC_CTX
*mem_ctx
, char **pmapped_name
)
741 return SMB_VFS_NEXT_TRANSLATE_NAME(handle
, mapped_name
, direction
,
742 mem_ctx
, pmapped_name
);
745 static NTSTATUS
skel_fsctl(struct vfs_handle_struct
*handle
,
746 struct files_struct
*fsp
,
749 uint16_t req_flags
, /* Needed for UNICODE ... */
750 const uint8_t *_in_data
,
752 uint8_t ** _out_data
,
753 uint32_t max_out_len
, uint32_t *out_len
)
755 return SMB_VFS_NEXT_FSCTL(handle
,
761 in_len
, _out_data
, max_out_len
, out_len
);
764 static NTSTATUS
skel_readdir_attr(struct vfs_handle_struct
*handle
,
765 const struct smb_filename
*fname
,
767 struct readdir_attr_data
**pattr_data
)
769 return SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
772 static NTSTATUS
skel_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
773 uint32 security_info
,
775 struct security_descriptor
**ppdesc
)
777 return SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, mem_ctx
,
781 static NTSTATUS
skel_get_nt_acl(vfs_handle_struct
*handle
,
782 const char *name
, uint32 security_info
,
784 struct security_descriptor
**ppdesc
)
786 return SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, mem_ctx
,
790 static NTSTATUS
skel_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
791 uint32 security_info_sent
,
792 const struct security_descriptor
*psd
)
794 return SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
797 static int skel_chmod_acl(vfs_handle_struct
*handle
, const char *name
,
800 return SMB_VFS_NEXT_CHMOD_ACL(handle
, name
, mode
);
803 static int skel_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
806 return SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
809 static SMB_ACL_T
skel_sys_acl_get_file(vfs_handle_struct
*handle
,
814 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
, mem_ctx
);
817 static SMB_ACL_T
skel_sys_acl_get_fd(vfs_handle_struct
*handle
,
818 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
820 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
823 static int skel_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
824 const char *path_p
, TALLOC_CTX
*mem_ctx
,
825 char **blob_description
, DATA_BLOB
*blob
)
827 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, path_p
, mem_ctx
,
828 blob_description
, blob
);
831 static int skel_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
832 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
,
833 char **blob_description
, DATA_BLOB
*blob
)
835 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
,
836 blob_description
, blob
);
839 static int skel_sys_acl_set_file(vfs_handle_struct
*handle
, const char *name
,
840 SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
842 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
, theacl
);
845 static int skel_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
848 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
851 static int skel_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
854 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
857 static ssize_t
skel_getxattr(vfs_handle_struct
*handle
, const char *path
,
858 const char *name
, void *value
, size_t size
)
860 return SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
863 static ssize_t
skel_fgetxattr(vfs_handle_struct
*handle
,
864 struct files_struct
*fsp
, const char *name
,
865 void *value
, size_t size
)
867 return SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
870 static ssize_t
skel_listxattr(vfs_handle_struct
*handle
, const char *path
,
871 char *list
, size_t size
)
873 return SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
876 static ssize_t
skel_flistxattr(vfs_handle_struct
*handle
,
877 struct files_struct
*fsp
, char *list
,
880 return SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
883 static int skel_removexattr(vfs_handle_struct
*handle
, const char *path
,
886 return SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
889 static int skel_fremovexattr(vfs_handle_struct
*handle
,
890 struct files_struct
*fsp
, const char *name
)
892 return SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
895 static int skel_setxattr(vfs_handle_struct
*handle
, const char *path
,
896 const char *name
, const void *value
, size_t size
,
899 return SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
, flags
);
902 static int skel_fsetxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
,
903 const char *name
, const void *value
, size_t size
,
906 return SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
909 static bool skel_aio_force(struct vfs_handle_struct
*handle
,
910 struct files_struct
*fsp
)
912 return SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
915 static bool skel_is_offline(struct vfs_handle_struct
*handle
,
916 const struct smb_filename
*fname
,
917 SMB_STRUCT_STAT
*sbuf
)
919 return SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
922 static int skel_set_offline(struct vfs_handle_struct
*handle
,
923 const struct smb_filename
*fname
)
925 return SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
928 /* VFS operations structure */
930 struct vfs_fn_pointers skel_transparent_fns
= {
931 /* Disk operations */
933 .connect_fn
= skel_connect
,
934 .disconnect_fn
= skel_disconnect
,
935 .disk_free_fn
= skel_disk_free
,
936 .get_quota_fn
= skel_get_quota
,
937 .set_quota_fn
= skel_set_quota
,
938 .get_shadow_copy_data_fn
= skel_get_shadow_copy_data
,
939 .statvfs_fn
= skel_statvfs
,
940 .fs_capabilities_fn
= skel_fs_capabilities
,
941 .get_dfs_referrals_fn
= skel_get_dfs_referrals
,
943 /* Directory operations */
945 .opendir_fn
= skel_opendir
,
946 .fdopendir_fn
= skel_fdopendir
,
947 .readdir_fn
= skel_readdir
,
948 .seekdir_fn
= skel_seekdir
,
949 .telldir_fn
= skel_telldir
,
950 .rewind_dir_fn
= skel_rewind_dir
,
951 .mkdir_fn
= skel_mkdir
,
952 .rmdir_fn
= skel_rmdir
,
953 .closedir_fn
= skel_closedir
,
954 .init_search_op_fn
= skel_init_search_op
,
956 /* File operations */
958 .open_fn
= skel_open
,
959 .create_file_fn
= skel_create_file
,
960 .close_fn
= skel_close_fn
,
961 .read_fn
= skel_vfs_read
,
962 .pread_fn
= skel_pread
,
963 .pread_send_fn
= skel_pread_send
,
964 .pread_recv_fn
= skel_pread_recv
,
965 .write_fn
= skel_write
,
966 .pwrite_fn
= skel_pwrite
,
967 .pwrite_send_fn
= skel_pwrite_send
,
968 .pwrite_recv_fn
= skel_pwrite_recv
,
969 .lseek_fn
= skel_lseek
,
970 .sendfile_fn
= skel_sendfile
,
971 .recvfile_fn
= skel_recvfile
,
972 .rename_fn
= skel_rename
,
973 .fsync_fn
= skel_fsync
,
974 .fsync_send_fn
= skel_fsync_send
,
975 .fsync_recv_fn
= skel_fsync_recv
,
976 .stat_fn
= skel_stat
,
977 .fstat_fn
= skel_fstat
,
978 .lstat_fn
= skel_lstat
,
979 .get_alloc_size_fn
= skel_get_alloc_size
,
980 .unlink_fn
= skel_unlink
,
981 .chmod_fn
= skel_chmod
,
982 .fchmod_fn
= skel_fchmod
,
983 .chown_fn
= skel_chown
,
984 .fchown_fn
= skel_fchown
,
985 .lchown_fn
= skel_lchown
,
986 .chdir_fn
= skel_chdir
,
987 .getwd_fn
= skel_getwd
,
988 .ntimes_fn
= skel_ntimes
,
989 .ftruncate_fn
= skel_ftruncate
,
990 .fallocate_fn
= skel_fallocate
,
991 .lock_fn
= skel_lock
,
992 .kernel_flock_fn
= skel_kernel_flock
,
993 .linux_setlease_fn
= skel_linux_setlease
,
994 .getlock_fn
= skel_getlock
,
995 .symlink_fn
= skel_symlink
,
996 .readlink_fn
= skel_vfs_readlink
,
997 .link_fn
= skel_link
,
998 .mknod_fn
= skel_mknod
,
999 .realpath_fn
= skel_realpath
,
1000 .notify_watch_fn
= skel_notify_watch
,
1001 .chflags_fn
= skel_chflags
,
1002 .file_id_create_fn
= skel_file_id_create
,
1003 .copy_chunk_send_fn
= skel_copy_chunk_send
,
1004 .copy_chunk_recv_fn
= skel_copy_chunk_recv
,
1005 .get_compression_fn
= skel_get_compression
,
1006 .set_compression_fn
= skel_set_compression
,
1008 .streaminfo_fn
= skel_streaminfo
,
1009 .get_real_filename_fn
= skel_get_real_filename
,
1010 .connectpath_fn
= skel_connectpath
,
1011 .brl_lock_windows_fn
= skel_brl_lock_windows
,
1012 .brl_unlock_windows_fn
= skel_brl_unlock_windows
,
1013 .brl_cancel_windows_fn
= skel_brl_cancel_windows
,
1014 .strict_lock_fn
= skel_strict_lock
,
1015 .strict_unlock_fn
= skel_strict_unlock
,
1016 .translate_name_fn
= skel_translate_name
,
1017 .fsctl_fn
= skel_fsctl
,
1018 .readdir_attr_fn
= skel_readdir_attr
,
1020 /* NT ACL operations. */
1022 .fget_nt_acl_fn
= skel_fget_nt_acl
,
1023 .get_nt_acl_fn
= skel_get_nt_acl
,
1024 .fset_nt_acl_fn
= skel_fset_nt_acl
,
1026 /* POSIX ACL operations. */
1028 .chmod_acl_fn
= skel_chmod_acl
,
1029 .fchmod_acl_fn
= skel_fchmod_acl
,
1031 .sys_acl_get_file_fn
= skel_sys_acl_get_file
,
1032 .sys_acl_get_fd_fn
= skel_sys_acl_get_fd
,
1033 .sys_acl_blob_get_file_fn
= skel_sys_acl_blob_get_file
,
1034 .sys_acl_blob_get_fd_fn
= skel_sys_acl_blob_get_fd
,
1035 .sys_acl_set_file_fn
= skel_sys_acl_set_file
,
1036 .sys_acl_set_fd_fn
= skel_sys_acl_set_fd
,
1037 .sys_acl_delete_def_file_fn
= skel_sys_acl_delete_def_file
,
1039 /* EA operations. */
1040 .getxattr_fn
= skel_getxattr
,
1041 .fgetxattr_fn
= skel_fgetxattr
,
1042 .listxattr_fn
= skel_listxattr
,
1043 .flistxattr_fn
= skel_flistxattr
,
1044 .removexattr_fn
= skel_removexattr
,
1045 .fremovexattr_fn
= skel_fremovexattr
,
1046 .setxattr_fn
= skel_setxattr
,
1047 .fsetxattr_fn
= skel_fsetxattr
,
1049 /* aio operations */
1050 .aio_force_fn
= skel_aio_force
,
1052 /* offline operations */
1053 .is_offline_fn
= skel_is_offline
,
1054 .set_offline_fn
= skel_set_offline
1057 NTSTATUS
vfs_skel_transparent_init(void)
1059 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "skel_transparent",
1060 &skel_transparent_fns
);