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