smbd: vfs: convert link_contents arg of SMB_VFS_SYMLINKAT() to struct smb_filename
[samba.git] / examples / VFS / skel_opaque.c
1 /* 
2  * Skeleton VFS module.  Implements dummy versions of all VFS
3  * functions.
4  *
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
9  *
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.
14  *  
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.
19  *  
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/>.
22  */
23
24 #include "../source3/include/includes.h"
25 #include "lib/util/tevent_unix.h"
26 #include "lib/util/tevent_ntstatus.h"
27
28 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE 
29    SAMBA DEVELOPERS GUIDE!!!!!!
30  */
31
32 /* If you take this file as template for your module
33  * you must re-implement every function.
34  */
35
36 static int skel_connect(vfs_handle_struct *handle, const char *service,
37                         const char *user)
38 {
39         errno = ENOSYS;
40         return -1;
41 }
42
43 static void skel_disconnect(vfs_handle_struct *handle)
44 {
45         ;
46 }
47
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)
53 {
54         *bsize = 0;
55         *dfree = 0;
56         *dsize = 0;
57         return 0;
58 }
59
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)
65 {
66         errno = ENOSYS;
67         return -1;
68 }
69
70 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
71                           unid_t id, SMB_DISK_QUOTA *dq)
72 {
73         errno = ENOSYS;
74         return -1;
75 }
76
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)
81 {
82         errno = ENOSYS;
83         return -1;
84 }
85
86 static int skel_statvfs(struct vfs_handle_struct *handle,
87                                 const struct smb_filename *smb_fname,
88                                 struct vfs_statvfs_struct *statbuf)
89 {
90         errno = ENOSYS;
91         return -1;
92 }
93
94 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
95                                      enum timestamp_set_resolution *p_ts_res)
96 {
97         return 0;
98 }
99
100 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
101                                        struct dfs_GetDFSReferral *r)
102 {
103         return NT_STATUS_NOT_IMPLEMENTED;
104 }
105
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)
111 {
112         return NT_STATUS_NOT_IMPLEMENTED;
113 }
114
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)
121 {
122         return NT_STATUS_NOT_IMPLEMENTED;
123 }
124
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)
129 {
130         return NT_STATUS_NOT_SUPPORTED;
131 }
132
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)
140 {
141         return NT_STATUS_NOT_SUPPORTED;
142 }
143
144 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
145                                  TALLOC_CTX *mem_ctx,
146                                  char *base_path,
147                                  char *snap_path)
148 {
149         return NT_STATUS_NOT_SUPPORTED;
150 }
151
152 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
153                            const char *mask, uint32_t attr)
154 {
155         return NULL;
156 }
157
158 static struct dirent *skel_readdir(vfs_handle_struct *handle,
159                                    DIR *dirp, SMB_STRUCT_STAT *sbuf)
160 {
161         return NULL;
162 }
163
164 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
165 {
166         ;
167 }
168
169 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
170 {
171         return (long)-1;
172 }
173
174 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
175 {
176         ;
177 }
178
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)
183 {
184         errno = ENOSYS;
185         return -1;
186 }
187
188 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
189 {
190         errno = ENOSYS;
191         return -1;
192 }
193
194 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
195                      files_struct *fsp, int flags, mode_t mode)
196 {
197         errno = ENOSYS;
198         return -1;
199 }
200
201 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
202                                  struct smb_request *req,
203                                  uint16_t root_dir_fid,
204                                  struct smb_filename *smb_fname,
205                                  uint32_t access_mask,
206                                  uint32_t share_access,
207                                  uint32_t create_disposition,
208                                  uint32_t create_options,
209                                  uint32_t file_attributes,
210                                  uint32_t oplock_request,
211                                  const struct smb2_lease *lease,
212                                  uint64_t allocation_size,
213                                  uint32_t private_flags,
214                                  struct security_descriptor *sd,
215                                  struct ea_list *ea_list,
216                                  files_struct **result, int *pinfo,
217                                  const struct smb2_create_blobs *in_context_blobs,
218                                  struct smb2_create_blobs *out_context_blobs)
219 {
220         return NT_STATUS_NOT_IMPLEMENTED;
221 }
222
223 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
224 {
225         errno = ENOSYS;
226         return -1;
227 }
228
229 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
230                           void *data, size_t n, off_t offset)
231 {
232         errno = ENOSYS;
233         return -1;
234 }
235
236 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
237                                           TALLOC_CTX *mem_ctx,
238                                           struct tevent_context *ev,
239                                           struct files_struct *fsp,
240                                           void *data, size_t n, off_t offset)
241 {
242         return NULL;
243 }
244
245 static ssize_t skel_pread_recv(struct tevent_req *req,
246                                struct vfs_aio_state *vfs_aio_state)
247 {
248         vfs_aio_state->error = ENOSYS;
249         return -1;
250 }
251
252 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
253                            const void *data, size_t n, off_t offset)
254 {
255         errno = ENOSYS;
256         return -1;
257 }
258
259 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
260                                            TALLOC_CTX *mem_ctx,
261                                            struct tevent_context *ev,
262                                            struct files_struct *fsp,
263                                            const void *data,
264                                            size_t n, off_t offset)
265 {
266         return NULL;
267 }
268
269 static ssize_t skel_pwrite_recv(struct tevent_req *req,
270                                 struct vfs_aio_state *vfs_aio_state)
271 {
272         vfs_aio_state->error = ENOSYS;
273         return -1;
274 }
275
276 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
277                         off_t offset, int whence)
278 {
279         errno = ENOSYS;
280         return (off_t) - 1;
281 }
282
283 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
284                              files_struct *fromfsp, const DATA_BLOB *hdr,
285                              off_t offset, size_t n)
286 {
287         errno = ENOSYS;
288         return -1;
289 }
290
291 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
292                              files_struct *tofsp, off_t offset, size_t n)
293 {
294         errno = ENOSYS;
295         return -1;
296 }
297
298 static int skel_renameat(vfs_handle_struct *handle,
299                        files_struct *srcfsp,
300                        const struct smb_filename *smb_fname_src,
301                        files_struct *dstfsp,
302                        const struct smb_filename *smb_fname_dst)
303 {
304         errno = ENOSYS;
305         return -1;
306 }
307
308 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
309                                           TALLOC_CTX *mem_ctx,
310                                           struct tevent_context *ev,
311                                           struct files_struct *fsp)
312 {
313         return NULL;
314 }
315
316 static int skel_fsync_recv(struct tevent_req *req,
317                            struct vfs_aio_state *vfs_aio_state)
318 {
319         vfs_aio_state->error = ENOSYS;
320         return -1;
321 }
322
323 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
324 {
325         errno = ENOSYS;
326         return -1;
327 }
328
329 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
330                       SMB_STRUCT_STAT *sbuf)
331 {
332         errno = ENOSYS;
333         return -1;
334 }
335
336 static int skel_lstat(vfs_handle_struct *handle,
337                       struct smb_filename *smb_fname)
338 {
339         errno = ENOSYS;
340         return -1;
341 }
342
343 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
344                                     struct files_struct *fsp,
345                                     const SMB_STRUCT_STAT *sbuf)
346 {
347         errno = ENOSYS;
348         return -1;
349 }
350
351 static int skel_unlinkat(vfs_handle_struct *handle,
352                         struct files_struct *dirfsp,
353                         const struct smb_filename *smb_fname,
354                         int flags)
355 {
356         errno = ENOSYS;
357         return -1;
358 }
359
360 static int skel_chmod(vfs_handle_struct *handle,
361                         const struct smb_filename *smb_fname,
362                         mode_t mode)
363 {
364         errno = ENOSYS;
365         return -1;
366 }
367
368 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
369                        mode_t mode)
370 {
371         errno = ENOSYS;
372         return -1;
373 }
374
375 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
376                        uid_t uid, gid_t gid)
377 {
378         errno = ENOSYS;
379         return -1;
380 }
381
382 static int skel_lchown(vfs_handle_struct *handle,
383                         const struct smb_filename *smb_fname,
384                         uid_t uid,
385                         gid_t gid)
386 {
387         errno = ENOSYS;
388         return -1;
389 }
390
391 static int skel_chdir(vfs_handle_struct *handle,
392                         const struct smb_filename *smb_fname)
393 {
394         errno = ENOSYS;
395         return -1;
396 }
397
398 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
399                                 TALLOC_CTX *ctx)
400 {
401         errno = ENOSYS;
402         return NULL;
403 }
404
405 static int skel_ntimes(vfs_handle_struct *handle,
406                        const struct smb_filename *smb_fname,
407                        struct smb_file_time *ft)
408 {
409         errno = ENOSYS;
410         return -1;
411 }
412
413 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
414                           off_t offset)
415 {
416         errno = ENOSYS;
417         return -1;
418 }
419
420 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
421                           uint32_t mode, off_t offset, off_t len)
422 {
423         errno = ENOSYS;
424         return -1;
425 }
426
427 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
428                       off_t offset, off_t count, int type)
429 {
430         errno = ENOSYS;
431         return false;
432 }
433
434 static int skel_kernel_flock(struct vfs_handle_struct *handle,
435                              struct files_struct *fsp,
436                              uint32_t share_mode, uint32_t access_mask)
437 {
438         errno = ENOSYS;
439         return -1;
440 }
441
442 static int skel_fcntl(struct vfs_handle_struct *handle,
443                       struct files_struct *fsp, int cmd, va_list cmd_arg)
444 {
445         errno = ENOSYS;
446         return -1;
447 }
448
449 static int skel_linux_setlease(struct vfs_handle_struct *handle,
450                                struct files_struct *fsp, int leasetype)
451 {
452         errno = ENOSYS;
453         return -1;
454 }
455
456 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
457                          off_t *poffset, off_t *pcount, int *ptype,
458                          pid_t *ppid)
459 {
460         errno = ENOSYS;
461         return false;
462 }
463
464 static int skel_symlinkat(vfs_handle_struct *handle,
465                         const struct smb_filename *link_contents,
466                         struct files_struct *dirfsp,
467                         const struct smb_filename *new_smb_fname)
468 {
469         errno = ENOSYS;
470         return -1;
471 }
472
473 static int skel_vfs_readlinkat(vfs_handle_struct *handle,
474                         files_struct *dirfsp,
475                         const struct smb_filename *smb_fname,
476                         char *buf,
477                         size_t bufsiz)
478 {
479         errno = ENOSYS;
480         return -1;
481 }
482
483 static int skel_linkat(vfs_handle_struct *handle,
484                         files_struct *srcfsp,
485                         const struct smb_filename *old_smb_fname,
486                         files_struct *dstfsp,
487                         const struct smb_filename *new_smb_fname,
488                         int flags)
489 {
490         errno = ENOSYS;
491         return -1;
492 }
493
494 static int skel_mknodat(vfs_handle_struct *handle,
495                         files_struct *dirfsp,
496                         const struct smb_filename *smb_fname,
497                         mode_t mode,
498                         SMB_DEV_T dev)
499 {
500         errno = ENOSYS;
501         return -1;
502 }
503
504 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
505                         TALLOC_CTX *ctx,
506                         const struct smb_filename *smb_fname)
507 {
508         errno = ENOSYS;
509         return NULL;
510 }
511
512 static int skel_chflags(vfs_handle_struct *handle,
513                         const struct smb_filename *smb_fname,
514                         uint flags)
515 {
516         errno = ENOSYS;
517         return -1;
518 }
519
520 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
521                                           const SMB_STRUCT_STAT *sbuf)
522 {
523         struct file_id id;
524         ZERO_STRUCT(id);
525         errno = ENOSYS;
526         return id;
527 }
528
529 static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
530                                 const SMB_STRUCT_STAT *sbuf)
531 {
532         errno = ENOSYS;
533         return 0;
534 }
535
536 struct skel_offload_read_state {
537         bool dummy;
538 };
539
540 static struct tevent_req *skel_offload_read_send(
541         TALLOC_CTX *mem_ctx,
542         struct tevent_context *ev,
543         struct vfs_handle_struct *handle,
544         struct files_struct *fsp,
545         uint32_t fsctl,
546         uint32_t ttl,
547         off_t offset,
548         size_t to_copy)
549 {
550         struct tevent_req *req = NULL;
551         struct skel_offload_read_state *state = NULL;
552
553         req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
554         if (req == NULL) {
555                 return NULL;
556         }
557
558         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
559         return tevent_req_post(req, ev);
560 }
561
562 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
563                                        struct vfs_handle_struct *handle,
564                                        TALLOC_CTX *mem_ctx,
565                                        DATA_BLOB *_token_blob)
566 {
567         NTSTATUS status;
568
569         if (tevent_req_is_nterror(req, &status)) {
570                 tevent_req_received(req);
571                 return status;
572         }
573         tevent_req_received(req);
574
575         return NT_STATUS_OK;
576 }
577
578 struct skel_cc_state {
579         uint64_t unused;
580 };
581 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
582                                                TALLOC_CTX *mem_ctx,
583                                                struct tevent_context *ev,
584                                                uint32_t fsctl,
585                                                DATA_BLOB *token,
586                                                off_t transfer_offset,
587                                                struct files_struct *dest_fsp,
588                                                off_t dest_off,
589                                                off_t num)
590 {
591         struct tevent_req *req;
592         struct skel_cc_state *cc_state;
593
594         req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
595         if (req == NULL) {
596                 return NULL;
597         }
598
599         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
600         return tevent_req_post(req, ev);
601 }
602
603 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
604                                      struct tevent_req *req,
605                                      off_t *copied)
606 {
607         NTSTATUS status;
608
609         if (tevent_req_is_nterror(req, &status)) {
610                 tevent_req_received(req);
611                 return status;
612         }
613         tevent_req_received(req);
614
615         return NT_STATUS_OK;
616 }
617
618 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
619                                      TALLOC_CTX *mem_ctx,
620                                      struct files_struct *fsp,
621                                      struct smb_filename *smb_fname,
622                                      uint16_t *_compression_fmt)
623 {
624         return NT_STATUS_INVALID_DEVICE_REQUEST;
625 }
626
627 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
628                                      TALLOC_CTX *mem_ctx,
629                                      struct files_struct *fsp,
630                                      uint16_t compression_fmt)
631 {
632         return NT_STATUS_INVALID_DEVICE_REQUEST;
633 }
634
635 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
636                                 struct files_struct *fsp,
637                                 const struct smb_filename *smb_fname,
638                                 TALLOC_CTX *mem_ctx,
639                                 unsigned int *num_streams,
640                                 struct stream_struct **streams)
641 {
642         return NT_STATUS_NOT_IMPLEMENTED;
643 }
644
645 static int skel_get_real_filename(struct vfs_handle_struct *handle,
646                                   const struct smb_filename *path,
647                                   const char *name,
648                                   TALLOC_CTX *mem_ctx, char **found_name)
649 {
650         errno = ENOSYS;
651         return -1;
652 }
653
654 static const char *skel_connectpath(struct vfs_handle_struct *handle,
655                                 const struct smb_filename *smb_fname)
656 {
657         errno = ENOSYS;
658         return NULL;
659 }
660
661 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
662                                       struct byte_range_lock *br_lck,
663                                       struct lock_struct *plock)
664 {
665         return NT_STATUS_NOT_IMPLEMENTED;
666 }
667
668 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
669                                     struct byte_range_lock *br_lck,
670                                     const struct lock_struct *plock)
671 {
672         errno = ENOSYS;
673         return false;
674 }
675
676 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
677                                    struct files_struct *fsp,
678                                    struct lock_struct *plock)
679 {
680         errno = ENOSYS;
681         return false;
682 }
683
684 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
685                                     const char *mapped_name,
686                                     enum vfs_translate_direction direction,
687                                     TALLOC_CTX *mem_ctx, char **pmapped_name)
688 {
689         return NT_STATUS_NOT_IMPLEMENTED;
690 }
691
692 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
693                            struct files_struct *fsp,
694                            TALLOC_CTX *ctx,
695                            uint32_t function,
696                            uint16_t req_flags,  /* Needed for UNICODE ... */
697                            const uint8_t *_in_data,
698                            uint32_t in_len,
699                            uint8_t **_out_data,
700                            uint32_t max_out_len, uint32_t *out_len)
701 {
702         return NT_STATUS_NOT_IMPLEMENTED;
703 }
704
705 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
706                                   const struct smb_filename *fname,
707                                   TALLOC_CTX *mem_ctx,
708                                   struct readdir_attr_data **pattr_data)
709 {
710         return NT_STATUS_NOT_IMPLEMENTED;
711 }
712
713 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
714                                 struct smb_filename *smb_fname,
715                                 uint32_t *dosmode)
716 {
717         return NT_STATUS_NOT_IMPLEMENTED;
718 }
719
720 struct skel_get_dos_attributes_state {
721         struct vfs_aio_state aio_state;
722         uint32_t dosmode;
723 };
724
725 static struct tevent_req *skel_get_dos_attributes_send(
726                         TALLOC_CTX *mem_ctx,
727                         struct tevent_context *ev,
728                         struct vfs_handle_struct *handle,
729                         files_struct *dir_fsp,
730                         struct smb_filename *smb_fname)
731 {
732         struct tevent_req *req = NULL;
733         struct skel_get_dos_attributes_state *state = NULL;
734
735         req = tevent_req_create(mem_ctx, &state,
736                                 struct skel_get_dos_attributes_state);
737         if (req == NULL) {
738                 return NULL;
739         }
740
741         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
742         return tevent_req_post(req, ev);
743 }
744
745 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
746                                              struct vfs_aio_state *aio_state,
747                                              uint32_t *dosmode)
748 {
749         struct skel_get_dos_attributes_state *state =
750                 tevent_req_data(req,
751                 struct skel_get_dos_attributes_state);
752         NTSTATUS status;
753
754         if (tevent_req_is_nterror(req, &status)) {
755                 tevent_req_received(req);
756                 return status;
757         }
758
759         *aio_state = state->aio_state;
760         *dosmode = state->dosmode;
761         tevent_req_received(req);
762         return NT_STATUS_OK;
763 }
764
765 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
766                                 struct files_struct *fsp,
767                                 uint32_t *dosmode)
768 {
769         return NT_STATUS_NOT_IMPLEMENTED;
770 }
771
772 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
773                                 const struct smb_filename *smb_fname,
774                                 uint32_t dosmode)
775 {
776         return NT_STATUS_NOT_IMPLEMENTED;
777 }
778
779 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
780                                 struct files_struct *fsp,
781                                 uint32_t dosmode)
782 {
783         return NT_STATUS_NOT_IMPLEMENTED;
784 }
785
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)
790 {
791         return NT_STATUS_NOT_IMPLEMENTED;
792 }
793
794 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
795                                 const struct smb_filename *smb_fname,
796                                 uint32_t security_info,
797                                 TALLOC_CTX *mem_ctx,
798                                 struct security_descriptor **ppdesc)
799 {
800         return NT_STATUS_NOT_IMPLEMENTED;
801 }
802
803 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
804                                  uint32_t security_info_sent,
805                                  const struct security_descriptor *psd)
806 {
807         return NT_STATUS_NOT_IMPLEMENTED;
808 }
809
810 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
811                                        const struct smb_filename *smb_fname,
812                                        SMB_ACL_TYPE_T type,
813                                        TALLOC_CTX *mem_ctx)
814 {
815         errno = ENOSYS;
816         return (SMB_ACL_T) NULL;
817 }
818
819 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
820                                      files_struct *fsp, TALLOC_CTX *mem_ctx)
821 {
822         errno = ENOSYS;
823         return (SMB_ACL_T) NULL;
824 }
825
826 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
827                                 const struct smb_filename *smb_fname,
828                                 TALLOC_CTX *mem_ctx,
829                                 char **blob_description,
830                                 DATA_BLOB *blob)
831 {
832         errno = ENOSYS;
833         return -1;
834 }
835
836 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
837                                     files_struct *fsp, TALLOC_CTX *mem_ctx,
838                                     char **blob_description, DATA_BLOB *blob)
839 {
840         errno = ENOSYS;
841         return -1;
842 }
843
844 static int skel_sys_acl_set_file(vfs_handle_struct *handle,
845                                 const struct smb_filename *smb_fname,
846                                 SMB_ACL_TYPE_T acltype,
847                                 SMB_ACL_T theacl)
848 {
849         errno = ENOSYS;
850         return -1;
851 }
852
853 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
854                                SMB_ACL_T theacl)
855 {
856         errno = ENOSYS;
857         return -1;
858 }
859
860 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
861                                         const struct smb_filename *smb_fname)
862 {
863         errno = ENOSYS;
864         return -1;
865 }
866
867 static ssize_t skel_getxattr(vfs_handle_struct *handle,
868                                 const struct smb_filename *smb_fname,
869                                 const char *name,
870                                 void *value,
871                                 size_t size)
872 {
873         errno = ENOSYS;
874         return -1;
875 }
876
877 struct skel_getxattrat_state {
878         struct vfs_aio_state aio_state;
879         ssize_t xattr_size;
880         uint8_t *xattr_value;
881 };
882
883 static struct tevent_req *skel_getxattrat_send(
884                         TALLOC_CTX *mem_ctx,
885                         struct tevent_context *ev,
886                         struct vfs_handle_struct *handle,
887                         files_struct *dir_fsp,
888                         const struct smb_filename *smb_fname,
889                         const char *xattr_name,
890                         size_t alloc_hint)
891 {
892         struct tevent_req *req = NULL;
893         struct skel_getxattrat_state *state = NULL;
894
895         req = tevent_req_create(mem_ctx, &state,
896                                 struct skel_getxattrat_state);
897         if (req == NULL) {
898                 return NULL;
899         }
900
901         tevent_req_error(req, ENOSYS);
902         return tevent_req_post(req, ev);
903 }
904
905 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
906                                     struct vfs_aio_state *aio_state,
907                                     TALLOC_CTX *mem_ctx,
908                                     uint8_t **xattr_value)
909 {
910         struct skel_getxattrat_state *state = tevent_req_data(
911                 req, struct skel_getxattrat_state);
912         ssize_t xattr_size;
913
914         if (tevent_req_is_unix_error(req, &aio_state->error)) {
915                 tevent_req_received(req);
916                 return -1;
917         }
918
919         *aio_state = state->aio_state;
920         xattr_size = state->xattr_size;
921         if (xattr_value != NULL) {
922                 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
923         }
924
925         tevent_req_received(req);
926         return xattr_size;
927 }
928
929 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
930                               struct files_struct *fsp, const char *name,
931                               void *value, size_t size)
932 {
933         errno = ENOSYS;
934         return -1;
935 }
936
937 static ssize_t skel_listxattr(vfs_handle_struct *handle,
938                                 const struct smb_filename *smb_fname,
939                                 char *list,
940                                 size_t size)
941 {
942         errno = ENOSYS;
943         return -1;
944 }
945
946 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
947                                struct files_struct *fsp, char *list,
948                                size_t size)
949 {
950         errno = ENOSYS;
951         return -1;
952 }
953
954 static int skel_removexattr(vfs_handle_struct *handle,
955                         const struct smb_filename *smb_fname,
956                         const char *name)
957 {
958         errno = ENOSYS;
959         return -1;
960 }
961
962 static int skel_fremovexattr(vfs_handle_struct *handle,
963                              struct files_struct *fsp, const char *name)
964 {
965         errno = ENOSYS;
966         return -1;
967 }
968
969 static int skel_setxattr(vfs_handle_struct *handle,
970                         const struct smb_filename *smb_fname,
971                         const char *name,
972                         const void *value,
973                         size_t size,
974                         int flags)
975 {
976         errno = ENOSYS;
977         return -1;
978 }
979
980 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
981                           const char *name, const void *value, size_t size,
982                           int flags)
983 {
984         errno = ENOSYS;
985         return -1;
986 }
987
988 static bool skel_aio_force(struct vfs_handle_struct *handle,
989                            struct files_struct *fsp)
990 {
991         errno = ENOSYS;
992         return false;
993 }
994
995 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
996                                 struct smb_filename *file,
997                                 struct security_acl *sacl,
998                                 uint32_t access_requested,
999                                 uint32_t access_denied)
1000 {
1001         return NT_STATUS_NOT_IMPLEMENTED;
1002 }
1003
1004 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
1005                                     struct files_struct *fsp,
1006                                     TALLOC_CTX *mem_ctx,
1007                                     DATA_BLOB *cookie)
1008 {
1009         return NT_STATUS_NOT_IMPLEMENTED;
1010 }
1011
1012 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
1013                                         struct files_struct *fsp,
1014                                         const DATA_BLOB old_cookie,
1015                                         TALLOC_CTX *mem_ctx,
1016                                         DATA_BLOB *new_cookie)
1017 {
1018         return NT_STATUS_NOT_IMPLEMENTED;
1019 }
1020
1021 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
1022                                        struct smb_request *smb1req,
1023                                        struct smbXsrv_open *op,
1024                                        const DATA_BLOB old_cookie,
1025                                        TALLOC_CTX *mem_ctx,
1026                                        struct files_struct **fsp,
1027                                        DATA_BLOB *new_cookie)
1028 {
1029         return NT_STATUS_NOT_IMPLEMENTED;
1030 }
1031
1032 /* VFS operations structure */
1033
1034 static struct vfs_fn_pointers skel_opaque_fns = {
1035         /* Disk operations */
1036
1037         .connect_fn = skel_connect,
1038         .disconnect_fn = skel_disconnect,
1039         .disk_free_fn = skel_disk_free,
1040         .get_quota_fn = skel_get_quota,
1041         .set_quota_fn = skel_set_quota,
1042         .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1043         .statvfs_fn = skel_statvfs,
1044         .fs_capabilities_fn = skel_fs_capabilities,
1045         .get_dfs_referrals_fn = skel_get_dfs_referrals,
1046         .create_dfs_pathat_fn = skel_create_dfs_pathat,
1047         .read_dfs_pathat_fn = skel_read_dfs_pathat,
1048         .snap_check_path_fn = skel_snap_check_path,
1049         .snap_create_fn = skel_snap_create,
1050         .snap_delete_fn = skel_snap_delete,
1051
1052         /* Directory operations */
1053
1054         .fdopendir_fn = skel_fdopendir,
1055         .readdir_fn = skel_readdir,
1056         .seekdir_fn = skel_seekdir,
1057         .telldir_fn = skel_telldir,
1058         .rewind_dir_fn = skel_rewind_dir,
1059         .mkdirat_fn = skel_mkdirat,
1060         .closedir_fn = skel_closedir,
1061
1062         /* File operations */
1063
1064         .open_fn = skel_open,
1065         .create_file_fn = skel_create_file,
1066         .close_fn = skel_close_fn,
1067         .pread_fn = skel_pread,
1068         .pread_send_fn = skel_pread_send,
1069         .pread_recv_fn = skel_pread_recv,
1070         .pwrite_fn = skel_pwrite,
1071         .pwrite_send_fn = skel_pwrite_send,
1072         .pwrite_recv_fn = skel_pwrite_recv,
1073         .lseek_fn = skel_lseek,
1074         .sendfile_fn = skel_sendfile,
1075         .recvfile_fn = skel_recvfile,
1076         .renameat_fn = skel_renameat,
1077         .fsync_send_fn = skel_fsync_send,
1078         .fsync_recv_fn = skel_fsync_recv,
1079         .stat_fn = skel_stat,
1080         .fstat_fn = skel_fstat,
1081         .lstat_fn = skel_lstat,
1082         .get_alloc_size_fn = skel_get_alloc_size,
1083         .unlinkat_fn = skel_unlinkat,
1084         .chmod_fn = skel_chmod,
1085         .fchmod_fn = skel_fchmod,
1086         .fchown_fn = skel_fchown,
1087         .lchown_fn = skel_lchown,
1088         .chdir_fn = skel_chdir,
1089         .getwd_fn = skel_getwd,
1090         .ntimes_fn = skel_ntimes,
1091         .ftruncate_fn = skel_ftruncate,
1092         .fallocate_fn = skel_fallocate,
1093         .lock_fn = skel_lock,
1094         .kernel_flock_fn = skel_kernel_flock,
1095         .fcntl_fn = skel_fcntl,
1096         .linux_setlease_fn = skel_linux_setlease,
1097         .getlock_fn = skel_getlock,
1098         .symlinkat_fn = skel_symlinkat,
1099         .readlinkat_fn = skel_vfs_readlinkat,
1100         .linkat_fn = skel_linkat,
1101         .mknodat_fn = skel_mknodat,
1102         .realpath_fn = skel_realpath,
1103         .chflags_fn = skel_chflags,
1104         .file_id_create_fn = skel_file_id_create,
1105         .fs_file_id_fn = skel_fs_file_id,
1106         .offload_read_send_fn = skel_offload_read_send,
1107         .offload_read_recv_fn = skel_offload_read_recv,
1108         .offload_write_send_fn = skel_offload_write_send,
1109         .offload_write_recv_fn = skel_offload_write_recv,
1110         .get_compression_fn = skel_get_compression,
1111         .set_compression_fn = skel_set_compression,
1112
1113         .streaminfo_fn = skel_streaminfo,
1114         .get_real_filename_fn = skel_get_real_filename,
1115         .connectpath_fn = skel_connectpath,
1116         .brl_lock_windows_fn = skel_brl_lock_windows,
1117         .brl_unlock_windows_fn = skel_brl_unlock_windows,
1118         .strict_lock_check_fn = skel_strict_lock_check,
1119         .translate_name_fn = skel_translate_name,
1120         .fsctl_fn = skel_fsctl,
1121         .readdir_attr_fn = skel_readdir_attr,
1122         .audit_file_fn = skel_audit_file,
1123
1124         /* DOS attributes. */
1125         .get_dos_attributes_fn = skel_get_dos_attributes,
1126         .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1127         .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1128         .fget_dos_attributes_fn = skel_fget_dos_attributes,
1129         .set_dos_attributes_fn = skel_set_dos_attributes,
1130         .fset_dos_attributes_fn = skel_fset_dos_attributes,
1131
1132         /* NT ACL operations. */
1133
1134         .fget_nt_acl_fn = skel_fget_nt_acl,
1135         .get_nt_acl_fn = skel_get_nt_acl,
1136         .fset_nt_acl_fn = skel_fset_nt_acl,
1137
1138         /* POSIX ACL operations. */
1139
1140         .sys_acl_get_file_fn = skel_sys_acl_get_file,
1141         .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1142         .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1143         .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1144         .sys_acl_set_file_fn = skel_sys_acl_set_file,
1145         .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1146         .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1147
1148         /* EA operations. */
1149         .getxattr_fn = skel_getxattr,
1150         .getxattrat_send_fn = skel_getxattrat_send,
1151         .getxattrat_recv_fn = skel_getxattrat_recv,
1152         .fgetxattr_fn = skel_fgetxattr,
1153         .listxattr_fn = skel_listxattr,
1154         .flistxattr_fn = skel_flistxattr,
1155         .removexattr_fn = skel_removexattr,
1156         .fremovexattr_fn = skel_fremovexattr,
1157         .setxattr_fn = skel_setxattr,
1158         .fsetxattr_fn = skel_fsetxattr,
1159
1160         /* aio operations */
1161         .aio_force_fn = skel_aio_force,
1162
1163         /* durable handle operations */
1164         .durable_cookie_fn = skel_durable_cookie,
1165         .durable_disconnect_fn = skel_durable_disconnect,
1166         .durable_reconnect_fn = skel_durable_reconnect,
1167 };
1168
1169 static_decl_vfs;
1170 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1171 {
1172         /*
1173          * smb_vfs_assert_all_fns() makes sure every
1174          * call is implemented.
1175          *
1176          * An opaque module requires this!
1177          */
1178         smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1179         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1180                                 &skel_opaque_fns);
1181 }