81ce1848898ee9efb7f6e454969458b871b811fc
[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_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,
247                                struct vfs_aio_state *vfs_aio_state)
248 {
249         vfs_aio_state->error = ENOSYS;
250         return -1;
251 }
252
253 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
254                           const void *data, size_t n)
255 {
256         errno = ENOSYS;
257         return -1;
258 }
259
260 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
261                            const void *data, size_t n, off_t offset)
262 {
263         errno = ENOSYS;
264         return -1;
265 }
266
267 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
268                                            TALLOC_CTX *mem_ctx,
269                                            struct tevent_context *ev,
270                                            struct files_struct *fsp,
271                                            const void *data,
272                                            size_t n, off_t offset)
273 {
274         return NULL;
275 }
276
277 static ssize_t skel_pwrite_recv(struct tevent_req *req,
278                                 struct vfs_aio_state *vfs_aio_state)
279 {
280         vfs_aio_state->error = ENOSYS;
281         return -1;
282 }
283
284 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
285                         off_t offset, int whence)
286 {
287         errno = ENOSYS;
288         return (off_t) - 1;
289 }
290
291 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
292                              files_struct *fromfsp, const DATA_BLOB *hdr,
293                              off_t offset, size_t n)
294 {
295         errno = ENOSYS;
296         return -1;
297 }
298
299 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
300                              files_struct *tofsp, off_t offset, size_t n)
301 {
302         errno = ENOSYS;
303         return -1;
304 }
305
306 static int skel_rename(vfs_handle_struct *handle,
307                        const struct smb_filename *smb_fname_src,
308                        const struct smb_filename *smb_fname_dst)
309 {
310         errno = ENOSYS;
311         return -1;
312 }
313
314 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
315 {
316         errno = ENOSYS;
317         return -1;
318 }
319
320 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
321                                           TALLOC_CTX *mem_ctx,
322                                           struct tevent_context *ev,
323                                           struct files_struct *fsp)
324 {
325         return NULL;
326 }
327
328 static int skel_fsync_recv(struct tevent_req *req,
329                            struct vfs_aio_state *vfs_aio_state)
330 {
331         vfs_aio_state->error = ENOSYS;
332         return -1;
333 }
334
335 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
336 {
337         errno = ENOSYS;
338         return -1;
339 }
340
341 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
342                       SMB_STRUCT_STAT *sbuf)
343 {
344         errno = ENOSYS;
345         return -1;
346 }
347
348 static int skel_lstat(vfs_handle_struct *handle,
349                       struct smb_filename *smb_fname)
350 {
351         errno = ENOSYS;
352         return -1;
353 }
354
355 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
356                                     struct files_struct *fsp,
357                                     const SMB_STRUCT_STAT *sbuf)
358 {
359         errno = ENOSYS;
360         return -1;
361 }
362
363 static int skel_unlink(vfs_handle_struct *handle,
364                        const struct smb_filename *smb_fname)
365 {
366         errno = ENOSYS;
367         return -1;
368 }
369
370 static int skel_chmod(vfs_handle_struct *handle,
371                         const struct smb_filename *smb_fname,
372                         mode_t mode)
373 {
374         errno = ENOSYS;
375         return -1;
376 }
377
378 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
379                        mode_t mode)
380 {
381         errno = ENOSYS;
382         return -1;
383 }
384
385 static int skel_chown(vfs_handle_struct *handle,
386                         const struct smb_filename *smb_fname,
387                         uid_t uid,
388                         gid_t gid)
389 {
390         errno = ENOSYS;
391         return -1;
392 }
393
394 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
395                        uid_t uid, gid_t gid)
396 {
397         errno = ENOSYS;
398         return -1;
399 }
400
401 static int skel_lchown(vfs_handle_struct *handle,
402                         const struct smb_filename *smb_fname,
403                         uid_t uid,
404                         gid_t gid)
405 {
406         errno = ENOSYS;
407         return -1;
408 }
409
410 static int skel_chdir(vfs_handle_struct *handle, const char *path)
411 {
412         errno = ENOSYS;
413         return -1;
414 }
415
416 static char *skel_getwd(vfs_handle_struct *handle)
417 {
418         errno = ENOSYS;
419         return NULL;
420 }
421
422 static int skel_ntimes(vfs_handle_struct *handle,
423                        const struct smb_filename *smb_fname,
424                        struct smb_file_time *ft)
425 {
426         errno = ENOSYS;
427         return -1;
428 }
429
430 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
431                           off_t offset)
432 {
433         errno = ENOSYS;
434         return -1;
435 }
436
437 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
438                           uint32_t mode, off_t offset, off_t len)
439 {
440         errno = ENOSYS;
441         return -1;
442 }
443
444 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
445                       off_t offset, off_t count, int type)
446 {
447         errno = ENOSYS;
448         return false;
449 }
450
451 static int skel_kernel_flock(struct vfs_handle_struct *handle,
452                              struct files_struct *fsp,
453                              uint32_t share_mode, uint32_t access_mask)
454 {
455         errno = ENOSYS;
456         return -1;
457 }
458
459 static int skel_linux_setlease(struct vfs_handle_struct *handle,
460                                struct files_struct *fsp, int leasetype)
461 {
462         errno = ENOSYS;
463         return -1;
464 }
465
466 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
467                          off_t *poffset, off_t *pcount, int *ptype,
468                          pid_t *ppid)
469 {
470         errno = ENOSYS;
471         return false;
472 }
473
474 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
475                         const char *newpath)
476 {
477         errno = ENOSYS;
478         return -1;
479 }
480
481 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
482                              char *buf, size_t bufsiz)
483 {
484         errno = ENOSYS;
485         return -1;
486 }
487
488 static int skel_link(vfs_handle_struct *handle, const char *oldpath,
489                      const char *newpath)
490 {
491         errno = ENOSYS;
492         return -1;
493 }
494
495 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
496                       SMB_DEV_T dev)
497 {
498         errno = ENOSYS;
499         return -1;
500 }
501
502 static char *skel_realpath(vfs_handle_struct *handle, const char *path)
503 {
504         errno = ENOSYS;
505         return NULL;
506 }
507
508 static int skel_chflags(vfs_handle_struct *handle, const char *path,
509                         uint flags)
510 {
511         errno = ENOSYS;
512         return -1;
513 }
514
515 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
516                                           const SMB_STRUCT_STAT *sbuf)
517 {
518         struct file_id id;
519         ZERO_STRUCT(id);
520         errno = ENOSYS;
521         return id;
522 }
523
524 struct skel_cc_state {
525         uint64_t unused;
526 };
527 static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
528                                                TALLOC_CTX *mem_ctx,
529                                                struct tevent_context *ev,
530                                                struct files_struct *src_fsp,
531                                                off_t src_off,
532                                                struct files_struct *dest_fsp,
533                                                off_t dest_off,
534                                                off_t num)
535 {
536         struct tevent_req *req;
537         struct skel_cc_state *cc_state;
538
539         req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
540         if (req == NULL) {
541                 return NULL;
542         }
543
544         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
545         return tevent_req_post(req, ev);
546 }
547
548 static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
549                                      struct tevent_req *req,
550                                      off_t *copied)
551 {
552         NTSTATUS status;
553
554         if (tevent_req_is_nterror(req, &status)) {
555                 tevent_req_received(req);
556                 return status;
557         }
558         tevent_req_received(req);
559
560         return NT_STATUS_OK;
561 }
562
563 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
564                                      TALLOC_CTX *mem_ctx,
565                                      struct files_struct *fsp,
566                                      struct smb_filename *smb_fname,
567                                      uint16_t *_compression_fmt)
568 {
569         return NT_STATUS_INVALID_DEVICE_REQUEST;
570 }
571
572 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
573                                      TALLOC_CTX *mem_ctx,
574                                      struct files_struct *fsp,
575                                      uint16_t compression_fmt)
576 {
577         return NT_STATUS_INVALID_DEVICE_REQUEST;
578 }
579
580 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
581                                 struct files_struct *fsp,
582                                 const struct smb_filename *smb_fname,
583                                 TALLOC_CTX *mem_ctx,
584                                 unsigned int *num_streams,
585                                 struct stream_struct **streams)
586 {
587         return NT_STATUS_NOT_IMPLEMENTED;
588 }
589
590 static int skel_get_real_filename(struct vfs_handle_struct *handle,
591                                   const char *path,
592                                   const char *name,
593                                   TALLOC_CTX *mem_ctx, char **found_name)
594 {
595         errno = ENOSYS;
596         return -1;
597 }
598
599 static const char *skel_connectpath(struct vfs_handle_struct *handle,
600                                     const char *filename)
601 {
602         errno = ENOSYS;
603         return NULL;
604 }
605
606 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
607                                       struct byte_range_lock *br_lck,
608                                       struct lock_struct *plock,
609                                       bool blocking_lock)
610 {
611         return NT_STATUS_NOT_IMPLEMENTED;
612 }
613
614 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
615                                     struct messaging_context *msg_ctx,
616                                     struct byte_range_lock *br_lck,
617                                     const struct lock_struct *plock)
618 {
619         errno = ENOSYS;
620         return false;
621 }
622
623 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
624                                     struct byte_range_lock *br_lck,
625                                     struct lock_struct *plock)
626 {
627         errno = ENOSYS;
628         return false;
629 }
630
631 static bool skel_strict_lock(struct vfs_handle_struct *handle,
632                              struct files_struct *fsp,
633                              struct lock_struct *plock)
634 {
635         errno = ENOSYS;
636         return false;
637 }
638
639 static void skel_strict_unlock(struct vfs_handle_struct *handle,
640                                struct files_struct *fsp,
641                                struct lock_struct *plock)
642 {
643         ;
644 }
645
646 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
647                                     const char *mapped_name,
648                                     enum vfs_translate_direction direction,
649                                     TALLOC_CTX *mem_ctx, char **pmapped_name)
650 {
651         return NT_STATUS_NOT_IMPLEMENTED;
652 }
653
654 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
655                            struct files_struct *fsp,
656                            TALLOC_CTX *ctx,
657                            uint32_t function,
658                            uint16_t req_flags,  /* Needed for UNICODE ... */
659                            const uint8_t *_in_data,
660                            uint32_t in_len,
661                            uint8_t **_out_data,
662                            uint32_t max_out_len, uint32_t *out_len)
663 {
664         return NT_STATUS_NOT_IMPLEMENTED;
665 }
666
667 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
668                                   const struct smb_filename *fname,
669                                   TALLOC_CTX *mem_ctx,
670                                   struct readdir_attr_data **pattr_data)
671 {
672         return NT_STATUS_NOT_IMPLEMENTED;
673 }
674
675 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
676                                 struct smb_filename *smb_fname,
677                                 uint32_t *dosmode)
678 {
679         return NT_STATUS_NOT_IMPLEMENTED;
680 }
681
682 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
683                                 struct files_struct *fsp,
684                                 uint32_t *dosmode)
685 {
686         return NT_STATUS_NOT_IMPLEMENTED;
687 }
688
689 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
690                                 const struct smb_filename *smb_fname,
691                                 uint32_t dosmode)
692 {
693         return NT_STATUS_NOT_IMPLEMENTED;
694 }
695
696 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
697                                 struct files_struct *fsp,
698                                 uint32_t dosmode)
699 {
700         return NT_STATUS_NOT_IMPLEMENTED;
701 }
702
703 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
704                                  uint32_t security_info,
705                                  TALLOC_CTX *mem_ctx,
706                                  struct security_descriptor **ppdesc)
707 {
708         return NT_STATUS_NOT_IMPLEMENTED;
709 }
710
711 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
712                                 const struct smb_filename *smb_fname,
713                                 uint32_t security_info,
714                                 TALLOC_CTX *mem_ctx,
715                                 struct security_descriptor **ppdesc)
716 {
717         return NT_STATUS_NOT_IMPLEMENTED;
718 }
719
720 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
721                                  uint32_t security_info_sent,
722                                  const struct security_descriptor *psd)
723 {
724         return NT_STATUS_NOT_IMPLEMENTED;
725 }
726
727 static int skel_chmod_acl(vfs_handle_struct *handle,
728                         const struct smb_filename *smb_fname,
729                         mode_t mode)
730 {
731         errno = ENOSYS;
732         return -1;
733 }
734
735 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
736                            mode_t mode)
737 {
738         errno = ENOSYS;
739         return -1;
740 }
741
742 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
743                                        const char *path_p,
744                                        SMB_ACL_TYPE_T type,
745                                        TALLOC_CTX *mem_ctx)
746 {
747         errno = ENOSYS;
748         return (SMB_ACL_T) NULL;
749 }
750
751 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
752                                      files_struct *fsp, TALLOC_CTX *mem_ctx)
753 {
754         errno = ENOSYS;
755         return (SMB_ACL_T) NULL;
756 }
757
758 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
759                                       const char *path_p, TALLOC_CTX *mem_ctx,
760                                       char **blob_description, DATA_BLOB *blob)
761 {
762         errno = ENOSYS;
763         return -1;
764 }
765
766 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
767                                     files_struct *fsp, TALLOC_CTX *mem_ctx,
768                                     char **blob_description, DATA_BLOB *blob)
769 {
770         errno = ENOSYS;
771         return -1;
772 }
773
774 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
775                                  SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
776 {
777         errno = ENOSYS;
778         return -1;
779 }
780
781 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
782                                SMB_ACL_T theacl)
783 {
784         errno = ENOSYS;
785         return -1;
786 }
787
788 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
789                                         const char *path)
790 {
791         errno = ENOSYS;
792         return -1;
793 }
794
795 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
796                              const char *name, void *value, size_t size)
797 {
798         errno = ENOSYS;
799         return -1;
800 }
801
802 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
803                               struct files_struct *fsp, const char *name,
804                               void *value, size_t size)
805 {
806         errno = ENOSYS;
807         return -1;
808 }
809
810 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
811                               char *list, size_t size)
812 {
813         errno = ENOSYS;
814         return -1;
815 }
816
817 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
818                                struct files_struct *fsp, char *list,
819                                size_t size)
820 {
821         errno = ENOSYS;
822         return -1;
823 }
824
825 static int skel_removexattr(vfs_handle_struct *handle, const char *path,
826                             const char *name)
827 {
828         errno = ENOSYS;
829         return -1;
830 }
831
832 static int skel_fremovexattr(vfs_handle_struct *handle,
833                              struct files_struct *fsp, const char *name)
834 {
835         errno = ENOSYS;
836         return -1;
837         return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
838 }
839
840 static int skel_setxattr(vfs_handle_struct *handle, const char *path,
841                          const char *name, const void *value, size_t size,
842                          int flags)
843 {
844         errno = ENOSYS;
845         return -1;
846 }
847
848 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
849                           const char *name, const void *value, size_t size,
850                           int flags)
851 {
852         errno = ENOSYS;
853         return -1;
854 }
855
856 static bool skel_aio_force(struct vfs_handle_struct *handle,
857                            struct files_struct *fsp)
858 {
859         errno = ENOSYS;
860         return false;
861 }
862
863 static bool skel_is_offline(struct vfs_handle_struct *handle,
864                             const struct smb_filename *fname,
865                             SMB_STRUCT_STAT *sbuf)
866 {
867         errno = ENOSYS;
868         return false;
869 }
870
871 static int skel_set_offline(struct vfs_handle_struct *handle,
872                             const struct smb_filename *fname)
873 {
874         errno = ENOSYS;
875         return -1;
876 }
877
878 /* VFS operations structure */
879
880 struct vfs_fn_pointers skel_opaque_fns = {
881         /* Disk operations */
882
883         .connect_fn = skel_connect,
884         .disconnect_fn = skel_disconnect,
885         .disk_free_fn = skel_disk_free,
886         .get_quota_fn = skel_get_quota,
887         .set_quota_fn = skel_set_quota,
888         .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
889         .statvfs_fn = skel_statvfs,
890         .fs_capabilities_fn = skel_fs_capabilities,
891         .get_dfs_referrals_fn = skel_get_dfs_referrals,
892         .snap_check_path_fn = skel_snap_check_path,
893         .snap_create_fn = skel_snap_create,
894         .snap_delete_fn = skel_snap_delete,
895
896         /* Directory operations */
897
898         .opendir_fn = skel_opendir,
899         .fdopendir_fn = skel_fdopendir,
900         .readdir_fn = skel_readdir,
901         .seekdir_fn = skel_seekdir,
902         .telldir_fn = skel_telldir,
903         .rewind_dir_fn = skel_rewind_dir,
904         .mkdir_fn = skel_mkdir,
905         .rmdir_fn = skel_rmdir,
906         .closedir_fn = skel_closedir,
907         .init_search_op_fn = skel_init_search_op,
908
909         /* File operations */
910
911         .open_fn = skel_open,
912         .create_file_fn = skel_create_file,
913         .close_fn = skel_close_fn,
914         .read_fn = skel_vfs_read,
915         .pread_fn = skel_pread,
916         .pread_send_fn = skel_pread_send,
917         .pread_recv_fn = skel_pread_recv,
918         .write_fn = skel_write,
919         .pwrite_fn = skel_pwrite,
920         .pwrite_send_fn = skel_pwrite_send,
921         .pwrite_recv_fn = skel_pwrite_recv,
922         .lseek_fn = skel_lseek,
923         .sendfile_fn = skel_sendfile,
924         .recvfile_fn = skel_recvfile,
925         .rename_fn = skel_rename,
926         .fsync_fn = skel_fsync,
927         .fsync_send_fn = skel_fsync_send,
928         .fsync_recv_fn = skel_fsync_recv,
929         .stat_fn = skel_stat,
930         .fstat_fn = skel_fstat,
931         .lstat_fn = skel_lstat,
932         .get_alloc_size_fn = skel_get_alloc_size,
933         .unlink_fn = skel_unlink,
934         .chmod_fn = skel_chmod,
935         .fchmod_fn = skel_fchmod,
936         .chown_fn = skel_chown,
937         .fchown_fn = skel_fchown,
938         .lchown_fn = skel_lchown,
939         .chdir_fn = skel_chdir,
940         .getwd_fn = skel_getwd,
941         .ntimes_fn = skel_ntimes,
942         .ftruncate_fn = skel_ftruncate,
943         .fallocate_fn = skel_fallocate,
944         .lock_fn = skel_lock,
945         .kernel_flock_fn = skel_kernel_flock,
946         .linux_setlease_fn = skel_linux_setlease,
947         .getlock_fn = skel_getlock,
948         .symlink_fn = skel_symlink,
949         .readlink_fn = skel_vfs_readlink,
950         .link_fn = skel_link,
951         .mknod_fn = skel_mknod,
952         .realpath_fn = skel_realpath,
953         .chflags_fn = skel_chflags,
954         .file_id_create_fn = skel_file_id_create,
955         .copy_chunk_send_fn = skel_copy_chunk_send,
956         .copy_chunk_recv_fn = skel_copy_chunk_recv,
957         .get_compression_fn = skel_get_compression,
958         .set_compression_fn = skel_set_compression,
959
960         .streaminfo_fn = skel_streaminfo,
961         .get_real_filename_fn = skel_get_real_filename,
962         .connectpath_fn = skel_connectpath,
963         .brl_lock_windows_fn = skel_brl_lock_windows,
964         .brl_unlock_windows_fn = skel_brl_unlock_windows,
965         .brl_cancel_windows_fn = skel_brl_cancel_windows,
966         .strict_lock_fn = skel_strict_lock,
967         .strict_unlock_fn = skel_strict_unlock,
968         .translate_name_fn = skel_translate_name,
969         .fsctl_fn = skel_fsctl,
970         .readdir_attr_fn = skel_readdir_attr,
971
972         /* DOS attributes. */
973         .get_dos_attributes_fn = skel_get_dos_attributes,
974         .fget_dos_attributes_fn = skel_fget_dos_attributes,
975         .set_dos_attributes_fn = skel_set_dos_attributes,
976         .fset_dos_attributes_fn = skel_fset_dos_attributes,
977
978         /* NT ACL operations. */
979
980         .fget_nt_acl_fn = skel_fget_nt_acl,
981         .get_nt_acl_fn = skel_get_nt_acl,
982         .fset_nt_acl_fn = skel_fset_nt_acl,
983
984         /* POSIX ACL operations. */
985
986         .chmod_acl_fn = skel_chmod_acl,
987         .fchmod_acl_fn = skel_fchmod_acl,
988
989         .sys_acl_get_file_fn = skel_sys_acl_get_file,
990         .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
991         .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
992         .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
993         .sys_acl_set_file_fn = skel_sys_acl_set_file,
994         .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
995         .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
996
997         /* EA operations. */
998         .getxattr_fn = skel_getxattr,
999         .fgetxattr_fn = skel_fgetxattr,
1000         .listxattr_fn = skel_listxattr,
1001         .flistxattr_fn = skel_flistxattr,
1002         .removexattr_fn = skel_removexattr,
1003         .fremovexattr_fn = skel_fremovexattr,
1004         .setxattr_fn = skel_setxattr,
1005         .fsetxattr_fn = skel_fsetxattr,
1006
1007         /* aio operations */
1008         .aio_force_fn = skel_aio_force,
1009
1010         /* offline operations */
1011         .is_offline_fn = skel_is_offline,
1012         .set_offline_fn = skel_set_offline
1013 };
1014
1015 static_decl_vfs;
1016 NTSTATUS vfs_skel_opaque_init(void)
1017 {
1018         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1019                                 &skel_opaque_fns);
1020 }