VFS: Remove SMB_VFS_LISTXATTR, no longer used
[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 uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
349                                     struct files_struct *fsp,
350                                     const SMB_STRUCT_STAT *sbuf)
351 {
352         errno = ENOSYS;
353         return -1;
354 }
355
356 static int skel_unlinkat(vfs_handle_struct *handle,
357                         struct files_struct *dirfsp,
358                         const struct smb_filename *smb_fname,
359                         int flags)
360 {
361         errno = ENOSYS;
362         return -1;
363 }
364
365 static int skel_chmod(vfs_handle_struct *handle,
366                         const struct smb_filename *smb_fname,
367                         mode_t mode)
368 {
369         errno = ENOSYS;
370         return -1;
371 }
372
373 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
374                        mode_t mode)
375 {
376         errno = ENOSYS;
377         return -1;
378 }
379
380 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
381                        uid_t uid, gid_t gid)
382 {
383         errno = ENOSYS;
384         return -1;
385 }
386
387 static int skel_lchown(vfs_handle_struct *handle,
388                         const struct smb_filename *smb_fname,
389                         uid_t uid,
390                         gid_t gid)
391 {
392         errno = ENOSYS;
393         return -1;
394 }
395
396 static int skel_chdir(vfs_handle_struct *handle,
397                         const struct smb_filename *smb_fname)
398 {
399         errno = ENOSYS;
400         return -1;
401 }
402
403 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
404                                 TALLOC_CTX *ctx)
405 {
406         errno = ENOSYS;
407         return NULL;
408 }
409
410 static int skel_ntimes(vfs_handle_struct *handle,
411                        const struct smb_filename *smb_fname,
412                        struct smb_file_time *ft)
413 {
414         errno = ENOSYS;
415         return -1;
416 }
417
418 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
419                           off_t offset)
420 {
421         errno = ENOSYS;
422         return -1;
423 }
424
425 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
426                           uint32_t mode, off_t offset, off_t len)
427 {
428         errno = ENOSYS;
429         return -1;
430 }
431
432 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
433                       off_t offset, off_t count, int type)
434 {
435         errno = ENOSYS;
436         return false;
437 }
438
439 static int skel_kernel_flock(struct vfs_handle_struct *handle,
440                              struct files_struct *fsp,
441                              uint32_t share_mode, uint32_t access_mask)
442 {
443         errno = ENOSYS;
444         return -1;
445 }
446
447 static int skel_fcntl(struct vfs_handle_struct *handle,
448                       struct files_struct *fsp, int cmd, va_list cmd_arg)
449 {
450         errno = ENOSYS;
451         return -1;
452 }
453
454 static int skel_linux_setlease(struct vfs_handle_struct *handle,
455                                struct files_struct *fsp, int leasetype)
456 {
457         errno = ENOSYS;
458         return -1;
459 }
460
461 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
462                          off_t *poffset, off_t *pcount, int *ptype,
463                          pid_t *ppid)
464 {
465         errno = ENOSYS;
466         return false;
467 }
468
469 static int skel_symlinkat(vfs_handle_struct *handle,
470                         const struct smb_filename *link_contents,
471                         struct files_struct *dirfsp,
472                         const struct smb_filename *new_smb_fname)
473 {
474         errno = ENOSYS;
475         return -1;
476 }
477
478 static int skel_vfs_readlinkat(vfs_handle_struct *handle,
479                         const struct files_struct *dirfsp,
480                         const struct smb_filename *smb_fname,
481                         char *buf,
482                         size_t bufsiz)
483 {
484         errno = ENOSYS;
485         return -1;
486 }
487
488 static int skel_linkat(vfs_handle_struct *handle,
489                         files_struct *srcfsp,
490                         const struct smb_filename *old_smb_fname,
491                         files_struct *dstfsp,
492                         const struct smb_filename *new_smb_fname,
493                         int flags)
494 {
495         errno = ENOSYS;
496         return -1;
497 }
498
499 static int skel_mknodat(vfs_handle_struct *handle,
500                         files_struct *dirfsp,
501                         const struct smb_filename *smb_fname,
502                         mode_t mode,
503                         SMB_DEV_T dev)
504 {
505         errno = ENOSYS;
506         return -1;
507 }
508
509 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
510                         TALLOC_CTX *ctx,
511                         const struct smb_filename *smb_fname)
512 {
513         errno = ENOSYS;
514         return NULL;
515 }
516
517 static int skel_chflags(vfs_handle_struct *handle,
518                         const struct smb_filename *smb_fname,
519                         uint flags)
520 {
521         errno = ENOSYS;
522         return -1;
523 }
524
525 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
526                                           const SMB_STRUCT_STAT *sbuf)
527 {
528         struct file_id id;
529         ZERO_STRUCT(id);
530         errno = ENOSYS;
531         return id;
532 }
533
534 static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
535                                 const SMB_STRUCT_STAT *sbuf)
536 {
537         errno = ENOSYS;
538         return 0;
539 }
540
541 struct skel_offload_read_state {
542         bool dummy;
543 };
544
545 static struct tevent_req *skel_offload_read_send(
546         TALLOC_CTX *mem_ctx,
547         struct tevent_context *ev,
548         struct vfs_handle_struct *handle,
549         struct files_struct *fsp,
550         uint32_t fsctl,
551         uint32_t ttl,
552         off_t offset,
553         size_t to_copy)
554 {
555         struct tevent_req *req = NULL;
556         struct skel_offload_read_state *state = NULL;
557
558         req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
559         if (req == NULL) {
560                 return NULL;
561         }
562
563         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
564         return tevent_req_post(req, ev);
565 }
566
567 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
568                                        struct vfs_handle_struct *handle,
569                                        TALLOC_CTX *mem_ctx,
570                                        DATA_BLOB *_token_blob)
571 {
572         NTSTATUS status;
573
574         if (tevent_req_is_nterror(req, &status)) {
575                 tevent_req_received(req);
576                 return status;
577         }
578         tevent_req_received(req);
579
580         return NT_STATUS_OK;
581 }
582
583 struct skel_cc_state {
584         uint64_t unused;
585 };
586 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
587                                                TALLOC_CTX *mem_ctx,
588                                                struct tevent_context *ev,
589                                                uint32_t fsctl,
590                                                DATA_BLOB *token,
591                                                off_t transfer_offset,
592                                                struct files_struct *dest_fsp,
593                                                off_t dest_off,
594                                                off_t num)
595 {
596         struct tevent_req *req;
597         struct skel_cc_state *cc_state;
598
599         req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
600         if (req == NULL) {
601                 return NULL;
602         }
603
604         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
605         return tevent_req_post(req, ev);
606 }
607
608 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
609                                      struct tevent_req *req,
610                                      off_t *copied)
611 {
612         NTSTATUS status;
613
614         if (tevent_req_is_nterror(req, &status)) {
615                 tevent_req_received(req);
616                 return status;
617         }
618         tevent_req_received(req);
619
620         return NT_STATUS_OK;
621 }
622
623 static NTSTATUS skel_fget_compression(struct vfs_handle_struct *handle,
624                                      TALLOC_CTX *mem_ctx,
625                                      struct files_struct *fsp,
626                                      uint16_t *_compression_fmt)
627 {
628         return NT_STATUS_INVALID_DEVICE_REQUEST;
629 }
630
631 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
632                                      TALLOC_CTX *mem_ctx,
633                                      struct files_struct *fsp,
634                                      uint16_t compression_fmt)
635 {
636         return NT_STATUS_INVALID_DEVICE_REQUEST;
637 }
638
639 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
640                                 struct files_struct *fsp,
641                                 const struct smb_filename *smb_fname,
642                                 TALLOC_CTX *mem_ctx,
643                                 unsigned int *num_streams,
644                                 struct stream_struct **streams)
645 {
646         return NT_STATUS_NOT_IMPLEMENTED;
647 }
648
649 static int skel_get_real_filename(struct vfs_handle_struct *handle,
650                                   const struct smb_filename *path,
651                                   const char *name,
652                                   TALLOC_CTX *mem_ctx, char **found_name)
653 {
654         errno = ENOSYS;
655         return -1;
656 }
657
658 static const char *skel_connectpath(struct vfs_handle_struct *handle,
659                                 const struct smb_filename *smb_fname)
660 {
661         errno = ENOSYS;
662         return NULL;
663 }
664
665 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
666                                       struct byte_range_lock *br_lck,
667                                       struct lock_struct *plock)
668 {
669         return NT_STATUS_NOT_IMPLEMENTED;
670 }
671
672 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
673                                     struct byte_range_lock *br_lck,
674                                     const struct lock_struct *plock)
675 {
676         errno = ENOSYS;
677         return false;
678 }
679
680 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
681                                    struct files_struct *fsp,
682                                    struct lock_struct *plock)
683 {
684         errno = ENOSYS;
685         return false;
686 }
687
688 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
689                                     const char *mapped_name,
690                                     enum vfs_translate_direction direction,
691                                     TALLOC_CTX *mem_ctx, char **pmapped_name)
692 {
693         return NT_STATUS_NOT_IMPLEMENTED;
694 }
695
696 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
697                            struct files_struct *fsp,
698                            TALLOC_CTX *ctx,
699                            uint32_t function,
700                            uint16_t req_flags,  /* Needed for UNICODE ... */
701                            const uint8_t *_in_data,
702                            uint32_t in_len,
703                            uint8_t **_out_data,
704                            uint32_t max_out_len, uint32_t *out_len)
705 {
706         return NT_STATUS_NOT_IMPLEMENTED;
707 }
708
709 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
710                                   const struct smb_filename *fname,
711                                   TALLOC_CTX *mem_ctx,
712                                   struct readdir_attr_data **pattr_data)
713 {
714         return NT_STATUS_NOT_IMPLEMENTED;
715 }
716
717 struct skel_get_dos_attributes_state {
718         struct vfs_aio_state aio_state;
719         uint32_t dosmode;
720 };
721
722 static struct tevent_req *skel_get_dos_attributes_send(
723                         TALLOC_CTX *mem_ctx,
724                         struct tevent_context *ev,
725                         struct vfs_handle_struct *handle,
726                         files_struct *dir_fsp,
727                         struct smb_filename *smb_fname)
728 {
729         struct tevent_req *req = NULL;
730         struct skel_get_dos_attributes_state *state = NULL;
731
732         req = tevent_req_create(mem_ctx, &state,
733                                 struct skel_get_dos_attributes_state);
734         if (req == NULL) {
735                 return NULL;
736         }
737
738         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
739         return tevent_req_post(req, ev);
740 }
741
742 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
743                                              struct vfs_aio_state *aio_state,
744                                              uint32_t *dosmode)
745 {
746         struct skel_get_dos_attributes_state *state =
747                 tevent_req_data(req,
748                 struct skel_get_dos_attributes_state);
749         NTSTATUS status;
750
751         if (tevent_req_is_nterror(req, &status)) {
752                 tevent_req_received(req);
753                 return status;
754         }
755
756         *aio_state = state->aio_state;
757         *dosmode = state->dosmode;
758         tevent_req_received(req);
759         return NT_STATUS_OK;
760 }
761
762 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
763                                 struct files_struct *fsp,
764                                 uint32_t *dosmode)
765 {
766         return NT_STATUS_NOT_IMPLEMENTED;
767 }
768
769 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
770                                 const struct smb_filename *smb_fname,
771                                 uint32_t dosmode)
772 {
773         return NT_STATUS_NOT_IMPLEMENTED;
774 }
775
776 static NTSTATUS skel_fset_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_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
784                                  uint32_t security_info,
785                                  TALLOC_CTX *mem_ctx,
786                                  struct security_descriptor **ppdesc)
787 {
788         return NT_STATUS_NOT_IMPLEMENTED;
789 }
790
791 static NTSTATUS skel_get_nt_acl_at(vfs_handle_struct *handle,
792                                 struct files_struct *dirfsp,
793                                 const struct smb_filename *smb_fname,
794                                 uint32_t security_info,
795                                 TALLOC_CTX *mem_ctx,
796                                 struct security_descriptor **ppdesc)
797 {
798         return NT_STATUS_NOT_IMPLEMENTED;
799 }
800
801 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
802                                  uint32_t security_info_sent,
803                                  const struct security_descriptor *psd)
804 {
805         return NT_STATUS_NOT_IMPLEMENTED;
806 }
807
808 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
809                                        const struct smb_filename *smb_fname,
810                                        SMB_ACL_TYPE_T type,
811                                        TALLOC_CTX *mem_ctx)
812 {
813         errno = ENOSYS;
814         return (SMB_ACL_T) NULL;
815 }
816
817 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
818                                      files_struct *fsp, TALLOC_CTX *mem_ctx)
819 {
820         errno = ENOSYS;
821         return (SMB_ACL_T) NULL;
822 }
823
824 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
825                                 const struct smb_filename *smb_fname,
826                                 TALLOC_CTX *mem_ctx,
827                                 char **blob_description,
828                                 DATA_BLOB *blob)
829 {
830         errno = ENOSYS;
831         return -1;
832 }
833
834 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
835                                     files_struct *fsp, TALLOC_CTX *mem_ctx,
836                                     char **blob_description, DATA_BLOB *blob)
837 {
838         errno = ENOSYS;
839         return -1;
840 }
841
842 static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
843                                struct files_struct *fsp,
844                                SMB_ACL_TYPE_T type,
845                                SMB_ACL_T theacl)
846 {
847         errno = ENOSYS;
848         return -1;
849 }
850
851 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
852                                         const struct smb_filename *smb_fname)
853 {
854         errno = ENOSYS;
855         return -1;
856 }
857
858 static ssize_t skel_getxattr(vfs_handle_struct *handle,
859                                 const struct smb_filename *smb_fname,
860                                 const char *name,
861                                 void *value,
862                                 size_t size)
863 {
864         errno = ENOSYS;
865         return -1;
866 }
867
868 struct skel_getxattrat_state {
869         struct vfs_aio_state aio_state;
870         ssize_t xattr_size;
871         uint8_t *xattr_value;
872 };
873
874 static struct tevent_req *skel_getxattrat_send(
875                         TALLOC_CTX *mem_ctx,
876                         struct tevent_context *ev,
877                         struct vfs_handle_struct *handle,
878                         files_struct *dir_fsp,
879                         const struct smb_filename *smb_fname,
880                         const char *xattr_name,
881                         size_t alloc_hint)
882 {
883         struct tevent_req *req = NULL;
884         struct skel_getxattrat_state *state = NULL;
885
886         req = tevent_req_create(mem_ctx, &state,
887                                 struct skel_getxattrat_state);
888         if (req == NULL) {
889                 return NULL;
890         }
891
892         tevent_req_error(req, ENOSYS);
893         return tevent_req_post(req, ev);
894 }
895
896 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
897                                     struct vfs_aio_state *aio_state,
898                                     TALLOC_CTX *mem_ctx,
899                                     uint8_t **xattr_value)
900 {
901         struct skel_getxattrat_state *state = tevent_req_data(
902                 req, struct skel_getxattrat_state);
903         ssize_t xattr_size;
904
905         if (tevent_req_is_unix_error(req, &aio_state->error)) {
906                 tevent_req_received(req);
907                 return -1;
908         }
909
910         *aio_state = state->aio_state;
911         xattr_size = state->xattr_size;
912         if (xattr_value != NULL) {
913                 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
914         }
915
916         tevent_req_received(req);
917         return xattr_size;
918 }
919
920 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
921                               struct files_struct *fsp, const char *name,
922                               void *value, size_t size)
923 {
924         errno = ENOSYS;
925         return -1;
926 }
927
928 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
929                                struct files_struct *fsp, char *list,
930                                size_t size)
931 {
932         errno = ENOSYS;
933         return -1;
934 }
935
936 static int skel_removexattr(vfs_handle_struct *handle,
937                         const struct smb_filename *smb_fname,
938                         const char *name)
939 {
940         errno = ENOSYS;
941         return -1;
942 }
943
944 static int skel_fremovexattr(vfs_handle_struct *handle,
945                              struct files_struct *fsp, const char *name)
946 {
947         errno = ENOSYS;
948         return -1;
949 }
950
951 static int skel_setxattr(vfs_handle_struct *handle,
952                         const struct smb_filename *smb_fname,
953                         const char *name,
954                         const void *value,
955                         size_t size,
956                         int flags)
957 {
958         errno = ENOSYS;
959         return -1;
960 }
961
962 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
963                           const char *name, const void *value, size_t size,
964                           int flags)
965 {
966         errno = ENOSYS;
967         return -1;
968 }
969
970 static bool skel_aio_force(struct vfs_handle_struct *handle,
971                            struct files_struct *fsp)
972 {
973         errno = ENOSYS;
974         return false;
975 }
976
977 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
978                                 struct smb_filename *file,
979                                 struct security_acl *sacl,
980                                 uint32_t access_requested,
981                                 uint32_t access_denied)
982 {
983         return NT_STATUS_NOT_IMPLEMENTED;
984 }
985
986 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
987                                     struct files_struct *fsp,
988                                     TALLOC_CTX *mem_ctx,
989                                     DATA_BLOB *cookie)
990 {
991         return NT_STATUS_NOT_IMPLEMENTED;
992 }
993
994 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
995                                         struct files_struct *fsp,
996                                         const DATA_BLOB old_cookie,
997                                         TALLOC_CTX *mem_ctx,
998                                         DATA_BLOB *new_cookie)
999 {
1000         return NT_STATUS_NOT_IMPLEMENTED;
1001 }
1002
1003 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
1004                                        struct smb_request *smb1req,
1005                                        struct smbXsrv_open *op,
1006                                        const DATA_BLOB old_cookie,
1007                                        TALLOC_CTX *mem_ctx,
1008                                        struct files_struct **fsp,
1009                                        DATA_BLOB *new_cookie)
1010 {
1011         return NT_STATUS_NOT_IMPLEMENTED;
1012 }
1013
1014 /* VFS operations structure */
1015
1016 static struct vfs_fn_pointers skel_opaque_fns = {
1017         /* Disk operations */
1018
1019         .connect_fn = skel_connect,
1020         .disconnect_fn = skel_disconnect,
1021         .disk_free_fn = skel_disk_free,
1022         .get_quota_fn = skel_get_quota,
1023         .set_quota_fn = skel_set_quota,
1024         .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1025         .statvfs_fn = skel_statvfs,
1026         .fs_capabilities_fn = skel_fs_capabilities,
1027         .get_dfs_referrals_fn = skel_get_dfs_referrals,
1028         .create_dfs_pathat_fn = skel_create_dfs_pathat,
1029         .read_dfs_pathat_fn = skel_read_dfs_pathat,
1030         .snap_check_path_fn = skel_snap_check_path,
1031         .snap_create_fn = skel_snap_create,
1032         .snap_delete_fn = skel_snap_delete,
1033
1034         /* Directory operations */
1035
1036         .fdopendir_fn = skel_fdopendir,
1037         .readdir_fn = skel_readdir,
1038         .seekdir_fn = skel_seekdir,
1039         .telldir_fn = skel_telldir,
1040         .rewind_dir_fn = skel_rewind_dir,
1041         .mkdirat_fn = skel_mkdirat,
1042         .closedir_fn = skel_closedir,
1043
1044         /* File operations */
1045
1046         .openat_fn = skel_openat,
1047         .create_file_fn = skel_create_file,
1048         .close_fn = skel_close_fn,
1049         .pread_fn = skel_pread,
1050         .pread_send_fn = skel_pread_send,
1051         .pread_recv_fn = skel_pread_recv,
1052         .pwrite_fn = skel_pwrite,
1053         .pwrite_send_fn = skel_pwrite_send,
1054         .pwrite_recv_fn = skel_pwrite_recv,
1055         .lseek_fn = skel_lseek,
1056         .sendfile_fn = skel_sendfile,
1057         .recvfile_fn = skel_recvfile,
1058         .renameat_fn = skel_renameat,
1059         .fsync_send_fn = skel_fsync_send,
1060         .fsync_recv_fn = skel_fsync_recv,
1061         .stat_fn = skel_stat,
1062         .fstat_fn = skel_fstat,
1063         .lstat_fn = skel_lstat,
1064         .get_alloc_size_fn = skel_get_alloc_size,
1065         .unlinkat_fn = skel_unlinkat,
1066         .chmod_fn = skel_chmod,
1067         .fchmod_fn = skel_fchmod,
1068         .fchown_fn = skel_fchown,
1069         .lchown_fn = skel_lchown,
1070         .chdir_fn = skel_chdir,
1071         .getwd_fn = skel_getwd,
1072         .ntimes_fn = skel_ntimes,
1073         .ftruncate_fn = skel_ftruncate,
1074         .fallocate_fn = skel_fallocate,
1075         .lock_fn = skel_lock,
1076         .kernel_flock_fn = skel_kernel_flock,
1077         .fcntl_fn = skel_fcntl,
1078         .linux_setlease_fn = skel_linux_setlease,
1079         .getlock_fn = skel_getlock,
1080         .symlinkat_fn = skel_symlinkat,
1081         .readlinkat_fn = skel_vfs_readlinkat,
1082         .linkat_fn = skel_linkat,
1083         .mknodat_fn = skel_mknodat,
1084         .realpath_fn = skel_realpath,
1085         .chflags_fn = skel_chflags,
1086         .file_id_create_fn = skel_file_id_create,
1087         .fs_file_id_fn = skel_fs_file_id,
1088         .offload_read_send_fn = skel_offload_read_send,
1089         .offload_read_recv_fn = skel_offload_read_recv,
1090         .offload_write_send_fn = skel_offload_write_send,
1091         .offload_write_recv_fn = skel_offload_write_recv,
1092         .fget_compression_fn = skel_fget_compression,
1093         .set_compression_fn = skel_set_compression,
1094
1095         .streaminfo_fn = skel_streaminfo,
1096         .get_real_filename_fn = skel_get_real_filename,
1097         .connectpath_fn = skel_connectpath,
1098         .brl_lock_windows_fn = skel_brl_lock_windows,
1099         .brl_unlock_windows_fn = skel_brl_unlock_windows,
1100         .strict_lock_check_fn = skel_strict_lock_check,
1101         .translate_name_fn = skel_translate_name,
1102         .fsctl_fn = skel_fsctl,
1103         .readdir_attr_fn = skel_readdir_attr,
1104         .audit_file_fn = skel_audit_file,
1105
1106         /* DOS attributes. */
1107         .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1108         .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1109         .fget_dos_attributes_fn = skel_fget_dos_attributes,
1110         .set_dos_attributes_fn = skel_set_dos_attributes,
1111         .fset_dos_attributes_fn = skel_fset_dos_attributes,
1112
1113         /* NT ACL operations. */
1114
1115         .fget_nt_acl_fn = skel_fget_nt_acl,
1116         .get_nt_acl_at_fn = skel_get_nt_acl_at,
1117         .fset_nt_acl_fn = skel_fset_nt_acl,
1118
1119         /* POSIX ACL operations. */
1120
1121         .sys_acl_get_file_fn = skel_sys_acl_get_file,
1122         .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1123         .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1124         .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1125         .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1126         .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1127
1128         /* EA operations. */
1129         .getxattr_fn = skel_getxattr,
1130         .getxattrat_send_fn = skel_getxattrat_send,
1131         .getxattrat_recv_fn = skel_getxattrat_recv,
1132         .fgetxattr_fn = skel_fgetxattr,
1133         .flistxattr_fn = skel_flistxattr,
1134         .removexattr_fn = skel_removexattr,
1135         .fremovexattr_fn = skel_fremovexattr,
1136         .setxattr_fn = skel_setxattr,
1137         .fsetxattr_fn = skel_fsetxattr,
1138
1139         /* aio operations */
1140         .aio_force_fn = skel_aio_force,
1141
1142         /* durable handle operations */
1143         .durable_cookie_fn = skel_durable_cookie,
1144         .durable_disconnect_fn = skel_durable_disconnect,
1145         .durable_reconnect_fn = skel_durable_reconnect,
1146 };
1147
1148 static_decl_vfs;
1149 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1150 {
1151         /*
1152          * smb_vfs_assert_all_fns() makes sure every
1153          * call is implemented.
1154          *
1155          * An opaque module requires this!
1156          */
1157         smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
1158         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1159                                 &skel_opaque_fns);
1160 }