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