VFS: Modify opendir to take a const struct smb_filename * instead of const char *
[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_ntstatus.h"
26
27 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE 
28    SAMBA DEVELOPERS GUIDE!!!!!!
29  */
30
31 /* If you take this file as template for your module
32  * you must re-implement every function.
33  */
34
35 static int skel_connect(vfs_handle_struct *handle, const char *service,
36                         const char *user)
37 {
38         errno = ENOSYS;
39         return -1;
40 }
41
42 static void skel_disconnect(vfs_handle_struct *handle)
43 {
44         ;
45 }
46
47 static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path,
48                                uint64_t *bsize,
49                                uint64_t *dfree, uint64_t *dsize)
50 {
51         *bsize = 0;
52         *dfree = 0;
53         *dsize = 0;
54         return 0;
55 }
56
57 static int skel_get_quota(vfs_handle_struct *handle, const char *path,
58                           enum SMB_QUOTA_TYPE qtype, unid_t id,
59                           SMB_DISK_QUOTA *dq)
60 {
61         errno = ENOSYS;
62         return -1;
63 }
64
65 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
66                           unid_t id, SMB_DISK_QUOTA *dq)
67 {
68         errno = ENOSYS;
69         return -1;
70 }
71
72 static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
73                                      files_struct *fsp,
74                                      struct shadow_copy_data *shadow_copy_data,
75                                      bool labels)
76 {
77         errno = ENOSYS;
78         return -1;
79 }
80
81 static int skel_statvfs(struct vfs_handle_struct *handle,
82                         const char *path, struct vfs_statvfs_struct *statbuf)
83 {
84         errno = ENOSYS;
85         return -1;
86 }
87
88 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
89                                      enum timestamp_set_resolution *p_ts_res)
90 {
91         return 0;
92 }
93
94 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
95                                        struct dfs_GetDFSReferral *r)
96 {
97         return NT_STATUS_NOT_IMPLEMENTED;
98 }
99
100 static DIR *skel_opendir(vfs_handle_struct *handle,
101                         const struct smb_filename *smb_fname,
102                         const char *mask,
103                         uint32_t attr)
104 {
105         return NULL;
106 }
107
108 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
109                                      TALLOC_CTX *mem_ctx,
110                                      const char *service_path,
111                                      char **base_volume)
112 {
113         return NT_STATUS_NOT_SUPPORTED;
114 }
115
116 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
117                                  TALLOC_CTX *mem_ctx,
118                                  const char *base_volume,
119                                  time_t *tstamp,
120                                  bool rw,
121                                  char **base_path,
122                                  char **snap_path)
123 {
124         return NT_STATUS_NOT_SUPPORTED;
125 }
126
127 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
128                                  TALLOC_CTX *mem_ctx,
129                                  char *base_path,
130                                  char *snap_path)
131 {
132         return NT_STATUS_NOT_SUPPORTED;
133 }
134
135 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
136                            const char *mask, uint32_t attr)
137 {
138         return NULL;
139 }
140
141 static struct dirent *skel_readdir(vfs_handle_struct *handle,
142                                    DIR *dirp, SMB_STRUCT_STAT *sbuf)
143 {
144         return NULL;
145 }
146
147 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
148 {
149         ;
150 }
151
152 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
153 {
154         return (long)-1;
155 }
156
157 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
158 {
159         ;
160 }
161
162 static int skel_mkdir(vfs_handle_struct *handle,
163                 const struct smb_filename *smb_fname,
164                 mode_t mode)
165 {
166         errno = ENOSYS;
167         return -1;
168 }
169
170 static int skel_rmdir(vfs_handle_struct *handle,
171                 const struct smb_filename *smb_fname)
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 void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
184 {
185         ;
186 }
187
188 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
189                      files_struct *fsp, int flags, mode_t mode)
190 {
191         errno = ENOSYS;
192         return -1;
193 }
194
195 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
196                                  struct smb_request *req,
197                                  uint16_t root_dir_fid,
198                                  struct smb_filename *smb_fname,
199                                  uint32_t access_mask,
200                                  uint32_t share_access,
201                                  uint32_t create_disposition,
202                                  uint32_t create_options,
203                                  uint32_t file_attributes,
204                                  uint32_t oplock_request,
205                                  struct smb2_lease *lease,
206                                  uint64_t allocation_size,
207                                  uint32_t private_flags,
208                                  struct security_descriptor *sd,
209                                  struct ea_list *ea_list,
210                                  files_struct **result, int *pinfo,
211                                  const struct smb2_create_blobs *in_context_blobs,
212                                  struct smb2_create_blobs *out_context_blobs)
213 {
214         return NT_STATUS_NOT_IMPLEMENTED;
215 }
216
217 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
218 {
219         errno = ENOSYS;
220         return -1;
221 }
222
223 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
224                              void *data, size_t n)
225 {
226         errno = ENOSYS;
227         return -1;
228 }
229
230 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
231                           void *data, size_t n, off_t offset)
232 {
233         errno = ENOSYS;
234         return -1;
235 }
236
237 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
238                                           TALLOC_CTX *mem_ctx,
239                                           struct tevent_context *ev,
240                                           struct files_struct *fsp,
241                                           void *data, size_t n, off_t offset)
242 {
243         return NULL;
244 }
245
246 static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
247 {
248         *err = ENOSYS;
249         return -1;
250 }
251
252 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
253                           const void *data, size_t n)
254 {
255         errno = ENOSYS;
256         return -1;
257 }
258
259 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
260                            const void *data, size_t n, off_t offset)
261 {
262         errno = ENOSYS;
263         return -1;
264 }
265
266 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
267                                            TALLOC_CTX *mem_ctx,
268                                            struct tevent_context *ev,
269                                            struct files_struct *fsp,
270                                            const void *data,
271                                            size_t n, off_t offset)
272 {
273         return NULL;
274 }
275
276 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
277 {
278         *err = ENOSYS;
279         return -1;
280 }
281
282 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
283                         off_t offset, int whence)
284 {
285         errno = ENOSYS;
286         return (off_t) - 1;
287 }
288
289 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
290                              files_struct *fromfsp, const DATA_BLOB *hdr,
291                              off_t offset, size_t n)
292 {
293         errno = ENOSYS;
294         return -1;
295 }
296
297 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
298                              files_struct *tofsp, off_t offset, size_t n)
299 {
300         errno = ENOSYS;
301         return -1;
302 }
303
304 static int skel_rename(vfs_handle_struct *handle,
305                        const struct smb_filename *smb_fname_src,
306                        const struct smb_filename *smb_fname_dst)
307 {
308         errno = ENOSYS;
309         return -1;
310 }
311
312 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
313 {
314         errno = ENOSYS;
315         return -1;
316 }
317
318 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
319                                           TALLOC_CTX *mem_ctx,
320                                           struct tevent_context *ev,
321                                           struct files_struct *fsp)
322 {
323         return NULL;
324 }
325
326 static int skel_fsync_recv(struct tevent_req *req, int *err)
327 {
328         *err = ENOSYS;
329         return -1;
330 }
331
332 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
333 {
334         errno = ENOSYS;
335         return -1;
336 }
337
338 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
339                       SMB_STRUCT_STAT *sbuf)
340 {
341         errno = ENOSYS;
342         return -1;
343 }
344
345 static int skel_lstat(vfs_handle_struct *handle,
346                       struct smb_filename *smb_fname)
347 {
348         errno = ENOSYS;
349         return -1;
350 }
351
352 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
353                                     struct files_struct *fsp,
354                                     const SMB_STRUCT_STAT *sbuf)
355 {
356         errno = ENOSYS;
357         return -1;
358 }
359
360 static int skel_unlink(vfs_handle_struct *handle,
361                        const struct smb_filename *smb_fname)
362 {
363         errno = ENOSYS;
364         return -1;
365 }
366
367 static int skel_chmod(vfs_handle_struct *handle, const char *path, 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_chown(vfs_handle_struct *handle, const char *path,
381                       uid_t uid, gid_t gid)
382 {
383         errno = ENOSYS;
384         return -1;
385 }
386
387 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
388                        uid_t uid, gid_t gid)
389 {
390         errno = ENOSYS;
391         return -1;
392 }
393
394 static int skel_lchown(vfs_handle_struct *handle, const char *path,
395                        uid_t uid, gid_t gid)
396 {
397         errno = ENOSYS;
398         return -1;
399 }
400
401 static int skel_chdir(vfs_handle_struct *handle, const char *path)
402 {
403         errno = ENOSYS;
404         return -1;
405 }
406
407 static char *skel_getwd(vfs_handle_struct *handle)
408 {
409         errno = ENOSYS;
410         return NULL;
411 }
412
413 static int skel_ntimes(vfs_handle_struct *handle,
414                        const struct smb_filename *smb_fname,
415                        struct smb_file_time *ft)
416 {
417         errno = ENOSYS;
418         return -1;
419 }
420
421 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
422                           off_t offset)
423 {
424         errno = ENOSYS;
425         return -1;
426 }
427
428 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
429                           uint32_t mode, off_t offset, off_t len)
430 {
431         errno = ENOSYS;
432         return -1;
433 }
434
435 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
436                       off_t offset, off_t count, int type)
437 {
438         errno = ENOSYS;
439         return false;
440 }
441
442 static int skel_kernel_flock(struct vfs_handle_struct *handle,
443                              struct files_struct *fsp,
444                              uint32_t share_mode, uint32_t access_mask)
445 {
446         errno = ENOSYS;
447         return -1;
448 }
449
450 static int skel_linux_setlease(struct vfs_handle_struct *handle,
451                                struct files_struct *fsp, int leasetype)
452 {
453         errno = ENOSYS;
454         return -1;
455 }
456
457 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
458                          off_t *poffset, off_t *pcount, int *ptype,
459                          pid_t *ppid)
460 {
461         errno = ENOSYS;
462         return false;
463 }
464
465 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
466                         const char *newpath)
467 {
468         errno = ENOSYS;
469         return -1;
470 }
471
472 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
473                              char *buf, size_t bufsiz)
474 {
475         errno = ENOSYS;
476         return -1;
477 }
478
479 static int skel_link(vfs_handle_struct *handle, const char *oldpath,
480                      const char *newpath)
481 {
482         errno = ENOSYS;
483         return -1;
484 }
485
486 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
487                       SMB_DEV_T dev)
488 {
489         errno = ENOSYS;
490         return -1;
491 }
492
493 static char *skel_realpath(vfs_handle_struct *handle, const char *path)
494 {
495         errno = ENOSYS;
496         return NULL;
497 }
498
499 static int skel_chflags(vfs_handle_struct *handle, const char *path,
500                         uint flags)
501 {
502         errno = ENOSYS;
503         return -1;
504 }
505
506 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
507                                           const SMB_STRUCT_STAT *sbuf)
508 {
509         struct file_id id;
510         ZERO_STRUCT(id);
511         errno = ENOSYS;
512         return id;
513 }
514
515 struct skel_cc_state {
516         uint64_t unused;
517 };
518 static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
519                                                TALLOC_CTX *mem_ctx,
520                                                struct tevent_context *ev,
521                                                struct files_struct *src_fsp,
522                                                off_t src_off,
523                                                struct files_struct *dest_fsp,
524                                                off_t dest_off,
525                                                off_t num)
526 {
527         struct tevent_req *req;
528         struct skel_cc_state *cc_state;
529
530         req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
531         if (req == NULL) {
532                 return NULL;
533         }
534
535         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
536         return tevent_req_post(req, ev);
537 }
538
539 static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
540                                      struct tevent_req *req,
541                                      off_t *copied)
542 {
543         NTSTATUS status;
544
545         if (tevent_req_is_nterror(req, &status)) {
546                 tevent_req_received(req);
547                 return status;
548         }
549         tevent_req_received(req);
550
551         return NT_STATUS_OK;
552 }
553
554 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
555                                      TALLOC_CTX *mem_ctx,
556                                      struct files_struct *fsp,
557                                      struct smb_filename *smb_fname,
558                                      uint16_t *_compression_fmt)
559 {
560         return NT_STATUS_INVALID_DEVICE_REQUEST;
561 }
562
563 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
564                                      TALLOC_CTX *mem_ctx,
565                                      struct files_struct *fsp,
566                                      uint16_t compression_fmt)
567 {
568         return NT_STATUS_INVALID_DEVICE_REQUEST;
569 }
570
571 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
572                                 struct files_struct *fsp,
573                                 const char *fname,
574                                 TALLOC_CTX *mem_ctx,
575                                 unsigned int *num_streams,
576                                 struct stream_struct **streams)
577 {
578         return NT_STATUS_NOT_IMPLEMENTED;
579 }
580
581 static int skel_get_real_filename(struct vfs_handle_struct *handle,
582                                   const char *path,
583                                   const char *name,
584                                   TALLOC_CTX *mem_ctx, char **found_name)
585 {
586         errno = ENOSYS;
587         return -1;
588 }
589
590 static const char *skel_connectpath(struct vfs_handle_struct *handle,
591                                     const char *filename)
592 {
593         errno = ENOSYS;
594         return NULL;
595 }
596
597 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
598                                       struct byte_range_lock *br_lck,
599                                       struct lock_struct *plock,
600                                       bool blocking_lock)
601 {
602         return NT_STATUS_NOT_IMPLEMENTED;
603 }
604
605 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
606                                     struct messaging_context *msg_ctx,
607                                     struct byte_range_lock *br_lck,
608                                     const struct lock_struct *plock)
609 {
610         errno = ENOSYS;
611         return false;
612 }
613
614 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
615                                     struct byte_range_lock *br_lck,
616                                     struct lock_struct *plock)
617 {
618         errno = ENOSYS;
619         return false;
620 }
621
622 static bool skel_strict_lock(struct vfs_handle_struct *handle,
623                              struct files_struct *fsp,
624                              struct lock_struct *plock)
625 {
626         errno = ENOSYS;
627         return false;
628 }
629
630 static void skel_strict_unlock(struct vfs_handle_struct *handle,
631                                struct files_struct *fsp,
632                                struct lock_struct *plock)
633 {
634         ;
635 }
636
637 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
638                                     const char *mapped_name,
639                                     enum vfs_translate_direction direction,
640                                     TALLOC_CTX *mem_ctx, char **pmapped_name)
641 {
642         return NT_STATUS_NOT_IMPLEMENTED;
643 }
644
645 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
646                            struct files_struct *fsp,
647                            TALLOC_CTX *ctx,
648                            uint32_t function,
649                            uint16_t req_flags,  /* Needed for UNICODE ... */
650                            const uint8_t *_in_data,
651                            uint32_t in_len,
652                            uint8_t **_out_data,
653                            uint32_t max_out_len, uint32_t *out_len)
654 {
655         return NT_STATUS_NOT_IMPLEMENTED;
656 }
657
658 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
659                                   const struct smb_filename *fname,
660                                   TALLOC_CTX *mem_ctx,
661                                   struct readdir_attr_data **pattr_data)
662 {
663         return NT_STATUS_NOT_IMPLEMENTED;
664 }
665
666 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
667                                  uint32_t security_info,
668                                  TALLOC_CTX *mem_ctx,
669                                  struct security_descriptor **ppdesc)
670 {
671         return NT_STATUS_NOT_IMPLEMENTED;
672 }
673
674 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
675                                 const struct smb_filename *smb_fname,
676                                 uint32_t security_info,
677                                 TALLOC_CTX *mem_ctx,
678                                 struct security_descriptor **ppdesc)
679 {
680         return NT_STATUS_NOT_IMPLEMENTED;
681 }
682
683 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
684                                  uint32_t security_info_sent,
685                                  const struct security_descriptor *psd)
686 {
687         return NT_STATUS_NOT_IMPLEMENTED;
688 }
689
690 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
691                           mode_t mode)
692 {
693         errno = ENOSYS;
694         return -1;
695 }
696
697 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
698                            mode_t mode)
699 {
700         errno = ENOSYS;
701         return -1;
702 }
703
704 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
705                                        const char *path_p,
706                                        SMB_ACL_TYPE_T type,
707                                        TALLOC_CTX *mem_ctx)
708 {
709         errno = ENOSYS;
710         return (SMB_ACL_T) NULL;
711 }
712
713 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
714                                      files_struct *fsp, TALLOC_CTX *mem_ctx)
715 {
716         errno = ENOSYS;
717         return (SMB_ACL_T) NULL;
718 }
719
720 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
721                                       const char *path_p, TALLOC_CTX *mem_ctx,
722                                       char **blob_description, DATA_BLOB *blob)
723 {
724         errno = ENOSYS;
725         return -1;
726 }
727
728 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
729                                     files_struct *fsp, TALLOC_CTX *mem_ctx,
730                                     char **blob_description, DATA_BLOB *blob)
731 {
732         errno = ENOSYS;
733         return -1;
734 }
735
736 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
737                                  SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
738 {
739         errno = ENOSYS;
740         return -1;
741 }
742
743 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
744                                SMB_ACL_T theacl)
745 {
746         errno = ENOSYS;
747         return -1;
748 }
749
750 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
751                                         const char *path)
752 {
753         errno = ENOSYS;
754         return -1;
755 }
756
757 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
758                              const char *name, void *value, size_t size)
759 {
760         errno = ENOSYS;
761         return -1;
762 }
763
764 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
765                               struct files_struct *fsp, const char *name,
766                               void *value, size_t size)
767 {
768         errno = ENOSYS;
769         return -1;
770 }
771
772 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
773                               char *list, size_t size)
774 {
775         errno = ENOSYS;
776         return -1;
777 }
778
779 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
780                                struct files_struct *fsp, char *list,
781                                size_t size)
782 {
783         errno = ENOSYS;
784         return -1;
785 }
786
787 static int skel_removexattr(vfs_handle_struct *handle, const char *path,
788                             const char *name)
789 {
790         errno = ENOSYS;
791         return -1;
792 }
793
794 static int skel_fremovexattr(vfs_handle_struct *handle,
795                              struct files_struct *fsp, const char *name)
796 {
797         errno = ENOSYS;
798         return -1;
799         return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
800 }
801
802 static int skel_setxattr(vfs_handle_struct *handle, const char *path,
803                          const char *name, const void *value, size_t size,
804                          int flags)
805 {
806         errno = ENOSYS;
807         return -1;
808 }
809
810 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
811                           const char *name, const void *value, size_t size,
812                           int flags)
813 {
814         errno = ENOSYS;
815         return -1;
816 }
817
818 static bool skel_aio_force(struct vfs_handle_struct *handle,
819                            struct files_struct *fsp)
820 {
821         errno = ENOSYS;
822         return false;
823 }
824
825 static bool skel_is_offline(struct vfs_handle_struct *handle,
826                             const struct smb_filename *fname,
827                             SMB_STRUCT_STAT *sbuf)
828 {
829         errno = ENOSYS;
830         return false;
831 }
832
833 static int skel_set_offline(struct vfs_handle_struct *handle,
834                             const struct smb_filename *fname)
835 {
836         errno = ENOSYS;
837         return -1;
838 }
839
840 /* VFS operations structure */
841
842 struct vfs_fn_pointers skel_opaque_fns = {
843         /* Disk operations */
844
845         .connect_fn = skel_connect,
846         .disconnect_fn = skel_disconnect,
847         .disk_free_fn = skel_disk_free,
848         .get_quota_fn = skel_get_quota,
849         .set_quota_fn = skel_set_quota,
850         .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
851         .statvfs_fn = skel_statvfs,
852         .fs_capabilities_fn = skel_fs_capabilities,
853         .get_dfs_referrals_fn = skel_get_dfs_referrals,
854         .snap_check_path_fn = skel_snap_check_path,
855         .snap_create_fn = skel_snap_create,
856         .snap_delete_fn = skel_snap_delete,
857
858         /* Directory operations */
859
860         .opendir_fn = skel_opendir,
861         .fdopendir_fn = skel_fdopendir,
862         .readdir_fn = skel_readdir,
863         .seekdir_fn = skel_seekdir,
864         .telldir_fn = skel_telldir,
865         .rewind_dir_fn = skel_rewind_dir,
866         .mkdir_fn = skel_mkdir,
867         .rmdir_fn = skel_rmdir,
868         .closedir_fn = skel_closedir,
869         .init_search_op_fn = skel_init_search_op,
870
871         /* File operations */
872
873         .open_fn = skel_open,
874         .create_file_fn = skel_create_file,
875         .close_fn = skel_close_fn,
876         .read_fn = skel_vfs_read,
877         .pread_fn = skel_pread,
878         .pread_send_fn = skel_pread_send,
879         .pread_recv_fn = skel_pread_recv,
880         .write_fn = skel_write,
881         .pwrite_fn = skel_pwrite,
882         .pwrite_send_fn = skel_pwrite_send,
883         .pwrite_recv_fn = skel_pwrite_recv,
884         .lseek_fn = skel_lseek,
885         .sendfile_fn = skel_sendfile,
886         .recvfile_fn = skel_recvfile,
887         .rename_fn = skel_rename,
888         .fsync_fn = skel_fsync,
889         .fsync_send_fn = skel_fsync_send,
890         .fsync_recv_fn = skel_fsync_recv,
891         .stat_fn = skel_stat,
892         .fstat_fn = skel_fstat,
893         .lstat_fn = skel_lstat,
894         .get_alloc_size_fn = skel_get_alloc_size,
895         .unlink_fn = skel_unlink,
896         .chmod_fn = skel_chmod,
897         .fchmod_fn = skel_fchmod,
898         .chown_fn = skel_chown,
899         .fchown_fn = skel_fchown,
900         .lchown_fn = skel_lchown,
901         .chdir_fn = skel_chdir,
902         .getwd_fn = skel_getwd,
903         .ntimes_fn = skel_ntimes,
904         .ftruncate_fn = skel_ftruncate,
905         .fallocate_fn = skel_fallocate,
906         .lock_fn = skel_lock,
907         .kernel_flock_fn = skel_kernel_flock,
908         .linux_setlease_fn = skel_linux_setlease,
909         .getlock_fn = skel_getlock,
910         .symlink_fn = skel_symlink,
911         .readlink_fn = skel_vfs_readlink,
912         .link_fn = skel_link,
913         .mknod_fn = skel_mknod,
914         .realpath_fn = skel_realpath,
915         .chflags_fn = skel_chflags,
916         .file_id_create_fn = skel_file_id_create,
917         .copy_chunk_send_fn = skel_copy_chunk_send,
918         .copy_chunk_recv_fn = skel_copy_chunk_recv,
919         .get_compression_fn = skel_get_compression,
920         .set_compression_fn = skel_set_compression,
921
922         .streaminfo_fn = skel_streaminfo,
923         .get_real_filename_fn = skel_get_real_filename,
924         .connectpath_fn = skel_connectpath,
925         .brl_lock_windows_fn = skel_brl_lock_windows,
926         .brl_unlock_windows_fn = skel_brl_unlock_windows,
927         .brl_cancel_windows_fn = skel_brl_cancel_windows,
928         .strict_lock_fn = skel_strict_lock,
929         .strict_unlock_fn = skel_strict_unlock,
930         .translate_name_fn = skel_translate_name,
931         .fsctl_fn = skel_fsctl,
932         .readdir_attr_fn = skel_readdir_attr,
933
934         /* NT ACL operations. */
935
936         .fget_nt_acl_fn = skel_fget_nt_acl,
937         .get_nt_acl_fn = skel_get_nt_acl,
938         .fset_nt_acl_fn = skel_fset_nt_acl,
939
940         /* POSIX ACL operations. */
941
942         .chmod_acl_fn = skel_chmod_acl,
943         .fchmod_acl_fn = skel_fchmod_acl,
944
945         .sys_acl_get_file_fn = skel_sys_acl_get_file,
946         .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
947         .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
948         .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
949         .sys_acl_set_file_fn = skel_sys_acl_set_file,
950         .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
951         .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
952
953         /* EA operations. */
954         .getxattr_fn = skel_getxattr,
955         .fgetxattr_fn = skel_fgetxattr,
956         .listxattr_fn = skel_listxattr,
957         .flistxattr_fn = skel_flistxattr,
958         .removexattr_fn = skel_removexattr,
959         .fremovexattr_fn = skel_fremovexattr,
960         .setxattr_fn = skel_setxattr,
961         .fsetxattr_fn = skel_fsetxattr,
962
963         /* aio operations */
964         .aio_force_fn = skel_aio_force,
965
966         /* offline operations */
967         .is_offline_fn = skel_is_offline,
968         .set_offline_fn = skel_set_offline
969 };
970
971 static_decl_vfs;
972 NTSTATUS vfs_skel_opaque_init(void)
973 {
974         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
975                                 &skel_opaque_fns);
976 }