s3: smbd: Strip any leading '\\' characters if the SMB2 DFS flag is set.
[Samba.git] / examples / VFS / skel_opaque.c
blob98b090728f27c20d0006230072577cb25e87f794
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,
161 SMB_STRUCT_STAT *sbuf)
163 return NULL;
166 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
171 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
173 return (long)-1;
176 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
181 static int skel_mkdirat(vfs_handle_struct *handle,
182 struct files_struct *dirfsp,
183 const struct smb_filename *smb_fname,
184 mode_t mode)
186 errno = ENOSYS;
187 return -1;
190 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
192 errno = ENOSYS;
193 return -1;
196 static int skel_openat(struct vfs_handle_struct *handle,
197 const struct files_struct *dirfsp,
198 const struct smb_filename *smb_fname,
199 struct files_struct *fsp,
200 const struct vfs_open_how *how)
202 if (how->resolve != 0) {
203 errno = ENOSYS;
204 return -1;
207 errno = ENOSYS;
208 return -1;
211 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
212 struct smb_request *req,
213 struct files_struct *dirfsp,
214 struct smb_filename *smb_fname,
215 uint32_t access_mask,
216 uint32_t share_access,
217 uint32_t create_disposition,
218 uint32_t create_options,
219 uint32_t file_attributes,
220 uint32_t oplock_request,
221 const struct smb2_lease *lease,
222 uint64_t allocation_size,
223 uint32_t private_flags,
224 struct security_descriptor *sd,
225 struct ea_list *ea_list,
226 files_struct **result, int *pinfo,
227 const struct smb2_create_blobs *in_context_blobs,
228 struct smb2_create_blobs *out_context_blobs)
230 return NT_STATUS_NOT_IMPLEMENTED;
233 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
235 errno = ENOSYS;
236 return -1;
239 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
240 void *data, size_t n, off_t offset)
242 errno = ENOSYS;
243 return -1;
246 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
247 TALLOC_CTX *mem_ctx,
248 struct tevent_context *ev,
249 struct files_struct *fsp,
250 void *data, size_t n, off_t offset)
252 return NULL;
255 static ssize_t skel_pread_recv(struct tevent_req *req,
256 struct vfs_aio_state *vfs_aio_state)
258 vfs_aio_state->error = ENOSYS;
259 return -1;
262 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
263 const void *data, size_t n, off_t offset)
265 errno = ENOSYS;
266 return -1;
269 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
270 TALLOC_CTX *mem_ctx,
271 struct tevent_context *ev,
272 struct files_struct *fsp,
273 const void *data,
274 size_t n, off_t offset)
276 return NULL;
279 static ssize_t skel_pwrite_recv(struct tevent_req *req,
280 struct vfs_aio_state *vfs_aio_state)
282 vfs_aio_state->error = ENOSYS;
283 return -1;
286 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
287 off_t offset, int whence)
289 errno = ENOSYS;
290 return (off_t) - 1;
293 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
294 files_struct *fromfsp, const DATA_BLOB *hdr,
295 off_t offset, size_t n)
297 errno = ENOSYS;
298 return -1;
301 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
302 files_struct *tofsp, off_t offset, size_t n)
304 errno = ENOSYS;
305 return -1;
308 static int skel_renameat(vfs_handle_struct *handle,
309 files_struct *srcfsp,
310 const struct smb_filename *smb_fname_src,
311 files_struct *dstfsp,
312 const struct smb_filename *smb_fname_dst)
314 errno = ENOSYS;
315 return -1;
318 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
319 TALLOC_CTX *mem_ctx,
320 struct tevent_context *ev,
321 struct files_struct *fsp)
323 return NULL;
326 static int skel_fsync_recv(struct tevent_req *req,
327 struct vfs_aio_state *vfs_aio_state)
329 vfs_aio_state->error = ENOSYS;
330 return -1;
333 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
335 errno = ENOSYS;
336 return -1;
339 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
340 SMB_STRUCT_STAT *sbuf)
342 errno = ENOSYS;
343 return -1;
346 static int skel_lstat(vfs_handle_struct *handle,
347 struct smb_filename *smb_fname)
349 errno = ENOSYS;
350 return -1;
353 static int skel_fstatat(
354 struct vfs_handle_struct *handle,
355 const struct files_struct *dirfsp,
356 const struct smb_filename *smb_fname,
357 SMB_STRUCT_STAT *sbuf,
358 int flags)
360 errno = ENOSYS;
361 return -1;
364 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
365 struct files_struct *fsp,
366 const SMB_STRUCT_STAT *sbuf)
368 errno = ENOSYS;
369 return -1;
372 static int skel_unlinkat(vfs_handle_struct *handle,
373 struct files_struct *dirfsp,
374 const struct smb_filename *smb_fname,
375 int flags)
377 errno = ENOSYS;
378 return -1;
381 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
382 mode_t mode)
384 errno = ENOSYS;
385 return -1;
388 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
389 uid_t uid, gid_t gid)
391 errno = ENOSYS;
392 return -1;
395 static int skel_lchown(vfs_handle_struct *handle,
396 const struct smb_filename *smb_fname,
397 uid_t uid,
398 gid_t gid)
400 errno = ENOSYS;
401 return -1;
404 static int skel_chdir(vfs_handle_struct *handle,
405 const struct smb_filename *smb_fname)
407 errno = ENOSYS;
408 return -1;
411 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
412 TALLOC_CTX *ctx)
414 errno = ENOSYS;
415 return NULL;
418 static int skel_fntimes(vfs_handle_struct *handle,
419 files_struct *fsp,
420 struct smb_file_time *ft)
422 errno = ENOSYS;
423 return -1;
426 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
427 off_t offset)
429 errno = ENOSYS;
430 return -1;
433 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
434 uint32_t mode, off_t offset, off_t len)
436 errno = ENOSYS;
437 return -1;
440 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
441 off_t offset, off_t count, int type)
443 errno = ENOSYS;
444 return false;
447 static int skel_filesystem_sharemode(struct vfs_handle_struct *handle,
448 struct files_struct *fsp,
449 uint32_t share_mode,
450 uint32_t access_mask)
452 errno = ENOSYS;
453 return -1;
456 static int skel_fcntl(struct vfs_handle_struct *handle,
457 struct files_struct *fsp, int cmd, va_list cmd_arg)
459 errno = ENOSYS;
460 return -1;
463 static int skel_linux_setlease(struct vfs_handle_struct *handle,
464 struct files_struct *fsp, int leasetype)
466 errno = ENOSYS;
467 return -1;
470 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
471 off_t *poffset, off_t *pcount, int *ptype,
472 pid_t *ppid)
474 errno = ENOSYS;
475 return false;
478 static int skel_symlinkat(vfs_handle_struct *handle,
479 const struct smb_filename *link_contents,
480 struct files_struct *dirfsp,
481 const struct smb_filename *new_smb_fname)
483 errno = ENOSYS;
484 return -1;
487 static int skel_vfs_readlinkat(vfs_handle_struct *handle,
488 const struct files_struct *dirfsp,
489 const struct smb_filename *smb_fname,
490 char *buf,
491 size_t bufsiz)
493 errno = ENOSYS;
494 return -1;
497 static int skel_linkat(vfs_handle_struct *handle,
498 files_struct *srcfsp,
499 const struct smb_filename *old_smb_fname,
500 files_struct *dstfsp,
501 const struct smb_filename *new_smb_fname,
502 int flags)
504 errno = ENOSYS;
505 return -1;
508 static int skel_mknodat(vfs_handle_struct *handle,
509 files_struct *dirfsp,
510 const struct smb_filename *smb_fname,
511 mode_t mode,
512 SMB_DEV_T dev)
514 errno = ENOSYS;
515 return -1;
518 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
519 TALLOC_CTX *ctx,
520 const struct smb_filename *smb_fname)
522 errno = ENOSYS;
523 return NULL;
526 static int skel_fchflags(vfs_handle_struct *handle,
527 struct files_struct *fsp,
528 uint flags)
530 errno = ENOSYS;
531 return -1;
534 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
535 const SMB_STRUCT_STAT *sbuf)
537 struct file_id id;
538 ZERO_STRUCT(id);
539 errno = ENOSYS;
540 return id;
543 static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
544 const SMB_STRUCT_STAT *sbuf)
546 errno = ENOSYS;
547 return 0;
550 struct skel_offload_read_state {
551 bool dummy;
554 static struct tevent_req *skel_offload_read_send(
555 TALLOC_CTX *mem_ctx,
556 struct tevent_context *ev,
557 struct vfs_handle_struct *handle,
558 struct files_struct *fsp,
559 uint32_t fsctl,
560 uint32_t ttl,
561 off_t offset,
562 size_t to_copy)
564 struct tevent_req *req = NULL;
565 struct skel_offload_read_state *state = NULL;
567 req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
568 if (req == NULL) {
569 return NULL;
572 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
573 return tevent_req_post(req, ev);
576 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
577 struct vfs_handle_struct *handle,
578 TALLOC_CTX *mem_ctx,
579 uint32_t *flags,
580 uint64_t *xferlen,
581 DATA_BLOB *_token_blob)
583 NTSTATUS status;
585 if (tevent_req_is_nterror(req, &status)) {
586 tevent_req_received(req);
587 return status;
589 tevent_req_received(req);
591 return NT_STATUS_OK;
594 struct skel_cc_state {
595 uint64_t unused;
597 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
598 TALLOC_CTX *mem_ctx,
599 struct tevent_context *ev,
600 uint32_t fsctl,
601 DATA_BLOB *token,
602 off_t transfer_offset,
603 struct files_struct *dest_fsp,
604 off_t dest_off,
605 off_t num)
607 struct tevent_req *req;
608 struct skel_cc_state *cc_state;
610 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
611 if (req == NULL) {
612 return NULL;
615 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
616 return tevent_req_post(req, ev);
619 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
620 struct tevent_req *req,
621 off_t *copied)
623 NTSTATUS status;
625 if (tevent_req_is_nterror(req, &status)) {
626 tevent_req_received(req);
627 return status;
629 tevent_req_received(req);
631 return NT_STATUS_OK;
634 static NTSTATUS skel_fget_compression(struct vfs_handle_struct *handle,
635 TALLOC_CTX *mem_ctx,
636 struct files_struct *fsp,
637 uint16_t *_compression_fmt)
639 return NT_STATUS_INVALID_DEVICE_REQUEST;
642 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
643 TALLOC_CTX *mem_ctx,
644 struct files_struct *fsp,
645 uint16_t compression_fmt)
647 return NT_STATUS_INVALID_DEVICE_REQUEST;
650 static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
651 struct files_struct *fsp,
652 TALLOC_CTX *mem_ctx,
653 unsigned int *num_streams,
654 struct stream_struct **streams)
656 return NT_STATUS_NOT_IMPLEMENTED;
659 static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle,
660 struct files_struct *dirfsp,
661 const char *name,
662 TALLOC_CTX *mem_ctx,
663 char **found_name)
665 return NT_STATUS_NOT_IMPLEMENTED;
668 static const char *skel_connectpath(
669 struct vfs_handle_struct *handle,
670 const struct files_struct *dirfsp,
671 const struct smb_filename *smb_fname)
673 errno = ENOSYS;
674 return NULL;
677 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
678 struct byte_range_lock *br_lck,
679 struct lock_struct *plock)
681 return NT_STATUS_NOT_IMPLEMENTED;
684 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
685 struct byte_range_lock *br_lck,
686 const struct lock_struct *plock)
688 errno = ENOSYS;
689 return false;
692 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
693 struct files_struct *fsp,
694 struct lock_struct *plock)
696 errno = ENOSYS;
697 return false;
700 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
701 const char *mapped_name,
702 enum vfs_translate_direction direction,
703 TALLOC_CTX *mem_ctx, char **pmapped_name)
705 return NT_STATUS_NOT_IMPLEMENTED;
708 static NTSTATUS skel_parent_pathname(struct vfs_handle_struct *handle,
709 TALLOC_CTX *mem_ctx,
710 const struct smb_filename *smb_fname_in,
711 struct smb_filename **parent_dir_out,
712 struct smb_filename **atname_out)
714 return NT_STATUS_NOT_IMPLEMENTED;
717 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
718 struct files_struct *fsp,
719 TALLOC_CTX *ctx,
720 uint32_t function,
721 uint16_t req_flags, /* Needed for UNICODE ... */
722 const uint8_t *_in_data,
723 uint32_t in_len,
724 uint8_t **_out_data,
725 uint32_t max_out_len, uint32_t *out_len)
727 return NT_STATUS_NOT_IMPLEMENTED;
730 static NTSTATUS skel_freaddir_attr(struct vfs_handle_struct *handle,
731 struct files_struct *fsp,
732 TALLOC_CTX *mem_ctx,
733 struct readdir_attr_data **pattr_data)
735 return NT_STATUS_NOT_IMPLEMENTED;
738 struct skel_get_dos_attributes_state {
739 struct vfs_aio_state aio_state;
740 uint32_t dosmode;
743 static struct tevent_req *skel_get_dos_attributes_send(
744 TALLOC_CTX *mem_ctx,
745 struct tevent_context *ev,
746 struct vfs_handle_struct *handle,
747 files_struct *dir_fsp,
748 struct smb_filename *smb_fname)
750 struct tevent_req *req = NULL;
751 struct skel_get_dos_attributes_state *state = NULL;
753 req = tevent_req_create(mem_ctx, &state,
754 struct skel_get_dos_attributes_state);
755 if (req == NULL) {
756 return NULL;
759 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
760 return tevent_req_post(req, ev);
763 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
764 struct vfs_aio_state *aio_state,
765 uint32_t *dosmode)
767 struct skel_get_dos_attributes_state *state =
768 tevent_req_data(req,
769 struct skel_get_dos_attributes_state);
770 NTSTATUS status;
772 if (tevent_req_is_nterror(req, &status)) {
773 tevent_req_received(req);
774 return status;
777 *aio_state = state->aio_state;
778 *dosmode = state->dosmode;
779 tevent_req_received(req);
780 return NT_STATUS_OK;
783 static NTSTATUS skel_fget_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_fset_dos_attributes(struct vfs_handle_struct *handle,
791 struct files_struct *fsp,
792 uint32_t dosmode)
794 return NT_STATUS_NOT_IMPLEMENTED;
797 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
798 uint32_t security_info,
799 TALLOC_CTX *mem_ctx,
800 struct security_descriptor **ppdesc)
802 return NT_STATUS_NOT_IMPLEMENTED;
805 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
806 uint32_t security_info_sent,
807 const struct security_descriptor *psd)
809 return NT_STATUS_NOT_IMPLEMENTED;
812 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
813 files_struct *fsp,
814 SMB_ACL_TYPE_T type,
815 TALLOC_CTX *mem_ctx)
817 errno = ENOSYS;
818 return (SMB_ACL_T) NULL;
821 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
822 files_struct *fsp, TALLOC_CTX *mem_ctx,
823 char **blob_description, DATA_BLOB *blob)
825 errno = ENOSYS;
826 return -1;
829 static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
830 struct files_struct *fsp,
831 SMB_ACL_TYPE_T type,
832 SMB_ACL_T theacl)
834 errno = ENOSYS;
835 return -1;
838 static int skel_sys_acl_delete_def_fd(vfs_handle_struct *handle,
839 struct files_struct *fsp)
841 errno = ENOSYS;
842 return -1;
845 struct skel_getxattrat_state {
846 struct vfs_aio_state aio_state;
847 ssize_t xattr_size;
848 uint8_t *xattr_value;
851 static struct tevent_req *skel_getxattrat_send(
852 TALLOC_CTX *mem_ctx,
853 struct tevent_context *ev,
854 struct vfs_handle_struct *handle,
855 files_struct *dir_fsp,
856 const struct smb_filename *smb_fname,
857 const char *xattr_name,
858 size_t alloc_hint)
860 struct tevent_req *req = NULL;
861 struct skel_getxattrat_state *state = NULL;
863 req = tevent_req_create(mem_ctx, &state,
864 struct skel_getxattrat_state);
865 if (req == NULL) {
866 return NULL;
869 tevent_req_error(req, ENOSYS);
870 return tevent_req_post(req, ev);
873 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
874 struct vfs_aio_state *aio_state,
875 TALLOC_CTX *mem_ctx,
876 uint8_t **xattr_value)
878 struct skel_getxattrat_state *state = tevent_req_data(
879 req, struct skel_getxattrat_state);
880 ssize_t xattr_size;
882 if (tevent_req_is_unix_error(req, &aio_state->error)) {
883 tevent_req_received(req);
884 return -1;
887 *aio_state = state->aio_state;
888 xattr_size = state->xattr_size;
889 if (xattr_value != NULL) {
890 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
893 tevent_req_received(req);
894 return xattr_size;
897 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
898 struct files_struct *fsp, const char *name,
899 void *value, size_t size)
901 errno = ENOSYS;
902 return -1;
905 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
906 struct files_struct *fsp, char *list,
907 size_t size)
909 errno = ENOSYS;
910 return -1;
913 static int skel_fremovexattr(vfs_handle_struct *handle,
914 struct files_struct *fsp, const char *name)
916 errno = ENOSYS;
917 return -1;
920 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
921 const char *name, const void *value, size_t size,
922 int flags)
924 errno = ENOSYS;
925 return -1;
928 static bool skel_aio_force(struct vfs_handle_struct *handle,
929 struct files_struct *fsp)
931 errno = ENOSYS;
932 return false;
935 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
936 struct smb_filename *file,
937 struct security_acl *sacl,
938 uint32_t access_requested,
939 uint32_t access_denied)
941 return NT_STATUS_NOT_IMPLEMENTED;
944 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
945 struct files_struct *fsp,
946 TALLOC_CTX *mem_ctx,
947 DATA_BLOB *cookie)
949 return NT_STATUS_NOT_IMPLEMENTED;
952 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
953 struct files_struct *fsp,
954 const DATA_BLOB old_cookie,
955 TALLOC_CTX *mem_ctx,
956 DATA_BLOB *new_cookie)
958 return NT_STATUS_NOT_IMPLEMENTED;
961 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
962 struct smb_request *smb1req,
963 struct smbXsrv_open *op,
964 const DATA_BLOB old_cookie,
965 TALLOC_CTX *mem_ctx,
966 struct files_struct **fsp,
967 DATA_BLOB *new_cookie)
969 return NT_STATUS_NOT_IMPLEMENTED;
972 /* VFS operations structure */
974 static struct vfs_fn_pointers skel_opaque_fns = {
975 /* Disk operations */
977 .connect_fn = skel_connect,
978 .disconnect_fn = skel_disconnect,
979 .disk_free_fn = skel_disk_free,
980 .get_quota_fn = skel_get_quota,
981 .set_quota_fn = skel_set_quota,
982 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
983 .statvfs_fn = skel_statvfs,
984 .fs_capabilities_fn = skel_fs_capabilities,
985 .get_dfs_referrals_fn = skel_get_dfs_referrals,
986 .create_dfs_pathat_fn = skel_create_dfs_pathat,
987 .read_dfs_pathat_fn = skel_read_dfs_pathat,
988 .snap_check_path_fn = skel_snap_check_path,
989 .snap_create_fn = skel_snap_create,
990 .snap_delete_fn = skel_snap_delete,
992 /* Directory operations */
994 .fdopendir_fn = skel_fdopendir,
995 .readdir_fn = skel_readdir,
996 .seekdir_fn = skel_seekdir,
997 .telldir_fn = skel_telldir,
998 .rewind_dir_fn = skel_rewind_dir,
999 .mkdirat_fn = skel_mkdirat,
1000 .closedir_fn = skel_closedir,
1002 /* File operations */
1004 .openat_fn = skel_openat,
1005 .create_file_fn = skel_create_file,
1006 .close_fn = skel_close_fn,
1007 .pread_fn = skel_pread,
1008 .pread_send_fn = skel_pread_send,
1009 .pread_recv_fn = skel_pread_recv,
1010 .pwrite_fn = skel_pwrite,
1011 .pwrite_send_fn = skel_pwrite_send,
1012 .pwrite_recv_fn = skel_pwrite_recv,
1013 .lseek_fn = skel_lseek,
1014 .sendfile_fn = skel_sendfile,
1015 .recvfile_fn = skel_recvfile,
1016 .renameat_fn = skel_renameat,
1017 .fsync_send_fn = skel_fsync_send,
1018 .fsync_recv_fn = skel_fsync_recv,
1019 .stat_fn = skel_stat,
1020 .fstat_fn = skel_fstat,
1021 .lstat_fn = skel_lstat,
1022 .fstatat_fn = skel_fstatat,
1023 .get_alloc_size_fn = skel_get_alloc_size,
1024 .unlinkat_fn = skel_unlinkat,
1025 .fchmod_fn = skel_fchmod,
1026 .fchown_fn = skel_fchown,
1027 .lchown_fn = skel_lchown,
1028 .chdir_fn = skel_chdir,
1029 .getwd_fn = skel_getwd,
1030 .fntimes_fn = skel_fntimes,
1031 .ftruncate_fn = skel_ftruncate,
1032 .fallocate_fn = skel_fallocate,
1033 .lock_fn = skel_lock,
1034 .filesystem_sharemode_fn = skel_filesystem_sharemode,
1035 .fcntl_fn = skel_fcntl,
1036 .linux_setlease_fn = skel_linux_setlease,
1037 .getlock_fn = skel_getlock,
1038 .symlinkat_fn = skel_symlinkat,
1039 .readlinkat_fn = skel_vfs_readlinkat,
1040 .linkat_fn = skel_linkat,
1041 .mknodat_fn = skel_mknodat,
1042 .realpath_fn = skel_realpath,
1043 .fchflags_fn = skel_fchflags,
1044 .file_id_create_fn = skel_file_id_create,
1045 .fs_file_id_fn = skel_fs_file_id,
1046 .offload_read_send_fn = skel_offload_read_send,
1047 .offload_read_recv_fn = skel_offload_read_recv,
1048 .offload_write_send_fn = skel_offload_write_send,
1049 .offload_write_recv_fn = skel_offload_write_recv,
1050 .fget_compression_fn = skel_fget_compression,
1051 .set_compression_fn = skel_set_compression,
1053 .fstreaminfo_fn = skel_fstreaminfo,
1054 .get_real_filename_at_fn = skel_get_real_filename_at,
1055 .connectpath_fn = skel_connectpath,
1056 .brl_lock_windows_fn = skel_brl_lock_windows,
1057 .brl_unlock_windows_fn = skel_brl_unlock_windows,
1058 .strict_lock_check_fn = skel_strict_lock_check,
1059 .translate_name_fn = skel_translate_name,
1060 .parent_pathname_fn = skel_parent_pathname,
1061 .fsctl_fn = skel_fsctl,
1062 .freaddir_attr_fn = skel_freaddir_attr,
1063 .audit_file_fn = skel_audit_file,
1065 /* DOS attributes. */
1066 .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1067 .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1068 .fget_dos_attributes_fn = skel_fget_dos_attributes,
1069 .fset_dos_attributes_fn = skel_fset_dos_attributes,
1071 /* NT ACL operations. */
1073 .fget_nt_acl_fn = skel_fget_nt_acl,
1074 .fset_nt_acl_fn = skel_fset_nt_acl,
1076 /* POSIX ACL operations. */
1078 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1079 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1080 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1081 .sys_acl_delete_def_fd_fn = skel_sys_acl_delete_def_fd,
1083 /* EA operations. */
1084 .getxattrat_send_fn = skel_getxattrat_send,
1085 .getxattrat_recv_fn = skel_getxattrat_recv,
1086 .fgetxattr_fn = skel_fgetxattr,
1087 .flistxattr_fn = skel_flistxattr,
1088 .fremovexattr_fn = skel_fremovexattr,
1089 .fsetxattr_fn = skel_fsetxattr,
1091 /* aio operations */
1092 .aio_force_fn = skel_aio_force,
1094 /* durable handle operations */
1095 .durable_cookie_fn = skel_durable_cookie,
1096 .durable_disconnect_fn = skel_durable_disconnect,
1097 .durable_reconnect_fn = skel_durable_reconnect,
1100 static_decl_vfs;
1101 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1104 * smb_vfs_assert_all_fns() makes sure every
1105 * call is implemented.
1107 * An opaque module requires this!
1109 smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1110 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1111 &skel_opaque_fns);