41215ccf911e3d15f00d98a273cbdd3ba970c0a5
[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,
48                                 const struct smb_filename *smb_fname,
49                                 uint64_t *bsize,
50                                 uint64_t *dfree,
51                                 uint64_t *dsize)
52 {
53         *bsize = 0;
54         *dfree = 0;
55         *dsize = 0;
56         return 0;
57 }
58
59 static int skel_get_quota(vfs_handle_struct *handle,
60                                 const struct smb_filename *smb_fname,
61                                 enum SMB_QUOTA_TYPE qtype,
62                                 unid_t id,
63                                 SMB_DISK_QUOTA *dq)
64 {
65         errno = ENOSYS;
66         return -1;
67 }
68
69 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
70                           unid_t id, SMB_DISK_QUOTA *dq)
71 {
72         errno = ENOSYS;
73         return -1;
74 }
75
76 static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
77                                      files_struct *fsp,
78                                      struct shadow_copy_data *shadow_copy_data,
79                                      bool labels)
80 {
81         errno = ENOSYS;
82         return -1;
83 }
84
85 static int skel_statvfs(struct vfs_handle_struct *handle,
86                                 const struct smb_filename *smb_fname,
87                                 struct vfs_statvfs_struct *statbuf)
88 {
89         errno = ENOSYS;
90         return -1;
91 }
92
93 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
94                                      enum timestamp_set_resolution *p_ts_res)
95 {
96         return 0;
97 }
98
99 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
100                                        struct dfs_GetDFSReferral *r)
101 {
102         return NT_STATUS_NOT_IMPLEMENTED;
103 }
104
105 static DIR *skel_opendir(vfs_handle_struct *handle,
106                         const struct smb_filename *smb_fname,
107                         const char *mask,
108                         uint32_t attr)
109 {
110         return NULL;
111 }
112
113 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
114                                      TALLOC_CTX *mem_ctx,
115                                      const char *service_path,
116                                      char **base_volume)
117 {
118         return NT_STATUS_NOT_SUPPORTED;
119 }
120
121 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
122                                  TALLOC_CTX *mem_ctx,
123                                  const char *base_volume,
124                                  time_t *tstamp,
125                                  bool rw,
126                                  char **base_path,
127                                  char **snap_path)
128 {
129         return NT_STATUS_NOT_SUPPORTED;
130 }
131
132 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
133                                  TALLOC_CTX *mem_ctx,
134                                  char *base_path,
135                                  char *snap_path)
136 {
137         return NT_STATUS_NOT_SUPPORTED;
138 }
139
140 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
141                            const char *mask, uint32_t attr)
142 {
143         return NULL;
144 }
145
146 static struct dirent *skel_readdir(vfs_handle_struct *handle,
147                                    DIR *dirp, SMB_STRUCT_STAT *sbuf)
148 {
149         return NULL;
150 }
151
152 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
153 {
154         ;
155 }
156
157 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
158 {
159         return (long)-1;
160 }
161
162 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
163 {
164         ;
165 }
166
167 static int skel_mkdir(vfs_handle_struct *handle,
168                 const struct smb_filename *smb_fname,
169                 mode_t mode)
170 {
171         errno = ENOSYS;
172         return -1;
173 }
174
175 static int skel_rmdir(vfs_handle_struct *handle,
176                 const struct smb_filename *smb_fname)
177 {
178         errno = ENOSYS;
179         return -1;
180 }
181
182 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
183 {
184         errno = ENOSYS;
185         return -1;
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 struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
315                                           TALLOC_CTX *mem_ctx,
316                                           struct tevent_context *ev,
317                                           struct files_struct *fsp)
318 {
319         return NULL;
320 }
321
322 static int skel_fsync_recv(struct tevent_req *req,
323                            struct vfs_aio_state *vfs_aio_state)
324 {
325         vfs_aio_state->error = ENOSYS;
326         return -1;
327 }
328
329 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
330 {
331         errno = ENOSYS;
332         return -1;
333 }
334
335 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
336                       SMB_STRUCT_STAT *sbuf)
337 {
338         errno = ENOSYS;
339         return -1;
340 }
341
342 static int skel_lstat(vfs_handle_struct *handle,
343                       struct smb_filename *smb_fname)
344 {
345         errno = ENOSYS;
346         return -1;
347 }
348
349 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
350                                     struct files_struct *fsp,
351                                     const SMB_STRUCT_STAT *sbuf)
352 {
353         errno = ENOSYS;
354         return -1;
355 }
356
357 static int skel_unlink(vfs_handle_struct *handle,
358                        const struct smb_filename *smb_fname)
359 {
360         errno = ENOSYS;
361         return -1;
362 }
363
364 static int skel_chmod(vfs_handle_struct *handle,
365                         const struct smb_filename *smb_fname,
366                         mode_t mode)
367 {
368         errno = ENOSYS;
369         return -1;
370 }
371
372 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
373                        mode_t mode)
374 {
375         errno = ENOSYS;
376         return -1;
377 }
378
379 static int skel_chown(vfs_handle_struct *handle,
380                         const struct smb_filename *smb_fname,
381                         uid_t uid,
382                         gid_t gid)
383 {
384         errno = ENOSYS;
385         return -1;
386 }
387
388 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
389                        uid_t uid, gid_t gid)
390 {
391         errno = ENOSYS;
392         return -1;
393 }
394
395 static int skel_lchown(vfs_handle_struct *handle,
396                         const struct smb_filename *smb_fname,
397                         uid_t uid,
398                         gid_t gid)
399 {
400         errno = ENOSYS;
401         return -1;
402 }
403
404 static int skel_chdir(vfs_handle_struct *handle,
405                         const struct smb_filename *smb_fname)
406 {
407         errno = ENOSYS;
408         return -1;
409 }
410
411 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
412                                 TALLOC_CTX *ctx)
413 {
414         errno = ENOSYS;
415         return NULL;
416 }
417
418 static int skel_ntimes(vfs_handle_struct *handle,
419                        const struct smb_filename *smb_fname,
420                        struct smb_file_time *ft)
421 {
422         errno = ENOSYS;
423         return -1;
424 }
425
426 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
427                           off_t offset)
428 {
429         errno = ENOSYS;
430         return -1;
431 }
432
433 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
434                           uint32_t mode, off_t offset, off_t len)
435 {
436         errno = ENOSYS;
437         return -1;
438 }
439
440 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
441                       off_t offset, off_t count, int type)
442 {
443         errno = ENOSYS;
444         return false;
445 }
446
447 static int skel_kernel_flock(struct vfs_handle_struct *handle,
448                              struct files_struct *fsp,
449                              uint32_t share_mode, uint32_t access_mask)
450 {
451         errno = ENOSYS;
452         return -1;
453 }
454
455 static int skel_linux_setlease(struct vfs_handle_struct *handle,
456                                struct files_struct *fsp, int leasetype)
457 {
458         errno = ENOSYS;
459         return -1;
460 }
461
462 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
463                          off_t *poffset, off_t *pcount, int *ptype,
464                          pid_t *ppid)
465 {
466         errno = ENOSYS;
467         return false;
468 }
469
470 static int skel_symlink(vfs_handle_struct *handle,
471                         const char *link_contents,
472                         const struct smb_filename *new_smb_fname)
473 {
474         errno = ENOSYS;
475         return -1;
476 }
477
478 static int skel_vfs_readlink(vfs_handle_struct *handle,
479                         const struct smb_filename *smb_fname,
480                         char *buf,
481                         size_t bufsiz)
482 {
483         errno = ENOSYS;
484         return -1;
485 }
486
487 static int skel_link(vfs_handle_struct *handle,
488                         const struct smb_filename *old_smb_fname,
489                         const struct smb_filename *new_smb_fname)
490 {
491         errno = ENOSYS;
492         return -1;
493 }
494
495 static int skel_mknod(vfs_handle_struct *handle,
496                         const struct smb_filename *smb_fname,
497                         mode_t mode,
498                         SMB_DEV_T dev)
499 {
500         errno = ENOSYS;
501         return -1;
502 }
503
504 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
505                         TALLOC_CTX *ctx,
506                         const struct smb_filename *smb_fname)
507 {
508         errno = ENOSYS;
509         return NULL;
510 }
511
512 static int skel_chflags(vfs_handle_struct *handle,
513                         const struct smb_filename *smb_fname,
514                         uint flags)
515 {
516         errno = ENOSYS;
517         return -1;
518 }
519
520 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
521                                           const SMB_STRUCT_STAT *sbuf)
522 {
523         struct file_id id;
524         ZERO_STRUCT(id);
525         errno = ENOSYS;
526         return id;
527 }
528
529 struct skel_offload_read_state {
530         bool dummy;
531 };
532
533 static struct tevent_req *skel_offload_read_send(
534         TALLOC_CTX *mem_ctx,
535         struct tevent_context *ev,
536         struct vfs_handle_struct *handle,
537         struct files_struct *fsp,
538         uint32_t fsctl,
539         uint32_t ttl,
540         off_t offset,
541         size_t to_copy)
542 {
543         struct tevent_req *req = NULL;
544         struct skel_offload_read_state *state = NULL;
545
546         req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
547         if (req == NULL) {
548                 return NULL;
549         }
550
551         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
552         return tevent_req_post(req, ev);
553 }
554
555 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
556                                        struct vfs_handle_struct *handle,
557                                        TALLOC_CTX *mem_ctx,
558                                        DATA_BLOB *_token_blob)
559 {
560         NTSTATUS status;
561
562         if (tevent_req_is_nterror(req, &status)) {
563                 tevent_req_received(req);
564                 return status;
565         }
566         tevent_req_received(req);
567
568         return NT_STATUS_OK;
569 }
570
571 struct skel_cc_state {
572         uint64_t unused;
573 };
574 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
575                                                TALLOC_CTX *mem_ctx,
576                                                struct tevent_context *ev,
577                                                uint32_t fsctl,
578                                                DATA_BLOB *token,
579                                                off_t transfer_offset,
580                                                struct files_struct *dest_fsp,
581                                                off_t dest_off,
582                                                off_t num)
583 {
584         struct tevent_req *req;
585         struct skel_cc_state *cc_state;
586
587         req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
588         if (req == NULL) {
589                 return NULL;
590         }
591
592         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
593         return tevent_req_post(req, ev);
594 }
595
596 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
597                                      struct tevent_req *req,
598                                      off_t *copied)
599 {
600         NTSTATUS status;
601
602         if (tevent_req_is_nterror(req, &status)) {
603                 tevent_req_received(req);
604                 return status;
605         }
606         tevent_req_received(req);
607
608         return NT_STATUS_OK;
609 }
610
611 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
612                                      TALLOC_CTX *mem_ctx,
613                                      struct files_struct *fsp,
614                                      struct smb_filename *smb_fname,
615                                      uint16_t *_compression_fmt)
616 {
617         return NT_STATUS_INVALID_DEVICE_REQUEST;
618 }
619
620 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
621                                      TALLOC_CTX *mem_ctx,
622                                      struct files_struct *fsp,
623                                      uint16_t compression_fmt)
624 {
625         return NT_STATUS_INVALID_DEVICE_REQUEST;
626 }
627
628 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
629                                 struct files_struct *fsp,
630                                 const struct smb_filename *smb_fname,
631                                 TALLOC_CTX *mem_ctx,
632                                 unsigned int *num_streams,
633                                 struct stream_struct **streams)
634 {
635         return NT_STATUS_NOT_IMPLEMENTED;
636 }
637
638 static int skel_get_real_filename(struct vfs_handle_struct *handle,
639                                   const char *path,
640                                   const char *name,
641                                   TALLOC_CTX *mem_ctx, char **found_name)
642 {
643         errno = ENOSYS;
644         return -1;
645 }
646
647 static const char *skel_connectpath(struct vfs_handle_struct *handle,
648                                 const struct smb_filename *smb_fname)
649 {
650         errno = ENOSYS;
651         return NULL;
652 }
653
654 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
655                                       struct byte_range_lock *br_lck,
656                                       struct lock_struct *plock,
657                                       bool blocking_lock)
658 {
659         return NT_STATUS_NOT_IMPLEMENTED;
660 }
661
662 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
663                                     struct messaging_context *msg_ctx,
664                                     struct byte_range_lock *br_lck,
665                                     const struct lock_struct *plock)
666 {
667         errno = ENOSYS;
668         return false;
669 }
670
671 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
672                                     struct byte_range_lock *br_lck,
673                                     struct lock_struct *plock)
674 {
675         errno = ENOSYS;
676         return false;
677 }
678
679 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
680                                    struct files_struct *fsp,
681                                    struct lock_struct *plock)
682 {
683         errno = ENOSYS;
684         return false;
685 }
686
687 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
688                                     const char *mapped_name,
689                                     enum vfs_translate_direction direction,
690                                     TALLOC_CTX *mem_ctx, char **pmapped_name)
691 {
692         return NT_STATUS_NOT_IMPLEMENTED;
693 }
694
695 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
696                            struct files_struct *fsp,
697                            TALLOC_CTX *ctx,
698                            uint32_t function,
699                            uint16_t req_flags,  /* Needed for UNICODE ... */
700                            const uint8_t *_in_data,
701                            uint32_t in_len,
702                            uint8_t **_out_data,
703                            uint32_t max_out_len, uint32_t *out_len)
704 {
705         return NT_STATUS_NOT_IMPLEMENTED;
706 }
707
708 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
709                                   const struct smb_filename *fname,
710                                   TALLOC_CTX *mem_ctx,
711                                   struct readdir_attr_data **pattr_data)
712 {
713         return NT_STATUS_NOT_IMPLEMENTED;
714 }
715
716 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
717                                 struct smb_filename *smb_fname,
718                                 uint32_t *dosmode)
719 {
720         return NT_STATUS_NOT_IMPLEMENTED;
721 }
722
723 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
724                                 struct files_struct *fsp,
725                                 uint32_t *dosmode)
726 {
727         return NT_STATUS_NOT_IMPLEMENTED;
728 }
729
730 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
731                                 const struct smb_filename *smb_fname,
732                                 uint32_t dosmode)
733 {
734         return NT_STATUS_NOT_IMPLEMENTED;
735 }
736
737 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
738                                 struct files_struct *fsp,
739                                 uint32_t dosmode)
740 {
741         return NT_STATUS_NOT_IMPLEMENTED;
742 }
743
744 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
745                                  uint32_t security_info,
746                                  TALLOC_CTX *mem_ctx,
747                                  struct security_descriptor **ppdesc)
748 {
749         return NT_STATUS_NOT_IMPLEMENTED;
750 }
751
752 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
753                                 const struct smb_filename *smb_fname,
754                                 uint32_t security_info,
755                                 TALLOC_CTX *mem_ctx,
756                                 struct security_descriptor **ppdesc)
757 {
758         return NT_STATUS_NOT_IMPLEMENTED;
759 }
760
761 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
762                                  uint32_t security_info_sent,
763                                  const struct security_descriptor *psd)
764 {
765         return NT_STATUS_NOT_IMPLEMENTED;
766 }
767
768 static int skel_chmod_acl(vfs_handle_struct *handle,
769                         const struct smb_filename *smb_fname,
770                         mode_t mode)
771 {
772         errno = ENOSYS;
773         return -1;
774 }
775
776 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
777                            mode_t mode)
778 {
779         errno = ENOSYS;
780         return -1;
781 }
782
783 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
784                                        const struct smb_filename *smb_fname,
785                                        SMB_ACL_TYPE_T type,
786                                        TALLOC_CTX *mem_ctx)
787 {
788         errno = ENOSYS;
789         return (SMB_ACL_T) NULL;
790 }
791
792 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
793                                      files_struct *fsp, TALLOC_CTX *mem_ctx)
794 {
795         errno = ENOSYS;
796         return (SMB_ACL_T) NULL;
797 }
798
799 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
800                                 const struct smb_filename *smb_fname,
801                                 TALLOC_CTX *mem_ctx,
802                                 char **blob_description,
803                                 DATA_BLOB *blob)
804 {
805         errno = ENOSYS;
806         return -1;
807 }
808
809 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
810                                     files_struct *fsp, TALLOC_CTX *mem_ctx,
811                                     char **blob_description, DATA_BLOB *blob)
812 {
813         errno = ENOSYS;
814         return -1;
815 }
816
817 static int skel_sys_acl_set_file(vfs_handle_struct *handle,
818                                 const struct smb_filename *smb_fname,
819                                 SMB_ACL_TYPE_T acltype,
820                                 SMB_ACL_T theacl)
821 {
822         errno = ENOSYS;
823         return -1;
824 }
825
826 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
827                                SMB_ACL_T theacl)
828 {
829         errno = ENOSYS;
830         return -1;
831 }
832
833 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
834                                         const struct smb_filename *smb_fname)
835 {
836         errno = ENOSYS;
837         return -1;
838 }
839
840 static ssize_t skel_getxattr(vfs_handle_struct *handle,
841                                 const struct smb_filename *smb_fname,
842                                 const char *name,
843                                 void *value,
844                                 size_t size)
845 {
846         errno = ENOSYS;
847         return -1;
848 }
849
850 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
851                               struct files_struct *fsp, const char *name,
852                               void *value, size_t size)
853 {
854         errno = ENOSYS;
855         return -1;
856 }
857
858 static ssize_t skel_listxattr(vfs_handle_struct *handle,
859                                 const struct smb_filename *smb_fname,
860                                 char *list,
861                                 size_t size)
862 {
863         errno = ENOSYS;
864         return -1;
865 }
866
867 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
868                                struct files_struct *fsp, char *list,
869                                size_t size)
870 {
871         errno = ENOSYS;
872         return -1;
873 }
874
875 static int skel_removexattr(vfs_handle_struct *handle,
876                         const struct smb_filename *smb_fname,
877                         const char *name)
878 {
879         errno = ENOSYS;
880         return -1;
881 }
882
883 static int skel_fremovexattr(vfs_handle_struct *handle,
884                              struct files_struct *fsp, const char *name)
885 {
886         errno = ENOSYS;
887         return -1;
888         return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
889 }
890
891 static int skel_setxattr(vfs_handle_struct *handle,
892                         const struct smb_filename *smb_fname,
893                         const char *name,
894                         const void *value,
895                         size_t size,
896                         int flags)
897 {
898         errno = ENOSYS;
899         return -1;
900 }
901
902 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
903                           const char *name, const void *value, size_t size,
904                           int flags)
905 {
906         errno = ENOSYS;
907         return -1;
908 }
909
910 static bool skel_aio_force(struct vfs_handle_struct *handle,
911                            struct files_struct *fsp)
912 {
913         errno = ENOSYS;
914         return false;
915 }
916
917 /* VFS operations structure */
918
919 struct vfs_fn_pointers skel_opaque_fns = {
920         /* Disk operations */
921
922         .connect_fn = skel_connect,
923         .disconnect_fn = skel_disconnect,
924         .disk_free_fn = skel_disk_free,
925         .get_quota_fn = skel_get_quota,
926         .set_quota_fn = skel_set_quota,
927         .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
928         .statvfs_fn = skel_statvfs,
929         .fs_capabilities_fn = skel_fs_capabilities,
930         .get_dfs_referrals_fn = skel_get_dfs_referrals,
931         .snap_check_path_fn = skel_snap_check_path,
932         .snap_create_fn = skel_snap_create,
933         .snap_delete_fn = skel_snap_delete,
934
935         /* Directory operations */
936
937         .opendir_fn = skel_opendir,
938         .fdopendir_fn = skel_fdopendir,
939         .readdir_fn = skel_readdir,
940         .seekdir_fn = skel_seekdir,
941         .telldir_fn = skel_telldir,
942         .rewind_dir_fn = skel_rewind_dir,
943         .mkdir_fn = skel_mkdir,
944         .rmdir_fn = skel_rmdir,
945         .closedir_fn = skel_closedir,
946
947         /* File operations */
948
949         .open_fn = skel_open,
950         .create_file_fn = skel_create_file,
951         .close_fn = skel_close_fn,
952         .read_fn = skel_vfs_read,
953         .pread_fn = skel_pread,
954         .pread_send_fn = skel_pread_send,
955         .pread_recv_fn = skel_pread_recv,
956         .write_fn = skel_write,
957         .pwrite_fn = skel_pwrite,
958         .pwrite_send_fn = skel_pwrite_send,
959         .pwrite_recv_fn = skel_pwrite_recv,
960         .lseek_fn = skel_lseek,
961         .sendfile_fn = skel_sendfile,
962         .recvfile_fn = skel_recvfile,
963         .rename_fn = skel_rename,
964         .fsync_send_fn = skel_fsync_send,
965         .fsync_recv_fn = skel_fsync_recv,
966         .stat_fn = skel_stat,
967         .fstat_fn = skel_fstat,
968         .lstat_fn = skel_lstat,
969         .get_alloc_size_fn = skel_get_alloc_size,
970         .unlink_fn = skel_unlink,
971         .chmod_fn = skel_chmod,
972         .fchmod_fn = skel_fchmod,
973         .chown_fn = skel_chown,
974         .fchown_fn = skel_fchown,
975         .lchown_fn = skel_lchown,
976         .chdir_fn = skel_chdir,
977         .getwd_fn = skel_getwd,
978         .ntimes_fn = skel_ntimes,
979         .ftruncate_fn = skel_ftruncate,
980         .fallocate_fn = skel_fallocate,
981         .lock_fn = skel_lock,
982         .kernel_flock_fn = skel_kernel_flock,
983         .linux_setlease_fn = skel_linux_setlease,
984         .getlock_fn = skel_getlock,
985         .symlink_fn = skel_symlink,
986         .readlink_fn = skel_vfs_readlink,
987         .link_fn = skel_link,
988         .mknod_fn = skel_mknod,
989         .realpath_fn = skel_realpath,
990         .chflags_fn = skel_chflags,
991         .file_id_create_fn = skel_file_id_create,
992         .offload_read_send_fn = skel_offload_read_send,
993         .offload_read_recv_fn = skel_offload_read_recv,
994         .offload_write_send_fn = skel_offload_write_send,
995         .offload_write_recv_fn = skel_offload_write_recv,
996         .get_compression_fn = skel_get_compression,
997         .set_compression_fn = skel_set_compression,
998
999         .streaminfo_fn = skel_streaminfo,
1000         .get_real_filename_fn = skel_get_real_filename,
1001         .connectpath_fn = skel_connectpath,
1002         .brl_lock_windows_fn = skel_brl_lock_windows,
1003         .brl_unlock_windows_fn = skel_brl_unlock_windows,
1004         .brl_cancel_windows_fn = skel_brl_cancel_windows,
1005         .strict_lock_check_fn = skel_strict_lock_check,
1006         .translate_name_fn = skel_translate_name,
1007         .fsctl_fn = skel_fsctl,
1008         .readdir_attr_fn = skel_readdir_attr,
1009
1010         /* DOS attributes. */
1011         .get_dos_attributes_fn = skel_get_dos_attributes,
1012         .fget_dos_attributes_fn = skel_fget_dos_attributes,
1013         .set_dos_attributes_fn = skel_set_dos_attributes,
1014         .fset_dos_attributes_fn = skel_fset_dos_attributes,
1015
1016         /* NT ACL operations. */
1017
1018         .fget_nt_acl_fn = skel_fget_nt_acl,
1019         .get_nt_acl_fn = skel_get_nt_acl,
1020         .fset_nt_acl_fn = skel_fset_nt_acl,
1021
1022         /* POSIX ACL operations. */
1023
1024         .chmod_acl_fn = skel_chmod_acl,
1025         .fchmod_acl_fn = skel_fchmod_acl,
1026
1027         .sys_acl_get_file_fn = skel_sys_acl_get_file,
1028         .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1029         .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1030         .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1031         .sys_acl_set_file_fn = skel_sys_acl_set_file,
1032         .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1033         .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1034
1035         /* EA operations. */
1036         .getxattr_fn = skel_getxattr,
1037         .fgetxattr_fn = skel_fgetxattr,
1038         .listxattr_fn = skel_listxattr,
1039         .flistxattr_fn = skel_flistxattr,
1040         .removexattr_fn = skel_removexattr,
1041         .fremovexattr_fn = skel_fremovexattr,
1042         .setxattr_fn = skel_setxattr,
1043         .fsetxattr_fn = skel_fsetxattr,
1044
1045         /* aio operations */
1046         .aio_force_fn = skel_aio_force,
1047 };
1048
1049 static_decl_vfs;
1050 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
1051 {
1052         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
1053                                 &skel_opaque_fns);
1054 }