s4:ldap_server: Store whether an LDAP connection is over ldapi
[Samba.git] / examples / VFS / skel_opaque.c
blob255fa830402e5e854ec8771bfc74609a36eab1d2
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 struct smb_filename *smb_fname,
119 struct referral **ppreflist,
120 size_t *preferral_count)
122 return NT_STATUS_NOT_IMPLEMENTED;
125 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
126 TALLOC_CTX *mem_ctx,
127 const char *service_path,
128 char **base_volume)
130 return NT_STATUS_NOT_SUPPORTED;
133 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
134 TALLOC_CTX *mem_ctx,
135 const char *base_volume,
136 time_t *tstamp,
137 bool rw,
138 char **base_path,
139 char **snap_path)
141 return NT_STATUS_NOT_SUPPORTED;
144 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
145 TALLOC_CTX *mem_ctx,
146 char *base_path,
147 char *snap_path)
149 return NT_STATUS_NOT_SUPPORTED;
152 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
153 const char *mask, uint32_t attr)
155 return NULL;
158 static struct dirent *skel_readdir(vfs_handle_struct *handle,
159 struct files_struct *dirfsp,
160 DIR *dirp)
162 return NULL;
165 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
170 static int skel_mkdirat(vfs_handle_struct *handle,
171 struct files_struct *dirfsp,
172 const struct smb_filename *smb_fname,
173 mode_t mode)
175 errno = ENOSYS;
176 return -1;
179 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
181 errno = ENOSYS;
182 return -1;
185 static int skel_openat(struct vfs_handle_struct *handle,
186 const struct files_struct *dirfsp,
187 const struct smb_filename *smb_fname,
188 struct files_struct *fsp,
189 const struct vfs_open_how *how)
191 if (how->resolve != 0) {
192 errno = ENOSYS;
193 return -1;
196 errno = ENOSYS;
197 return -1;
200 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
201 struct smb_request *req,
202 struct files_struct *dirfsp,
203 struct smb_filename *smb_fname,
204 uint32_t access_mask,
205 uint32_t share_access,
206 uint32_t create_disposition,
207 uint32_t create_options,
208 uint32_t file_attributes,
209 uint32_t oplock_request,
210 const struct smb2_lease *lease,
211 uint64_t allocation_size,
212 uint32_t private_flags,
213 struct security_descriptor *sd,
214 struct ea_list *ea_list,
215 files_struct **result, int *pinfo,
216 const struct smb2_create_blobs *in_context_blobs,
217 struct smb2_create_blobs *out_context_blobs)
219 return NT_STATUS_NOT_IMPLEMENTED;
222 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
224 errno = ENOSYS;
225 return -1;
228 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
229 void *data, size_t n, off_t offset)
231 errno = ENOSYS;
232 return -1;
235 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
236 TALLOC_CTX *mem_ctx,
237 struct tevent_context *ev,
238 struct files_struct *fsp,
239 void *data, size_t n, off_t offset)
241 return NULL;
244 static ssize_t skel_pread_recv(struct tevent_req *req,
245 struct vfs_aio_state *vfs_aio_state)
247 vfs_aio_state->error = ENOSYS;
248 return -1;
251 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
252 const void *data, size_t n, off_t offset)
254 errno = ENOSYS;
255 return -1;
258 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
259 TALLOC_CTX *mem_ctx,
260 struct tevent_context *ev,
261 struct files_struct *fsp,
262 const void *data,
263 size_t n, off_t offset)
265 return NULL;
268 static ssize_t skel_pwrite_recv(struct tevent_req *req,
269 struct vfs_aio_state *vfs_aio_state)
271 vfs_aio_state->error = ENOSYS;
272 return -1;
275 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
276 off_t offset, int whence)
278 errno = ENOSYS;
279 return (off_t) - 1;
282 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
283 files_struct *fromfsp, const DATA_BLOB *hdr,
284 off_t offset, size_t n)
286 errno = ENOSYS;
287 return -1;
290 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
291 files_struct *tofsp, off_t offset, size_t n)
293 errno = ENOSYS;
294 return -1;
297 static int skel_renameat(vfs_handle_struct *handle,
298 files_struct *srcfsp,
299 const struct smb_filename *smb_fname_src,
300 files_struct *dstfsp,
301 const struct smb_filename *smb_fname_dst)
303 errno = ENOSYS;
304 return -1;
307 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
308 TALLOC_CTX *mem_ctx,
309 struct tevent_context *ev,
310 struct files_struct *fsp)
312 return NULL;
315 static int skel_fsync_recv(struct tevent_req *req,
316 struct vfs_aio_state *vfs_aio_state)
318 vfs_aio_state->error = ENOSYS;
319 return -1;
322 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
324 errno = ENOSYS;
325 return -1;
328 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
329 SMB_STRUCT_STAT *sbuf)
331 errno = ENOSYS;
332 return -1;
335 static int skel_lstat(vfs_handle_struct *handle,
336 struct smb_filename *smb_fname)
338 errno = ENOSYS;
339 return -1;
342 static int skel_fstatat(
343 struct vfs_handle_struct *handle,
344 const struct files_struct *dirfsp,
345 const struct smb_filename *smb_fname,
346 SMB_STRUCT_STAT *sbuf,
347 int flags)
349 errno = ENOSYS;
350 return -1;
353 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
354 struct files_struct *fsp,
355 const SMB_STRUCT_STAT *sbuf)
357 errno = ENOSYS;
358 return -1;
361 static int skel_unlinkat(vfs_handle_struct *handle,
362 struct files_struct *dirfsp,
363 const struct smb_filename *smb_fname,
364 int flags)
366 errno = ENOSYS;
367 return -1;
370 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
371 mode_t mode)
373 errno = ENOSYS;
374 return -1;
377 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
378 uid_t uid, gid_t gid)
380 errno = ENOSYS;
381 return -1;
384 static int skel_lchown(vfs_handle_struct *handle,
385 const struct smb_filename *smb_fname,
386 uid_t uid,
387 gid_t gid)
389 errno = ENOSYS;
390 return -1;
393 static int skel_chdir(vfs_handle_struct *handle,
394 const struct smb_filename *smb_fname)
396 errno = ENOSYS;
397 return -1;
400 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
401 TALLOC_CTX *ctx)
403 errno = ENOSYS;
404 return NULL;
407 static int skel_fntimes(vfs_handle_struct *handle,
408 files_struct *fsp,
409 struct smb_file_time *ft)
411 errno = ENOSYS;
412 return -1;
415 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
416 off_t offset)
418 errno = ENOSYS;
419 return -1;
422 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
423 uint32_t mode, off_t offset, off_t len)
425 errno = ENOSYS;
426 return -1;
429 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
430 off_t offset, off_t count, int type)
432 errno = ENOSYS;
433 return false;
436 static int skel_filesystem_sharemode(struct vfs_handle_struct *handle,
437 struct files_struct *fsp,
438 uint32_t share_mode,
439 uint32_t access_mask)
441 errno = ENOSYS;
442 return -1;
445 static int skel_fcntl(struct vfs_handle_struct *handle,
446 struct files_struct *fsp, int cmd, va_list cmd_arg)
448 errno = ENOSYS;
449 return -1;
452 static int skel_linux_setlease(struct vfs_handle_struct *handle,
453 struct files_struct *fsp, int leasetype)
455 errno = ENOSYS;
456 return -1;
459 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
460 off_t *poffset, off_t *pcount, int *ptype,
461 pid_t *ppid)
463 errno = ENOSYS;
464 return false;
467 static int skel_symlinkat(vfs_handle_struct *handle,
468 const struct smb_filename *link_contents,
469 struct files_struct *dirfsp,
470 const struct smb_filename *new_smb_fname)
472 errno = ENOSYS;
473 return -1;
476 static int skel_vfs_readlinkat(vfs_handle_struct *handle,
477 const struct files_struct *dirfsp,
478 const struct smb_filename *smb_fname,
479 char *buf,
480 size_t bufsiz)
482 errno = ENOSYS;
483 return -1;
486 static int skel_linkat(vfs_handle_struct *handle,
487 files_struct *srcfsp,
488 const struct smb_filename *old_smb_fname,
489 files_struct *dstfsp,
490 const struct smb_filename *new_smb_fname,
491 int flags)
493 errno = ENOSYS;
494 return -1;
497 static int skel_mknodat(vfs_handle_struct *handle,
498 files_struct *dirfsp,
499 const struct smb_filename *smb_fname,
500 mode_t mode,
501 SMB_DEV_T dev)
503 errno = ENOSYS;
504 return -1;
507 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
508 TALLOC_CTX *ctx,
509 const struct smb_filename *smb_fname)
511 errno = ENOSYS;
512 return NULL;
515 static int skel_fchflags(vfs_handle_struct *handle,
516 struct files_struct *fsp,
517 uint flags)
519 errno = ENOSYS;
520 return -1;
523 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
524 const SMB_STRUCT_STAT *sbuf)
526 struct file_id id;
527 ZERO_STRUCT(id);
528 errno = ENOSYS;
529 return id;
532 static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
533 const SMB_STRUCT_STAT *sbuf)
535 errno = ENOSYS;
536 return 0;
539 struct skel_offload_read_state {
540 bool dummy;
543 static struct tevent_req *skel_offload_read_send(
544 TALLOC_CTX *mem_ctx,
545 struct tevent_context *ev,
546 struct vfs_handle_struct *handle,
547 struct files_struct *fsp,
548 uint32_t fsctl,
549 uint32_t ttl,
550 off_t offset,
551 size_t to_copy)
553 struct tevent_req *req = NULL;
554 struct skel_offload_read_state *state = NULL;
556 req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
557 if (req == NULL) {
558 return NULL;
561 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
562 return tevent_req_post(req, ev);
565 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
566 struct vfs_handle_struct *handle,
567 TALLOC_CTX *mem_ctx,
568 uint32_t *flags,
569 uint64_t *xferlen,
570 DATA_BLOB *_token_blob)
572 NTSTATUS status;
574 if (tevent_req_is_nterror(req, &status)) {
575 tevent_req_received(req);
576 return status;
578 tevent_req_received(req);
580 return NT_STATUS_OK;
583 struct skel_cc_state {
584 uint64_t unused;
586 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
587 TALLOC_CTX *mem_ctx,
588 struct tevent_context *ev,
589 uint32_t fsctl,
590 DATA_BLOB *token,
591 off_t transfer_offset,
592 struct files_struct *dest_fsp,
593 off_t dest_off,
594 off_t num)
596 struct tevent_req *req;
597 struct skel_cc_state *cc_state;
599 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
600 if (req == NULL) {
601 return NULL;
604 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
605 return tevent_req_post(req, ev);
608 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
609 struct tevent_req *req,
610 off_t *copied)
612 NTSTATUS status;
614 if (tevent_req_is_nterror(req, &status)) {
615 tevent_req_received(req);
616 return status;
618 tevent_req_received(req);
620 return NT_STATUS_OK;
623 static NTSTATUS skel_fget_compression(struct vfs_handle_struct *handle,
624 TALLOC_CTX *mem_ctx,
625 struct files_struct *fsp,
626 uint16_t *_compression_fmt)
628 return NT_STATUS_INVALID_DEVICE_REQUEST;
631 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
632 TALLOC_CTX *mem_ctx,
633 struct files_struct *fsp,
634 uint16_t compression_fmt)
636 return NT_STATUS_INVALID_DEVICE_REQUEST;
639 static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
640 struct files_struct *fsp,
641 TALLOC_CTX *mem_ctx,
642 unsigned int *num_streams,
643 struct stream_struct **streams)
645 return NT_STATUS_NOT_IMPLEMENTED;
648 static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle,
649 struct files_struct *dirfsp,
650 const char *name,
651 TALLOC_CTX *mem_ctx,
652 char **found_name)
654 return NT_STATUS_NOT_IMPLEMENTED;
657 static const char *skel_connectpath(
658 struct vfs_handle_struct *handle,
659 const struct files_struct *dirfsp,
660 const struct smb_filename *smb_fname)
662 errno = ENOSYS;
663 return NULL;
666 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
667 struct byte_range_lock *br_lck,
668 struct lock_struct *plock)
670 return NT_STATUS_NOT_IMPLEMENTED;
673 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
674 struct byte_range_lock *br_lck,
675 const struct lock_struct *plock)
677 errno = ENOSYS;
678 return false;
681 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
682 struct files_struct *fsp,
683 struct lock_struct *plock)
685 errno = ENOSYS;
686 return false;
689 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
690 const char *mapped_name,
691 enum vfs_translate_direction direction,
692 TALLOC_CTX *mem_ctx, char **pmapped_name)
694 return NT_STATUS_NOT_IMPLEMENTED;
697 static NTSTATUS skel_parent_pathname(struct vfs_handle_struct *handle,
698 TALLOC_CTX *mem_ctx,
699 const struct smb_filename *smb_fname_in,
700 struct smb_filename **parent_dir_out,
701 struct smb_filename **atname_out)
703 return NT_STATUS_NOT_IMPLEMENTED;
706 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
707 struct files_struct *fsp,
708 TALLOC_CTX *ctx,
709 uint32_t function,
710 uint16_t req_flags, /* Needed for UNICODE ... */
711 const uint8_t *_in_data,
712 uint32_t in_len,
713 uint8_t **_out_data,
714 uint32_t max_out_len, uint32_t *out_len)
716 return NT_STATUS_NOT_IMPLEMENTED;
719 static NTSTATUS skel_freaddir_attr(struct vfs_handle_struct *handle,
720 struct files_struct *fsp,
721 TALLOC_CTX *mem_ctx,
722 struct readdir_attr_data **pattr_data)
724 return NT_STATUS_NOT_IMPLEMENTED;
727 struct skel_get_dos_attributes_state {
728 struct vfs_aio_state aio_state;
729 uint32_t dosmode;
732 static struct tevent_req *skel_get_dos_attributes_send(
733 TALLOC_CTX *mem_ctx,
734 struct tevent_context *ev,
735 struct vfs_handle_struct *handle,
736 files_struct *dir_fsp,
737 struct smb_filename *smb_fname)
739 struct tevent_req *req = NULL;
740 struct skel_get_dos_attributes_state *state = NULL;
742 req = tevent_req_create(mem_ctx, &state,
743 struct skel_get_dos_attributes_state);
744 if (req == NULL) {
745 return NULL;
748 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
749 return tevent_req_post(req, ev);
752 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
753 struct vfs_aio_state *aio_state,
754 uint32_t *dosmode)
756 struct skel_get_dos_attributes_state *state =
757 tevent_req_data(req,
758 struct skel_get_dos_attributes_state);
759 NTSTATUS status;
761 if (tevent_req_is_nterror(req, &status)) {
762 tevent_req_received(req);
763 return status;
766 *aio_state = state->aio_state;
767 *dosmode = state->dosmode;
768 tevent_req_received(req);
769 return NT_STATUS_OK;
772 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
773 struct files_struct *fsp,
774 uint32_t *dosmode)
776 return NT_STATUS_NOT_IMPLEMENTED;
779 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
780 struct files_struct *fsp,
781 uint32_t dosmode)
783 return NT_STATUS_NOT_IMPLEMENTED;
786 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
787 uint32_t security_info,
788 TALLOC_CTX *mem_ctx,
789 struct security_descriptor **ppdesc)
791 return NT_STATUS_NOT_IMPLEMENTED;
794 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
795 uint32_t security_info_sent,
796 const struct security_descriptor *psd)
798 return NT_STATUS_NOT_IMPLEMENTED;
801 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
802 files_struct *fsp,
803 SMB_ACL_TYPE_T type,
804 TALLOC_CTX *mem_ctx)
806 errno = ENOSYS;
807 return (SMB_ACL_T) NULL;
810 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
811 files_struct *fsp, TALLOC_CTX *mem_ctx,
812 char **blob_description, DATA_BLOB *blob)
814 errno = ENOSYS;
815 return -1;
818 static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
819 struct files_struct *fsp,
820 SMB_ACL_TYPE_T type,
821 SMB_ACL_T theacl)
823 errno = ENOSYS;
824 return -1;
827 static int skel_sys_acl_delete_def_fd(vfs_handle_struct *handle,
828 struct files_struct *fsp)
830 errno = ENOSYS;
831 return -1;
834 struct skel_getxattrat_state {
835 struct vfs_aio_state aio_state;
836 ssize_t xattr_size;
837 uint8_t *xattr_value;
840 static struct tevent_req *skel_getxattrat_send(
841 TALLOC_CTX *mem_ctx,
842 struct tevent_context *ev,
843 struct vfs_handle_struct *handle,
844 files_struct *dir_fsp,
845 const struct smb_filename *smb_fname,
846 const char *xattr_name,
847 size_t alloc_hint)
849 struct tevent_req *req = NULL;
850 struct skel_getxattrat_state *state = NULL;
852 req = tevent_req_create(mem_ctx, &state,
853 struct skel_getxattrat_state);
854 if (req == NULL) {
855 return NULL;
858 tevent_req_error(req, ENOSYS);
859 return tevent_req_post(req, ev);
862 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
863 struct vfs_aio_state *aio_state,
864 TALLOC_CTX *mem_ctx,
865 uint8_t **xattr_value)
867 struct skel_getxattrat_state *state = tevent_req_data(
868 req, struct skel_getxattrat_state);
869 ssize_t xattr_size;
871 if (tevent_req_is_unix_error(req, &aio_state->error)) {
872 tevent_req_received(req);
873 return -1;
876 *aio_state = state->aio_state;
877 xattr_size = state->xattr_size;
878 if (xattr_value != NULL) {
879 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
882 tevent_req_received(req);
883 return xattr_size;
886 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
887 struct files_struct *fsp, const char *name,
888 void *value, size_t size)
890 errno = ENOSYS;
891 return -1;
894 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
895 struct files_struct *fsp, char *list,
896 size_t size)
898 errno = ENOSYS;
899 return -1;
902 static int skel_fremovexattr(vfs_handle_struct *handle,
903 struct files_struct *fsp, const char *name)
905 errno = ENOSYS;
906 return -1;
909 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
910 const char *name, const void *value, size_t size,
911 int flags)
913 errno = ENOSYS;
914 return -1;
917 static bool skel_aio_force(struct vfs_handle_struct *handle,
918 struct files_struct *fsp)
920 errno = ENOSYS;
921 return false;
924 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
925 struct smb_filename *file,
926 struct security_acl *sacl,
927 uint32_t access_requested,
928 uint32_t access_denied)
930 return NT_STATUS_NOT_IMPLEMENTED;
933 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
934 struct files_struct *fsp,
935 TALLOC_CTX *mem_ctx,
936 DATA_BLOB *cookie)
938 return NT_STATUS_NOT_IMPLEMENTED;
941 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
942 struct files_struct *fsp,
943 const DATA_BLOB old_cookie,
944 TALLOC_CTX *mem_ctx,
945 DATA_BLOB *new_cookie)
947 return NT_STATUS_NOT_IMPLEMENTED;
950 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
951 struct smb_request *smb1req,
952 struct smbXsrv_open *op,
953 const DATA_BLOB old_cookie,
954 TALLOC_CTX *mem_ctx,
955 struct files_struct **fsp,
956 DATA_BLOB *new_cookie)
958 return NT_STATUS_NOT_IMPLEMENTED;
961 /* VFS operations structure */
963 static struct vfs_fn_pointers skel_opaque_fns = {
964 /* Disk operations */
966 .connect_fn = skel_connect,
967 .disconnect_fn = skel_disconnect,
968 .disk_free_fn = skel_disk_free,
969 .get_quota_fn = skel_get_quota,
970 .set_quota_fn = skel_set_quota,
971 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
972 .statvfs_fn = skel_statvfs,
973 .fs_capabilities_fn = skel_fs_capabilities,
974 .get_dfs_referrals_fn = skel_get_dfs_referrals,
975 .create_dfs_pathat_fn = skel_create_dfs_pathat,
976 .read_dfs_pathat_fn = skel_read_dfs_pathat,
977 .snap_check_path_fn = skel_snap_check_path,
978 .snap_create_fn = skel_snap_create,
979 .snap_delete_fn = skel_snap_delete,
981 /* Directory operations */
983 .fdopendir_fn = skel_fdopendir,
984 .readdir_fn = skel_readdir,
985 .rewind_dir_fn = skel_rewind_dir,
986 .mkdirat_fn = skel_mkdirat,
987 .closedir_fn = skel_closedir,
989 /* File operations */
991 .openat_fn = skel_openat,
992 .create_file_fn = skel_create_file,
993 .close_fn = skel_close_fn,
994 .pread_fn = skel_pread,
995 .pread_send_fn = skel_pread_send,
996 .pread_recv_fn = skel_pread_recv,
997 .pwrite_fn = skel_pwrite,
998 .pwrite_send_fn = skel_pwrite_send,
999 .pwrite_recv_fn = skel_pwrite_recv,
1000 .lseek_fn = skel_lseek,
1001 .sendfile_fn = skel_sendfile,
1002 .recvfile_fn = skel_recvfile,
1003 .renameat_fn = skel_renameat,
1004 .fsync_send_fn = skel_fsync_send,
1005 .fsync_recv_fn = skel_fsync_recv,
1006 .stat_fn = skel_stat,
1007 .fstat_fn = skel_fstat,
1008 .lstat_fn = skel_lstat,
1009 .fstatat_fn = skel_fstatat,
1010 .get_alloc_size_fn = skel_get_alloc_size,
1011 .unlinkat_fn = skel_unlinkat,
1012 .fchmod_fn = skel_fchmod,
1013 .fchown_fn = skel_fchown,
1014 .lchown_fn = skel_lchown,
1015 .chdir_fn = skel_chdir,
1016 .getwd_fn = skel_getwd,
1017 .fntimes_fn = skel_fntimes,
1018 .ftruncate_fn = skel_ftruncate,
1019 .fallocate_fn = skel_fallocate,
1020 .lock_fn = skel_lock,
1021 .filesystem_sharemode_fn = skel_filesystem_sharemode,
1022 .fcntl_fn = skel_fcntl,
1023 .linux_setlease_fn = skel_linux_setlease,
1024 .getlock_fn = skel_getlock,
1025 .symlinkat_fn = skel_symlinkat,
1026 .readlinkat_fn = skel_vfs_readlinkat,
1027 .linkat_fn = skel_linkat,
1028 .mknodat_fn = skel_mknodat,
1029 .realpath_fn = skel_realpath,
1030 .fchflags_fn = skel_fchflags,
1031 .file_id_create_fn = skel_file_id_create,
1032 .fs_file_id_fn = skel_fs_file_id,
1033 .offload_read_send_fn = skel_offload_read_send,
1034 .offload_read_recv_fn = skel_offload_read_recv,
1035 .offload_write_send_fn = skel_offload_write_send,
1036 .offload_write_recv_fn = skel_offload_write_recv,
1037 .fget_compression_fn = skel_fget_compression,
1038 .set_compression_fn = skel_set_compression,
1040 .fstreaminfo_fn = skel_fstreaminfo,
1041 .get_real_filename_at_fn = skel_get_real_filename_at,
1042 .connectpath_fn = skel_connectpath,
1043 .brl_lock_windows_fn = skel_brl_lock_windows,
1044 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1045 .strict_lock_check_fn = skel_strict_lock_check,
1046 .translate_name_fn = skel_translate_name,
1047 .parent_pathname_fn = skel_parent_pathname,
1048 .fsctl_fn = skel_fsctl,
1049 .freaddir_attr_fn = skel_freaddir_attr,
1050 .audit_file_fn = skel_audit_file,
1052 /* DOS attributes. */
1053 .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1054 .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1055 .fget_dos_attributes_fn = skel_fget_dos_attributes,
1056 .fset_dos_attributes_fn = skel_fset_dos_attributes,
1058 /* NT ACL operations. */
1060 .fget_nt_acl_fn = skel_fget_nt_acl,
1061 .fset_nt_acl_fn = skel_fset_nt_acl,
1063 /* POSIX ACL operations. */
1065 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1066 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1067 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1068 .sys_acl_delete_def_fd_fn = skel_sys_acl_delete_def_fd,
1070 /* EA operations. */
1071 .getxattrat_send_fn = skel_getxattrat_send,
1072 .getxattrat_recv_fn = skel_getxattrat_recv,
1073 .fgetxattr_fn = skel_fgetxattr,
1074 .flistxattr_fn = skel_flistxattr,
1075 .fremovexattr_fn = skel_fremovexattr,
1076 .fsetxattr_fn = skel_fsetxattr,
1078 /* aio operations */
1079 .aio_force_fn = skel_aio_force,
1081 /* durable handle operations */
1082 .durable_cookie_fn = skel_durable_cookie,
1083 .durable_disconnect_fn = skel_durable_disconnect,
1084 .durable_reconnect_fn = skel_durable_reconnect,
1087 static_decl_vfs;
1088 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1091 * smb_vfs_assert_all_fns() makes sure every
1092 * call is implemented.
1094 * An opaque module requires this!
1096 smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1097 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1098 &skel_opaque_fns);