s3:smbd: let SMB_VFS_GETXATTRAT_SEND() do explicit impersonation
[kamenim/samba-autobuild/.git] / examples / VFS / skel_transparent.c
1 /* 
2  * Skeleton VFS module.  Implements passthrough operation of all VFS
3  * calls to disk functions.
4  *
5  * Copyright (C) Tim Potter, 1999-2000
6  * Copyright (C) Alexander Bokovoy, 2002
7  * Copyright (C) Stefan (metze) Metzmacher, 2003
8  * Copyright (C) Jeremy Allison 2009
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *  
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *  
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #include "../source3/include/includes.h"
25 #include "lib/util/tevent_unix.h"
26 #include "lib/util/tevent_ntstatus.h"
27
28 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE 
29    SAMBA DEVELOPERS GUIDE!!!!!!
30  */
31
32 /* If you take this file as template for your module
33  * please make sure that you remove all skel_XXX() functions you don't
34  * want to implement!! The passthrough operations are not
35  * neccessary in a real module.
36  *
37  * --metze
38  */
39
40 static int skel_connect(vfs_handle_struct *handle, const char *service,
41                         const char *user)
42 {
43         return SMB_VFS_NEXT_CONNECT(handle, service, user);
44 }
45
46 static void skel_disconnect(vfs_handle_struct *handle)
47 {
48         SMB_VFS_NEXT_DISCONNECT(handle);
49 }
50
51 static uint64_t skel_disk_free(vfs_handle_struct *handle,
52                                 const struct smb_filename *smb_fname,
53                                 uint64_t *bsize,
54                                 uint64_t *dfree,
55                                 uint64_t *dsize)
56 {
57         return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
58 }
59
60 static int skel_get_quota(vfs_handle_struct *handle,
61                                 const struct smb_filename *smb_fname,
62                                 enum SMB_QUOTA_TYPE qtype,
63                                 unid_t id,
64                                 SMB_DISK_QUOTA *dq)
65 {
66         return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
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         return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
73 }
74
75 static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
76                                      files_struct *fsp,
77                                      struct shadow_copy_data *shadow_copy_data,
78                                      bool labels)
79 {
80         return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data,
81                                                  labels);
82 }
83
84 static int skel_statvfs(struct vfs_handle_struct *handle,
85                         const struct smb_filename *smb_fname,
86                         struct vfs_statvfs_struct *statbuf)
87 {
88         return SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
89 }
90
91 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
92                                      enum timestamp_set_resolution *p_ts_res)
93 {
94         return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
95 }
96
97 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
98                                        struct dfs_GetDFSReferral *r)
99 {
100         return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
101 }
102
103 static DIR *skel_opendir(vfs_handle_struct *handle,
104                         const struct smb_filename *smb_fname,
105                         const char *mask,
106                         uint32_t attr)
107 {
108         return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
109 }
110
111 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
112                                      TALLOC_CTX *mem_ctx,
113                                      const char *service_path,
114                                      char **base_volume)
115 {
116         return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
117                                             base_volume);
118 }
119
120 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
121                                  TALLOC_CTX *mem_ctx,
122                                  const char *base_volume,
123                                  time_t *tstamp,
124                                  bool rw,
125                                  char **base_path,
126                                  char **snap_path)
127 {
128         return SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
129                                         rw, base_path, snap_path);
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 SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path);
138 }
139
140 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
141                            const char *mask, uint32_t attr)
142 {
143         return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
144 }
145
146 static struct dirent *skel_readdir(vfs_handle_struct *handle,
147                                    DIR *dirp, SMB_STRUCT_STAT *sbuf)
148 {
149         return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
150 }
151
152 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
153 {
154         SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
155 }
156
157 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
158 {
159         return SMB_VFS_NEXT_TELLDIR(handle, dirp);
160 }
161
162 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
163 {
164         SMB_VFS_NEXT_REWINDDIR(handle, dirp);
165 }
166
167 static int skel_mkdir(vfs_handle_struct *handle,
168                 const struct smb_filename *smb_fname,
169                 mode_t mode)
170 {
171         return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
172 }
173
174 static int skel_rmdir(vfs_handle_struct *handle,
175                 const struct smb_filename *smb_fname)
176 {
177         return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
178 }
179
180 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
181 {
182         return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
183 }
184
185 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
186                      files_struct *fsp, int flags, mode_t mode)
187 {
188         return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
189 }
190
191 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
192                                  struct smb_request *req,
193                                  uint16_t root_dir_fid,
194                                  struct smb_filename *smb_fname,
195                                  uint32_t access_mask,
196                                  uint32_t share_access,
197                                  uint32_t create_disposition,
198                                  uint32_t create_options,
199                                  uint32_t file_attributes,
200                                  uint32_t oplock_request,
201                                  struct smb2_lease *lease,
202                                  uint64_t allocation_size,
203                                  uint32_t private_flags,
204                                  struct security_descriptor *sd,
205                                  struct ea_list *ea_list,
206                                  files_struct ** result, int *pinfo,
207                                  const struct smb2_create_blobs *in_context_blobs,
208                                  struct smb2_create_blobs *out_context_blobs)
209 {
210         return SMB_VFS_NEXT_CREATE_FILE(handle,
211                                         req,
212                                         root_dir_fid,
213                                         smb_fname,
214                                         access_mask,
215                                         share_access,
216                                         create_disposition,
217                                         create_options,
218                                         file_attributes,
219                                         oplock_request,
220                                         lease,
221                                         allocation_size,
222                                         private_flags,
223                                         sd, ea_list, result, pinfo,
224                                         in_context_blobs, out_context_blobs);
225 }
226
227 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
228 {
229         return SMB_VFS_NEXT_CLOSE(handle, fsp);
230 }
231
232 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
233                           void *data, size_t n, off_t offset)
234 {
235         return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
236 }
237
238 struct skel_pread_state {
239         ssize_t ret;
240         struct vfs_aio_state vfs_aio_state;
241 };
242
243 static void skel_pread_done(struct tevent_req *subreq);
244
245 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
246                                           TALLOC_CTX *mem_ctx,
247                                           struct tevent_context *ev,
248                                           struct files_struct *fsp,
249                                           void *data, size_t n, off_t offset)
250 {
251         struct tevent_req *req, *subreq;
252         struct skel_pread_state *state;
253
254         req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
255         if (req == NULL) {
256                 return NULL;
257         }
258         subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
259                                          n, offset);
260         if (tevent_req_nomem(subreq, req)) {
261                 return tevent_req_post(req, ev);
262         }
263         tevent_req_set_callback(subreq, skel_pread_done, req);
264         return req;
265 }
266
267 static void skel_pread_done(struct tevent_req *subreq)
268 {
269         struct tevent_req *req =
270             tevent_req_callback_data(subreq, struct tevent_req);
271         struct skel_pread_state *state =
272             tevent_req_data(req, struct skel_pread_state);
273
274         state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
275         TALLOC_FREE(subreq);
276         tevent_req_done(req);
277 }
278
279 static ssize_t skel_pread_recv(struct tevent_req *req,
280                                struct vfs_aio_state *vfs_aio_state)
281 {
282         struct skel_pread_state *state =
283             tevent_req_data(req, struct skel_pread_state);
284
285         if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
286                 return -1;
287         }
288         *vfs_aio_state = state->vfs_aio_state;
289         return state->ret;
290 }
291
292 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
293                            const void *data, size_t n, off_t offset)
294 {
295         return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
296 }
297
298 struct skel_pwrite_state {
299         ssize_t ret;
300         struct vfs_aio_state vfs_aio_state;
301 };
302
303 static void skel_pwrite_done(struct tevent_req *subreq);
304
305 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
306                                            TALLOC_CTX *mem_ctx,
307                                            struct tevent_context *ev,
308                                            struct files_struct *fsp,
309                                            const void *data,
310                                            size_t n, off_t offset)
311 {
312         struct tevent_req *req, *subreq;
313         struct skel_pwrite_state *state;
314
315         req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
316         if (req == NULL) {
317                 return NULL;
318         }
319         subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
320                                           n, offset);
321         if (tevent_req_nomem(subreq, req)) {
322                 return tevent_req_post(req, ev);
323         }
324         tevent_req_set_callback(subreq, skel_pwrite_done, req);
325         return req;
326 }
327
328 static void skel_pwrite_done(struct tevent_req *subreq)
329 {
330         struct tevent_req *req =
331             tevent_req_callback_data(subreq, struct tevent_req);
332         struct skel_pwrite_state *state =
333             tevent_req_data(req, struct skel_pwrite_state);
334
335         state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
336         TALLOC_FREE(subreq);
337         tevent_req_done(req);
338 }
339
340 static ssize_t skel_pwrite_recv(struct tevent_req *req,
341                                 struct vfs_aio_state *vfs_aio_state)
342 {
343         struct skel_pwrite_state *state =
344             tevent_req_data(req, struct skel_pwrite_state);
345
346         if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
347                 return -1;
348         }
349         *vfs_aio_state = state->vfs_aio_state;
350         return state->ret;
351 }
352
353 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
354                         off_t offset, int whence)
355 {
356         return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
357 }
358
359 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
360                              files_struct *fromfsp, const DATA_BLOB *hdr,
361                              off_t offset, size_t n)
362 {
363         return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
364 }
365
366 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
367                              files_struct *tofsp, off_t offset, size_t n)
368 {
369         return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
370 }
371
372 static int skel_rename(vfs_handle_struct *handle,
373                        const struct smb_filename *smb_fname_src,
374                        const struct smb_filename *smb_fname_dst)
375 {
376         return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
377 }
378
379 struct skel_fsync_state {
380         int ret;
381         struct vfs_aio_state vfs_aio_state;
382 };
383
384 static void skel_fsync_done(struct tevent_req *subreq);
385
386 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
387                                           TALLOC_CTX *mem_ctx,
388                                           struct tevent_context *ev,
389                                           struct files_struct *fsp)
390 {
391         struct tevent_req *req, *subreq;
392         struct skel_fsync_state *state;
393
394         req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
395         if (req == NULL) {
396                 return NULL;
397         }
398         subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
399         if (tevent_req_nomem(subreq, req)) {
400                 return tevent_req_post(req, ev);
401         }
402         tevent_req_set_callback(subreq, skel_fsync_done, req);
403         return req;
404 }
405
406 static void skel_fsync_done(struct tevent_req *subreq)
407 {
408         struct tevent_req *req =
409             tevent_req_callback_data(subreq, struct tevent_req);
410         struct skel_fsync_state *state =
411             tevent_req_data(req, struct skel_fsync_state);
412
413         state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
414         TALLOC_FREE(subreq);
415         tevent_req_done(req);
416 }
417
418 static int skel_fsync_recv(struct tevent_req *req,
419                            struct vfs_aio_state *vfs_aio_state)
420 {
421         struct skel_fsync_state *state =
422             tevent_req_data(req, struct skel_fsync_state);
423
424         if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
425                 return -1;
426         }
427         *vfs_aio_state = state->vfs_aio_state;
428         return state->ret;
429 }
430
431 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
432 {
433         return SMB_VFS_NEXT_STAT(handle, smb_fname);
434 }
435
436 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
437                       SMB_STRUCT_STAT *sbuf)
438 {
439         return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
440 }
441
442 static int skel_lstat(vfs_handle_struct *handle,
443                       struct smb_filename *smb_fname)
444 {
445         return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
446 }
447
448 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
449                                     struct files_struct *fsp,
450                                     const SMB_STRUCT_STAT *sbuf)
451 {
452         return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
453 }
454
455 static int skel_unlink(vfs_handle_struct *handle,
456                        const struct smb_filename *smb_fname)
457 {
458         return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
459 }
460
461 static int skel_chmod(vfs_handle_struct *handle,
462                         const struct smb_filename *smb_fname,
463                         mode_t mode)
464 {
465         return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
466 }
467
468 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
469                        mode_t mode)
470 {
471         return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
472 }
473
474 static int skel_chown(vfs_handle_struct *handle,
475                         const struct smb_filename *smb_fname,
476                         uid_t uid,
477                         gid_t gid)
478 {
479         return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
480 }
481
482 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
483                        uid_t uid, gid_t gid)
484 {
485         return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
486 }
487
488 static int skel_lchown(vfs_handle_struct *handle,
489                         const struct smb_filename *smb_fname,
490                         uid_t uid,
491                         gid_t gid)
492 {
493         return SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
494 }
495
496 static int skel_chdir(vfs_handle_struct *handle,
497                         const struct smb_filename *smb_fname)
498 {
499         return SMB_VFS_NEXT_CHDIR(handle, smb_fname);
500 }
501
502 static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
503                                         TALLOC_CTX *ctx)
504 {
505         return SMB_VFS_NEXT_GETWD(handle, ctx);
506 }
507
508 static int skel_ntimes(vfs_handle_struct *handle,
509                        const struct smb_filename *smb_fname,
510                        struct smb_file_time *ft)
511 {
512         return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
513 }
514
515 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
516                           off_t offset)
517 {
518         return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
519 }
520
521 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
522                           uint32_t mode, off_t offset, off_t len)
523 {
524         return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
525 }
526
527 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
528                       off_t offset, off_t count, int type)
529 {
530         return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
531 }
532
533 static int skel_kernel_flock(struct vfs_handle_struct *handle,
534                              struct files_struct *fsp, uint32_t share_mode,
535                              uint32_t access_mask)
536 {
537         return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
538 }
539
540 static int skel_linux_setlease(struct vfs_handle_struct *handle,
541                                struct files_struct *fsp, int leasetype)
542 {
543         return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
544 }
545
546 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
547                          off_t *poffset, off_t *pcount, int *ptype,
548                          pid_t *ppid)
549 {
550         return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
551 }
552
553 static int skel_symlink(vfs_handle_struct *handle,
554                         const char *link_contents,
555                         const struct smb_filename *new_smb_fname)
556 {
557         return SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname);
558 }
559
560 static int skel_vfs_readlink(vfs_handle_struct *handle,
561                         const struct smb_filename *smb_fname,
562                         char *buf,
563                         size_t bufsiz)
564 {
565         return SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz);
566 }
567
568 static int skel_link(vfs_handle_struct *handle,
569                         const struct smb_filename *old_smb_fname,
570                         const struct smb_filename *new_smb_fname)
571 {
572         return SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname);
573 }
574
575 static int skel_mknod(vfs_handle_struct *handle,
576                         const struct smb_filename *smb_fname,
577                         mode_t mode,
578                         SMB_DEV_T dev)
579 {
580         return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
581 }
582
583 static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
584                         TALLOC_CTX *ctx,
585                         const struct smb_filename *smb_fname)
586 {
587         return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
588 }
589
590 static int skel_chflags(vfs_handle_struct *handle,
591                         const struct smb_filename *smb_fname,
592                         uint flags)
593 {
594         return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
595 }
596
597 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
598                                           const SMB_STRUCT_STAT *sbuf)
599 {
600         return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
601 }
602
603 struct skel_offload_read_state {
604         struct vfs_handle_struct *handle;
605         DATA_BLOB token;
606 };
607
608 static void skel_offload_read_done(struct tevent_req *subreq);
609
610 static struct tevent_req *skel_offload_read_send(
611         TALLOC_CTX *mem_ctx,
612         struct tevent_context *ev,
613         struct vfs_handle_struct *handle,
614         struct files_struct *fsp,
615         uint32_t fsctl,
616         uint32_t ttl,
617         off_t offset,
618         size_t to_copy)
619 {
620         struct tevent_req *req = NULL;
621         struct skel_offload_read_state *state = NULL;
622         struct tevent_req *subreq = NULL;
623
624         req = tevent_req_create(mem_ctx, &state, struct skel_offload_read_state);
625         if (req == NULL) {
626                 return NULL;
627         }
628         *state = (struct skel_offload_read_state) {
629                 .handle = handle,
630         };
631
632         subreq = SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp,
633                                                 fsctl, ttl, offset, to_copy);
634         if (tevent_req_nomem(subreq, req)) {
635                 return tevent_req_post(req, ev);
636         }
637         tevent_req_set_callback(subreq, skel_offload_read_done, req);
638         return req;
639 }
640
641 static void skel_offload_read_done(struct tevent_req *subreq)
642 {
643         struct tevent_req *req = tevent_req_callback_data(
644                 subreq, struct tevent_req);
645         struct skel_offload_read_state *state = tevent_req_data(
646                 req, struct skel_offload_read_state);
647         NTSTATUS status;
648
649         status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq,
650                                                 state->handle,
651                                                 state,
652                                                 &state->token);
653         TALLOC_FREE(subreq);
654         if (tevent_req_nterror(req, status)) {
655                 return;
656         }
657
658         tevent_req_done(req);
659         return;
660 }
661
662 static NTSTATUS skel_offload_read_recv(struct tevent_req *req,
663                                        struct vfs_handle_struct *handle,
664                                        TALLOC_CTX *mem_ctx,
665                                        DATA_BLOB *_token)
666 {
667         struct skel_offload_read_state *state = tevent_req_data(
668                 req, struct skel_offload_read_state);
669         DATA_BLOB token;
670         NTSTATUS status;
671
672         if (tevent_req_is_nterror(req, &status)) {
673                 tevent_req_received(req);
674                 return status;
675         }
676
677         token = data_blob_talloc(mem_ctx,
678                                  state->token.data,
679                                  state->token.length);
680
681         tevent_req_received(req);
682
683         if (token.data == NULL) {
684                 return NT_STATUS_NO_MEMORY;
685         }
686
687         *_token = token;
688         return NT_STATUS_OK;
689 }
690
691 struct skel_offload_write_state {
692         struct vfs_handle_struct *handle;
693         off_t copied;
694 };
695 static void skel_offload_write_done(struct tevent_req *subreq);
696
697 static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
698                                                TALLOC_CTX *mem_ctx,
699                                                struct tevent_context *ev,
700                                                uint32_t fsctl,
701                                                DATA_BLOB *token,
702                                                off_t transfer_offset,
703                                                struct files_struct *dest_fsp,
704                                                off_t dest_off,
705                                                off_t num)
706 {
707         struct tevent_req *req;
708         struct tevent_req *subreq;
709         struct skel_offload_write_state *state;
710
711         req = tevent_req_create(mem_ctx, &state, struct skel_offload_write_state);
712         if (req == NULL) {
713                 return NULL;
714         }
715
716         state->handle = handle;
717         subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, state, ev,
718                                               fsctl, token, transfer_offset,
719                                               dest_fsp, dest_off, num);
720         if (tevent_req_nomem(subreq, req)) {
721                 return tevent_req_post(req, ev);
722         }
723
724         tevent_req_set_callback(subreq, skel_offload_write_done, req);
725         return req;
726 }
727
728 static void skel_offload_write_done(struct tevent_req *subreq)
729 {
730         struct tevent_req *req = tevent_req_callback_data(
731                 subreq, struct tevent_req);
732         struct skel_offload_write_state *state
733                         = tevent_req_data(req, struct skel_offload_write_state);
734         NTSTATUS status;
735
736         status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle,
737                                               subreq,
738                                               &state->copied);
739         TALLOC_FREE(subreq);
740         if (tevent_req_nterror(req, status)) {
741                 return;
742         }
743         tevent_req_done(req);
744 }
745
746 static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
747                                      struct tevent_req *req,
748                                      off_t *copied)
749 {
750         struct skel_offload_write_state *state
751                         = tevent_req_data(req, struct skel_offload_write_state);
752         NTSTATUS status;
753
754         *copied = state->copied;
755         if (tevent_req_is_nterror(req, &status)) {
756                 tevent_req_received(req);
757                 return status;
758         }
759
760         tevent_req_received(req);
761         return NT_STATUS_OK;
762 }
763
764 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
765                                      TALLOC_CTX *mem_ctx,
766                                      struct files_struct *fsp,
767                                      struct smb_filename *smb_fname,
768                                      uint16_t *_compression_fmt)
769 {
770         return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
771                                             _compression_fmt);
772 }
773
774 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
775                                      TALLOC_CTX *mem_ctx,
776                                      struct files_struct *fsp,
777                                      uint16_t compression_fmt)
778 {
779         return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
780                                             compression_fmt);
781 }
782
783 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
784                                 struct files_struct *fsp,
785                                 const struct smb_filename *smb_fname,
786                                 TALLOC_CTX *mem_ctx,
787                                 unsigned int *num_streams,
788                                 struct stream_struct **streams)
789 {
790         return SMB_VFS_NEXT_STREAMINFO(handle,
791                                 fsp,
792                                 smb_fname,
793                                 mem_ctx,
794                                 num_streams,
795                                 streams);
796 }
797
798 static int skel_get_real_filename(struct vfs_handle_struct *handle,
799                                   const char *path,
800                                   const char *name,
801                                   TALLOC_CTX *mem_ctx, char **found_name)
802 {
803         return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
804                                               path, name, mem_ctx, found_name);
805 }
806
807 static const char *skel_connectpath(struct vfs_handle_struct *handle,
808                                 const struct smb_filename *smb_fname)
809 {
810         return SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname);
811 }
812
813 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
814                                       struct byte_range_lock *br_lck,
815                                       struct lock_struct *plock,
816                                       bool blocking_lock)
817 {
818         return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
819                                              br_lck, plock, blocking_lock);
820 }
821
822 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
823                                     struct messaging_context *msg_ctx,
824                                     struct byte_range_lock *br_lck,
825                                     const struct lock_struct *plock)
826 {
827         return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
828 }
829
830 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
831                                     struct byte_range_lock *br_lck,
832                                     struct lock_struct *plock)
833 {
834         return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
835 }
836
837 static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
838                                    struct files_struct *fsp,
839                                    struct lock_struct *plock)
840 {
841         return SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock);
842 }
843
844 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
845                                     const char *mapped_name,
846                                     enum vfs_translate_direction direction,
847                                     TALLOC_CTX *mem_ctx, char **pmapped_name)
848 {
849         return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
850                                            mem_ctx, pmapped_name);
851 }
852
853 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
854                            struct files_struct *fsp,
855                            TALLOC_CTX *ctx,
856                            uint32_t function,
857                            uint16_t req_flags,  /* Needed for UNICODE ... */
858                            const uint8_t *_in_data,
859                            uint32_t in_len,
860                            uint8_t ** _out_data,
861                            uint32_t max_out_len, uint32_t *out_len)
862 {
863         return SMB_VFS_NEXT_FSCTL(handle,
864                                   fsp,
865                                   ctx,
866                                   function,
867                                   req_flags,
868                                   _in_data,
869                                   in_len, _out_data, max_out_len, out_len);
870 }
871
872 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
873                                   const struct smb_filename *fname,
874                                   TALLOC_CTX *mem_ctx,
875                                   struct readdir_attr_data **pattr_data)
876 {
877         return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
878 }
879
880 static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
881                                 struct smb_filename *smb_fname,
882                                 uint32_t *dosmode)
883 {
884         return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
885                                 smb_fname,
886                                 dosmode);
887 }
888
889 struct skel_get_dos_attributes_state {
890         struct vfs_aio_state aio_state;
891         uint32_t dosmode;
892 };
893
894 static void skel_get_dos_attributes_done(struct tevent_req *subreq);
895
896 static struct tevent_req *skel_get_dos_attributes_send(
897                         TALLOC_CTX *mem_ctx,
898                         const struct smb_vfs_ev_glue *evg,
899                         struct vfs_handle_struct *handle,
900                         files_struct *dir_fsp,
901                         struct smb_filename *smb_fname)
902 {
903         struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
904         struct tevent_req *req = NULL;
905         struct skel_get_dos_attributes_state *state = NULL;
906         struct tevent_req *subreq = NULL;
907
908         req = tevent_req_create(mem_ctx, &state,
909                                 struct skel_get_dos_attributes_state);
910         if (req == NULL) {
911                 return NULL;
912         }
913
914         subreq = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx,
915                                                       evg,
916                                                       handle,
917                                                       dir_fsp,
918                                                       smb_fname);
919         if (tevent_req_nomem(subreq, req)) {
920                 return tevent_req_post(req, ev);
921         }
922         tevent_req_set_callback(subreq, skel_get_dos_attributes_done, req);
923
924         return req;
925 }
926
927 static void skel_get_dos_attributes_done(struct tevent_req *subreq)
928 {
929         struct tevent_req *req =
930                 tevent_req_callback_data(subreq,
931                 struct tevent_req);
932         struct skel_get_dos_attributes_state *state =
933                 tevent_req_data(req,
934                 struct skel_get_dos_attributes_state);
935         NTSTATUS status;
936
937         status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_RECV(subreq,
938                                                       &state->aio_state,
939                                                       &state->dosmode);
940         TALLOC_FREE(subreq);
941         if (tevent_req_nterror(req, status)) {
942                 return;
943         }
944
945         tevent_req_done(req);
946         return;
947 }
948
949 static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
950                                              struct vfs_aio_state *aio_state,
951                                              uint32_t *dosmode)
952 {
953         struct skel_get_dos_attributes_state *state =
954                 tevent_req_data(req,
955                 struct skel_get_dos_attributes_state);
956         NTSTATUS status;
957
958         if (tevent_req_is_nterror(req, &status)) {
959                 tevent_req_received(req);
960                 return status;
961         }
962
963         *aio_state = state->aio_state;
964         *dosmode = state->dosmode;
965         tevent_req_received(req);
966         return NT_STATUS_OK;
967 }
968
969 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
970                                 struct files_struct *fsp,
971                                 uint32_t *dosmode)
972 {
973         return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle,
974                                 fsp,
975                                 dosmode);
976 }
977
978 static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
979                                 const struct smb_filename *smb_fname,
980                                 uint32_t dosmode)
981 {
982         return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
983                                 smb_fname,
984                                 dosmode);
985 }
986
987 static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
988                                 struct files_struct *fsp,
989                                 uint32_t dosmode)
990 {
991         return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle,
992                                 fsp,
993                                 dosmode);
994 }
995
996 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
997                                  uint32_t security_info,
998                                  TALLOC_CTX *mem_ctx,
999                                  struct security_descriptor **ppdesc)
1000 {
1001         return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx,
1002                                         ppdesc);
1003 }
1004
1005 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
1006                                 const struct smb_filename *smb_fname,
1007                                 uint32_t security_info,
1008                                 TALLOC_CTX *mem_ctx,
1009                                 struct security_descriptor **ppdesc)
1010 {
1011         return SMB_VFS_NEXT_GET_NT_ACL(handle,
1012                                 smb_fname,
1013                                 security_info,
1014                                 mem_ctx,
1015                                 ppdesc);
1016 }
1017
1018 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
1019                                  uint32_t security_info_sent,
1020                                  const struct security_descriptor *psd)
1021 {
1022         return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
1023 }
1024
1025 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
1026                                        const struct smb_filename *smb_fname,
1027                                        SMB_ACL_TYPE_T type,
1028                                        TALLOC_CTX *mem_ctx)
1029 {
1030         return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx);
1031 }
1032
1033 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
1034                                      files_struct *fsp, TALLOC_CTX *mem_ctx)
1035 {
1036         return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
1037 }
1038
1039 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
1040                                 const struct smb_filename *smb_fname,
1041                                 TALLOC_CTX *mem_ctx,
1042                                 char **blob_description,
1043                                 DATA_BLOB *blob)
1044 {
1045         return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx,
1046                                                   blob_description, blob);
1047 }
1048
1049 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
1050                                     files_struct *fsp, TALLOC_CTX *mem_ctx,
1051                                     char **blob_description, DATA_BLOB *blob)
1052 {
1053         return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx,
1054                                                 blob_description, blob);
1055 }
1056
1057 static int skel_sys_acl_set_file(vfs_handle_struct *handle,
1058                                 const struct smb_filename *smb_fname,
1059                                 SMB_ACL_TYPE_T acltype,
1060                                 SMB_ACL_T theacl)
1061 {
1062         return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
1063                         acltype, theacl);
1064 }
1065
1066 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
1067                                SMB_ACL_T theacl)
1068 {
1069         return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
1070 }
1071
1072 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
1073                                         const struct smb_filename *smb_fname)
1074 {
1075         return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
1076 }
1077
1078 static ssize_t skel_getxattr(vfs_handle_struct *handle,
1079                                 const struct smb_filename *smb_fname,
1080                                 const char *name,
1081                                 void *value,
1082                                 size_t size)
1083 {
1084         return SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size);
1085 }
1086
1087 struct skel_getxattrat_state {
1088         struct vfs_aio_state aio_state;
1089         ssize_t xattr_size;
1090         uint8_t *xattr_value;
1091 };
1092
1093 static void skel_getxattrat_done(struct tevent_req *subreq);
1094
1095 static struct tevent_req *skel_getxattrat_send(
1096                         TALLOC_CTX *mem_ctx,
1097                         struct tevent_context *ev,
1098                         struct vfs_handle_struct *handle,
1099                         files_struct *dir_fsp,
1100                         const struct smb_filename *smb_fname,
1101                         const char *xattr_name,
1102                         size_t alloc_hint)
1103 {
1104         struct tevent_req *req = NULL;
1105         struct skel_getxattrat_state *state = NULL;
1106         struct tevent_req *subreq = NULL;
1107
1108         req = tevent_req_create(mem_ctx, &state,
1109                                 struct skel_getxattrat_state);
1110         if (req == NULL) {
1111                 return NULL;
1112         }
1113
1114         subreq = SMB_VFS_NEXT_GETXATTRAT_SEND(state,
1115                                               ev,
1116                                               handle,
1117                                               dir_fsp,
1118                                               smb_fname,
1119                                               xattr_name,
1120                                               alloc_hint);
1121         if (tevent_req_nomem(subreq, req)) {
1122                 return tevent_req_post(req, ev);
1123         }
1124         tevent_req_set_callback(subreq, skel_getxattrat_done, req);
1125
1126         return req;
1127 }
1128
1129 static void skel_getxattrat_done(struct tevent_req *subreq)
1130 {
1131         struct tevent_req *req = tevent_req_callback_data(
1132                 subreq, struct tevent_req);
1133         struct skel_getxattrat_state *state = tevent_req_data(
1134                 req, struct skel_getxattrat_state);
1135
1136         state->xattr_size = SMB_VFS_NEXT_GETXATTRAT_RECV(subreq,
1137                                                          &state->aio_state,
1138                                                          state,
1139                                                          &state->xattr_value);
1140         TALLOC_FREE(subreq);
1141         if (state->xattr_size == -1) {
1142                 tevent_req_error(req, state->aio_state.error);
1143                 return;
1144         }
1145
1146         tevent_req_done(req);
1147 }
1148
1149 static ssize_t skel_getxattrat_recv(struct tevent_req *req,
1150                                     struct vfs_aio_state *aio_state,
1151                                     TALLOC_CTX *mem_ctx,
1152                                     uint8_t **xattr_value)
1153 {
1154         struct skel_getxattrat_state *state = tevent_req_data(
1155                 req, struct skel_getxattrat_state);
1156         ssize_t xattr_size;
1157
1158         if (tevent_req_is_unix_error(req, &aio_state->error)) {
1159                 tevent_req_received(req);
1160                 return -1;
1161         }
1162
1163         *aio_state = state->aio_state;
1164         xattr_size = state->xattr_size;
1165         if (xattr_value != NULL) {
1166                 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
1167         }
1168
1169         tevent_req_received(req);
1170         return xattr_size;
1171 }
1172
1173 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
1174                               struct files_struct *fsp, const char *name,
1175                               void *value, size_t size)
1176 {
1177         return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
1178 }
1179
1180 static ssize_t skel_listxattr(vfs_handle_struct *handle,
1181                                 const struct smb_filename *smb_fname,
1182                                 char *list,
1183                                 size_t size)
1184 {
1185         return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
1186 }
1187
1188 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
1189                                struct files_struct *fsp, char *list,
1190                                size_t size)
1191 {
1192         return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
1193 }
1194
1195 static int skel_removexattr(vfs_handle_struct *handle,
1196                         const struct smb_filename *smb_fname,
1197                         const char *name)
1198 {
1199         return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
1200 }
1201
1202 static int skel_fremovexattr(vfs_handle_struct *handle,
1203                              struct files_struct *fsp, const char *name)
1204 {
1205         return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
1206 }
1207
1208 static int skel_setxattr(vfs_handle_struct *handle,
1209                         const struct smb_filename *smb_fname,
1210                         const char *name,
1211                         const void *value,
1212                         size_t size,
1213                         int flags)
1214 {
1215         return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
1216                         name, value, size, flags);
1217 }
1218
1219 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
1220                           const char *name, const void *value, size_t size,
1221                           int flags)
1222 {
1223         return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
1224 }
1225
1226 static bool skel_aio_force(struct vfs_handle_struct *handle,
1227                            struct files_struct *fsp)
1228 {
1229         return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
1230 }
1231
1232 static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
1233                                 struct smb_filename *file,
1234                                 struct security_acl *sacl,
1235                                 uint32_t access_requested,
1236                                 uint32_t access_denied)
1237 {
1238         return SMB_VFS_NEXT_AUDIT_FILE(handle,
1239                                        file,
1240                                        sacl,
1241                                        access_requested,
1242                                        access_denied);
1243 }
1244
1245 static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
1246                                     struct files_struct *fsp,
1247                                     TALLOC_CTX *mem_ctx,
1248                                     DATA_BLOB *cookie)
1249 {
1250         return SMB_VFS_NEXT_DURABLE_COOKIE(handle,
1251                                            fsp,
1252                                            mem_ctx,
1253                                            cookie);
1254 }
1255
1256 static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
1257                                         struct files_struct *fsp,
1258                                         const DATA_BLOB old_cookie,
1259                                         TALLOC_CTX *mem_ctx,
1260                                         DATA_BLOB *new_cookie)
1261 {
1262         return SMB_VFS_NEXT_DURABLE_DISCONNECT(handle,
1263                                                fsp,
1264                                                old_cookie,
1265                                                mem_ctx,
1266                                                new_cookie);
1267 }
1268
1269 static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
1270                                        struct smb_request *smb1req,
1271                                        struct smbXsrv_open *op,
1272                                        const DATA_BLOB old_cookie,
1273                                        TALLOC_CTX *mem_ctx,
1274                                        struct files_struct **fsp,
1275                                        DATA_BLOB *new_cookie)
1276 {
1277         return SMB_VFS_NEXT_DURABLE_RECONNECT(handle,
1278                                               smb1req,
1279                                               op,
1280                                               old_cookie,
1281                                               mem_ctx,
1282                                               fsp,
1283                                               new_cookie);
1284 }
1285
1286 /* VFS operations structure */
1287
1288 static struct vfs_fn_pointers skel_transparent_fns = {
1289         /* Disk operations */
1290
1291         .connect_fn = skel_connect,
1292         .disconnect_fn = skel_disconnect,
1293         .disk_free_fn = skel_disk_free,
1294         .get_quota_fn = skel_get_quota,
1295         .set_quota_fn = skel_set_quota,
1296         .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
1297         .statvfs_fn = skel_statvfs,
1298         .fs_capabilities_fn = skel_fs_capabilities,
1299         .get_dfs_referrals_fn = skel_get_dfs_referrals,
1300         .snap_check_path_fn = skel_snap_check_path,
1301         .snap_create_fn = skel_snap_create,
1302         .snap_delete_fn = skel_snap_delete,
1303
1304         /* Directory operations */
1305
1306         .opendir_fn = skel_opendir,
1307         .fdopendir_fn = skel_fdopendir,
1308         .readdir_fn = skel_readdir,
1309         .seekdir_fn = skel_seekdir,
1310         .telldir_fn = skel_telldir,
1311         .rewind_dir_fn = skel_rewind_dir,
1312         .mkdir_fn = skel_mkdir,
1313         .rmdir_fn = skel_rmdir,
1314         .closedir_fn = skel_closedir,
1315
1316         /* File operations */
1317
1318         .open_fn = skel_open,
1319         .create_file_fn = skel_create_file,
1320         .close_fn = skel_close_fn,
1321         .pread_fn = skel_pread,
1322         .pread_send_fn = skel_pread_send,
1323         .pread_recv_fn = skel_pread_recv,
1324         .pwrite_fn = skel_pwrite,
1325         .pwrite_send_fn = skel_pwrite_send,
1326         .pwrite_recv_fn = skel_pwrite_recv,
1327         .lseek_fn = skel_lseek,
1328         .sendfile_fn = skel_sendfile,
1329         .recvfile_fn = skel_recvfile,
1330         .rename_fn = skel_rename,
1331         .fsync_send_fn = skel_fsync_send,
1332         .fsync_recv_fn = skel_fsync_recv,
1333         .stat_fn = skel_stat,
1334         .fstat_fn = skel_fstat,
1335         .lstat_fn = skel_lstat,
1336         .get_alloc_size_fn = skel_get_alloc_size,
1337         .unlink_fn = skel_unlink,
1338         .chmod_fn = skel_chmod,
1339         .fchmod_fn = skel_fchmod,
1340         .chown_fn = skel_chown,
1341         .fchown_fn = skel_fchown,
1342         .lchown_fn = skel_lchown,
1343         .chdir_fn = skel_chdir,
1344         .getwd_fn = skel_getwd,
1345         .ntimes_fn = skel_ntimes,
1346         .ftruncate_fn = skel_ftruncate,
1347         .fallocate_fn = skel_fallocate,
1348         .lock_fn = skel_lock,
1349         .kernel_flock_fn = skel_kernel_flock,
1350         .linux_setlease_fn = skel_linux_setlease,
1351         .getlock_fn = skel_getlock,
1352         .symlink_fn = skel_symlink,
1353         .readlink_fn = skel_vfs_readlink,
1354         .link_fn = skel_link,
1355         .mknod_fn = skel_mknod,
1356         .realpath_fn = skel_realpath,
1357         .chflags_fn = skel_chflags,
1358         .file_id_create_fn = skel_file_id_create,
1359         .offload_read_send_fn = skel_offload_read_send,
1360         .offload_read_recv_fn = skel_offload_read_recv,
1361         .offload_write_send_fn = skel_offload_write_send,
1362         .offload_write_recv_fn = skel_offload_write_recv,
1363         .get_compression_fn = skel_get_compression,
1364         .set_compression_fn = skel_set_compression,
1365
1366         .streaminfo_fn = skel_streaminfo,
1367         .get_real_filename_fn = skel_get_real_filename,
1368         .connectpath_fn = skel_connectpath,
1369         .brl_lock_windows_fn = skel_brl_lock_windows,
1370         .brl_unlock_windows_fn = skel_brl_unlock_windows,
1371         .brl_cancel_windows_fn = skel_brl_cancel_windows,
1372         .strict_lock_check_fn = skel_strict_lock_check,
1373         .translate_name_fn = skel_translate_name,
1374         .fsctl_fn = skel_fsctl,
1375         .readdir_attr_fn = skel_readdir_attr,
1376         .audit_file_fn = skel_audit_file,
1377
1378         /* DOS attributes. */
1379         .get_dos_attributes_fn = skel_get_dos_attributes,
1380         .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
1381         .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
1382         .fget_dos_attributes_fn = skel_fget_dos_attributes,
1383         .set_dos_attributes_fn = skel_set_dos_attributes,
1384         .fset_dos_attributes_fn = skel_fset_dos_attributes,
1385
1386         /* NT ACL operations. */
1387
1388         .fget_nt_acl_fn = skel_fget_nt_acl,
1389         .get_nt_acl_fn = skel_get_nt_acl,
1390         .fset_nt_acl_fn = skel_fset_nt_acl,
1391
1392         /* POSIX ACL operations. */
1393
1394         .sys_acl_get_file_fn = skel_sys_acl_get_file,
1395         .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
1396         .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
1397         .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
1398         .sys_acl_set_file_fn = skel_sys_acl_set_file,
1399         .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
1400         .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
1401
1402         /* EA operations. */
1403         .getxattr_fn = skel_getxattr,
1404         .getxattrat_send_fn = skel_getxattrat_send,
1405         .getxattrat_recv_fn = skel_getxattrat_recv,
1406         .fgetxattr_fn = skel_fgetxattr,
1407         .listxattr_fn = skel_listxattr,
1408         .flistxattr_fn = skel_flistxattr,
1409         .removexattr_fn = skel_removexattr,
1410         .fremovexattr_fn = skel_fremovexattr,
1411         .setxattr_fn = skel_setxattr,
1412         .fsetxattr_fn = skel_fsetxattr,
1413
1414         /* aio operations */
1415         .aio_force_fn = skel_aio_force,
1416
1417         /* durable handle operations */
1418         .durable_cookie_fn = skel_durable_cookie,
1419         .durable_disconnect_fn = skel_durable_disconnect,
1420         .durable_reconnect_fn = skel_durable_reconnect,
1421 };
1422
1423 static_decl_vfs;
1424 NTSTATUS vfs_skel_transparent_init(TALLOC_CTX *ctx)
1425 {
1426         /*
1427          * smb_vfs_assert_all_fns() is only needed in
1428          * order to have a complete example.
1429          *
1430          * A transparent vfs module typically don't
1431          * need to implement every calls.
1432          */
1433         smb_vfs_assert_all_fns(&skel_transparent_fns, "skel_transparent");
1434         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
1435                                 &skel_transparent_fns);
1436 }