vfs: remove SMB_VFS_OPEN()
[Samba.git] / examples / VFS / skel_opaque.c
blob1a9b472634db72f28cd510b5c134a7157287b3cf
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 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 DIR *dirp, SMB_STRUCT_STAT *sbuf)
161 return NULL;
164 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
169 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
171 return (long)-1;
174 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
179 static int skel_mkdirat(vfs_handle_struct *handle,
180 struct files_struct *dirfsp,
181 const struct smb_filename *smb_fname,
182 mode_t mode)
184 errno = ENOSYS;
185 return -1;
188 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
190 errno = ENOSYS;
191 return -1;
194 static int skel_openat(struct vfs_handle_struct *handle,
195 const struct files_struct *dirfsp,
196 const struct smb_filename *smb_fname,
197 struct files_struct *fsp,
198 int flags,
199 mode_t mode)
201 errno = ENOSYS;
202 return -1;
205 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
206 struct smb_request *req,
207 struct files_struct **dirfsp,
208 struct smb_filename *smb_fname,
209 uint32_t access_mask,
210 uint32_t share_access,
211 uint32_t create_disposition,
212 uint32_t create_options,
213 uint32_t file_attributes,
214 uint32_t oplock_request,
215 const struct smb2_lease *lease,
216 uint64_t allocation_size,
217 uint32_t private_flags,
218 struct security_descriptor *sd,
219 struct ea_list *ea_list,
220 files_struct **result, int *pinfo,
221 const struct smb2_create_blobs *in_context_blobs,
222 struct smb2_create_blobs *out_context_blobs)
224 return NT_STATUS_NOT_IMPLEMENTED;
227 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
229 errno = ENOSYS;
230 return -1;
233 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
234 void *data, size_t n, off_t offset)
236 errno = ENOSYS;
237 return -1;
240 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
241 TALLOC_CTX *mem_ctx,
242 struct tevent_context *ev,
243 struct files_struct *fsp,
244 void *data, size_t n, off_t offset)
246 return NULL;
249 static ssize_t skel_pread_recv(struct tevent_req *req,
250 struct vfs_aio_state *vfs_aio_state)
252 vfs_aio_state->error = ENOSYS;
253 return -1;
256 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
257 const void *data, size_t n, off_t offset)
259 errno = ENOSYS;
260 return -1;
263 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
264 TALLOC_CTX *mem_ctx,
265 struct tevent_context *ev,
266 struct files_struct *fsp,
267 const void *data,
268 size_t n, off_t offset)
270 return NULL;
273 static ssize_t skel_pwrite_recv(struct tevent_req *req,
274 struct vfs_aio_state *vfs_aio_state)
276 vfs_aio_state->error = ENOSYS;
277 return -1;
280 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
281 off_t offset, int whence)
283 errno = ENOSYS;
284 return (off_t) - 1;
287 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
288 files_struct *fromfsp, const DATA_BLOB *hdr,
289 off_t offset, size_t n)
291 errno = ENOSYS;
292 return -1;
295 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
296 files_struct *tofsp, off_t offset, size_t n)
298 errno = ENOSYS;
299 return -1;
302 static int skel_renameat(vfs_handle_struct *handle,
303 files_struct *srcfsp,
304 const struct smb_filename *smb_fname_src,
305 files_struct *dstfsp,
306 const struct smb_filename *smb_fname_dst)
308 errno = ENOSYS;
309 return -1;
312 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
313 TALLOC_CTX *mem_ctx,
314 struct tevent_context *ev,
315 struct files_struct *fsp)
317 return NULL;
320 static int skel_fsync_recv(struct tevent_req *req,
321 struct vfs_aio_state *vfs_aio_state)
323 vfs_aio_state->error = ENOSYS;
324 return -1;
327 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
329 errno = ENOSYS;
330 return -1;
333 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
334 SMB_STRUCT_STAT *sbuf)
336 errno = ENOSYS;
337 return -1;
340 static int skel_lstat(vfs_handle_struct *handle,
341 struct smb_filename *smb_fname)
343 errno = ENOSYS;
344 return -1;
347 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
348 struct files_struct *fsp,
349 const SMB_STRUCT_STAT *sbuf)
351 errno = ENOSYS;
352 return -1;
355 static int skel_unlinkat(vfs_handle_struct *handle,
356 struct files_struct *dirfsp,
357 const struct smb_filename *smb_fname,
358 int flags)
360 errno = ENOSYS;
361 return -1;
364 static int skel_chmod(vfs_handle_struct *handle,
365 const struct smb_filename *smb_fname,
366 mode_t mode)
368 errno = ENOSYS;
369 return -1;
372 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
373 mode_t mode)
375 errno = ENOSYS;
376 return -1;
379 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
380 uid_t uid, gid_t gid)
382 errno = ENOSYS;
383 return -1;
386 static int skel_lchown(vfs_handle_struct *handle,
387 const struct smb_filename *smb_fname,
388 uid_t uid,
389 gid_t gid)
391 errno = ENOSYS;
392 return -1;
395 static int skel_chdir(vfs_handle_struct *handle,
396 const struct smb_filename *smb_fname)
398 errno = ENOSYS;
399 return -1;
402 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
403 TALLOC_CTX *ctx)
405 errno = ENOSYS;
406 return NULL;
409 static int skel_ntimes(vfs_handle_struct *handle,
410 const struct smb_filename *smb_fname,
411 struct smb_file_time *ft)
413 errno = ENOSYS;
414 return -1;
417 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
418 off_t offset)
420 errno = ENOSYS;
421 return -1;
424 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
425 uint32_t mode, off_t offset, off_t len)
427 errno = ENOSYS;
428 return -1;
431 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
432 off_t offset, off_t count, int type)
434 errno = ENOSYS;
435 return false;
438 static int skel_kernel_flock(struct vfs_handle_struct *handle,
439 struct files_struct *fsp,
440 uint32_t share_mode, uint32_t access_mask)
442 errno = ENOSYS;
443 return -1;
446 static int skel_fcntl(struct vfs_handle_struct *handle,
447 struct files_struct *fsp, int cmd, va_list cmd_arg)
449 errno = ENOSYS;
450 return -1;
453 static int skel_linux_setlease(struct vfs_handle_struct *handle,
454 struct files_struct *fsp, int leasetype)
456 errno = ENOSYS;
457 return -1;
460 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
461 off_t *poffset, off_t *pcount, int *ptype,
462 pid_t *ppid)
464 errno = ENOSYS;
465 return false;
468 static int skel_symlinkat(vfs_handle_struct *handle,
469 const struct smb_filename *link_contents,
470 struct files_struct *dirfsp,
471 const struct smb_filename *new_smb_fname)
473 errno = ENOSYS;
474 return -1;
477 static int skel_vfs_readlinkat(vfs_handle_struct *handle,
478 files_struct *dirfsp,
479 const struct smb_filename *smb_fname,
480 char *buf,
481 size_t bufsiz)
483 errno = ENOSYS;
484 return -1;
487 static int skel_linkat(vfs_handle_struct *handle,
488 files_struct *srcfsp,
489 const struct smb_filename *old_smb_fname,
490 files_struct *dstfsp,
491 const struct smb_filename *new_smb_fname,
492 int flags)
494 errno = ENOSYS;
495 return -1;
498 static int skel_mknodat(vfs_handle_struct *handle,
499 files_struct *dirfsp,
500 const struct smb_filename *smb_fname,
501 mode_t mode,
502 SMB_DEV_T dev)
504 errno = ENOSYS;
505 return -1;
508 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
509 TALLOC_CTX *ctx,
510 const struct smb_filename *smb_fname)
512 errno = ENOSYS;
513 return NULL;
516 static int skel_chflags(vfs_handle_struct *handle,
517 const struct smb_filename *smb_fname,
518 uint flags)
520 errno = ENOSYS;
521 return -1;
524 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
525 const SMB_STRUCT_STAT *sbuf)
527 struct file_id id;
528 ZERO_STRUCT(id);
529 errno = ENOSYS;
530 return id;
533 static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
534 const SMB_STRUCT_STAT *sbuf)
536 errno = ENOSYS;
537 return 0;
540 struct skel_offload_read_state {
541 bool dummy;
544 static struct tevent_req *skel_offload_read_send(
545 TALLOC_CTX *mem_ctx,
546 struct tevent_context *ev,
547 struct vfs_handle_struct *handle,
548 struct files_struct *fsp,
549 uint32_t fsctl,
550 uint32_t ttl,
551 off_t offset,
552 size_t to_copy)
554 struct tevent_req *req = NULL;
555 struct skel_offload_read_state *state = NULL;
557 req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
558 if (req == NULL) {
559 return NULL;
562 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
563 return tevent_req_post(req, ev);
566 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
567 struct vfs_handle_struct *handle,
568 TALLOC_CTX *mem_ctx,
569 DATA_BLOB *_token_blob)
571 NTSTATUS status;
573 if (tevent_req_is_nterror(req, &status)) {
574 tevent_req_received(req);
575 return status;
577 tevent_req_received(req);
579 return NT_STATUS_OK;
582 struct skel_cc_state {
583 uint64_t unused;
585 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
586 TALLOC_CTX *mem_ctx,
587 struct tevent_context *ev,
588 uint32_t fsctl,
589 DATA_BLOB *token,
590 off_t transfer_offset,
591 struct files_struct *dest_fsp,
592 off_t dest_off,
593 off_t num)
595 struct tevent_req *req;
596 struct skel_cc_state *cc_state;
598 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
599 if (req == NULL) {
600 return NULL;
603 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
604 return tevent_req_post(req, ev);
607 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
608 struct tevent_req *req,
609 off_t *copied)
611 NTSTATUS status;
613 if (tevent_req_is_nterror(req, &status)) {
614 tevent_req_received(req);
615 return status;
617 tevent_req_received(req);
619 return NT_STATUS_OK;
622 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
623 TALLOC_CTX *mem_ctx,
624 struct files_struct *fsp,
625 struct smb_filename *smb_fname,
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_streaminfo(struct vfs_handle_struct *handle,
640 struct files_struct *fsp,
641 const struct smb_filename *smb_fname,
642 TALLOC_CTX *mem_ctx,
643 unsigned int *num_streams,
644 struct stream_struct **streams)
646 return NT_STATUS_NOT_IMPLEMENTED;
649 static int skel_get_real_filename(struct vfs_handle_struct *handle,
650 const struct smb_filename *path,
651 const char *name,
652 TALLOC_CTX *mem_ctx, char **found_name)
654 errno = ENOSYS;
655 return -1;
658 static const char *skel_connectpath(struct vfs_handle_struct *handle,
659 const struct smb_filename *smb_fname)
661 errno = ENOSYS;
662 return NULL;
665 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
666 struct byte_range_lock *br_lck,
667 struct lock_struct *plock)
669 return NT_STATUS_NOT_IMPLEMENTED;
672 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
673 struct byte_range_lock *br_lck,
674 const struct lock_struct *plock)
676 errno = ENOSYS;
677 return false;
680 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
681 struct files_struct *fsp,
682 struct lock_struct *plock)
684 errno = ENOSYS;
685 return false;
688 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
689 const char *mapped_name,
690 enum vfs_translate_direction direction,
691 TALLOC_CTX *mem_ctx, char **pmapped_name)
693 return NT_STATUS_NOT_IMPLEMENTED;
696 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
697 struct files_struct *fsp,
698 TALLOC_CTX *ctx,
699 uint32_t function,
700 uint16_t req_flags, /* Needed for UNICODE ... */
701 const uint8_t *_in_data,
702 uint32_t in_len,
703 uint8_t **_out_data,
704 uint32_t max_out_len, uint32_t *out_len)
706 return NT_STATUS_NOT_IMPLEMENTED;
709 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
710 const struct smb_filename *fname,
711 TALLOC_CTX *mem_ctx,
712 struct readdir_attr_data **pattr_data)
714 return NT_STATUS_NOT_IMPLEMENTED;
717 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
718 struct smb_filename *smb_fname,
719 uint32_t *dosmode)
721 return NT_STATUS_NOT_IMPLEMENTED;
724 struct skel_get_dos_attributes_state {
725 struct vfs_aio_state aio_state;
726 uint32_t dosmode;
729 static struct tevent_req *skel_get_dos_attributes_send(
730 TALLOC_CTX *mem_ctx,
731 struct tevent_context *ev,
732 struct vfs_handle_struct *handle,
733 files_struct *dir_fsp,
734 struct smb_filename *smb_fname)
736 struct tevent_req *req = NULL;
737 struct skel_get_dos_attributes_state *state = NULL;
739 req = tevent_req_create(mem_ctx, &state,
740 struct skel_get_dos_attributes_state);
741 if (req == NULL) {
742 return NULL;
745 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
746 return tevent_req_post(req, ev);
749 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
750 struct vfs_aio_state *aio_state,
751 uint32_t *dosmode)
753 struct skel_get_dos_attributes_state *state =
754 tevent_req_data(req,
755 struct skel_get_dos_attributes_state);
756 NTSTATUS status;
758 if (tevent_req_is_nterror(req, &status)) {
759 tevent_req_received(req);
760 return status;
763 *aio_state = state->aio_state;
764 *dosmode = state->dosmode;
765 tevent_req_received(req);
766 return NT_STATUS_OK;
769 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
770 struct files_struct *fsp,
771 uint32_t *dosmode)
773 return NT_STATUS_NOT_IMPLEMENTED;
776 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
777 const struct smb_filename *smb_fname,
778 uint32_t dosmode)
780 return NT_STATUS_NOT_IMPLEMENTED;
783 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
784 struct files_struct *fsp,
785 uint32_t dosmode)
787 return NT_STATUS_NOT_IMPLEMENTED;
790 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
791 uint32_t security_info,
792 TALLOC_CTX *mem_ctx,
793 struct security_descriptor **ppdesc)
795 return NT_STATUS_NOT_IMPLEMENTED;
798 static NTSTATUS skel_get_nt_acl_at(vfs_handle_struct *handle,
799 struct files_struct *dirfsp,
800 const struct smb_filename *smb_fname,
801 uint32_t security_info,
802 TALLOC_CTX *mem_ctx,
803 struct security_descriptor **ppdesc)
805 return NT_STATUS_NOT_IMPLEMENTED;
808 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
809 uint32_t security_info_sent,
810 const struct security_descriptor *psd)
812 return NT_STATUS_NOT_IMPLEMENTED;
815 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
816 const struct smb_filename *smb_fname,
817 SMB_ACL_TYPE_T type,
818 TALLOC_CTX *mem_ctx)
820 errno = ENOSYS;
821 return (SMB_ACL_T) NULL;
824 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
825 files_struct *fsp, TALLOC_CTX *mem_ctx)
827 errno = ENOSYS;
828 return (SMB_ACL_T) NULL;
831 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
832 const struct smb_filename *smb_fname,
833 TALLOC_CTX *mem_ctx,
834 char **blob_description,
835 DATA_BLOB *blob)
837 errno = ENOSYS;
838 return -1;
841 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
842 files_struct *fsp, TALLOC_CTX *mem_ctx,
843 char **blob_description, DATA_BLOB *blob)
845 errno = ENOSYS;
846 return -1;
849 static int skel_sys_acl_set_file(vfs_handle_struct *handle,
850 const struct smb_filename *smb_fname,
851 SMB_ACL_TYPE_T acltype,
852 SMB_ACL_T theacl)
854 errno = ENOSYS;
855 return -1;
858 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
859 SMB_ACL_T theacl)
861 errno = ENOSYS;
862 return -1;
865 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
866 const struct smb_filename *smb_fname)
868 errno = ENOSYS;
869 return -1;
872 static ssize_t skel_getxattr(vfs_handle_struct *handle,
873 const struct smb_filename *smb_fname,
874 const char *name,
875 void *value,
876 size_t size)
878 errno = ENOSYS;
879 return -1;
882 struct skel_getxattrat_state {
883 struct vfs_aio_state aio_state;
884 ssize_t xattr_size;
885 uint8_t *xattr_value;
888 static struct tevent_req *skel_getxattrat_send(
889 TALLOC_CTX *mem_ctx,
890 struct tevent_context *ev,
891 struct vfs_handle_struct *handle,
892 files_struct *dir_fsp,
893 const struct smb_filename *smb_fname,
894 const char *xattr_name,
895 size_t alloc_hint)
897 struct tevent_req *req = NULL;
898 struct skel_getxattrat_state *state = NULL;
900 req = tevent_req_create(mem_ctx, &state,
901 struct skel_getxattrat_state);
902 if (req == NULL) {
903 return NULL;
906 tevent_req_error(req, ENOSYS);
907 return tevent_req_post(req, ev);
910 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
911 struct vfs_aio_state *aio_state,
912 TALLOC_CTX *mem_ctx,
913 uint8_t **xattr_value)
915 struct skel_getxattrat_state *state = tevent_req_data(
916 req, struct skel_getxattrat_state);
917 ssize_t xattr_size;
919 if (tevent_req_is_unix_error(req, &aio_state->error)) {
920 tevent_req_received(req);
921 return -1;
924 *aio_state = state->aio_state;
925 xattr_size = state->xattr_size;
926 if (xattr_value != NULL) {
927 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
930 tevent_req_received(req);
931 return xattr_size;
934 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
935 struct files_struct *fsp, const char *name,
936 void *value, size_t size)
938 errno = ENOSYS;
939 return -1;
942 static ssize_t skel_listxattr(vfs_handle_struct *handle,
943 const struct smb_filename *smb_fname,
944 char *list,
945 size_t size)
947 errno = ENOSYS;
948 return -1;
951 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
952 struct files_struct *fsp, char *list,
953 size_t size)
955 errno = ENOSYS;
956 return -1;
959 static int skel_removexattr(vfs_handle_struct *handle,
960 const struct smb_filename *smb_fname,
961 const char *name)
963 errno = ENOSYS;
964 return -1;
967 static int skel_fremovexattr(vfs_handle_struct *handle,
968 struct files_struct *fsp, const char *name)
970 errno = ENOSYS;
971 return -1;
974 static int skel_setxattr(vfs_handle_struct *handle,
975 const struct smb_filename *smb_fname,
976 const char *name,
977 const void *value,
978 size_t size,
979 int flags)
981 errno = ENOSYS;
982 return -1;
985 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
986 const char *name, const void *value, size_t size,
987 int flags)
989 errno = ENOSYS;
990 return -1;
993 static bool skel_aio_force(struct vfs_handle_struct *handle,
994 struct files_struct *fsp)
996 errno = ENOSYS;
997 return false;
1000 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
1001 struct smb_filename *file,
1002 struct security_acl *sacl,
1003 uint32_t access_requested,
1004 uint32_t access_denied)
1006 return NT_STATUS_NOT_IMPLEMENTED;
1009 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
1010 struct files_struct *fsp,
1011 TALLOC_CTX *mem_ctx,
1012 DATA_BLOB *cookie)
1014 return NT_STATUS_NOT_IMPLEMENTED;
1017 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
1018 struct files_struct *fsp,
1019 const DATA_BLOB old_cookie,
1020 TALLOC_CTX *mem_ctx,
1021 DATA_BLOB *new_cookie)
1023 return NT_STATUS_NOT_IMPLEMENTED;
1026 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
1027 struct smb_request *smb1req,
1028 struct smbXsrv_open *op,
1029 const DATA_BLOB old_cookie,
1030 TALLOC_CTX *mem_ctx,
1031 struct files_struct **fsp,
1032 DATA_BLOB *new_cookie)
1034 return NT_STATUS_NOT_IMPLEMENTED;
1037 /* VFS operations structure */
1039 static struct vfs_fn_pointers skel_opaque_fns = {
1040 /* Disk operations */
1042 .connect_fn = skel_connect,
1043 .disconnect_fn = skel_disconnect,
1044 .disk_free_fn = skel_disk_free,
1045 .get_quota_fn = skel_get_quota,
1046 .set_quota_fn = skel_set_quota,
1047 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1048 .statvfs_fn = skel_statvfs,
1049 .fs_capabilities_fn = skel_fs_capabilities,
1050 .get_dfs_referrals_fn = skel_get_dfs_referrals,
1051 .create_dfs_pathat_fn = skel_create_dfs_pathat,
1052 .read_dfs_pathat_fn = skel_read_dfs_pathat,
1053 .snap_check_path_fn = skel_snap_check_path,
1054 .snap_create_fn = skel_snap_create,
1055 .snap_delete_fn = skel_snap_delete,
1057 /* Directory operations */
1059 .fdopendir_fn = skel_fdopendir,
1060 .readdir_fn = skel_readdir,
1061 .seekdir_fn = skel_seekdir,
1062 .telldir_fn = skel_telldir,
1063 .rewind_dir_fn = skel_rewind_dir,
1064 .mkdirat_fn = skel_mkdirat,
1065 .closedir_fn = skel_closedir,
1067 /* File operations */
1069 .openat_fn = skel_openat,
1070 .create_file_fn = skel_create_file,
1071 .close_fn = skel_close_fn,
1072 .pread_fn = skel_pread,
1073 .pread_send_fn = skel_pread_send,
1074 .pread_recv_fn = skel_pread_recv,
1075 .pwrite_fn = skel_pwrite,
1076 .pwrite_send_fn = skel_pwrite_send,
1077 .pwrite_recv_fn = skel_pwrite_recv,
1078 .lseek_fn = skel_lseek,
1079 .sendfile_fn = skel_sendfile,
1080 .recvfile_fn = skel_recvfile,
1081 .renameat_fn = skel_renameat,
1082 .fsync_send_fn = skel_fsync_send,
1083 .fsync_recv_fn = skel_fsync_recv,
1084 .stat_fn = skel_stat,
1085 .fstat_fn = skel_fstat,
1086 .lstat_fn = skel_lstat,
1087 .get_alloc_size_fn = skel_get_alloc_size,
1088 .unlinkat_fn = skel_unlinkat,
1089 .chmod_fn = skel_chmod,
1090 .fchmod_fn = skel_fchmod,
1091 .fchown_fn = skel_fchown,
1092 .lchown_fn = skel_lchown,
1093 .chdir_fn = skel_chdir,
1094 .getwd_fn = skel_getwd,
1095 .ntimes_fn = skel_ntimes,
1096 .ftruncate_fn = skel_ftruncate,
1097 .fallocate_fn = skel_fallocate,
1098 .lock_fn = skel_lock,
1099 .kernel_flock_fn = skel_kernel_flock,
1100 .fcntl_fn = skel_fcntl,
1101 .linux_setlease_fn = skel_linux_setlease,
1102 .getlock_fn = skel_getlock,
1103 .symlinkat_fn = skel_symlinkat,
1104 .readlinkat_fn = skel_vfs_readlinkat,
1105 .linkat_fn = skel_linkat,
1106 .mknodat_fn = skel_mknodat,
1107 .realpath_fn = skel_realpath,
1108 .chflags_fn = skel_chflags,
1109 .file_id_create_fn = skel_file_id_create,
1110 .fs_file_id_fn = skel_fs_file_id,
1111 .offload_read_send_fn = skel_offload_read_send,
1112 .offload_read_recv_fn = skel_offload_read_recv,
1113 .offload_write_send_fn = skel_offload_write_send,
1114 .offload_write_recv_fn = skel_offload_write_recv,
1115 .get_compression_fn = skel_get_compression,
1116 .set_compression_fn = skel_set_compression,
1118 .streaminfo_fn = skel_streaminfo,
1119 .get_real_filename_fn = skel_get_real_filename,
1120 .connectpath_fn = skel_connectpath,
1121 .brl_lock_windows_fn = skel_brl_lock_windows,
1122 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1123 .strict_lock_check_fn = skel_strict_lock_check,
1124 .translate_name_fn = skel_translate_name,
1125 .fsctl_fn = skel_fsctl,
1126 .readdir_attr_fn = skel_readdir_attr,
1127 .audit_file_fn = skel_audit_file,
1129 /* DOS attributes. */
1130 .get_dos_attributes_fn = skel_get_dos_attributes,
1131 .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1132 .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1133 .fget_dos_attributes_fn = skel_fget_dos_attributes,
1134 .set_dos_attributes_fn = skel_set_dos_attributes,
1135 .fset_dos_attributes_fn = skel_fset_dos_attributes,
1137 /* NT ACL operations. */
1139 .fget_nt_acl_fn = skel_fget_nt_acl,
1140 .get_nt_acl_at_fn = skel_get_nt_acl_at,
1141 .fset_nt_acl_fn = skel_fset_nt_acl,
1143 /* POSIX ACL operations. */
1145 .sys_acl_get_file_fn = skel_sys_acl_get_file,
1146 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1147 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1148 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1149 .sys_acl_set_file_fn = skel_sys_acl_set_file,
1150 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1151 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1153 /* EA operations. */
1154 .getxattr_fn = skel_getxattr,
1155 .getxattrat_send_fn = skel_getxattrat_send,
1156 .getxattrat_recv_fn = skel_getxattrat_recv,
1157 .fgetxattr_fn = skel_fgetxattr,
1158 .listxattr_fn = skel_listxattr,
1159 .flistxattr_fn = skel_flistxattr,
1160 .removexattr_fn = skel_removexattr,
1161 .fremovexattr_fn = skel_fremovexattr,
1162 .setxattr_fn = skel_setxattr,
1163 .fsetxattr_fn = skel_fsetxattr,
1165 /* aio operations */
1166 .aio_force_fn = skel_aio_force,
1168 /* durable handle operations */
1169 .durable_cookie_fn = skel_durable_cookie,
1170 .durable_disconnect_fn = skel_durable_disconnect,
1171 .durable_reconnect_fn = skel_durable_reconnect,
1174 static_decl_vfs;
1175 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1178 * smb_vfs_assert_all_fns() makes sure every
1179 * call is implemented.
1181 * An opaque module requires this!
1183 smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1184 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1185 &skel_opaque_fns);