s3:smbd: rename has_ctdb_public_ip to has_cluster_movable_ip
[Samba.git] / examples / VFS / skel_opaque.c
blob90ee82ab258fa56cd7ba11b6f2123da16006bd79
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 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 smb_filename *smb_fname,
208 uint32_t access_mask,
209 uint32_t share_access,
210 uint32_t create_disposition,
211 uint32_t create_options,
212 uint32_t file_attributes,
213 uint32_t oplock_request,
214 const struct smb2_lease *lease,
215 uint64_t allocation_size,
216 uint32_t private_flags,
217 struct security_descriptor *sd,
218 struct ea_list *ea_list,
219 files_struct **result, int *pinfo,
220 const struct smb2_create_blobs *in_context_blobs,
221 struct smb2_create_blobs *out_context_blobs)
223 return NT_STATUS_NOT_IMPLEMENTED;
226 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
228 errno = ENOSYS;
229 return -1;
232 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
233 void *data, size_t n, off_t offset)
235 errno = ENOSYS;
236 return -1;
239 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
240 TALLOC_CTX *mem_ctx,
241 struct tevent_context *ev,
242 struct files_struct *fsp,
243 void *data, size_t n, off_t offset)
245 return NULL;
248 static ssize_t skel_pread_recv(struct tevent_req *req,
249 struct vfs_aio_state *vfs_aio_state)
251 vfs_aio_state->error = ENOSYS;
252 return -1;
255 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
256 const void *data, size_t n, off_t offset)
258 errno = ENOSYS;
259 return -1;
262 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
263 TALLOC_CTX *mem_ctx,
264 struct tevent_context *ev,
265 struct files_struct *fsp,
266 const void *data,
267 size_t n, off_t offset)
269 return NULL;
272 static ssize_t skel_pwrite_recv(struct tevent_req *req,
273 struct vfs_aio_state *vfs_aio_state)
275 vfs_aio_state->error = ENOSYS;
276 return -1;
279 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
280 off_t offset, int whence)
282 errno = ENOSYS;
283 return (off_t) - 1;
286 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
287 files_struct *fromfsp, const DATA_BLOB *hdr,
288 off_t offset, size_t n)
290 errno = ENOSYS;
291 return -1;
294 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
295 files_struct *tofsp, off_t offset, size_t n)
297 errno = ENOSYS;
298 return -1;
301 static int skel_renameat(vfs_handle_struct *handle,
302 files_struct *srcfsp,
303 const struct smb_filename *smb_fname_src,
304 files_struct *dstfsp,
305 const struct smb_filename *smb_fname_dst)
307 errno = ENOSYS;
308 return -1;
311 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
312 TALLOC_CTX *mem_ctx,
313 struct tevent_context *ev,
314 struct files_struct *fsp)
316 return NULL;
319 static int skel_fsync_recv(struct tevent_req *req,
320 struct vfs_aio_state *vfs_aio_state)
322 vfs_aio_state->error = ENOSYS;
323 return -1;
326 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
328 errno = ENOSYS;
329 return -1;
332 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
333 SMB_STRUCT_STAT *sbuf)
335 errno = ENOSYS;
336 return -1;
339 static int skel_lstat(vfs_handle_struct *handle,
340 struct smb_filename *smb_fname)
342 errno = ENOSYS;
343 return -1;
346 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
347 struct files_struct *fsp,
348 const SMB_STRUCT_STAT *sbuf)
350 errno = ENOSYS;
351 return -1;
354 static int skel_unlinkat(vfs_handle_struct *handle,
355 struct files_struct *dirfsp,
356 const struct smb_filename *smb_fname,
357 int flags)
359 errno = ENOSYS;
360 return -1;
363 static int skel_chmod(vfs_handle_struct *handle,
364 const struct smb_filename *smb_fname,
365 mode_t mode)
367 errno = ENOSYS;
368 return -1;
371 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
372 mode_t mode)
374 errno = ENOSYS;
375 return -1;
378 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
379 uid_t uid, gid_t gid)
381 errno = ENOSYS;
382 return -1;
385 static int skel_lchown(vfs_handle_struct *handle,
386 const struct smb_filename *smb_fname,
387 uid_t uid,
388 gid_t gid)
390 errno = ENOSYS;
391 return -1;
394 static int skel_chdir(vfs_handle_struct *handle,
395 const struct smb_filename *smb_fname)
397 errno = ENOSYS;
398 return -1;
401 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
402 TALLOC_CTX *ctx)
404 errno = ENOSYS;
405 return NULL;
408 static int skel_ntimes(vfs_handle_struct *handle,
409 const struct smb_filename *smb_fname,
410 struct smb_file_time *ft)
412 errno = ENOSYS;
413 return -1;
416 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
417 off_t offset)
419 errno = ENOSYS;
420 return -1;
423 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
424 uint32_t mode, off_t offset, off_t len)
426 errno = ENOSYS;
427 return -1;
430 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
431 off_t offset, off_t count, int type)
433 errno = ENOSYS;
434 return false;
437 static int skel_kernel_flock(struct vfs_handle_struct *handle,
438 struct files_struct *fsp,
439 uint32_t share_mode, 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 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_chflags(vfs_handle_struct *handle,
516 const struct smb_filename *smb_fname,
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 DATA_BLOB *_token_blob)
570 NTSTATUS status;
572 if (tevent_req_is_nterror(req, &status)) {
573 tevent_req_received(req);
574 return status;
576 tevent_req_received(req);
578 return NT_STATUS_OK;
581 struct skel_cc_state {
582 uint64_t unused;
584 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
585 TALLOC_CTX *mem_ctx,
586 struct tevent_context *ev,
587 uint32_t fsctl,
588 DATA_BLOB *token,
589 off_t transfer_offset,
590 struct files_struct *dest_fsp,
591 off_t dest_off,
592 off_t num)
594 struct tevent_req *req;
595 struct skel_cc_state *cc_state;
597 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
598 if (req == NULL) {
599 return NULL;
602 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
603 return tevent_req_post(req, ev);
606 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
607 struct tevent_req *req,
608 off_t *copied)
610 NTSTATUS status;
612 if (tevent_req_is_nterror(req, &status)) {
613 tevent_req_received(req);
614 return status;
616 tevent_req_received(req);
618 return NT_STATUS_OK;
621 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
622 TALLOC_CTX *mem_ctx,
623 struct files_struct *fsp,
624 struct smb_filename *smb_fname,
625 uint16_t *_compression_fmt)
627 return NT_STATUS_INVALID_DEVICE_REQUEST;
630 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
631 TALLOC_CTX *mem_ctx,
632 struct files_struct *fsp,
633 uint16_t compression_fmt)
635 return NT_STATUS_INVALID_DEVICE_REQUEST;
638 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
639 struct files_struct *fsp,
640 const struct smb_filename *smb_fname,
641 TALLOC_CTX *mem_ctx,
642 unsigned int *num_streams,
643 struct stream_struct **streams)
645 return NT_STATUS_NOT_IMPLEMENTED;
648 static int skel_get_real_filename(struct vfs_handle_struct *handle,
649 const struct smb_filename *path,
650 const char *name,
651 TALLOC_CTX *mem_ctx, char **found_name)
653 errno = ENOSYS;
654 return -1;
657 static const char *skel_connectpath(struct vfs_handle_struct *handle,
658 const struct smb_filename *smb_fname)
660 errno = ENOSYS;
661 return NULL;
664 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
665 struct byte_range_lock *br_lck,
666 struct lock_struct *plock)
668 return NT_STATUS_NOT_IMPLEMENTED;
671 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
672 struct byte_range_lock *br_lck,
673 const struct lock_struct *plock)
675 errno = ENOSYS;
676 return false;
679 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
680 struct files_struct *fsp,
681 struct lock_struct *plock)
683 errno = ENOSYS;
684 return false;
687 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
688 const char *mapped_name,
689 enum vfs_translate_direction direction,
690 TALLOC_CTX *mem_ctx, char **pmapped_name)
692 return NT_STATUS_NOT_IMPLEMENTED;
695 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
696 struct files_struct *fsp,
697 TALLOC_CTX *ctx,
698 uint32_t function,
699 uint16_t req_flags, /* Needed for UNICODE ... */
700 const uint8_t *_in_data,
701 uint32_t in_len,
702 uint8_t **_out_data,
703 uint32_t max_out_len, uint32_t *out_len)
705 return NT_STATUS_NOT_IMPLEMENTED;
708 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
709 const struct smb_filename *fname,
710 TALLOC_CTX *mem_ctx,
711 struct readdir_attr_data **pattr_data)
713 return NT_STATUS_NOT_IMPLEMENTED;
716 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
717 struct smb_filename *smb_fname,
718 uint32_t *dosmode)
720 return NT_STATUS_NOT_IMPLEMENTED;
723 struct skel_get_dos_attributes_state {
724 struct vfs_aio_state aio_state;
725 uint32_t dosmode;
728 static struct tevent_req *skel_get_dos_attributes_send(
729 TALLOC_CTX *mem_ctx,
730 struct tevent_context *ev,
731 struct vfs_handle_struct *handle,
732 files_struct *dir_fsp,
733 struct smb_filename *smb_fname)
735 struct tevent_req *req = NULL;
736 struct skel_get_dos_attributes_state *state = NULL;
738 req = tevent_req_create(mem_ctx, &state,
739 struct skel_get_dos_attributes_state);
740 if (req == NULL) {
741 return NULL;
744 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
745 return tevent_req_post(req, ev);
748 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
749 struct vfs_aio_state *aio_state,
750 uint32_t *dosmode)
752 struct skel_get_dos_attributes_state *state =
753 tevent_req_data(req,
754 struct skel_get_dos_attributes_state);
755 NTSTATUS status;
757 if (tevent_req_is_nterror(req, &status)) {
758 tevent_req_received(req);
759 return status;
762 *aio_state = state->aio_state;
763 *dosmode = state->dosmode;
764 tevent_req_received(req);
765 return NT_STATUS_OK;
768 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
769 struct files_struct *fsp,
770 uint32_t *dosmode)
772 return NT_STATUS_NOT_IMPLEMENTED;
775 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
776 const struct smb_filename *smb_fname,
777 uint32_t dosmode)
779 return NT_STATUS_NOT_IMPLEMENTED;
782 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
783 struct files_struct *fsp,
784 uint32_t dosmode)
786 return NT_STATUS_NOT_IMPLEMENTED;
789 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
790 uint32_t security_info,
791 TALLOC_CTX *mem_ctx,
792 struct security_descriptor **ppdesc)
794 return NT_STATUS_NOT_IMPLEMENTED;
797 static NTSTATUS skel_get_nt_acl_at(vfs_handle_struct *handle,
798 struct files_struct *dirfsp,
799 const struct smb_filename *smb_fname,
800 uint32_t security_info,
801 TALLOC_CTX *mem_ctx,
802 struct security_descriptor **ppdesc)
804 return NT_STATUS_NOT_IMPLEMENTED;
807 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
808 uint32_t security_info_sent,
809 const struct security_descriptor *psd)
811 return NT_STATUS_NOT_IMPLEMENTED;
814 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
815 const struct smb_filename *smb_fname,
816 SMB_ACL_TYPE_T type,
817 TALLOC_CTX *mem_ctx)
819 errno = ENOSYS;
820 return (SMB_ACL_T) NULL;
823 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
824 files_struct *fsp, TALLOC_CTX *mem_ctx)
826 errno = ENOSYS;
827 return (SMB_ACL_T) NULL;
830 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
831 const struct smb_filename *smb_fname,
832 TALLOC_CTX *mem_ctx,
833 char **blob_description,
834 DATA_BLOB *blob)
836 errno = ENOSYS;
837 return -1;
840 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
841 files_struct *fsp, TALLOC_CTX *mem_ctx,
842 char **blob_description, DATA_BLOB *blob)
844 errno = ENOSYS;
845 return -1;
848 static int skel_sys_acl_set_file(vfs_handle_struct *handle,
849 const struct smb_filename *smb_fname,
850 SMB_ACL_TYPE_T acltype,
851 SMB_ACL_T theacl)
853 errno = ENOSYS;
854 return -1;
857 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
858 SMB_ACL_T theacl)
860 errno = ENOSYS;
861 return -1;
864 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
865 const struct smb_filename *smb_fname)
867 errno = ENOSYS;
868 return -1;
871 static ssize_t skel_getxattr(vfs_handle_struct *handle,
872 const struct smb_filename *smb_fname,
873 const char *name,
874 void *value,
875 size_t size)
877 errno = ENOSYS;
878 return -1;
881 struct skel_getxattrat_state {
882 struct vfs_aio_state aio_state;
883 ssize_t xattr_size;
884 uint8_t *xattr_value;
887 static struct tevent_req *skel_getxattrat_send(
888 TALLOC_CTX *mem_ctx,
889 struct tevent_context *ev,
890 struct vfs_handle_struct *handle,
891 files_struct *dir_fsp,
892 const struct smb_filename *smb_fname,
893 const char *xattr_name,
894 size_t alloc_hint)
896 struct tevent_req *req = NULL;
897 struct skel_getxattrat_state *state = NULL;
899 req = tevent_req_create(mem_ctx, &state,
900 struct skel_getxattrat_state);
901 if (req == NULL) {
902 return NULL;
905 tevent_req_error(req, ENOSYS);
906 return tevent_req_post(req, ev);
909 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
910 struct vfs_aio_state *aio_state,
911 TALLOC_CTX *mem_ctx,
912 uint8_t **xattr_value)
914 struct skel_getxattrat_state *state = tevent_req_data(
915 req, struct skel_getxattrat_state);
916 ssize_t xattr_size;
918 if (tevent_req_is_unix_error(req, &aio_state->error)) {
919 tevent_req_received(req);
920 return -1;
923 *aio_state = state->aio_state;
924 xattr_size = state->xattr_size;
925 if (xattr_value != NULL) {
926 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
929 tevent_req_received(req);
930 return xattr_size;
933 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
934 struct files_struct *fsp, const char *name,
935 void *value, size_t size)
937 errno = ENOSYS;
938 return -1;
941 static ssize_t skel_listxattr(vfs_handle_struct *handle,
942 const struct smb_filename *smb_fname,
943 char *list,
944 size_t size)
946 errno = ENOSYS;
947 return -1;
950 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
951 struct files_struct *fsp, char *list,
952 size_t size)
954 errno = ENOSYS;
955 return -1;
958 static int skel_removexattr(vfs_handle_struct *handle,
959 const struct smb_filename *smb_fname,
960 const char *name)
962 errno = ENOSYS;
963 return -1;
966 static int skel_fremovexattr(vfs_handle_struct *handle,
967 struct files_struct *fsp, const char *name)
969 errno = ENOSYS;
970 return -1;
973 static int skel_setxattr(vfs_handle_struct *handle,
974 const struct smb_filename *smb_fname,
975 const char *name,
976 const void *value,
977 size_t size,
978 int flags)
980 errno = ENOSYS;
981 return -1;
984 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
985 const char *name, const void *value, size_t size,
986 int flags)
988 errno = ENOSYS;
989 return -1;
992 static bool skel_aio_force(struct vfs_handle_struct *handle,
993 struct files_struct *fsp)
995 errno = ENOSYS;
996 return false;
999 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
1000 struct smb_filename *file,
1001 struct security_acl *sacl,
1002 uint32_t access_requested,
1003 uint32_t access_denied)
1005 return NT_STATUS_NOT_IMPLEMENTED;
1008 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
1009 struct files_struct *fsp,
1010 TALLOC_CTX *mem_ctx,
1011 DATA_BLOB *cookie)
1013 return NT_STATUS_NOT_IMPLEMENTED;
1016 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
1017 struct files_struct *fsp,
1018 const DATA_BLOB old_cookie,
1019 TALLOC_CTX *mem_ctx,
1020 DATA_BLOB *new_cookie)
1022 return NT_STATUS_NOT_IMPLEMENTED;
1025 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
1026 struct smb_request *smb1req,
1027 struct smbXsrv_open *op,
1028 const DATA_BLOB old_cookie,
1029 TALLOC_CTX *mem_ctx,
1030 struct files_struct **fsp,
1031 DATA_BLOB *new_cookie)
1033 return NT_STATUS_NOT_IMPLEMENTED;
1036 /* VFS operations structure */
1038 static struct vfs_fn_pointers skel_opaque_fns = {
1039 /* Disk operations */
1041 .connect_fn = skel_connect,
1042 .disconnect_fn = skel_disconnect,
1043 .disk_free_fn = skel_disk_free,
1044 .get_quota_fn = skel_get_quota,
1045 .set_quota_fn = skel_set_quota,
1046 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1047 .statvfs_fn = skel_statvfs,
1048 .fs_capabilities_fn = skel_fs_capabilities,
1049 .get_dfs_referrals_fn = skel_get_dfs_referrals,
1050 .create_dfs_pathat_fn = skel_create_dfs_pathat,
1051 .read_dfs_pathat_fn = skel_read_dfs_pathat,
1052 .snap_check_path_fn = skel_snap_check_path,
1053 .snap_create_fn = skel_snap_create,
1054 .snap_delete_fn = skel_snap_delete,
1056 /* Directory operations */
1058 .fdopendir_fn = skel_fdopendir,
1059 .readdir_fn = skel_readdir,
1060 .seekdir_fn = skel_seekdir,
1061 .telldir_fn = skel_telldir,
1062 .rewind_dir_fn = skel_rewind_dir,
1063 .mkdirat_fn = skel_mkdirat,
1064 .closedir_fn = skel_closedir,
1066 /* File operations */
1068 .openat_fn = skel_openat,
1069 .create_file_fn = skel_create_file,
1070 .close_fn = skel_close_fn,
1071 .pread_fn = skel_pread,
1072 .pread_send_fn = skel_pread_send,
1073 .pread_recv_fn = skel_pread_recv,
1074 .pwrite_fn = skel_pwrite,
1075 .pwrite_send_fn = skel_pwrite_send,
1076 .pwrite_recv_fn = skel_pwrite_recv,
1077 .lseek_fn = skel_lseek,
1078 .sendfile_fn = skel_sendfile,
1079 .recvfile_fn = skel_recvfile,
1080 .renameat_fn = skel_renameat,
1081 .fsync_send_fn = skel_fsync_send,
1082 .fsync_recv_fn = skel_fsync_recv,
1083 .stat_fn = skel_stat,
1084 .fstat_fn = skel_fstat,
1085 .lstat_fn = skel_lstat,
1086 .get_alloc_size_fn = skel_get_alloc_size,
1087 .unlinkat_fn = skel_unlinkat,
1088 .chmod_fn = skel_chmod,
1089 .fchmod_fn = skel_fchmod,
1090 .fchown_fn = skel_fchown,
1091 .lchown_fn = skel_lchown,
1092 .chdir_fn = skel_chdir,
1093 .getwd_fn = skel_getwd,
1094 .ntimes_fn = skel_ntimes,
1095 .ftruncate_fn = skel_ftruncate,
1096 .fallocate_fn = skel_fallocate,
1097 .lock_fn = skel_lock,
1098 .kernel_flock_fn = skel_kernel_flock,
1099 .fcntl_fn = skel_fcntl,
1100 .linux_setlease_fn = skel_linux_setlease,
1101 .getlock_fn = skel_getlock,
1102 .symlinkat_fn = skel_symlinkat,
1103 .readlinkat_fn = skel_vfs_readlinkat,
1104 .linkat_fn = skel_linkat,
1105 .mknodat_fn = skel_mknodat,
1106 .realpath_fn = skel_realpath,
1107 .chflags_fn = skel_chflags,
1108 .file_id_create_fn = skel_file_id_create,
1109 .fs_file_id_fn = skel_fs_file_id,
1110 .offload_read_send_fn = skel_offload_read_send,
1111 .offload_read_recv_fn = skel_offload_read_recv,
1112 .offload_write_send_fn = skel_offload_write_send,
1113 .offload_write_recv_fn = skel_offload_write_recv,
1114 .get_compression_fn = skel_get_compression,
1115 .set_compression_fn = skel_set_compression,
1117 .streaminfo_fn = skel_streaminfo,
1118 .get_real_filename_fn = skel_get_real_filename,
1119 .connectpath_fn = skel_connectpath,
1120 .brl_lock_windows_fn = skel_brl_lock_windows,
1121 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1122 .strict_lock_check_fn = skel_strict_lock_check,
1123 .translate_name_fn = skel_translate_name,
1124 .fsctl_fn = skel_fsctl,
1125 .readdir_attr_fn = skel_readdir_attr,
1126 .audit_file_fn = skel_audit_file,
1128 /* DOS attributes. */
1129 .get_dos_attributes_fn = skel_get_dos_attributes,
1130 .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1131 .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1132 .fget_dos_attributes_fn = skel_fget_dos_attributes,
1133 .set_dos_attributes_fn = skel_set_dos_attributes,
1134 .fset_dos_attributes_fn = skel_fset_dos_attributes,
1136 /* NT ACL operations. */
1138 .fget_nt_acl_fn = skel_fget_nt_acl,
1139 .get_nt_acl_at_fn = skel_get_nt_acl_at,
1140 .fset_nt_acl_fn = skel_fset_nt_acl,
1142 /* POSIX ACL operations. */
1144 .sys_acl_get_file_fn = skel_sys_acl_get_file,
1145 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1146 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1147 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1148 .sys_acl_set_file_fn = skel_sys_acl_set_file,
1149 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1150 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1152 /* EA operations. */
1153 .getxattr_fn = skel_getxattr,
1154 .getxattrat_send_fn = skel_getxattrat_send,
1155 .getxattrat_recv_fn = skel_getxattrat_recv,
1156 .fgetxattr_fn = skel_fgetxattr,
1157 .listxattr_fn = skel_listxattr,
1158 .flistxattr_fn = skel_flistxattr,
1159 .removexattr_fn = skel_removexattr,
1160 .fremovexattr_fn = skel_fremovexattr,
1161 .setxattr_fn = skel_setxattr,
1162 .fsetxattr_fn = skel_fsetxattr,
1164 /* aio operations */
1165 .aio_force_fn = skel_aio_force,
1167 /* durable handle operations */
1168 .durable_cookie_fn = skel_durable_cookie,
1169 .durable_disconnect_fn = skel_durable_disconnect,
1170 .durable_reconnect_fn = skel_durable_reconnect,
1173 static_decl_vfs;
1174 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1177 * smb_vfs_assert_all_fns() makes sure every
1178 * call is implemented.
1180 * An opaque module requires this!
1182 smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1183 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1184 &skel_opaque_fns);