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