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, const char *path,
59 enum SMB_QUOTA_TYPE qtype, unid_t id,
62 return SMB_VFS_NEXT_GET_QUOTA(handle, path, 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_t attr)
101 return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
104 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
106 const char *service_path,
109 return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
113 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
115 const char *base_volume,
121 return SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
122 rw, base_path, snap_path);
125 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
130 return SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path);
133 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
134 const char *mask, uint32_t attr)
136 return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
139 static struct dirent *skel_readdir(vfs_handle_struct *handle,
140 DIR *dirp, SMB_STRUCT_STAT *sbuf)
142 return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
145 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
147 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
150 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
152 return SMB_VFS_NEXT_TELLDIR(handle, dirp);
155 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
157 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
160 static int skel_mkdir(vfs_handle_struct *handle,
161 const struct smb_filename *smb_fname,
164 return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
167 static int skel_rmdir(vfs_handle_struct *handle, const char *path)
169 return SMB_VFS_NEXT_RMDIR(handle, path);
172 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
174 return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
177 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
179 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
182 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
183 files_struct *fsp, int flags, mode_t mode)
185 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
188 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
189 struct smb_request *req,
190 uint16_t root_dir_fid,
191 struct smb_filename *smb_fname,
192 uint32_t access_mask,
193 uint32_t share_access,
194 uint32_t create_disposition,
195 uint32_t create_options,
196 uint32_t file_attributes,
197 uint32_t oplock_request,
198 struct smb2_lease *lease,
199 uint64_t allocation_size,
200 uint32_t private_flags,
201 struct security_descriptor *sd,
202 struct ea_list *ea_list,
203 files_struct ** result, int *pinfo,
204 const struct smb2_create_blobs *in_context_blobs,
205 struct smb2_create_blobs *out_context_blobs)
207 return SMB_VFS_NEXT_CREATE_FILE(handle,
220 sd, ea_list, result, pinfo,
221 in_context_blobs, out_context_blobs);
224 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
226 return SMB_VFS_NEXT_CLOSE(handle, fsp);
229 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
230 void *data, size_t n)
232 return SMB_VFS_NEXT_READ(handle, fsp, data, n);
235 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
236 void *data, size_t n, off_t offset)
238 return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
241 struct skel_pread_state {
246 static void skel_pread_done(struct tevent_req *subreq);
248 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
250 struct tevent_context *ev,
251 struct files_struct *fsp,
252 void *data, size_t n, off_t offset)
254 struct tevent_req *req, *subreq;
255 struct skel_pread_state *state;
257 req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
261 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
263 if (tevent_req_nomem(subreq, req)) {
264 return tevent_req_post(req, ev);
266 tevent_req_set_callback(subreq, skel_pread_done, req);
270 static void skel_pread_done(struct tevent_req *subreq)
272 struct tevent_req *req =
273 tevent_req_callback_data(subreq, struct tevent_req);
274 struct skel_pread_state *state =
275 tevent_req_data(req, struct skel_pread_state);
277 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
279 tevent_req_done(req);
282 static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
284 struct skel_pread_state *state =
285 tevent_req_data(req, struct skel_pread_state);
287 if (tevent_req_is_unix_error(req, err)) {
294 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
295 const void *data, size_t n)
297 return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
300 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
301 const void *data, size_t n, off_t offset)
303 return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
306 struct skel_pwrite_state {
311 static void skel_pwrite_done(struct tevent_req *subreq);
313 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
315 struct tevent_context *ev,
316 struct files_struct *fsp,
318 size_t n, off_t offset)
320 struct tevent_req *req, *subreq;
321 struct skel_pwrite_state *state;
323 req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
327 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
329 if (tevent_req_nomem(subreq, req)) {
330 return tevent_req_post(req, ev);
332 tevent_req_set_callback(subreq, skel_pwrite_done, req);
336 static void skel_pwrite_done(struct tevent_req *subreq)
338 struct tevent_req *req =
339 tevent_req_callback_data(subreq, struct tevent_req);
340 struct skel_pwrite_state *state =
341 tevent_req_data(req, struct skel_pwrite_state);
343 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
345 tevent_req_done(req);
348 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
350 struct skel_pwrite_state *state =
351 tevent_req_data(req, struct skel_pwrite_state);
353 if (tevent_req_is_unix_error(req, err)) {
360 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
361 off_t offset, int whence)
363 return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
366 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
367 files_struct *fromfsp, const DATA_BLOB *hdr,
368 off_t offset, size_t n)
370 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
373 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
374 files_struct *tofsp, off_t offset, size_t n)
376 return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
379 static int skel_rename(vfs_handle_struct *handle,
380 const struct smb_filename *smb_fname_src,
381 const struct smb_filename *smb_fname_dst)
383 return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
386 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
388 return SMB_VFS_NEXT_FSYNC(handle, fsp);
391 struct skel_fsync_state {
396 static void skel_fsync_done(struct tevent_req *subreq);
398 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
400 struct tevent_context *ev,
401 struct files_struct *fsp)
403 struct tevent_req *req, *subreq;
404 struct skel_fsync_state *state;
406 req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
410 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
411 if (tevent_req_nomem(subreq, req)) {
412 return tevent_req_post(req, ev);
414 tevent_req_set_callback(subreq, skel_fsync_done, req);
418 static void skel_fsync_done(struct tevent_req *subreq)
420 struct tevent_req *req =
421 tevent_req_callback_data(subreq, struct tevent_req);
422 struct skel_fsync_state *state =
423 tevent_req_data(req, struct skel_fsync_state);
425 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
427 tevent_req_done(req);
430 static int skel_fsync_recv(struct tevent_req *req, int *err)
432 struct skel_fsync_state *state =
433 tevent_req_data(req, struct skel_fsync_state);
435 if (tevent_req_is_unix_error(req, err)) {
442 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
444 return SMB_VFS_NEXT_STAT(handle, smb_fname);
447 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
448 SMB_STRUCT_STAT *sbuf)
450 return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
453 static int skel_lstat(vfs_handle_struct *handle,
454 struct smb_filename *smb_fname)
456 return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
459 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
460 struct files_struct *fsp,
461 const SMB_STRUCT_STAT *sbuf)
463 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
466 static int skel_unlink(vfs_handle_struct *handle,
467 const struct smb_filename *smb_fname)
469 return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
472 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
474 return SMB_VFS_NEXT_CHMOD(handle, path, mode);
477 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
480 return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
483 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid,
486 return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
489 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
490 uid_t uid, gid_t gid)
492 return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
495 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid,
498 return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
501 static int skel_chdir(vfs_handle_struct *handle, const char *path)
503 return SMB_VFS_NEXT_CHDIR(handle, path);
506 static char *skel_getwd(vfs_handle_struct *handle)
508 return SMB_VFS_NEXT_GETWD(handle);
511 static int skel_ntimes(vfs_handle_struct *handle,
512 const struct smb_filename *smb_fname,
513 struct smb_file_time *ft)
515 return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
518 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
521 return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
524 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
525 uint32_t mode, off_t offset, off_t len)
527 return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
530 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
531 off_t offset, off_t count, int type)
533 return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
536 static int skel_kernel_flock(struct vfs_handle_struct *handle,
537 struct files_struct *fsp, uint32_t share_mode,
538 uint32_t access_mask)
540 return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
543 static int skel_linux_setlease(struct vfs_handle_struct *handle,
544 struct files_struct *fsp, int leasetype)
546 return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
549 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
550 off_t *poffset, off_t *pcount, int *ptype,
553 return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
556 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
559 return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
562 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
563 char *buf, size_t bufsiz)
565 return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
568 static int skel_link(vfs_handle_struct *handle, const char *oldpath,
571 return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
574 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
577 return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
580 static char *skel_realpath(vfs_handle_struct *handle, const char *path)
582 return SMB_VFS_NEXT_REALPATH(handle, path);
585 static int skel_chflags(vfs_handle_struct *handle, const char *path,
588 return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
591 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
592 const SMB_STRUCT_STAT *sbuf)
594 return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
597 struct skel_cc_state {
598 struct vfs_handle_struct *handle;
601 static void skel_copy_chunk_done(struct tevent_req *subreq);
603 static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
605 struct tevent_context *ev,
606 struct files_struct *src_fsp,
608 struct files_struct *dest_fsp,
612 struct tevent_req *req;
613 struct tevent_req *subreq;
614 struct skel_cc_state *cc_state;
616 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
621 cc_state->handle = handle;
622 subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, cc_state, ev,
624 dest_fsp, dest_off, num);
625 if (tevent_req_nomem(subreq, req)) {
626 return tevent_req_post(req, ev);
629 tevent_req_set_callback(subreq, skel_copy_chunk_done, req);
633 static void skel_copy_chunk_done(struct tevent_req *subreq)
635 struct tevent_req *req = tevent_req_callback_data(
636 subreq, struct tevent_req);
637 struct skel_cc_state *cc_state
638 = tevent_req_data(req, struct skel_cc_state);
641 status = SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state->handle,
645 if (tevent_req_nterror(req, status)) {
648 tevent_req_done(req);
651 static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
652 struct tevent_req *req,
655 struct skel_cc_state *cc_state
656 = tevent_req_data(req, struct skel_cc_state);
659 *copied = cc_state->copied;
660 if (tevent_req_is_nterror(req, &status)) {
661 tevent_req_received(req);
665 tevent_req_received(req);
669 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
671 struct files_struct *fsp,
672 struct smb_filename *smb_fname,
673 uint16_t *_compression_fmt)
675 return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
679 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
681 struct files_struct *fsp,
682 uint16_t compression_fmt)
684 return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
688 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
689 struct files_struct *fsp,
692 unsigned int *num_streams,
693 struct stream_struct **streams)
695 return SMB_VFS_NEXT_STREAMINFO(handle,
697 fname, mem_ctx, num_streams, streams);
700 static int skel_get_real_filename(struct vfs_handle_struct *handle,
703 TALLOC_CTX *mem_ctx, char **found_name)
705 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
706 path, name, mem_ctx, found_name);
709 static const char *skel_connectpath(struct vfs_handle_struct *handle,
710 const char *filename)
712 return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
715 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
716 struct byte_range_lock *br_lck,
717 struct lock_struct *plock,
720 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
721 br_lck, plock, blocking_lock);
724 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
725 struct messaging_context *msg_ctx,
726 struct byte_range_lock *br_lck,
727 const struct lock_struct *plock)
729 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
732 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
733 struct byte_range_lock *br_lck,
734 struct lock_struct *plock)
736 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
739 static bool skel_strict_lock(struct vfs_handle_struct *handle,
740 struct files_struct *fsp,
741 struct lock_struct *plock)
743 return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
746 static void skel_strict_unlock(struct vfs_handle_struct *handle,
747 struct files_struct *fsp,
748 struct lock_struct *plock)
750 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
753 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
754 const char *mapped_name,
755 enum vfs_translate_direction direction,
756 TALLOC_CTX *mem_ctx, char **pmapped_name)
758 return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
759 mem_ctx, pmapped_name);
762 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
763 struct files_struct *fsp,
766 uint16_t req_flags, /* Needed for UNICODE ... */
767 const uint8_t *_in_data,
769 uint8_t ** _out_data,
770 uint32_t max_out_len, uint32_t *out_len)
772 return SMB_VFS_NEXT_FSCTL(handle,
778 in_len, _out_data, max_out_len, out_len);
781 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
782 const struct smb_filename *fname,
784 struct readdir_attr_data **pattr_data)
786 return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
789 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
790 uint32_t security_info,
792 struct security_descriptor **ppdesc)
794 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx,
798 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
799 const struct smb_filename *smb_fname,
800 uint32_t security_info,
802 struct security_descriptor **ppdesc)
804 return SMB_VFS_NEXT_GET_NT_ACL(handle,
811 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
812 uint32_t security_info_sent,
813 const struct security_descriptor *psd)
815 return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
818 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
821 return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
824 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
827 return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
830 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
835 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
838 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
839 files_struct *fsp, TALLOC_CTX *mem_ctx)
841 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
844 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
845 const char *path_p, TALLOC_CTX *mem_ctx,
846 char **blob_description, DATA_BLOB *blob)
848 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx,
849 blob_description, blob);
852 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
853 files_struct *fsp, TALLOC_CTX *mem_ctx,
854 char **blob_description, DATA_BLOB *blob)
856 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx,
857 blob_description, blob);
860 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
861 SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
863 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
866 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
869 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
872 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
875 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
878 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
879 const char *name, void *value, size_t size)
881 return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
884 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
885 struct files_struct *fsp, const char *name,
886 void *value, size_t size)
888 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
891 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
892 char *list, size_t size)
894 return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
897 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
898 struct files_struct *fsp, char *list,
901 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
904 static int skel_removexattr(vfs_handle_struct *handle, const char *path,
907 return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
910 static int skel_fremovexattr(vfs_handle_struct *handle,
911 struct files_struct *fsp, const char *name)
913 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
916 static int skel_setxattr(vfs_handle_struct *handle, const char *path,
917 const char *name, const void *value, size_t size,
920 return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
923 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
924 const char *name, const void *value, size_t size,
927 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
930 static bool skel_aio_force(struct vfs_handle_struct *handle,
931 struct files_struct *fsp)
933 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
936 static bool skel_is_offline(struct vfs_handle_struct *handle,
937 const struct smb_filename *fname,
938 SMB_STRUCT_STAT *sbuf)
940 return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
943 static int skel_set_offline(struct vfs_handle_struct *handle,
944 const struct smb_filename *fname)
946 return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
949 /* VFS operations structure */
951 struct vfs_fn_pointers skel_transparent_fns = {
952 /* Disk operations */
954 .connect_fn = skel_connect,
955 .disconnect_fn = skel_disconnect,
956 .disk_free_fn = skel_disk_free,
957 .get_quota_fn = skel_get_quota,
958 .set_quota_fn = skel_set_quota,
959 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
960 .statvfs_fn = skel_statvfs,
961 .fs_capabilities_fn = skel_fs_capabilities,
962 .get_dfs_referrals_fn = skel_get_dfs_referrals,
963 .snap_check_path_fn = skel_snap_check_path,
964 .snap_create_fn = skel_snap_create,
965 .snap_delete_fn = skel_snap_delete,
967 /* Directory operations */
969 .opendir_fn = skel_opendir,
970 .fdopendir_fn = skel_fdopendir,
971 .readdir_fn = skel_readdir,
972 .seekdir_fn = skel_seekdir,
973 .telldir_fn = skel_telldir,
974 .rewind_dir_fn = skel_rewind_dir,
975 .mkdir_fn = skel_mkdir,
976 .rmdir_fn = skel_rmdir,
977 .closedir_fn = skel_closedir,
978 .init_search_op_fn = skel_init_search_op,
980 /* File operations */
982 .open_fn = skel_open,
983 .create_file_fn = skel_create_file,
984 .close_fn = skel_close_fn,
985 .read_fn = skel_vfs_read,
986 .pread_fn = skel_pread,
987 .pread_send_fn = skel_pread_send,
988 .pread_recv_fn = skel_pread_recv,
989 .write_fn = skel_write,
990 .pwrite_fn = skel_pwrite,
991 .pwrite_send_fn = skel_pwrite_send,
992 .pwrite_recv_fn = skel_pwrite_recv,
993 .lseek_fn = skel_lseek,
994 .sendfile_fn = skel_sendfile,
995 .recvfile_fn = skel_recvfile,
996 .rename_fn = skel_rename,
997 .fsync_fn = skel_fsync,
998 .fsync_send_fn = skel_fsync_send,
999 .fsync_recv_fn = skel_fsync_recv,
1000 .stat_fn = skel_stat,
1001 .fstat_fn = skel_fstat,
1002 .lstat_fn = skel_lstat,
1003 .get_alloc_size_fn = skel_get_alloc_size,
1004 .unlink_fn = skel_unlink,
1005 .chmod_fn = skel_chmod,
1006 .fchmod_fn = skel_fchmod,
1007 .chown_fn = skel_chown,
1008 .fchown_fn = skel_fchown,
1009 .lchown_fn = skel_lchown,
1010 .chdir_fn = skel_chdir,
1011 .getwd_fn = skel_getwd,
1012 .ntimes_fn = skel_ntimes,
1013 .ftruncate_fn = skel_ftruncate,
1014 .fallocate_fn = skel_fallocate,
1015 .lock_fn = skel_lock,
1016 .kernel_flock_fn = skel_kernel_flock,
1017 .linux_setlease_fn = skel_linux_setlease,
1018 .getlock_fn = skel_getlock,
1019 .symlink_fn = skel_symlink,
1020 .readlink_fn = skel_vfs_readlink,
1021 .link_fn = skel_link,
1022 .mknod_fn = skel_mknod,
1023 .realpath_fn = skel_realpath,
1024 .chflags_fn = skel_chflags,
1025 .file_id_create_fn = skel_file_id_create,
1026 .copy_chunk_send_fn = skel_copy_chunk_send,
1027 .copy_chunk_recv_fn = skel_copy_chunk_recv,
1028 .get_compression_fn = skel_get_compression,
1029 .set_compression_fn = skel_set_compression,
1031 .streaminfo_fn = skel_streaminfo,
1032 .get_real_filename_fn = skel_get_real_filename,
1033 .connectpath_fn = skel_connectpath,
1034 .brl_lock_windows_fn = skel_brl_lock_windows,
1035 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1036 .brl_cancel_windows_fn = skel_brl_cancel_windows,
1037 .strict_lock_fn = skel_strict_lock,
1038 .strict_unlock_fn = skel_strict_unlock,
1039 .translate_name_fn = skel_translate_name,
1040 .fsctl_fn = skel_fsctl,
1041 .readdir_attr_fn = skel_readdir_attr,
1043 /* NT ACL operations. */
1045 .fget_nt_acl_fn = skel_fget_nt_acl,
1046 .get_nt_acl_fn = skel_get_nt_acl,
1047 .fset_nt_acl_fn = skel_fset_nt_acl,
1049 /* POSIX ACL operations. */
1051 .chmod_acl_fn = skel_chmod_acl,
1052 .fchmod_acl_fn = skel_fchmod_acl,
1054 .sys_acl_get_file_fn = skel_sys_acl_get_file,
1055 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1056 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1057 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1058 .sys_acl_set_file_fn = skel_sys_acl_set_file,
1059 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1060 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1062 /* EA operations. */
1063 .getxattr_fn = skel_getxattr,
1064 .fgetxattr_fn = skel_fgetxattr,
1065 .listxattr_fn = skel_listxattr,
1066 .flistxattr_fn = skel_flistxattr,
1067 .removexattr_fn = skel_removexattr,
1068 .fremovexattr_fn = skel_fremovexattr,
1069 .setxattr_fn = skel_setxattr,
1070 .fsetxattr_fn = skel_fsetxattr,
1072 /* aio operations */
1073 .aio_force_fn = skel_aio_force,
1075 /* offline operations */
1076 .is_offline_fn = skel_is_offline,
1077 .set_offline_fn = skel_set_offline
1081 NTSTATUS vfs_skel_transparent_init(void)
1083 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
1084 &skel_transparent_fns);