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,
168 const struct smb_filename *smb_fname)
170 return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
173 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
175 return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
178 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
180 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
183 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
184 files_struct *fsp, int flags, mode_t mode)
186 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
189 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
190 struct smb_request *req,
191 uint16_t root_dir_fid,
192 struct smb_filename *smb_fname,
193 uint32_t access_mask,
194 uint32_t share_access,
195 uint32_t create_disposition,
196 uint32_t create_options,
197 uint32_t file_attributes,
198 uint32_t oplock_request,
199 struct smb2_lease *lease,
200 uint64_t allocation_size,
201 uint32_t private_flags,
202 struct security_descriptor *sd,
203 struct ea_list *ea_list,
204 files_struct ** result, int *pinfo,
205 const struct smb2_create_blobs *in_context_blobs,
206 struct smb2_create_blobs *out_context_blobs)
208 return SMB_VFS_NEXT_CREATE_FILE(handle,
221 sd, ea_list, result, pinfo,
222 in_context_blobs, out_context_blobs);
225 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
227 return SMB_VFS_NEXT_CLOSE(handle, fsp);
230 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
231 void *data, size_t n)
233 return SMB_VFS_NEXT_READ(handle, fsp, data, n);
236 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
237 void *data, size_t n, off_t offset)
239 return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
242 struct skel_pread_state {
247 static void skel_pread_done(struct tevent_req *subreq);
249 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
251 struct tevent_context *ev,
252 struct files_struct *fsp,
253 void *data, size_t n, off_t offset)
255 struct tevent_req *req, *subreq;
256 struct skel_pread_state *state;
258 req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
262 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
264 if (tevent_req_nomem(subreq, req)) {
265 return tevent_req_post(req, ev);
267 tevent_req_set_callback(subreq, skel_pread_done, req);
271 static void skel_pread_done(struct tevent_req *subreq)
273 struct tevent_req *req =
274 tevent_req_callback_data(subreq, struct tevent_req);
275 struct skel_pread_state *state =
276 tevent_req_data(req, struct skel_pread_state);
278 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
280 tevent_req_done(req);
283 static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
285 struct skel_pread_state *state =
286 tevent_req_data(req, struct skel_pread_state);
288 if (tevent_req_is_unix_error(req, err)) {
295 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
296 const void *data, size_t n)
298 return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
301 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
302 const void *data, size_t n, off_t offset)
304 return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
307 struct skel_pwrite_state {
312 static void skel_pwrite_done(struct tevent_req *subreq);
314 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
316 struct tevent_context *ev,
317 struct files_struct *fsp,
319 size_t n, off_t offset)
321 struct tevent_req *req, *subreq;
322 struct skel_pwrite_state *state;
324 req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
328 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
330 if (tevent_req_nomem(subreq, req)) {
331 return tevent_req_post(req, ev);
333 tevent_req_set_callback(subreq, skel_pwrite_done, req);
337 static void skel_pwrite_done(struct tevent_req *subreq)
339 struct tevent_req *req =
340 tevent_req_callback_data(subreq, struct tevent_req);
341 struct skel_pwrite_state *state =
342 tevent_req_data(req, struct skel_pwrite_state);
344 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
346 tevent_req_done(req);
349 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
351 struct skel_pwrite_state *state =
352 tevent_req_data(req, struct skel_pwrite_state);
354 if (tevent_req_is_unix_error(req, err)) {
361 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
362 off_t offset, int whence)
364 return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
367 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
368 files_struct *fromfsp, const DATA_BLOB *hdr,
369 off_t offset, size_t n)
371 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
374 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
375 files_struct *tofsp, off_t offset, size_t n)
377 return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
380 static int skel_rename(vfs_handle_struct *handle,
381 const struct smb_filename *smb_fname_src,
382 const struct smb_filename *smb_fname_dst)
384 return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
387 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
389 return SMB_VFS_NEXT_FSYNC(handle, fsp);
392 struct skel_fsync_state {
397 static void skel_fsync_done(struct tevent_req *subreq);
399 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
401 struct tevent_context *ev,
402 struct files_struct *fsp)
404 struct tevent_req *req, *subreq;
405 struct skel_fsync_state *state;
407 req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
411 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
412 if (tevent_req_nomem(subreq, req)) {
413 return tevent_req_post(req, ev);
415 tevent_req_set_callback(subreq, skel_fsync_done, req);
419 static void skel_fsync_done(struct tevent_req *subreq)
421 struct tevent_req *req =
422 tevent_req_callback_data(subreq, struct tevent_req);
423 struct skel_fsync_state *state =
424 tevent_req_data(req, struct skel_fsync_state);
426 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
428 tevent_req_done(req);
431 static int skel_fsync_recv(struct tevent_req *req, int *err)
433 struct skel_fsync_state *state =
434 tevent_req_data(req, struct skel_fsync_state);
436 if (tevent_req_is_unix_error(req, err)) {
443 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
445 return SMB_VFS_NEXT_STAT(handle, smb_fname);
448 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
449 SMB_STRUCT_STAT *sbuf)
451 return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
454 static int skel_lstat(vfs_handle_struct *handle,
455 struct smb_filename *smb_fname)
457 return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
460 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
461 struct files_struct *fsp,
462 const SMB_STRUCT_STAT *sbuf)
464 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
467 static int skel_unlink(vfs_handle_struct *handle,
468 const struct smb_filename *smb_fname)
470 return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
473 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
475 return SMB_VFS_NEXT_CHMOD(handle, path, mode);
478 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
481 return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
484 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid,
487 return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
490 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
491 uid_t uid, gid_t gid)
493 return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
496 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid,
499 return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
502 static int skel_chdir(vfs_handle_struct *handle, const char *path)
504 return SMB_VFS_NEXT_CHDIR(handle, path);
507 static char *skel_getwd(vfs_handle_struct *handle)
509 return SMB_VFS_NEXT_GETWD(handle);
512 static int skel_ntimes(vfs_handle_struct *handle,
513 const struct smb_filename *smb_fname,
514 struct smb_file_time *ft)
516 return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
519 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
522 return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
525 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
526 uint32_t mode, off_t offset, off_t len)
528 return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
531 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
532 off_t offset, off_t count, int type)
534 return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
537 static int skel_kernel_flock(struct vfs_handle_struct *handle,
538 struct files_struct *fsp, uint32_t share_mode,
539 uint32_t access_mask)
541 return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
544 static int skel_linux_setlease(struct vfs_handle_struct *handle,
545 struct files_struct *fsp, int leasetype)
547 return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
550 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
551 off_t *poffset, off_t *pcount, int *ptype,
554 return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
557 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
560 return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
563 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
564 char *buf, size_t bufsiz)
566 return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
569 static int skel_link(vfs_handle_struct *handle, const char *oldpath,
572 return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
575 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
578 return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
581 static char *skel_realpath(vfs_handle_struct *handle, const char *path)
583 return SMB_VFS_NEXT_REALPATH(handle, path);
586 static int skel_chflags(vfs_handle_struct *handle, const char *path,
589 return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
592 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
593 const SMB_STRUCT_STAT *sbuf)
595 return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
598 struct skel_cc_state {
599 struct vfs_handle_struct *handle;
602 static void skel_copy_chunk_done(struct tevent_req *subreq);
604 static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
606 struct tevent_context *ev,
607 struct files_struct *src_fsp,
609 struct files_struct *dest_fsp,
613 struct tevent_req *req;
614 struct tevent_req *subreq;
615 struct skel_cc_state *cc_state;
617 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
622 cc_state->handle = handle;
623 subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, cc_state, ev,
625 dest_fsp, dest_off, num);
626 if (tevent_req_nomem(subreq, req)) {
627 return tevent_req_post(req, ev);
630 tevent_req_set_callback(subreq, skel_copy_chunk_done, req);
634 static void skel_copy_chunk_done(struct tevent_req *subreq)
636 struct tevent_req *req = tevent_req_callback_data(
637 subreq, struct tevent_req);
638 struct skel_cc_state *cc_state
639 = tevent_req_data(req, struct skel_cc_state);
642 status = SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state->handle,
646 if (tevent_req_nterror(req, status)) {
649 tevent_req_done(req);
652 static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
653 struct tevent_req *req,
656 struct skel_cc_state *cc_state
657 = tevent_req_data(req, struct skel_cc_state);
660 *copied = cc_state->copied;
661 if (tevent_req_is_nterror(req, &status)) {
662 tevent_req_received(req);
666 tevent_req_received(req);
670 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
672 struct files_struct *fsp,
673 struct smb_filename *smb_fname,
674 uint16_t *_compression_fmt)
676 return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
680 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
682 struct files_struct *fsp,
683 uint16_t compression_fmt)
685 return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
689 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
690 struct files_struct *fsp,
693 unsigned int *num_streams,
694 struct stream_struct **streams)
696 return SMB_VFS_NEXT_STREAMINFO(handle,
698 fname, mem_ctx, num_streams, streams);
701 static int skel_get_real_filename(struct vfs_handle_struct *handle,
704 TALLOC_CTX *mem_ctx, char **found_name)
706 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
707 path, name, mem_ctx, found_name);
710 static const char *skel_connectpath(struct vfs_handle_struct *handle,
711 const char *filename)
713 return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
716 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
717 struct byte_range_lock *br_lck,
718 struct lock_struct *plock,
721 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
722 br_lck, plock, blocking_lock);
725 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
726 struct messaging_context *msg_ctx,
727 struct byte_range_lock *br_lck,
728 const struct lock_struct *plock)
730 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
733 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
734 struct byte_range_lock *br_lck,
735 struct lock_struct *plock)
737 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
740 static bool skel_strict_lock(struct vfs_handle_struct *handle,
741 struct files_struct *fsp,
742 struct lock_struct *plock)
744 return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
747 static void skel_strict_unlock(struct vfs_handle_struct *handle,
748 struct files_struct *fsp,
749 struct lock_struct *plock)
751 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
754 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
755 const char *mapped_name,
756 enum vfs_translate_direction direction,
757 TALLOC_CTX *mem_ctx, char **pmapped_name)
759 return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
760 mem_ctx, pmapped_name);
763 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
764 struct files_struct *fsp,
767 uint16_t req_flags, /* Needed for UNICODE ... */
768 const uint8_t *_in_data,
770 uint8_t ** _out_data,
771 uint32_t max_out_len, uint32_t *out_len)
773 return SMB_VFS_NEXT_FSCTL(handle,
779 in_len, _out_data, max_out_len, out_len);
782 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
783 const struct smb_filename *fname,
785 struct readdir_attr_data **pattr_data)
787 return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
790 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
791 uint32_t security_info,
793 struct security_descriptor **ppdesc)
795 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx,
799 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
800 const struct smb_filename *smb_fname,
801 uint32_t security_info,
803 struct security_descriptor **ppdesc)
805 return SMB_VFS_NEXT_GET_NT_ACL(handle,
812 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
813 uint32_t security_info_sent,
814 const struct security_descriptor *psd)
816 return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
819 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
822 return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
825 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
828 return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
831 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
836 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
839 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
840 files_struct *fsp, TALLOC_CTX *mem_ctx)
842 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
845 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
846 const char *path_p, TALLOC_CTX *mem_ctx,
847 char **blob_description, DATA_BLOB *blob)
849 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx,
850 blob_description, blob);
853 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
854 files_struct *fsp, TALLOC_CTX *mem_ctx,
855 char **blob_description, DATA_BLOB *blob)
857 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx,
858 blob_description, blob);
861 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
862 SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
864 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
867 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
870 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
873 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
876 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
879 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
880 const char *name, void *value, size_t size)
882 return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
885 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
886 struct files_struct *fsp, const char *name,
887 void *value, size_t size)
889 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
892 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
893 char *list, size_t size)
895 return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
898 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
899 struct files_struct *fsp, char *list,
902 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
905 static int skel_removexattr(vfs_handle_struct *handle, const char *path,
908 return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
911 static int skel_fremovexattr(vfs_handle_struct *handle,
912 struct files_struct *fsp, const char *name)
914 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
917 static int skel_setxattr(vfs_handle_struct *handle, const char *path,
918 const char *name, const void *value, size_t size,
921 return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
924 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
925 const char *name, const void *value, size_t size,
928 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
931 static bool skel_aio_force(struct vfs_handle_struct *handle,
932 struct files_struct *fsp)
934 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
937 static bool skel_is_offline(struct vfs_handle_struct *handle,
938 const struct smb_filename *fname,
939 SMB_STRUCT_STAT *sbuf)
941 return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
944 static int skel_set_offline(struct vfs_handle_struct *handle,
945 const struct smb_filename *fname)
947 return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
950 /* VFS operations structure */
952 struct vfs_fn_pointers skel_transparent_fns = {
953 /* Disk operations */
955 .connect_fn = skel_connect,
956 .disconnect_fn = skel_disconnect,
957 .disk_free_fn = skel_disk_free,
958 .get_quota_fn = skel_get_quota,
959 .set_quota_fn = skel_set_quota,
960 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
961 .statvfs_fn = skel_statvfs,
962 .fs_capabilities_fn = skel_fs_capabilities,
963 .get_dfs_referrals_fn = skel_get_dfs_referrals,
964 .snap_check_path_fn = skel_snap_check_path,
965 .snap_create_fn = skel_snap_create,
966 .snap_delete_fn = skel_snap_delete,
968 /* Directory operations */
970 .opendir_fn = skel_opendir,
971 .fdopendir_fn = skel_fdopendir,
972 .readdir_fn = skel_readdir,
973 .seekdir_fn = skel_seekdir,
974 .telldir_fn = skel_telldir,
975 .rewind_dir_fn = skel_rewind_dir,
976 .mkdir_fn = skel_mkdir,
977 .rmdir_fn = skel_rmdir,
978 .closedir_fn = skel_closedir,
979 .init_search_op_fn = skel_init_search_op,
981 /* File operations */
983 .open_fn = skel_open,
984 .create_file_fn = skel_create_file,
985 .close_fn = skel_close_fn,
986 .read_fn = skel_vfs_read,
987 .pread_fn = skel_pread,
988 .pread_send_fn = skel_pread_send,
989 .pread_recv_fn = skel_pread_recv,
990 .write_fn = skel_write,
991 .pwrite_fn = skel_pwrite,
992 .pwrite_send_fn = skel_pwrite_send,
993 .pwrite_recv_fn = skel_pwrite_recv,
994 .lseek_fn = skel_lseek,
995 .sendfile_fn = skel_sendfile,
996 .recvfile_fn = skel_recvfile,
997 .rename_fn = skel_rename,
998 .fsync_fn = skel_fsync,
999 .fsync_send_fn = skel_fsync_send,
1000 .fsync_recv_fn = skel_fsync_recv,
1001 .stat_fn = skel_stat,
1002 .fstat_fn = skel_fstat,
1003 .lstat_fn = skel_lstat,
1004 .get_alloc_size_fn = skel_get_alloc_size,
1005 .unlink_fn = skel_unlink,
1006 .chmod_fn = skel_chmod,
1007 .fchmod_fn = skel_fchmod,
1008 .chown_fn = skel_chown,
1009 .fchown_fn = skel_fchown,
1010 .lchown_fn = skel_lchown,
1011 .chdir_fn = skel_chdir,
1012 .getwd_fn = skel_getwd,
1013 .ntimes_fn = skel_ntimes,
1014 .ftruncate_fn = skel_ftruncate,
1015 .fallocate_fn = skel_fallocate,
1016 .lock_fn = skel_lock,
1017 .kernel_flock_fn = skel_kernel_flock,
1018 .linux_setlease_fn = skel_linux_setlease,
1019 .getlock_fn = skel_getlock,
1020 .symlink_fn = skel_symlink,
1021 .readlink_fn = skel_vfs_readlink,
1022 .link_fn = skel_link,
1023 .mknod_fn = skel_mknod,
1024 .realpath_fn = skel_realpath,
1025 .chflags_fn = skel_chflags,
1026 .file_id_create_fn = skel_file_id_create,
1027 .copy_chunk_send_fn = skel_copy_chunk_send,
1028 .copy_chunk_recv_fn = skel_copy_chunk_recv,
1029 .get_compression_fn = skel_get_compression,
1030 .set_compression_fn = skel_set_compression,
1032 .streaminfo_fn = skel_streaminfo,
1033 .get_real_filename_fn = skel_get_real_filename,
1034 .connectpath_fn = skel_connectpath,
1035 .brl_lock_windows_fn = skel_brl_lock_windows,
1036 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1037 .brl_cancel_windows_fn = skel_brl_cancel_windows,
1038 .strict_lock_fn = skel_strict_lock,
1039 .strict_unlock_fn = skel_strict_unlock,
1040 .translate_name_fn = skel_translate_name,
1041 .fsctl_fn = skel_fsctl,
1042 .readdir_attr_fn = skel_readdir_attr,
1044 /* NT ACL operations. */
1046 .fget_nt_acl_fn = skel_fget_nt_acl,
1047 .get_nt_acl_fn = skel_get_nt_acl,
1048 .fset_nt_acl_fn = skel_fset_nt_acl,
1050 /* POSIX ACL operations. */
1052 .chmod_acl_fn = skel_chmod_acl,
1053 .fchmod_acl_fn = skel_fchmod_acl,
1055 .sys_acl_get_file_fn = skel_sys_acl_get_file,
1056 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1057 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1058 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1059 .sys_acl_set_file_fn = skel_sys_acl_set_file,
1060 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1061 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1063 /* EA operations. */
1064 .getxattr_fn = skel_getxattr,
1065 .fgetxattr_fn = skel_fgetxattr,
1066 .listxattr_fn = skel_listxattr,
1067 .flistxattr_fn = skel_flistxattr,
1068 .removexattr_fn = skel_removexattr,
1069 .fremovexattr_fn = skel_fremovexattr,
1070 .setxattr_fn = skel_setxattr,
1071 .fsetxattr_fn = skel_fsetxattr,
1073 /* aio operations */
1074 .aio_force_fn = skel_aio_force,
1076 /* offline operations */
1077 .is_offline_fn = skel_is_offline,
1078 .set_offline_fn = skel_set_offline
1082 NTSTATUS vfs_skel_transparent_init(void)
1084 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
1085 &skel_transparent_fns);