s3: VFS: Add SMB_VFS_READ_DFS_PATHAT().
[Samba.git] / examples / VFS / skel_opaque.c
blobc1b5923b7523db35a8fae4ef0d258694715aa116
1 /*
2 * Skeleton VFS module. Implements dummy versions of all VFS
3 * 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 * you must re-implement every function.
36 static int skel_connect(vfs_handle_struct *handle, const char *service,
37 const char *user)
39 errno = ENOSYS;
40 return -1;
43 static void skel_disconnect(vfs_handle_struct *handle)
48 static uint64_t skel_disk_free(vfs_handle_struct *handle,
49 const struct smb_filename *smb_fname,
50 uint64_t *bsize,
51 uint64_t *dfree,
52 uint64_t *dsize)
54 *bsize = 0;
55 *dfree = 0;
56 *dsize = 0;
57 return 0;
60 static int skel_get_quota(vfs_handle_struct *handle,
61 const struct smb_filename *smb_fname,
62 enum SMB_QUOTA_TYPE qtype,
63 unid_t id,
64 SMB_DISK_QUOTA *dq)
66 errno = ENOSYS;
67 return -1;
70 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
71 unid_t id, SMB_DISK_QUOTA *dq)
73 errno = ENOSYS;
74 return -1;
77 static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
78 files_struct *fsp,
79 struct shadow_copy_data *shadow_copy_data,
80 bool labels)
82 errno = ENOSYS;
83 return -1;
86 static int skel_statvfs(struct vfs_handle_struct *handle,
87 const struct smb_filename *smb_fname,
88 struct vfs_statvfs_struct *statbuf)
90 errno = ENOSYS;
91 return -1;
94 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
95 enum timestamp_set_resolution *p_ts_res)
97 return 0;
100 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
101 struct dfs_GetDFSReferral *r)
103 return NT_STATUS_NOT_IMPLEMENTED;
106 static NTSTATUS skel_create_dfs_pathat(struct vfs_handle_struct *handle,
107 struct files_struct *dirfsp,
108 const struct smb_filename *smb_fname,
109 const struct referral *reflist,
110 size_t referral_count)
112 return NT_STATUS_NOT_IMPLEMENTED;
115 static NTSTATUS skel_read_dfs_pathat(struct vfs_handle_struct *handle,
116 TALLOC_CTX *mem_ctx,
117 struct files_struct *dirfsp,
118 const struct smb_filename *smb_fname,
119 struct referral **ppreflist,
120 size_t *preferral_count)
122 return NT_STATUS_NOT_IMPLEMENTED;
125 static DIR *skel_opendir(vfs_handle_struct *handle,
126 const struct smb_filename *smb_fname,
127 const char *mask,
128 uint32_t attr)
130 return NULL;
133 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
134 TALLOC_CTX *mem_ctx,
135 const char *service_path,
136 char **base_volume)
138 return NT_STATUS_NOT_SUPPORTED;
141 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
142 TALLOC_CTX *mem_ctx,
143 const char *base_volume,
144 time_t *tstamp,
145 bool rw,
146 char **base_path,
147 char **snap_path)
149 return NT_STATUS_NOT_SUPPORTED;
152 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
153 TALLOC_CTX *mem_ctx,
154 char *base_path,
155 char *snap_path)
157 return NT_STATUS_NOT_SUPPORTED;
160 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
161 const char *mask, uint32_t attr)
163 return NULL;
166 static struct dirent *skel_readdir(vfs_handle_struct *handle,
167 DIR *dirp, SMB_STRUCT_STAT *sbuf)
169 return NULL;
172 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
177 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
179 return (long)-1;
182 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
187 static int skel_mkdirat(vfs_handle_struct *handle,
188 struct files_struct *dirfsp,
189 const struct smb_filename *smb_fname,
190 mode_t mode)
192 errno = ENOSYS;
193 return -1;
196 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
198 errno = ENOSYS;
199 return -1;
202 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
203 files_struct *fsp, int flags, mode_t mode)
205 errno = ENOSYS;
206 return -1;
209 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
210 struct smb_request *req,
211 uint16_t root_dir_fid,
212 struct smb_filename *smb_fname,
213 uint32_t access_mask,
214 uint32_t share_access,
215 uint32_t create_disposition,
216 uint32_t create_options,
217 uint32_t file_attributes,
218 uint32_t oplock_request,
219 const struct smb2_lease *lease,
220 uint64_t allocation_size,
221 uint32_t private_flags,
222 struct security_descriptor *sd,
223 struct ea_list *ea_list,
224 files_struct **result, int *pinfo,
225 const struct smb2_create_blobs *in_context_blobs,
226 struct smb2_create_blobs *out_context_blobs)
228 return NT_STATUS_NOT_IMPLEMENTED;
231 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
233 errno = ENOSYS;
234 return -1;
237 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
238 void *data, size_t n, off_t offset)
240 errno = ENOSYS;
241 return -1;
244 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
245 TALLOC_CTX *mem_ctx,
246 struct tevent_context *ev,
247 struct files_struct *fsp,
248 void *data, size_t n, off_t offset)
250 return NULL;
253 static ssize_t skel_pread_recv(struct tevent_req *req,
254 struct vfs_aio_state *vfs_aio_state)
256 vfs_aio_state->error = ENOSYS;
257 return -1;
260 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
261 const void *data, size_t n, off_t offset)
263 errno = ENOSYS;
264 return -1;
267 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
268 TALLOC_CTX *mem_ctx,
269 struct tevent_context *ev,
270 struct files_struct *fsp,
271 const void *data,
272 size_t n, off_t offset)
274 return NULL;
277 static ssize_t skel_pwrite_recv(struct tevent_req *req,
278 struct vfs_aio_state *vfs_aio_state)
280 vfs_aio_state->error = ENOSYS;
281 return -1;
284 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
285 off_t offset, int whence)
287 errno = ENOSYS;
288 return (off_t) - 1;
291 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
292 files_struct *fromfsp, const DATA_BLOB *hdr,
293 off_t offset, size_t n)
295 errno = ENOSYS;
296 return -1;
299 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
300 files_struct *tofsp, off_t offset, size_t n)
302 errno = ENOSYS;
303 return -1;
306 static int skel_renameat(vfs_handle_struct *handle,
307 files_struct *srcfsp,
308 const struct smb_filename *smb_fname_src,
309 files_struct *dstfsp,
310 const struct smb_filename *smb_fname_dst)
312 errno = ENOSYS;
313 return -1;
316 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
317 TALLOC_CTX *mem_ctx,
318 struct tevent_context *ev,
319 struct files_struct *fsp)
321 return NULL;
324 static int skel_fsync_recv(struct tevent_req *req,
325 struct vfs_aio_state *vfs_aio_state)
327 vfs_aio_state->error = ENOSYS;
328 return -1;
331 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
333 errno = ENOSYS;
334 return -1;
337 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
338 SMB_STRUCT_STAT *sbuf)
340 errno = ENOSYS;
341 return -1;
344 static int skel_lstat(vfs_handle_struct *handle,
345 struct smb_filename *smb_fname)
347 errno = ENOSYS;
348 return -1;
351 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
352 struct files_struct *fsp,
353 const SMB_STRUCT_STAT *sbuf)
355 errno = ENOSYS;
356 return -1;
359 static int skel_unlinkat(vfs_handle_struct *handle,
360 struct files_struct *dirfsp,
361 const struct smb_filename *smb_fname,
362 int flags)
364 errno = ENOSYS;
365 return -1;
368 static int skel_chmod(vfs_handle_struct *handle,
369 const struct smb_filename *smb_fname,
370 mode_t mode)
372 errno = ENOSYS;
373 return -1;
376 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
377 mode_t mode)
379 errno = ENOSYS;
380 return -1;
383 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
384 uid_t uid, gid_t gid)
386 errno = ENOSYS;
387 return -1;
390 static int skel_lchown(vfs_handle_struct *handle,
391 const struct smb_filename *smb_fname,
392 uid_t uid,
393 gid_t gid)
395 errno = ENOSYS;
396 return -1;
399 static int skel_chdir(vfs_handle_struct *handle,
400 const struct smb_filename *smb_fname)
402 errno = ENOSYS;
403 return -1;
406 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
407 TALLOC_CTX *ctx)
409 errno = ENOSYS;
410 return NULL;
413 static int skel_ntimes(vfs_handle_struct *handle,
414 const struct smb_filename *smb_fname,
415 struct smb_file_time *ft)
417 errno = ENOSYS;
418 return -1;
421 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
422 off_t offset)
424 errno = ENOSYS;
425 return -1;
428 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
429 uint32_t mode, off_t offset, off_t len)
431 errno = ENOSYS;
432 return -1;
435 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
436 off_t offset, off_t count, int type)
438 errno = ENOSYS;
439 return false;
442 static int skel_kernel_flock(struct vfs_handle_struct *handle,
443 struct files_struct *fsp,
444 uint32_t share_mode, uint32_t access_mask)
446 errno = ENOSYS;
447 return -1;
450 static int skel_fcntl(struct vfs_handle_struct *handle,
451 struct files_struct *fsp, int cmd, va_list cmd_arg)
453 errno = ENOSYS;
454 return -1;
457 static int skel_linux_setlease(struct vfs_handle_struct *handle,
458 struct files_struct *fsp, int leasetype)
460 errno = ENOSYS;
461 return -1;
464 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
465 off_t *poffset, off_t *pcount, int *ptype,
466 pid_t *ppid)
468 errno = ENOSYS;
469 return false;
472 static int skel_symlinkat(vfs_handle_struct *handle,
473 const char *link_contents,
474 struct files_struct *dirfsp,
475 const struct smb_filename *new_smb_fname)
477 errno = ENOSYS;
478 return -1;
481 static int skel_vfs_readlinkat(vfs_handle_struct *handle,
482 files_struct *dirfsp,
483 const struct smb_filename *smb_fname,
484 char *buf,
485 size_t bufsiz)
487 errno = ENOSYS;
488 return -1;
491 static int skel_linkat(vfs_handle_struct *handle,
492 files_struct *srcfsp,
493 const struct smb_filename *old_smb_fname,
494 files_struct *dstfsp,
495 const struct smb_filename *new_smb_fname,
496 int flags)
498 errno = ENOSYS;
499 return -1;
502 static int skel_mknodat(vfs_handle_struct *handle,
503 files_struct *dirfsp,
504 const struct smb_filename *smb_fname,
505 mode_t mode,
506 SMB_DEV_T dev)
508 errno = ENOSYS;
509 return -1;
512 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
513 TALLOC_CTX *ctx,
514 const struct smb_filename *smb_fname)
516 errno = ENOSYS;
517 return NULL;
520 static int skel_chflags(vfs_handle_struct *handle,
521 const struct smb_filename *smb_fname,
522 uint flags)
524 errno = ENOSYS;
525 return -1;
528 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
529 const SMB_STRUCT_STAT *sbuf)
531 struct file_id id;
532 ZERO_STRUCT(id);
533 errno = ENOSYS;
534 return id;
537 static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
538 const SMB_STRUCT_STAT *sbuf)
540 errno = ENOSYS;
541 return 0;
544 struct skel_offload_read_state {
545 bool dummy;
548 static struct tevent_req *skel_offload_read_send(
549 TALLOC_CTX *mem_ctx,
550 struct tevent_context *ev,
551 struct vfs_handle_struct *handle,
552 struct files_struct *fsp,
553 uint32_t fsctl,
554 uint32_t ttl,
555 off_t offset,
556 size_t to_copy)
558 struct tevent_req *req = NULL;
559 struct skel_offload_read_state *state = NULL;
561 req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
562 if (req == NULL) {
563 return NULL;
566 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
567 return tevent_req_post(req, ev);
570 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
571 struct vfs_handle_struct *handle,
572 TALLOC_CTX *mem_ctx,
573 DATA_BLOB *_token_blob)
575 NTSTATUS status;
577 if (tevent_req_is_nterror(req, &status)) {
578 tevent_req_received(req);
579 return status;
581 tevent_req_received(req);
583 return NT_STATUS_OK;
586 struct skel_cc_state {
587 uint64_t unused;
589 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
590 TALLOC_CTX *mem_ctx,
591 struct tevent_context *ev,
592 uint32_t fsctl,
593 DATA_BLOB *token,
594 off_t transfer_offset,
595 struct files_struct *dest_fsp,
596 off_t dest_off,
597 off_t num)
599 struct tevent_req *req;
600 struct skel_cc_state *cc_state;
602 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
603 if (req == NULL) {
604 return NULL;
607 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
608 return tevent_req_post(req, ev);
611 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
612 struct tevent_req *req,
613 off_t *copied)
615 NTSTATUS status;
617 if (tevent_req_is_nterror(req, &status)) {
618 tevent_req_received(req);
619 return status;
621 tevent_req_received(req);
623 return NT_STATUS_OK;
626 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
627 TALLOC_CTX *mem_ctx,
628 struct files_struct *fsp,
629 struct smb_filename *smb_fname,
630 uint16_t *_compression_fmt)
632 return NT_STATUS_INVALID_DEVICE_REQUEST;
635 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
636 TALLOC_CTX *mem_ctx,
637 struct files_struct *fsp,
638 uint16_t compression_fmt)
640 return NT_STATUS_INVALID_DEVICE_REQUEST;
643 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
644 struct files_struct *fsp,
645 const struct smb_filename *smb_fname,
646 TALLOC_CTX *mem_ctx,
647 unsigned int *num_streams,
648 struct stream_struct **streams)
650 return NT_STATUS_NOT_IMPLEMENTED;
653 static int skel_get_real_filename(struct vfs_handle_struct *handle,
654 const char *path,
655 const char *name,
656 TALLOC_CTX *mem_ctx, char **found_name)
658 errno = ENOSYS;
659 return -1;
662 static const char *skel_connectpath(struct vfs_handle_struct *handle,
663 const struct smb_filename *smb_fname)
665 errno = ENOSYS;
666 return NULL;
669 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
670 struct byte_range_lock *br_lck,
671 struct lock_struct *plock)
673 return NT_STATUS_NOT_IMPLEMENTED;
676 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
677 struct byte_range_lock *br_lck,
678 const struct lock_struct *plock)
680 errno = ENOSYS;
681 return false;
684 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
685 struct files_struct *fsp,
686 struct lock_struct *plock)
688 errno = ENOSYS;
689 return false;
692 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
693 const char *mapped_name,
694 enum vfs_translate_direction direction,
695 TALLOC_CTX *mem_ctx, char **pmapped_name)
697 return NT_STATUS_NOT_IMPLEMENTED;
700 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
701 struct files_struct *fsp,
702 TALLOC_CTX *ctx,
703 uint32_t function,
704 uint16_t req_flags, /* Needed for UNICODE ... */
705 const uint8_t *_in_data,
706 uint32_t in_len,
707 uint8_t **_out_data,
708 uint32_t max_out_len, uint32_t *out_len)
710 return NT_STATUS_NOT_IMPLEMENTED;
713 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
714 const struct smb_filename *fname,
715 TALLOC_CTX *mem_ctx,
716 struct readdir_attr_data **pattr_data)
718 return NT_STATUS_NOT_IMPLEMENTED;
721 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
722 struct smb_filename *smb_fname,
723 uint32_t *dosmode)
725 return NT_STATUS_NOT_IMPLEMENTED;
728 struct skel_get_dos_attributes_state {
729 struct vfs_aio_state aio_state;
730 uint32_t dosmode;
733 static struct tevent_req *skel_get_dos_attributes_send(
734 TALLOC_CTX *mem_ctx,
735 struct tevent_context *ev,
736 struct vfs_handle_struct *handle,
737 files_struct *dir_fsp,
738 struct smb_filename *smb_fname)
740 struct tevent_req *req = NULL;
741 struct skel_get_dos_attributes_state *state = NULL;
743 req = tevent_req_create(mem_ctx, &state,
744 struct skel_get_dos_attributes_state);
745 if (req == NULL) {
746 return NULL;
749 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
750 return tevent_req_post(req, ev);
753 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
754 struct vfs_aio_state *aio_state,
755 uint32_t *dosmode)
757 struct skel_get_dos_attributes_state *state =
758 tevent_req_data(req,
759 struct skel_get_dos_attributes_state);
760 NTSTATUS status;
762 if (tevent_req_is_nterror(req, &status)) {
763 tevent_req_received(req);
764 return status;
767 *aio_state = state->aio_state;
768 *dosmode = state->dosmode;
769 tevent_req_received(req);
770 return NT_STATUS_OK;
773 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
774 struct files_struct *fsp,
775 uint32_t *dosmode)
777 return NT_STATUS_NOT_IMPLEMENTED;
780 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
781 const struct smb_filename *smb_fname,
782 uint32_t dosmode)
784 return NT_STATUS_NOT_IMPLEMENTED;
787 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
788 struct files_struct *fsp,
789 uint32_t dosmode)
791 return NT_STATUS_NOT_IMPLEMENTED;
794 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
795 uint32_t security_info,
796 TALLOC_CTX *mem_ctx,
797 struct security_descriptor **ppdesc)
799 return NT_STATUS_NOT_IMPLEMENTED;
802 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
803 const struct smb_filename *smb_fname,
804 uint32_t security_info,
805 TALLOC_CTX *mem_ctx,
806 struct security_descriptor **ppdesc)
808 return NT_STATUS_NOT_IMPLEMENTED;
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 NT_STATUS_NOT_IMPLEMENTED;
818 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
819 const struct smb_filename *smb_fname,
820 SMB_ACL_TYPE_T type,
821 TALLOC_CTX *mem_ctx)
823 errno = ENOSYS;
824 return (SMB_ACL_T) NULL;
827 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
828 files_struct *fsp, TALLOC_CTX *mem_ctx)
830 errno = ENOSYS;
831 return (SMB_ACL_T) NULL;
834 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
835 const struct smb_filename *smb_fname,
836 TALLOC_CTX *mem_ctx,
837 char **blob_description,
838 DATA_BLOB *blob)
840 errno = ENOSYS;
841 return -1;
844 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
845 files_struct *fsp, TALLOC_CTX *mem_ctx,
846 char **blob_description, DATA_BLOB *blob)
848 errno = ENOSYS;
849 return -1;
852 static int skel_sys_acl_set_file(vfs_handle_struct *handle,
853 const struct smb_filename *smb_fname,
854 SMB_ACL_TYPE_T acltype,
855 SMB_ACL_T theacl)
857 errno = ENOSYS;
858 return -1;
861 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
862 SMB_ACL_T theacl)
864 errno = ENOSYS;
865 return -1;
868 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
869 const struct smb_filename *smb_fname)
871 errno = ENOSYS;
872 return -1;
875 static ssize_t skel_getxattr(vfs_handle_struct *handle,
876 const struct smb_filename *smb_fname,
877 const char *name,
878 void *value,
879 size_t size)
881 errno = ENOSYS;
882 return -1;
885 struct skel_getxattrat_state {
886 struct vfs_aio_state aio_state;
887 ssize_t xattr_size;
888 uint8_t *xattr_value;
891 static struct tevent_req *skel_getxattrat_send(
892 TALLOC_CTX *mem_ctx,
893 struct tevent_context *ev,
894 struct vfs_handle_struct *handle,
895 files_struct *dir_fsp,
896 const struct smb_filename *smb_fname,
897 const char *xattr_name,
898 size_t alloc_hint)
900 struct tevent_req *req = NULL;
901 struct skel_getxattrat_state *state = NULL;
903 req = tevent_req_create(mem_ctx, &state,
904 struct skel_getxattrat_state);
905 if (req == NULL) {
906 return NULL;
909 tevent_req_error(req, ENOSYS);
910 return tevent_req_post(req, ev);
913 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
914 struct vfs_aio_state *aio_state,
915 TALLOC_CTX *mem_ctx,
916 uint8_t **xattr_value)
918 struct skel_getxattrat_state *state = tevent_req_data(
919 req, struct skel_getxattrat_state);
920 ssize_t xattr_size;
922 if (tevent_req_is_unix_error(req, &aio_state->error)) {
923 tevent_req_received(req);
924 return -1;
927 *aio_state = state->aio_state;
928 xattr_size = state->xattr_size;
929 if (xattr_value != NULL) {
930 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
933 tevent_req_received(req);
934 return xattr_size;
937 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
938 struct files_struct *fsp, const char *name,
939 void *value, size_t size)
941 errno = ENOSYS;
942 return -1;
945 static ssize_t skel_listxattr(vfs_handle_struct *handle,
946 const struct smb_filename *smb_fname,
947 char *list,
948 size_t size)
950 errno = ENOSYS;
951 return -1;
954 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
955 struct files_struct *fsp, char *list,
956 size_t size)
958 errno = ENOSYS;
959 return -1;
962 static int skel_removexattr(vfs_handle_struct *handle,
963 const struct smb_filename *smb_fname,
964 const char *name)
966 errno = ENOSYS;
967 return -1;
970 static int skel_fremovexattr(vfs_handle_struct *handle,
971 struct files_struct *fsp, const char *name)
973 errno = ENOSYS;
974 return -1;
977 static int skel_setxattr(vfs_handle_struct *handle,
978 const struct smb_filename *smb_fname,
979 const char *name,
980 const void *value,
981 size_t size,
982 int flags)
984 errno = ENOSYS;
985 return -1;
988 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
989 const char *name, const void *value, size_t size,
990 int flags)
992 errno = ENOSYS;
993 return -1;
996 static bool skel_aio_force(struct vfs_handle_struct *handle,
997 struct files_struct *fsp)
999 errno = ENOSYS;
1000 return false;
1003 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
1004 struct smb_filename *file,
1005 struct security_acl *sacl,
1006 uint32_t access_requested,
1007 uint32_t access_denied)
1009 return NT_STATUS_NOT_IMPLEMENTED;
1012 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
1013 struct files_struct *fsp,
1014 TALLOC_CTX *mem_ctx,
1015 DATA_BLOB *cookie)
1017 return NT_STATUS_NOT_IMPLEMENTED;
1020 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
1021 struct files_struct *fsp,
1022 const DATA_BLOB old_cookie,
1023 TALLOC_CTX *mem_ctx,
1024 DATA_BLOB *new_cookie)
1026 return NT_STATUS_NOT_IMPLEMENTED;
1029 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
1030 struct smb_request *smb1req,
1031 struct smbXsrv_open *op,
1032 const DATA_BLOB old_cookie,
1033 TALLOC_CTX *mem_ctx,
1034 struct files_struct **fsp,
1035 DATA_BLOB *new_cookie)
1037 return NT_STATUS_NOT_IMPLEMENTED;
1040 /* VFS operations structure */
1042 static struct vfs_fn_pointers skel_opaque_fns = {
1043 /* Disk operations */
1045 .connect_fn = skel_connect,
1046 .disconnect_fn = skel_disconnect,
1047 .disk_free_fn = skel_disk_free,
1048 .get_quota_fn = skel_get_quota,
1049 .set_quota_fn = skel_set_quota,
1050 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1051 .statvfs_fn = skel_statvfs,
1052 .fs_capabilities_fn = skel_fs_capabilities,
1053 .get_dfs_referrals_fn = skel_get_dfs_referrals,
1054 .create_dfs_pathat_fn = skel_create_dfs_pathat,
1055 .read_dfs_pathat_fn = skel_read_dfs_pathat,
1056 .snap_check_path_fn = skel_snap_check_path,
1057 .snap_create_fn = skel_snap_create,
1058 .snap_delete_fn = skel_snap_delete,
1060 /* Directory operations */
1062 .opendir_fn = skel_opendir,
1063 .fdopendir_fn = skel_fdopendir,
1064 .readdir_fn = skel_readdir,
1065 .seekdir_fn = skel_seekdir,
1066 .telldir_fn = skel_telldir,
1067 .rewind_dir_fn = skel_rewind_dir,
1068 .mkdirat_fn = skel_mkdirat,
1069 .closedir_fn = skel_closedir,
1071 /* File operations */
1073 .open_fn = skel_open,
1074 .create_file_fn = skel_create_file,
1075 .close_fn = skel_close_fn,
1076 .pread_fn = skel_pread,
1077 .pread_send_fn = skel_pread_send,
1078 .pread_recv_fn = skel_pread_recv,
1079 .pwrite_fn = skel_pwrite,
1080 .pwrite_send_fn = skel_pwrite_send,
1081 .pwrite_recv_fn = skel_pwrite_recv,
1082 .lseek_fn = skel_lseek,
1083 .sendfile_fn = skel_sendfile,
1084 .recvfile_fn = skel_recvfile,
1085 .renameat_fn = skel_renameat,
1086 .fsync_send_fn = skel_fsync_send,
1087 .fsync_recv_fn = skel_fsync_recv,
1088 .stat_fn = skel_stat,
1089 .fstat_fn = skel_fstat,
1090 .lstat_fn = skel_lstat,
1091 .get_alloc_size_fn = skel_get_alloc_size,
1092 .unlinkat_fn = skel_unlinkat,
1093 .chmod_fn = skel_chmod,
1094 .fchmod_fn = skel_fchmod,
1095 .fchown_fn = skel_fchown,
1096 .lchown_fn = skel_lchown,
1097 .chdir_fn = skel_chdir,
1098 .getwd_fn = skel_getwd,
1099 .ntimes_fn = skel_ntimes,
1100 .ftruncate_fn = skel_ftruncate,
1101 .fallocate_fn = skel_fallocate,
1102 .lock_fn = skel_lock,
1103 .kernel_flock_fn = skel_kernel_flock,
1104 .fcntl_fn = skel_fcntl,
1105 .linux_setlease_fn = skel_linux_setlease,
1106 .getlock_fn = skel_getlock,
1107 .symlinkat_fn = skel_symlinkat,
1108 .readlinkat_fn = skel_vfs_readlinkat,
1109 .linkat_fn = skel_linkat,
1110 .mknodat_fn = skel_mknodat,
1111 .realpath_fn = skel_realpath,
1112 .chflags_fn = skel_chflags,
1113 .file_id_create_fn = skel_file_id_create,
1114 .fs_file_id_fn = skel_fs_file_id,
1115 .offload_read_send_fn = skel_offload_read_send,
1116 .offload_read_recv_fn = skel_offload_read_recv,
1117 .offload_write_send_fn = skel_offload_write_send,
1118 .offload_write_recv_fn = skel_offload_write_recv,
1119 .get_compression_fn = skel_get_compression,
1120 .set_compression_fn = skel_set_compression,
1122 .streaminfo_fn = skel_streaminfo,
1123 .get_real_filename_fn = skel_get_real_filename,
1124 .connectpath_fn = skel_connectpath,
1125 .brl_lock_windows_fn = skel_brl_lock_windows,
1126 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1127 .strict_lock_check_fn = skel_strict_lock_check,
1128 .translate_name_fn = skel_translate_name,
1129 .fsctl_fn = skel_fsctl,
1130 .readdir_attr_fn = skel_readdir_attr,
1131 .audit_file_fn = skel_audit_file,
1133 /* DOS attributes. */
1134 .get_dos_attributes_fn = skel_get_dos_attributes,
1135 .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1136 .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1137 .fget_dos_attributes_fn = skel_fget_dos_attributes,
1138 .set_dos_attributes_fn = skel_set_dos_attributes,
1139 .fset_dos_attributes_fn = skel_fset_dos_attributes,
1141 /* NT ACL operations. */
1143 .fget_nt_acl_fn = skel_fget_nt_acl,
1144 .get_nt_acl_fn = skel_get_nt_acl,
1145 .fset_nt_acl_fn = skel_fset_nt_acl,
1147 /* POSIX ACL operations. */
1149 .sys_acl_get_file_fn = skel_sys_acl_get_file,
1150 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1151 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1152 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1153 .sys_acl_set_file_fn = skel_sys_acl_set_file,
1154 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1155 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1157 /* EA operations. */
1158 .getxattr_fn = skel_getxattr,
1159 .getxattrat_send_fn = skel_getxattrat_send,
1160 .getxattrat_recv_fn = skel_getxattrat_recv,
1161 .fgetxattr_fn = skel_fgetxattr,
1162 .listxattr_fn = skel_listxattr,
1163 .flistxattr_fn = skel_flistxattr,
1164 .removexattr_fn = skel_removexattr,
1165 .fremovexattr_fn = skel_fremovexattr,
1166 .setxattr_fn = skel_setxattr,
1167 .fsetxattr_fn = skel_fsetxattr,
1169 /* aio operations */
1170 .aio_force_fn = skel_aio_force,
1172 /* durable handle operations */
1173 .durable_cookie_fn = skel_durable_cookie,
1174 .durable_disconnect_fn = skel_durable_disconnect,
1175 .durable_reconnect_fn = skel_durable_reconnect,
1178 static_decl_vfs;
1179 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1182 * smb_vfs_assert_all_fns() makes sure every
1183 * call is implemented.
1185 * An opaque module requires this!
1187 smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1188 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1189 &skel_opaque_fns);