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, const char *path, mode_t mode)
162 return SMB_VFS_NEXT_MKDIR(handle, path, mode);
165 static int skel_rmdir(vfs_handle_struct *handle, const char *path)
167 return SMB_VFS_NEXT_RMDIR(handle, path);
170 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
172 return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
175 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
177 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
180 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
181 files_struct *fsp, int flags, mode_t mode)
183 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
186 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
187 struct smb_request *req,
188 uint16_t root_dir_fid,
189 struct smb_filename *smb_fname,
190 uint32_t access_mask,
191 uint32_t share_access,
192 uint32_t create_disposition,
193 uint32_t create_options,
194 uint32_t file_attributes,
195 uint32_t oplock_request,
196 struct smb2_lease *lease,
197 uint64_t allocation_size,
198 uint32_t private_flags,
199 struct security_descriptor *sd,
200 struct ea_list *ea_list,
201 files_struct ** result, int *pinfo,
202 const struct smb2_create_blobs *in_context_blobs,
203 struct smb2_create_blobs *out_context_blobs)
205 return SMB_VFS_NEXT_CREATE_FILE(handle,
218 sd, ea_list, result, pinfo,
219 in_context_blobs, out_context_blobs);
222 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
224 return SMB_VFS_NEXT_CLOSE(handle, fsp);
227 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
228 void *data, size_t n)
230 return SMB_VFS_NEXT_READ(handle, fsp, data, n);
233 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
234 void *data, size_t n, off_t offset)
236 return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
239 struct skel_pread_state {
244 static void skel_pread_done(struct tevent_req *subreq);
246 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
248 struct tevent_context *ev,
249 struct files_struct *fsp,
250 void *data, size_t n, off_t offset)
252 struct tevent_req *req, *subreq;
253 struct skel_pread_state *state;
255 req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
259 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
261 if (tevent_req_nomem(subreq, req)) {
262 return tevent_req_post(req, ev);
264 tevent_req_set_callback(subreq, skel_pread_done, req);
268 static void skel_pread_done(struct tevent_req *subreq)
270 struct tevent_req *req =
271 tevent_req_callback_data(subreq, struct tevent_req);
272 struct skel_pread_state *state =
273 tevent_req_data(req, struct skel_pread_state);
275 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
277 tevent_req_done(req);
280 static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
282 struct skel_pread_state *state =
283 tevent_req_data(req, struct skel_pread_state);
285 if (tevent_req_is_unix_error(req, err)) {
292 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
293 const void *data, size_t n)
295 return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
298 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
299 const void *data, size_t n, off_t offset)
301 return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
304 struct skel_pwrite_state {
309 static void skel_pwrite_done(struct tevent_req *subreq);
311 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
313 struct tevent_context *ev,
314 struct files_struct *fsp,
316 size_t n, off_t offset)
318 struct tevent_req *req, *subreq;
319 struct skel_pwrite_state *state;
321 req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
325 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
327 if (tevent_req_nomem(subreq, req)) {
328 return tevent_req_post(req, ev);
330 tevent_req_set_callback(subreq, skel_pwrite_done, req);
334 static void skel_pwrite_done(struct tevent_req *subreq)
336 struct tevent_req *req =
337 tevent_req_callback_data(subreq, struct tevent_req);
338 struct skel_pwrite_state *state =
339 tevent_req_data(req, struct skel_pwrite_state);
341 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
343 tevent_req_done(req);
346 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
348 struct skel_pwrite_state *state =
349 tevent_req_data(req, struct skel_pwrite_state);
351 if (tevent_req_is_unix_error(req, err)) {
358 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
359 off_t offset, int whence)
361 return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
364 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
365 files_struct *fromfsp, const DATA_BLOB *hdr,
366 off_t offset, size_t n)
368 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
371 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
372 files_struct *tofsp, off_t offset, size_t n)
374 return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
377 static int skel_rename(vfs_handle_struct *handle,
378 const struct smb_filename *smb_fname_src,
379 const struct smb_filename *smb_fname_dst)
381 return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
384 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
386 return SMB_VFS_NEXT_FSYNC(handle, fsp);
389 struct skel_fsync_state {
394 static void skel_fsync_done(struct tevent_req *subreq);
396 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
398 struct tevent_context *ev,
399 struct files_struct *fsp)
401 struct tevent_req *req, *subreq;
402 struct skel_fsync_state *state;
404 req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
408 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
409 if (tevent_req_nomem(subreq, req)) {
410 return tevent_req_post(req, ev);
412 tevent_req_set_callback(subreq, skel_fsync_done, req);
416 static void skel_fsync_done(struct tevent_req *subreq)
418 struct tevent_req *req =
419 tevent_req_callback_data(subreq, struct tevent_req);
420 struct skel_fsync_state *state =
421 tevent_req_data(req, struct skel_fsync_state);
423 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
425 tevent_req_done(req);
428 static int skel_fsync_recv(struct tevent_req *req, int *err)
430 struct skel_fsync_state *state =
431 tevent_req_data(req, struct skel_fsync_state);
433 if (tevent_req_is_unix_error(req, err)) {
440 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
442 return SMB_VFS_NEXT_STAT(handle, smb_fname);
445 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
446 SMB_STRUCT_STAT *sbuf)
448 return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
451 static int skel_lstat(vfs_handle_struct *handle,
452 struct smb_filename *smb_fname)
454 return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
457 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
458 struct files_struct *fsp,
459 const SMB_STRUCT_STAT *sbuf)
461 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
464 static int skel_unlink(vfs_handle_struct *handle,
465 const struct smb_filename *smb_fname)
467 return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
470 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
472 return SMB_VFS_NEXT_CHMOD(handle, path, mode);
475 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
478 return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
481 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid,
484 return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
487 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
488 uid_t uid, gid_t gid)
490 return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
493 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid,
496 return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
499 static int skel_chdir(vfs_handle_struct *handle, const char *path)
501 return SMB_VFS_NEXT_CHDIR(handle, path);
504 static char *skel_getwd(vfs_handle_struct *handle)
506 return SMB_VFS_NEXT_GETWD(handle);
509 static int skel_ntimes(vfs_handle_struct *handle,
510 const struct smb_filename *smb_fname,
511 struct smb_file_time *ft)
513 return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
516 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
519 return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
522 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
523 uint32_t mode, off_t offset, off_t len)
525 return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
528 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
529 off_t offset, off_t count, int type)
531 return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
534 static int skel_kernel_flock(struct vfs_handle_struct *handle,
535 struct files_struct *fsp, uint32_t share_mode,
536 uint32_t access_mask)
538 return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
541 static int skel_linux_setlease(struct vfs_handle_struct *handle,
542 struct files_struct *fsp, int leasetype)
544 return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
547 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
548 off_t *poffset, off_t *pcount, int *ptype,
551 return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
554 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
557 return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
560 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
561 char *buf, size_t bufsiz)
563 return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
566 static int skel_link(vfs_handle_struct *handle, const char *oldpath,
569 return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
572 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
575 return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
578 static char *skel_realpath(vfs_handle_struct *handle, const char *path)
580 return SMB_VFS_NEXT_REALPATH(handle, path);
583 static int skel_chflags(vfs_handle_struct *handle, const char *path,
586 return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
589 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
590 const SMB_STRUCT_STAT *sbuf)
592 return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
595 struct skel_cc_state {
596 struct vfs_handle_struct *handle;
599 static void skel_copy_chunk_done(struct tevent_req *subreq);
601 static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
603 struct tevent_context *ev,
604 struct files_struct *src_fsp,
606 struct files_struct *dest_fsp,
610 struct tevent_req *req;
611 struct tevent_req *subreq;
612 struct skel_cc_state *cc_state;
614 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
619 cc_state->handle = handle;
620 subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, cc_state, ev,
622 dest_fsp, dest_off, num);
623 if (tevent_req_nomem(subreq, req)) {
624 return tevent_req_post(req, ev);
627 tevent_req_set_callback(subreq, skel_copy_chunk_done, req);
631 static void skel_copy_chunk_done(struct tevent_req *subreq)
633 struct tevent_req *req = tevent_req_callback_data(
634 subreq, struct tevent_req);
635 struct skel_cc_state *cc_state
636 = tevent_req_data(req, struct skel_cc_state);
639 status = SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state->handle,
643 if (tevent_req_nterror(req, status)) {
646 tevent_req_done(req);
649 static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
650 struct tevent_req *req,
653 struct skel_cc_state *cc_state
654 = tevent_req_data(req, struct skel_cc_state);
657 *copied = cc_state->copied;
658 if (tevent_req_is_nterror(req, &status)) {
659 tevent_req_received(req);
663 tevent_req_received(req);
667 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
669 struct files_struct *fsp,
670 struct smb_filename *smb_fname,
671 uint16_t *_compression_fmt)
673 return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
677 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
679 struct files_struct *fsp,
680 uint16_t compression_fmt)
682 return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
686 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
687 struct files_struct *fsp,
690 unsigned int *num_streams,
691 struct stream_struct **streams)
693 return SMB_VFS_NEXT_STREAMINFO(handle,
695 fname, mem_ctx, num_streams, streams);
698 static int skel_get_real_filename(struct vfs_handle_struct *handle,
701 TALLOC_CTX *mem_ctx, char **found_name)
703 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
704 path, name, mem_ctx, found_name);
707 static const char *skel_connectpath(struct vfs_handle_struct *handle,
708 const char *filename)
710 return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
713 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
714 struct byte_range_lock *br_lck,
715 struct lock_struct *plock,
718 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
719 br_lck, plock, blocking_lock);
722 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
723 struct messaging_context *msg_ctx,
724 struct byte_range_lock *br_lck,
725 const struct lock_struct *plock)
727 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
730 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
731 struct byte_range_lock *br_lck,
732 struct lock_struct *plock)
734 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
737 static bool skel_strict_lock(struct vfs_handle_struct *handle,
738 struct files_struct *fsp,
739 struct lock_struct *plock)
741 return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
744 static void skel_strict_unlock(struct vfs_handle_struct *handle,
745 struct files_struct *fsp,
746 struct lock_struct *plock)
748 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
751 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
752 const char *mapped_name,
753 enum vfs_translate_direction direction,
754 TALLOC_CTX *mem_ctx, char **pmapped_name)
756 return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
757 mem_ctx, pmapped_name);
760 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
761 struct files_struct *fsp,
764 uint16_t req_flags, /* Needed for UNICODE ... */
765 const uint8_t *_in_data,
767 uint8_t ** _out_data,
768 uint32_t max_out_len, uint32_t *out_len)
770 return SMB_VFS_NEXT_FSCTL(handle,
776 in_len, _out_data, max_out_len, out_len);
779 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
780 const struct smb_filename *fname,
782 struct readdir_attr_data **pattr_data)
784 return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
787 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
788 uint32_t security_info,
790 struct security_descriptor **ppdesc)
792 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx,
796 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
797 const struct smb_filename *smb_fname,
798 uint32_t security_info,
800 struct security_descriptor **ppdesc)
802 return SMB_VFS_NEXT_GET_NT_ACL(handle,
809 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
810 uint32_t security_info_sent,
811 const struct security_descriptor *psd)
813 return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
816 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
819 return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
822 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
825 return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
828 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
833 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
836 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
837 files_struct *fsp, TALLOC_CTX *mem_ctx)
839 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
842 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
843 const char *path_p, TALLOC_CTX *mem_ctx,
844 char **blob_description, DATA_BLOB *blob)
846 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx,
847 blob_description, blob);
850 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
851 files_struct *fsp, TALLOC_CTX *mem_ctx,
852 char **blob_description, DATA_BLOB *blob)
854 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx,
855 blob_description, blob);
858 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
859 SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
861 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
864 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
867 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
870 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
873 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
876 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
877 const char *name, void *value, size_t size)
879 return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
882 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
883 struct files_struct *fsp, const char *name,
884 void *value, size_t size)
886 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
889 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
890 char *list, size_t size)
892 return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
895 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
896 struct files_struct *fsp, char *list,
899 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
902 static int skel_removexattr(vfs_handle_struct *handle, const char *path,
905 return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
908 static int skel_fremovexattr(vfs_handle_struct *handle,
909 struct files_struct *fsp, const char *name)
911 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
914 static int skel_setxattr(vfs_handle_struct *handle, const char *path,
915 const char *name, const void *value, size_t size,
918 return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
921 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
922 const char *name, const void *value, size_t size,
925 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
928 static bool skel_aio_force(struct vfs_handle_struct *handle,
929 struct files_struct *fsp)
931 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
934 static bool skel_is_offline(struct vfs_handle_struct *handle,
935 const struct smb_filename *fname,
936 SMB_STRUCT_STAT *sbuf)
938 return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
941 static int skel_set_offline(struct vfs_handle_struct *handle,
942 const struct smb_filename *fname)
944 return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
947 /* VFS operations structure */
949 struct vfs_fn_pointers skel_transparent_fns = {
950 /* Disk operations */
952 .connect_fn = skel_connect,
953 .disconnect_fn = skel_disconnect,
954 .disk_free_fn = skel_disk_free,
955 .get_quota_fn = skel_get_quota,
956 .set_quota_fn = skel_set_quota,
957 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
958 .statvfs_fn = skel_statvfs,
959 .fs_capabilities_fn = skel_fs_capabilities,
960 .get_dfs_referrals_fn = skel_get_dfs_referrals,
961 .snap_check_path_fn = skel_snap_check_path,
962 .snap_create_fn = skel_snap_create,
963 .snap_delete_fn = skel_snap_delete,
965 /* Directory operations */
967 .opendir_fn = skel_opendir,
968 .fdopendir_fn = skel_fdopendir,
969 .readdir_fn = skel_readdir,
970 .seekdir_fn = skel_seekdir,
971 .telldir_fn = skel_telldir,
972 .rewind_dir_fn = skel_rewind_dir,
973 .mkdir_fn = skel_mkdir,
974 .rmdir_fn = skel_rmdir,
975 .closedir_fn = skel_closedir,
976 .init_search_op_fn = skel_init_search_op,
978 /* File operations */
980 .open_fn = skel_open,
981 .create_file_fn = skel_create_file,
982 .close_fn = skel_close_fn,
983 .read_fn = skel_vfs_read,
984 .pread_fn = skel_pread,
985 .pread_send_fn = skel_pread_send,
986 .pread_recv_fn = skel_pread_recv,
987 .write_fn = skel_write,
988 .pwrite_fn = skel_pwrite,
989 .pwrite_send_fn = skel_pwrite_send,
990 .pwrite_recv_fn = skel_pwrite_recv,
991 .lseek_fn = skel_lseek,
992 .sendfile_fn = skel_sendfile,
993 .recvfile_fn = skel_recvfile,
994 .rename_fn = skel_rename,
995 .fsync_fn = skel_fsync,
996 .fsync_send_fn = skel_fsync_send,
997 .fsync_recv_fn = skel_fsync_recv,
998 .stat_fn = skel_stat,
999 .fstat_fn = skel_fstat,
1000 .lstat_fn = skel_lstat,
1001 .get_alloc_size_fn = skel_get_alloc_size,
1002 .unlink_fn = skel_unlink,
1003 .chmod_fn = skel_chmod,
1004 .fchmod_fn = skel_fchmod,
1005 .chown_fn = skel_chown,
1006 .fchown_fn = skel_fchown,
1007 .lchown_fn = skel_lchown,
1008 .chdir_fn = skel_chdir,
1009 .getwd_fn = skel_getwd,
1010 .ntimes_fn = skel_ntimes,
1011 .ftruncate_fn = skel_ftruncate,
1012 .fallocate_fn = skel_fallocate,
1013 .lock_fn = skel_lock,
1014 .kernel_flock_fn = skel_kernel_flock,
1015 .linux_setlease_fn = skel_linux_setlease,
1016 .getlock_fn = skel_getlock,
1017 .symlink_fn = skel_symlink,
1018 .readlink_fn = skel_vfs_readlink,
1019 .link_fn = skel_link,
1020 .mknod_fn = skel_mknod,
1021 .realpath_fn = skel_realpath,
1022 .chflags_fn = skel_chflags,
1023 .file_id_create_fn = skel_file_id_create,
1024 .copy_chunk_send_fn = skel_copy_chunk_send,
1025 .copy_chunk_recv_fn = skel_copy_chunk_recv,
1026 .get_compression_fn = skel_get_compression,
1027 .set_compression_fn = skel_set_compression,
1029 .streaminfo_fn = skel_streaminfo,
1030 .get_real_filename_fn = skel_get_real_filename,
1031 .connectpath_fn = skel_connectpath,
1032 .brl_lock_windows_fn = skel_brl_lock_windows,
1033 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1034 .brl_cancel_windows_fn = skel_brl_cancel_windows,
1035 .strict_lock_fn = skel_strict_lock,
1036 .strict_unlock_fn = skel_strict_unlock,
1037 .translate_name_fn = skel_translate_name,
1038 .fsctl_fn = skel_fsctl,
1039 .readdir_attr_fn = skel_readdir_attr,
1041 /* NT ACL operations. */
1043 .fget_nt_acl_fn = skel_fget_nt_acl,
1044 .get_nt_acl_fn = skel_get_nt_acl,
1045 .fset_nt_acl_fn = skel_fset_nt_acl,
1047 /* POSIX ACL operations. */
1049 .chmod_acl_fn = skel_chmod_acl,
1050 .fchmod_acl_fn = skel_fchmod_acl,
1052 .sys_acl_get_file_fn = skel_sys_acl_get_file,
1053 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1054 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1055 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1056 .sys_acl_set_file_fn = skel_sys_acl_set_file,
1057 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1058 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1060 /* EA operations. */
1061 .getxattr_fn = skel_getxattr,
1062 .fgetxattr_fn = skel_fgetxattr,
1063 .listxattr_fn = skel_listxattr,
1064 .flistxattr_fn = skel_flistxattr,
1065 .removexattr_fn = skel_removexattr,
1066 .fremovexattr_fn = skel_fremovexattr,
1067 .setxattr_fn = skel_setxattr,
1068 .fsetxattr_fn = skel_fsetxattr,
1070 /* aio operations */
1071 .aio_force_fn = skel_aio_force,
1073 /* offline operations */
1074 .is_offline_fn = skel_is_offline,
1075 .set_offline_fn = skel_set_offline
1079 NTSTATUS vfs_skel_transparent_init(void)
1081 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
1082 &skel_transparent_fns);