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