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,
52 const struct smb_filename *smb_fname,
57 return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
60 static int skel_get_quota(vfs_handle_struct *handle,
61 const struct smb_filename *smb_fname,
62 enum SMB_QUOTA_TYPE qtype,
66 return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
69 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
70 unid_t id, SMB_DISK_QUOTA *dq)
72 return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
75 static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
77 struct shadow_copy_data *shadow_copy_data,
80 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data,
84 static int skel_statvfs(struct vfs_handle_struct *handle,
85 const struct smb_filename *smb_fname,
86 struct vfs_statvfs_struct *statbuf)
88 return SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
91 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
92 enum timestamp_set_resolution *p_ts_res)
94 return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
97 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
98 struct dfs_GetDFSReferral *r)
100 return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
103 static DIR *skel_opendir(vfs_handle_struct *handle,
104 const struct smb_filename *smb_fname,
108 return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
111 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
113 const char *service_path,
116 return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
120 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
122 const char *base_volume,
128 return SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
129 rw, base_path, snap_path);
132 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
137 return SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path);
140 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
141 const char *mask, uint32_t attr)
143 return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
146 static struct dirent *skel_readdir(vfs_handle_struct *handle,
147 DIR *dirp, SMB_STRUCT_STAT *sbuf)
149 return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
152 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
154 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
157 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
159 return SMB_VFS_NEXT_TELLDIR(handle, dirp);
162 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
164 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
167 static int skel_mkdir(vfs_handle_struct *handle,
168 const struct smb_filename *smb_fname,
171 return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
174 static int skel_rmdir(vfs_handle_struct *handle,
175 const struct smb_filename *smb_fname)
177 return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
180 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
182 return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
185 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
187 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
190 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
191 files_struct *fsp, int flags, mode_t mode)
193 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
196 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
197 struct smb_request *req,
198 uint16_t root_dir_fid,
199 struct smb_filename *smb_fname,
200 uint32_t access_mask,
201 uint32_t share_access,
202 uint32_t create_disposition,
203 uint32_t create_options,
204 uint32_t file_attributes,
205 uint32_t oplock_request,
206 struct smb2_lease *lease,
207 uint64_t allocation_size,
208 uint32_t private_flags,
209 struct security_descriptor *sd,
210 struct ea_list *ea_list,
211 files_struct ** result, int *pinfo,
212 const struct smb2_create_blobs *in_context_blobs,
213 struct smb2_create_blobs *out_context_blobs)
215 return SMB_VFS_NEXT_CREATE_FILE(handle,
228 sd, ea_list, result, pinfo,
229 in_context_blobs, out_context_blobs);
232 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
234 return SMB_VFS_NEXT_CLOSE(handle, fsp);
237 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
238 void *data, size_t n)
240 return SMB_VFS_NEXT_READ(handle, fsp, data, n);
243 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
244 void *data, size_t n, off_t offset)
246 return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
249 struct skel_pread_state {
251 struct vfs_aio_state vfs_aio_state;
254 static void skel_pread_done(struct tevent_req *subreq);
256 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
258 struct tevent_context *ev,
259 struct files_struct *fsp,
260 void *data, size_t n, off_t offset)
262 struct tevent_req *req, *subreq;
263 struct skel_pread_state *state;
265 req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
269 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
271 if (tevent_req_nomem(subreq, req)) {
272 return tevent_req_post(req, ev);
274 tevent_req_set_callback(subreq, skel_pread_done, req);
278 static void skel_pread_done(struct tevent_req *subreq)
280 struct tevent_req *req =
281 tevent_req_callback_data(subreq, struct tevent_req);
282 struct skel_pread_state *state =
283 tevent_req_data(req, struct skel_pread_state);
285 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
287 tevent_req_done(req);
290 static ssize_t skel_pread_recv(struct tevent_req *req,
291 struct vfs_aio_state *vfs_aio_state)
293 struct skel_pread_state *state =
294 tevent_req_data(req, struct skel_pread_state);
296 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
299 *vfs_aio_state = state->vfs_aio_state;
303 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
304 const void *data, size_t n)
306 return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
309 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
310 const void *data, size_t n, off_t offset)
312 return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
315 struct skel_pwrite_state {
317 struct vfs_aio_state vfs_aio_state;
320 static void skel_pwrite_done(struct tevent_req *subreq);
322 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
324 struct tevent_context *ev,
325 struct files_struct *fsp,
327 size_t n, off_t offset)
329 struct tevent_req *req, *subreq;
330 struct skel_pwrite_state *state;
332 req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
336 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
338 if (tevent_req_nomem(subreq, req)) {
339 return tevent_req_post(req, ev);
341 tevent_req_set_callback(subreq, skel_pwrite_done, req);
345 static void skel_pwrite_done(struct tevent_req *subreq)
347 struct tevent_req *req =
348 tevent_req_callback_data(subreq, struct tevent_req);
349 struct skel_pwrite_state *state =
350 tevent_req_data(req, struct skel_pwrite_state);
352 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
354 tevent_req_done(req);
357 static ssize_t skel_pwrite_recv(struct tevent_req *req,
358 struct vfs_aio_state *vfs_aio_state)
360 struct skel_pwrite_state *state =
361 tevent_req_data(req, struct skel_pwrite_state);
363 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
366 *vfs_aio_state = state->vfs_aio_state;
370 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
371 off_t offset, int whence)
373 return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
376 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
377 files_struct *fromfsp, const DATA_BLOB *hdr,
378 off_t offset, size_t n)
380 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
383 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
384 files_struct *tofsp, off_t offset, size_t n)
386 return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
389 static int skel_rename(vfs_handle_struct *handle,
390 const struct smb_filename *smb_fname_src,
391 const struct smb_filename *smb_fname_dst)
393 return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
396 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
398 return SMB_VFS_NEXT_FSYNC(handle, fsp);
401 struct skel_fsync_state {
403 struct vfs_aio_state vfs_aio_state;
406 static void skel_fsync_done(struct tevent_req *subreq);
408 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
410 struct tevent_context *ev,
411 struct files_struct *fsp)
413 struct tevent_req *req, *subreq;
414 struct skel_fsync_state *state;
416 req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
420 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
421 if (tevent_req_nomem(subreq, req)) {
422 return tevent_req_post(req, ev);
424 tevent_req_set_callback(subreq, skel_fsync_done, req);
428 static void skel_fsync_done(struct tevent_req *subreq)
430 struct tevent_req *req =
431 tevent_req_callback_data(subreq, struct tevent_req);
432 struct skel_fsync_state *state =
433 tevent_req_data(req, struct skel_fsync_state);
435 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
437 tevent_req_done(req);
440 static int skel_fsync_recv(struct tevent_req *req,
441 struct vfs_aio_state *vfs_aio_state)
443 struct skel_fsync_state *state =
444 tevent_req_data(req, struct skel_fsync_state);
446 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
449 *vfs_aio_state = state->vfs_aio_state;
453 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
455 return SMB_VFS_NEXT_STAT(handle, smb_fname);
458 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
459 SMB_STRUCT_STAT *sbuf)
461 return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
464 static int skel_lstat(vfs_handle_struct *handle,
465 struct smb_filename *smb_fname)
467 return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
470 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
471 struct files_struct *fsp,
472 const SMB_STRUCT_STAT *sbuf)
474 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
477 static int skel_unlink(vfs_handle_struct *handle,
478 const struct smb_filename *smb_fname)
480 return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
483 static int skel_chmod(vfs_handle_struct *handle,
484 const struct smb_filename *smb_fname,
487 return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
490 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
493 return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
496 static int skel_chown(vfs_handle_struct *handle,
497 const struct smb_filename *smb_fname,
501 return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
504 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
505 uid_t uid, gid_t gid)
507 return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
510 static int skel_lchown(vfs_handle_struct *handle,
511 const struct smb_filename *smb_fname,
515 return SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
518 static int skel_chdir(vfs_handle_struct *handle,
519 const struct smb_filename *smb_fname)
521 return SMB_VFS_NEXT_CHDIR(handle, smb_fname);
524 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
527 return SMB_VFS_NEXT_GETWD(handle, ctx);
530 static int skel_ntimes(vfs_handle_struct *handle,
531 const struct smb_filename *smb_fname,
532 struct smb_file_time *ft)
534 return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
537 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
540 return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
543 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
544 uint32_t mode, off_t offset, off_t len)
546 return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
549 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
550 off_t offset, off_t count, int type)
552 return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
555 static int skel_kernel_flock(struct vfs_handle_struct *handle,
556 struct files_struct *fsp, uint32_t share_mode,
557 uint32_t access_mask)
559 return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
562 static int skel_linux_setlease(struct vfs_handle_struct *handle,
563 struct files_struct *fsp, int leasetype)
565 return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
568 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
569 off_t *poffset, off_t *pcount, int *ptype,
572 return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
575 static int skel_symlink(vfs_handle_struct *handle,
576 const char *link_contents,
577 const struct smb_filename *new_smb_fname)
579 return SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname);
582 static int skel_vfs_readlink(vfs_handle_struct *handle,
583 const struct smb_filename *smb_fname,
587 return SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz);
590 static int skel_link(vfs_handle_struct *handle,
591 const struct smb_filename *old_smb_fname,
592 const struct smb_filename *new_smb_fname)
594 return SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname);
597 static int skel_mknod(vfs_handle_struct *handle,
598 const struct smb_filename *smb_fname,
602 return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
605 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
607 const struct smb_filename *smb_fname)
609 return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
612 static int skel_chflags(vfs_handle_struct *handle,
613 const struct smb_filename *smb_fname,
616 return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
619 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
620 const SMB_STRUCT_STAT *sbuf)
622 return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
625 struct skel_offload_read_state {
626 struct vfs_handle_struct *handle;
630 static void skel_offload_read_done(struct tevent_req *subreq);
632 static struct tevent_req *skel_offload_read_send(
634 struct tevent_context *ev,
635 struct vfs_handle_struct *handle,
636 struct files_struct *fsp,
642 struct tevent_req *req = NULL;
643 struct skel_offload_read_state *state = NULL;
644 struct tevent_req *subreq = NULL;
646 req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
650 *state = (struct skel_offload_read_state) {
654 subreq = SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp,
655 fsctl, ttl, offset, to_copy);
656 if (tevent_req_nomem(subreq, req)) {
657 return tevent_req_post(req, ev);
659 tevent_req_set_callback(subreq, skel_offload_read_done, req);
663 static void skel_offload_read_done(struct tevent_req *subreq)
665 struct tevent_req *req = tevent_req_callback_data(
666 subreq, struct tevent_req);
667 struct skel_offload_read_state *state = tevent_req_data(
668 req, struct skel_offload_read_state);
671 status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq,
676 if (tevent_req_nterror(req, status)) {
680 tevent_req_done(req);
684 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
685 struct vfs_handle_struct *handle,
689 struct skel_offload_read_state *state = tevent_req_data(
690 req, struct skel_offload_read_state);
694 if (tevent_req_is_nterror(req, &status)) {
695 tevent_req_received(req);
699 token = data_blob_talloc(mem_ctx,
701 state->token.length);
703 tevent_req_received(req);
705 if (token.data == NULL) {
706 return NT_STATUS_NO_MEMORY;
713 struct skel_offload_write_state {
714 struct vfs_handle_struct *handle;
717 static void skel_offload_write_done(struct tevent_req *subreq);
719 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
721 struct tevent_context *ev,
724 off_t transfer_offset,
725 struct files_struct *dest_fsp,
729 struct tevent_req *req;
730 struct tevent_req *subreq;
731 struct skel_offload_write_state *state;
733 req = tevent_req_create(mem_ctx, &state, struct skel_offload_write_state);
738 state->handle = handle;
739 subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, state, ev,
740 fsctl, token, transfer_offset,
741 dest_fsp, dest_off, num);
742 if (tevent_req_nomem(subreq, req)) {
743 return tevent_req_post(req, ev);
746 tevent_req_set_callback(subreq, skel_offload_write_done, req);
750 static void skel_offload_write_done(struct tevent_req *subreq)
752 struct tevent_req *req = tevent_req_callback_data(
753 subreq, struct tevent_req);
754 struct skel_offload_write_state *state
755 = tevent_req_data(req, struct skel_offload_write_state);
758 status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle,
762 if (tevent_req_nterror(req, status)) {
765 tevent_req_done(req);
768 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
769 struct tevent_req *req,
772 struct skel_offload_write_state *state
773 = tevent_req_data(req, struct skel_offload_write_state);
776 *copied = state->copied;
777 if (tevent_req_is_nterror(req, &status)) {
778 tevent_req_received(req);
782 tevent_req_received(req);
786 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
788 struct files_struct *fsp,
789 struct smb_filename *smb_fname,
790 uint16_t *_compression_fmt)
792 return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
796 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
798 struct files_struct *fsp,
799 uint16_t compression_fmt)
801 return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
805 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
806 struct files_struct *fsp,
807 const struct smb_filename *smb_fname,
809 unsigned int *num_streams,
810 struct stream_struct **streams)
812 return SMB_VFS_NEXT_STREAMINFO(handle,
820 static int skel_get_real_filename(struct vfs_handle_struct *handle,
823 TALLOC_CTX *mem_ctx, char **found_name)
825 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
826 path, name, mem_ctx, found_name);
829 static const char *skel_connectpath(struct vfs_handle_struct *handle,
830 const struct smb_filename *smb_fname)
832 return SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname);
835 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
836 struct byte_range_lock *br_lck,
837 struct lock_struct *plock,
840 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
841 br_lck, plock, blocking_lock);
844 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
845 struct messaging_context *msg_ctx,
846 struct byte_range_lock *br_lck,
847 const struct lock_struct *plock)
849 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
852 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
853 struct byte_range_lock *br_lck,
854 struct lock_struct *plock)
856 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
859 static bool skel_strict_lock(struct vfs_handle_struct *handle,
860 struct files_struct *fsp,
861 struct lock_struct *plock)
863 return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
866 static void skel_strict_unlock(struct vfs_handle_struct *handle,
867 struct files_struct *fsp,
868 struct lock_struct *plock)
870 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
873 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
874 const char *mapped_name,
875 enum vfs_translate_direction direction,
876 TALLOC_CTX *mem_ctx, char **pmapped_name)
878 return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
879 mem_ctx, pmapped_name);
882 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
883 struct files_struct *fsp,
886 uint16_t req_flags, /* Needed for UNICODE ... */
887 const uint8_t *_in_data,
889 uint8_t ** _out_data,
890 uint32_t max_out_len, uint32_t *out_len)
892 return SMB_VFS_NEXT_FSCTL(handle,
898 in_len, _out_data, max_out_len, out_len);
901 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
902 const struct smb_filename *fname,
904 struct readdir_attr_data **pattr_data)
906 return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
909 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
910 struct smb_filename *smb_fname,
913 return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
918 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
919 struct files_struct *fsp,
922 return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle,
927 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
928 const struct smb_filename *smb_fname,
931 return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
936 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
937 struct files_struct *fsp,
940 return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle,
945 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
946 uint32_t security_info,
948 struct security_descriptor **ppdesc)
950 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx,
954 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
955 const struct smb_filename *smb_fname,
956 uint32_t security_info,
958 struct security_descriptor **ppdesc)
960 return SMB_VFS_NEXT_GET_NT_ACL(handle,
967 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
968 uint32_t security_info_sent,
969 const struct security_descriptor *psd)
971 return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
974 static int skel_chmod_acl(vfs_handle_struct *handle,
975 const struct smb_filename *smb_fname,
978 return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
981 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
984 return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
987 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
988 const struct smb_filename *smb_fname,
992 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx);
995 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
996 files_struct *fsp, TALLOC_CTX *mem_ctx)
998 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
1001 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
1002 const struct smb_filename *smb_fname,
1003 TALLOC_CTX *mem_ctx,
1004 char **blob_description,
1007 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx,
1008 blob_description, blob);
1011 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
1012 files_struct *fsp, TALLOC_CTX *mem_ctx,
1013 char **blob_description, DATA_BLOB *blob)
1015 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx,
1016 blob_description, blob);
1019 static int skel_sys_acl_set_file(vfs_handle_struct *handle,
1020 const struct smb_filename *smb_fname,
1021 SMB_ACL_TYPE_T acltype,
1024 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
1028 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
1031 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
1034 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
1035 const struct smb_filename *smb_fname)
1037 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
1040 static ssize_t skel_getxattr(vfs_handle_struct *handle,
1041 const struct smb_filename *smb_fname,
1046 return SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size);
1049 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
1050 struct files_struct *fsp, const char *name,
1051 void *value, size_t size)
1053 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
1056 static ssize_t skel_listxattr(vfs_handle_struct *handle,
1057 const struct smb_filename *smb_fname,
1061 return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
1064 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
1065 struct files_struct *fsp, char *list,
1068 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
1071 static int skel_removexattr(vfs_handle_struct *handle,
1072 const struct smb_filename *smb_fname,
1075 return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
1078 static int skel_fremovexattr(vfs_handle_struct *handle,
1079 struct files_struct *fsp, const char *name)
1081 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
1084 static int skel_setxattr(vfs_handle_struct *handle,
1085 const struct smb_filename *smb_fname,
1091 return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
1092 name, value, size, flags);
1095 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
1096 const char *name, const void *value, size_t size,
1099 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
1102 static bool skel_aio_force(struct vfs_handle_struct *handle,
1103 struct files_struct *fsp)
1105 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
1108 /* VFS operations structure */
1110 struct vfs_fn_pointers skel_transparent_fns = {
1111 /* Disk operations */
1113 .connect_fn = skel_connect,
1114 .disconnect_fn = skel_disconnect,
1115 .disk_free_fn = skel_disk_free,
1116 .get_quota_fn = skel_get_quota,
1117 .set_quota_fn = skel_set_quota,
1118 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1119 .statvfs_fn = skel_statvfs,
1120 .fs_capabilities_fn = skel_fs_capabilities,
1121 .get_dfs_referrals_fn = skel_get_dfs_referrals,
1122 .snap_check_path_fn = skel_snap_check_path,
1123 .snap_create_fn = skel_snap_create,
1124 .snap_delete_fn = skel_snap_delete,
1126 /* Directory operations */
1128 .opendir_fn = skel_opendir,
1129 .fdopendir_fn = skel_fdopendir,
1130 .readdir_fn = skel_readdir,
1131 .seekdir_fn = skel_seekdir,
1132 .telldir_fn = skel_telldir,
1133 .rewind_dir_fn = skel_rewind_dir,
1134 .mkdir_fn = skel_mkdir,
1135 .rmdir_fn = skel_rmdir,
1136 .closedir_fn = skel_closedir,
1137 .init_search_op_fn = skel_init_search_op,
1139 /* File operations */
1141 .open_fn = skel_open,
1142 .create_file_fn = skel_create_file,
1143 .close_fn = skel_close_fn,
1144 .read_fn = skel_vfs_read,
1145 .pread_fn = skel_pread,
1146 .pread_send_fn = skel_pread_send,
1147 .pread_recv_fn = skel_pread_recv,
1148 .write_fn = skel_write,
1149 .pwrite_fn = skel_pwrite,
1150 .pwrite_send_fn = skel_pwrite_send,
1151 .pwrite_recv_fn = skel_pwrite_recv,
1152 .lseek_fn = skel_lseek,
1153 .sendfile_fn = skel_sendfile,
1154 .recvfile_fn = skel_recvfile,
1155 .rename_fn = skel_rename,
1156 .fsync_fn = skel_fsync,
1157 .fsync_send_fn = skel_fsync_send,
1158 .fsync_recv_fn = skel_fsync_recv,
1159 .stat_fn = skel_stat,
1160 .fstat_fn = skel_fstat,
1161 .lstat_fn = skel_lstat,
1162 .get_alloc_size_fn = skel_get_alloc_size,
1163 .unlink_fn = skel_unlink,
1164 .chmod_fn = skel_chmod,
1165 .fchmod_fn = skel_fchmod,
1166 .chown_fn = skel_chown,
1167 .fchown_fn = skel_fchown,
1168 .lchown_fn = skel_lchown,
1169 .chdir_fn = skel_chdir,
1170 .getwd_fn = skel_getwd,
1171 .ntimes_fn = skel_ntimes,
1172 .ftruncate_fn = skel_ftruncate,
1173 .fallocate_fn = skel_fallocate,
1174 .lock_fn = skel_lock,
1175 .kernel_flock_fn = skel_kernel_flock,
1176 .linux_setlease_fn = skel_linux_setlease,
1177 .getlock_fn = skel_getlock,
1178 .symlink_fn = skel_symlink,
1179 .readlink_fn = skel_vfs_readlink,
1180 .link_fn = skel_link,
1181 .mknod_fn = skel_mknod,
1182 .realpath_fn = skel_realpath,
1183 .chflags_fn = skel_chflags,
1184 .file_id_create_fn = skel_file_id_create,
1185 .offload_read_send_fn = skel_offload_read_send,
1186 .offload_read_recv_fn = skel_offload_read_recv,
1187 .offload_write_send_fn = skel_offload_write_send,
1188 .offload_write_recv_fn = skel_offload_write_recv,
1189 .get_compression_fn = skel_get_compression,
1190 .set_compression_fn = skel_set_compression,
1192 .streaminfo_fn = skel_streaminfo,
1193 .get_real_filename_fn = skel_get_real_filename,
1194 .connectpath_fn = skel_connectpath,
1195 .brl_lock_windows_fn = skel_brl_lock_windows,
1196 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1197 .brl_cancel_windows_fn = skel_brl_cancel_windows,
1198 .strict_lock_fn = skel_strict_lock,
1199 .strict_unlock_fn = skel_strict_unlock,
1200 .translate_name_fn = skel_translate_name,
1201 .fsctl_fn = skel_fsctl,
1202 .readdir_attr_fn = skel_readdir_attr,
1204 /* DOS attributes. */
1205 .get_dos_attributes_fn = skel_get_dos_attributes,
1206 .fget_dos_attributes_fn = skel_fget_dos_attributes,
1207 .set_dos_attributes_fn = skel_set_dos_attributes,
1208 .fset_dos_attributes_fn = skel_fset_dos_attributes,
1210 /* NT ACL operations. */
1212 .fget_nt_acl_fn = skel_fget_nt_acl,
1213 .get_nt_acl_fn = skel_get_nt_acl,
1214 .fset_nt_acl_fn = skel_fset_nt_acl,
1216 /* POSIX ACL operations. */
1218 .chmod_acl_fn = skel_chmod_acl,
1219 .fchmod_acl_fn = skel_fchmod_acl,
1221 .sys_acl_get_file_fn = skel_sys_acl_get_file,
1222 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1223 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1224 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1225 .sys_acl_set_file_fn = skel_sys_acl_set_file,
1226 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1227 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1229 /* EA operations. */
1230 .getxattr_fn = skel_getxattr,
1231 .fgetxattr_fn = skel_fgetxattr,
1232 .listxattr_fn = skel_listxattr,
1233 .flistxattr_fn = skel_flistxattr,
1234 .removexattr_fn = skel_removexattr,
1235 .fremovexattr_fn = skel_fremovexattr,
1236 .setxattr_fn = skel_setxattr,
1237 .fsetxattr_fn = skel_fsetxattr,
1239 /* aio operations */
1240 .aio_force_fn = skel_aio_force,
1244 NTSTATUS vfs_skel_transparent_init(TALLOC_CTX *ctx)
1246 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
1247 &skel_transparent_fns);