s3-aio: Remove unused VFS functions and more
[sfrench/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
25 #include "../source3/include/includes.h"
26 #include "lib/util/tevent_unix.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, const char *user)    
41 {
42         return SMB_VFS_NEXT_CONNECT(handle, service, user);
43 }
44
45 static void skel_disconnect(vfs_handle_struct *handle)
46 {
47         SMB_VFS_NEXT_DISCONNECT(handle);
48 }
49
50 static uint64_t skel_disk_free(vfs_handle_struct *handle,  const char *path,
51         bool small_query, uint64_t *bsize,
52         uint64_t *dfree, uint64_t *dsize)
53 {
54         return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, 
55                                          dfree, dsize);
56 }
57
58 static int skel_get_quota(vfs_handle_struct *handle,  enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
59 {
60         return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
61 }
62
63 static int skel_set_quota(vfs_handle_struct *handle,  enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
64 {
65         return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
66 }
67
68 static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels)
69 {
70         return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
71 }
72
73 static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf)
74 {
75         return SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
76 }
77
78 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
79 {
80         return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
81 }
82
83 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
84                                        struct dfs_GetDFSReferral *r)
85 {
86         return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
87 }
88
89 static DIR *skel_opendir(vfs_handle_struct *handle,  const char *fname, const char *mask, uint32 attr)
90 {
91         return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
92 }
93
94 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
95 {
96         return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
97 }
98
99 static struct dirent *skel_readdir(vfs_handle_struct *handle,
100                                        DIR *dirp,
101                                        SMB_STRUCT_STAT *sbuf)
102 {
103         return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
104 }
105
106 static void skel_seekdir(vfs_handle_struct *handle,  DIR *dirp, long offset)
107 {
108         SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
109 }
110
111 static long skel_telldir(vfs_handle_struct *handle,  DIR *dirp)
112 {
113         return SMB_VFS_NEXT_TELLDIR(handle, dirp);
114 }
115
116 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
117 {
118         SMB_VFS_NEXT_REWINDDIR(handle, dirp);
119 }
120
121 static int skel_mkdir(vfs_handle_struct *handle,  const char *path, mode_t mode)
122 {
123         return SMB_VFS_NEXT_MKDIR(handle, path, mode);
124 }
125
126 static int skel_rmdir(vfs_handle_struct *handle,  const char *path)
127 {
128         return SMB_VFS_NEXT_RMDIR(handle, path);
129 }
130
131 static int skel_closedir(vfs_handle_struct *handle,  DIR *dir)
132 {
133         return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
134 }
135
136 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
137 {
138         SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
139 }
140
141 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
142                      files_struct *fsp, int flags, mode_t mode)
143 {
144         return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
145 }
146
147 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
148                                 struct smb_request *req,
149                                 uint16_t root_dir_fid,
150                                 struct smb_filename *smb_fname,
151                                 uint32_t access_mask,
152                                 uint32_t share_access,
153                                 uint32_t create_disposition,
154                                 uint32_t create_options,
155                                 uint32_t file_attributes,
156                                 uint32_t oplock_request,
157                                 uint64_t allocation_size,
158                                 uint32_t private_flags,
159                                 struct security_descriptor *sd,
160                                 struct ea_list *ea_list,
161                                 files_struct **result,
162                                 int *pinfo)
163 {
164         return SMB_VFS_NEXT_CREATE_FILE(handle,
165                                 req,
166                                 root_dir_fid,
167                                 smb_fname,
168                                 access_mask,
169                                 share_access,
170                                 create_disposition,
171                                 create_options,
172                                 file_attributes,
173                                 oplock_request,
174                                 allocation_size,
175                                 private_flags,
176                                 sd,
177                                 ea_list,
178                                 result,
179                                 pinfo);
180 }
181
182 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
183 {
184         return SMB_VFS_NEXT_CLOSE(handle, fsp);
185 }
186
187 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
188 {
189         return SMB_VFS_NEXT_READ(handle, fsp, data, n);
190 }
191
192 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, off_t offset)
193 {
194         return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
195 }
196
197 struct skel_pread_state {
198         ssize_t ret;
199         int err;
200 };
201
202 static void skel_pread_done(struct tevent_req *subreq);
203
204 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
205                                           TALLOC_CTX *mem_ctx,
206                                           struct tevent_context *ev,
207                                           struct files_struct *fsp,
208                                           void *data, size_t n, off_t offset)
209 {
210         struct tevent_req *req, *subreq;
211         struct skel_pread_state *state;
212
213         req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
214         if (req == NULL) {
215                 return NULL;
216         }
217         subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
218                                          n, offset);
219         if (tevent_req_nomem(subreq, req)) {
220                 return tevent_req_post(req, ev);
221         }
222         tevent_req_set_callback(subreq, skel_pread_done, req);
223         return req;
224 }
225
226 static void skel_pread_done(struct tevent_req *subreq)
227 {
228         struct tevent_req *req = tevent_req_callback_data(
229                 subreq, struct tevent_req);
230         struct skel_pread_state *state = tevent_req_data(
231                 req, struct skel_pread_state);
232
233         state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
234         TALLOC_FREE(subreq);
235         tevent_req_done(req);
236 }
237
238 static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
239 {
240         struct skel_pread_state *state = tevent_req_data(
241                 req, struct skel_pread_state);
242
243         if (tevent_req_is_unix_error(req, err)) {
244                 return -1;
245         }
246         *err = state->err;
247         return state->ret;
248 }
249
250 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
251 {
252         return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
253 }
254
255 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, off_t offset)
256 {
257         return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
258 }
259
260 struct skel_pwrite_state {
261         ssize_t ret;
262         int err;
263 };
264
265 static void skel_pwrite_done(struct tevent_req *subreq);
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         struct tevent_req *req, *subreq;
275         struct skel_pwrite_state *state;
276
277         req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
278         if (req == NULL) {
279                 return NULL;
280         }
281         subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
282                                          n, offset);
283         if (tevent_req_nomem(subreq, req)) {
284                 return tevent_req_post(req, ev);
285         }
286         tevent_req_set_callback(subreq, skel_pwrite_done, req);
287         return req;
288 }
289
290 static void skel_pwrite_done(struct tevent_req *subreq)
291 {
292         struct tevent_req *req = tevent_req_callback_data(
293                 subreq, struct tevent_req);
294         struct skel_pwrite_state *state = tevent_req_data(
295                 req, struct skel_pwrite_state);
296
297         state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
298         TALLOC_FREE(subreq);
299         tevent_req_done(req);
300 }
301
302 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
303 {
304         struct skel_pwrite_state *state = tevent_req_data(
305                 req, struct skel_pwrite_state);
306
307         if (tevent_req_is_unix_error(req, err)) {
308                 return -1;
309         }
310         *err = state->err;
311         return state->ret;
312 }
313
314 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp, off_t offset, int whence)
315 {
316         return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
317 }
318
319 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, off_t offset, size_t n)
320 {
321         return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
322 }
323
324 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t n)
325 {
326         return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
327 }
328
329 static int skel_rename(vfs_handle_struct *handle,
330                        const struct smb_filename *smb_fname_src,
331                        const struct smb_filename *smb_fname_dst)
332 {
333         return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
334 }
335
336 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
337 {
338         return SMB_VFS_NEXT_FSYNC(handle, fsp);
339 }
340
341 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
342 {
343         return SMB_VFS_NEXT_STAT(handle, smb_fname);
344 }
345
346 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
347 {
348         return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
349 }
350
351 static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
352 {
353         return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
354 }
355
356 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
357 {
358         return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
359 }
360
361 static int skel_unlink(vfs_handle_struct *handle,
362                        const struct smb_filename *smb_fname)
363 {
364         return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
365 }
366
367 static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
368 {
369         return SMB_VFS_NEXT_CHMOD(handle, path, mode);
370 }
371
372 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
373 {
374         return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
375 }
376
377 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
378 {
379         return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
380 }
381
382 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
383 {
384         return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
385 }
386
387 static int skel_lchown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
388 {
389         return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
390 }
391
392 static int skel_chdir(vfs_handle_struct *handle,  const char *path)
393 {
394         return SMB_VFS_NEXT_CHDIR(handle, path);
395 }
396
397 static char *skel_getwd(vfs_handle_struct *handle)
398 {
399         return SMB_VFS_NEXT_GETWD(handle);
400 }
401
402 static int skel_ntimes(vfs_handle_struct *handle,
403                        const struct smb_filename *smb_fname,
404                        struct smb_file_time *ft)
405 {
406         return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
407 }
408
409 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t offset)
410 {
411         return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
412 }
413
414 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
415                         enum vfs_fallocate_mode mode,
416                         off_t offset,
417                         off_t len)
418 {
419         return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
420 }
421
422 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, off_t offset, off_t count, int type)
423 {
424         return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
425 }
426
427 static int skel_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32 access_mask)
428 {
429         return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
430 }
431
432 static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype)
433 {
434         return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
435 }
436
437 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
438 {
439         return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
440 }
441
442 static int skel_symlink(vfs_handle_struct *handle,  const char *oldpath, const char *newpath)
443 {
444         return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
445 }
446
447 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz)
448 {
449         return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
450 }
451
452 static int skel_link(vfs_handle_struct *handle,  const char *oldpath, const char *newpath)
453 {
454         return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
455 }
456
457 static int skel_mknod(vfs_handle_struct *handle,  const char *path, mode_t mode, SMB_DEV_T dev)
458 {
459         return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
460 }
461
462 static char *skel_realpath(vfs_handle_struct *handle,  const char *path)
463 {
464         return SMB_VFS_NEXT_REALPATH(handle, path);
465 }
466
467 static NTSTATUS skel_notify_watch(
468         struct vfs_handle_struct *handle,
469         struct sys_notify_context *ctx,
470         const char *path,
471         uint32_t *filter,
472         uint32_t *subdir_filter,
473         void (*callback)(struct sys_notify_context *ctx, void *private_data,
474                          struct notify_event *ev),
475         void *private_data, void *handle_p)
476 {
477         return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
478                                          filter, subdir_filter, callback,
479                 private_data, handle_p);
480 }
481
482 static int skel_chflags(vfs_handle_struct *handle,  const char *path, uint flags)
483 {
484         return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
485 }
486
487 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
488                                           const SMB_STRUCT_STAT *sbuf)
489 {
490         return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
491 }
492
493 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
494                                 struct files_struct *fsp,
495                                 const char *fname,
496                                 TALLOC_CTX *mem_ctx,
497                                 unsigned int *num_streams,
498                                 struct stream_struct **streams)
499 {
500         return SMB_VFS_NEXT_STREAMINFO(handle,
501                                         fsp,
502                                         fname,
503                                         mem_ctx,
504                                         num_streams,
505                                         streams);
506 }
507
508 static int skel_get_real_filename(struct vfs_handle_struct *handle,
509                                 const char *path,
510                                 const char *name,
511                                 TALLOC_CTX *mem_ctx,
512                                 char **found_name)
513 {
514         return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
515                                         path,
516                                         name,
517                                         mem_ctx,
518                                         found_name);
519 }
520
521 static const char *skel_connectpath(struct vfs_handle_struct *handle,
522                                 const char *filename)
523 {
524         return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
525 }
526
527 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
528                                 struct byte_range_lock *br_lck,
529                                 struct lock_struct *plock,
530                                 bool blocking_lock,
531                                 struct blocking_lock_record *blr)
532 {
533         return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
534                                         br_lck,
535                                         plock,
536                                         blocking_lock,
537                                         blr);
538 }
539
540 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
541                                 struct messaging_context *msg_ctx,
542                                 struct byte_range_lock *br_lck,
543                                 const struct lock_struct *plock)
544 {
545         return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle,
546                                         msg_ctx,
547                                         br_lck,
548                                         plock);
549 }
550
551 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
552                                 struct byte_range_lock *br_lck,
553                                 struct lock_struct *plock,
554                                 struct blocking_lock_record *blr)
555 {
556         return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle,
557                                 br_lck,
558                                 plock,
559                                 blr);
560 }
561
562 static bool skel_strict_lock(struct vfs_handle_struct *handle,
563                                 struct files_struct *fsp,
564                                 struct lock_struct *plock)
565 {
566         return SMB_VFS_NEXT_STRICT_LOCK(handle,
567                                         fsp,
568                                         plock);
569 }
570
571 static void skel_strict_unlock(struct vfs_handle_struct *handle,
572                                 struct files_struct *fsp,
573                                 struct lock_struct *plock)
574 {
575         SMB_VFS_NEXT_STRICT_UNLOCK(handle,
576                                         fsp,
577                                         plock);
578 }
579
580 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
581                                 const char *mapped_name,
582                                 enum vfs_translate_direction direction,
583                                 TALLOC_CTX *mem_ctx,
584                                 char **pmapped_name)
585 {
586         return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
587                                            mem_ctx, pmapped_name);
588 }
589
590 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
591                         struct files_struct *fsp,
592                         TALLOC_CTX *ctx,
593                         uint32_t function,
594                         uint16_t req_flags,  /* Needed for UNICODE ... */
595                         const uint8_t *_in_data,
596                         uint32_t in_len,
597                         uint8_t **_out_data,
598                         uint32_t max_out_len,
599                         uint32_t *out_len)
600 {
601         return SMB_VFS_NEXT_FSCTL(handle,
602                                 fsp,
603                                 ctx,
604                                 function,
605                                 req_flags,
606                                 _in_data,
607                                 in_len,
608                                 _out_data,
609                                 max_out_len,
610                                 out_len);
611 }
612
613 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
614         uint32 security_info, struct security_descriptor **ppdesc)
615 {
616         return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
617 }
618
619 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
620         const char *name, uint32 security_info, struct security_descriptor **ppdesc)
621 {
622         return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
623 }
624
625 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
626         uint32 security_info_sent, const struct security_descriptor *psd)
627 {
628         return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
629 }
630
631 static int skel_chmod_acl(vfs_handle_struct *handle,  const char *name, mode_t mode)
632 {
633         return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
634 }
635
636 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
637 {
638         return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
639 }
640
641 static int skel_sys_acl_get_entry(vfs_handle_struct *handle,  SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
642 {
643         return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p);
644 }
645
646 static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
647 {
648         return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p);
649 }
650
651 static int skel_sys_acl_get_permset(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
652 {
653         return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p);
654 }
655
656 static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry_d)
657 {
658         return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
659 }
660
661 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,  const char *path_p, SMB_ACL_TYPE_T type)
662 {
663         return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
664 }
665
666 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
667 {
668         return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
669 }
670
671 static int skel_sys_acl_clear_perms(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset)
672 {
673         return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
674 }
675
676 static int skel_sys_acl_add_perm(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
677 {
678         return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
679 }
680
681 static char *skel_sys_acl_to_text(vfs_handle_struct *handle,  SMB_ACL_T theacl, ssize_t *plen)
682 {
683         return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
684 }
685
686 static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle,  int count)
687 {
688         return SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
689 }
690
691 static int skel_sys_acl_create_entry(vfs_handle_struct *handle,  SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
692 {
693         return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
694 }
695
696 static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
697 {
698         return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry, tagtype);
699 }
700
701 static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry, void *qual)
702 {
703         return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
704 }
705
706 static int skel_sys_acl_set_permset(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
707 {
708         return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
709 }
710
711 static int skel_sys_acl_valid(vfs_handle_struct *handle,  SMB_ACL_T theacl )
712 {
713         return SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
714 }
715
716 static int skel_sys_acl_set_file(vfs_handle_struct *handle,  const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
717 {
718         return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
719 }
720
721 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
722 {
723         return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
724 }
725
726 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,  const char *path)
727 {
728         return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
729 }
730
731 static int skel_sys_acl_get_perm(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
732 {
733         return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
734 }
735
736 static int skel_sys_acl_free_text(vfs_handle_struct *handle,  char *text)
737 {
738         return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
739 }
740
741 static int skel_sys_acl_free_acl(vfs_handle_struct *handle,  SMB_ACL_T posix_acl)
742 {
743         return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
744 }
745
746 static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle,  void *qualifier, SMB_ACL_TAG_T tagtype)
747 {
748         return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier, tagtype);
749 }
750
751 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size)
752 {
753         return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
754 }
755
756 static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
757 {
758         return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
759 }
760
761 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
762 {
763         return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
764 }
765
766 static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
767 {
768         return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
769 }
770
771 static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name)
772 {
773         return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
774 }
775
776 static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
777 {
778         return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
779 }
780
781 static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
782 {
783         return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
784 }
785
786 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
787 {
788         return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
789 }
790
791 static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
792 {
793         return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
794 }
795
796 static bool skel_is_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname, SMB_STRUCT_STAT *sbuf)
797 {
798         return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
799 }
800
801 static int skel_set_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname)
802 {
803         return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
804 }
805
806 /* VFS operations structure */
807
808 struct vfs_fn_pointers skel_transparent_fns = {
809         /* Disk operations */
810
811         .connect_fn = skel_connect,
812         .disconnect_fn = skel_disconnect,
813         .disk_free_fn = skel_disk_free,
814         .get_quota_fn = skel_get_quota,
815         .set_quota_fn = skel_set_quota,
816         .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
817         .statvfs_fn = skel_statvfs,
818         .fs_capabilities_fn = skel_fs_capabilities,
819         .get_dfs_referrals_fn = skel_get_dfs_referrals,
820
821         /* Directory operations */
822
823         .opendir_fn = skel_opendir,
824         .fdopendir_fn = skel_fdopendir,
825         .readdir_fn = skel_readdir,
826         .seekdir_fn = skel_seekdir,
827         .telldir_fn = skel_telldir,
828         .rewind_dir_fn = skel_rewind_dir,
829         .mkdir_fn = skel_mkdir,
830         .rmdir_fn = skel_rmdir,
831         .closedir_fn = skel_closedir,
832         .init_search_op_fn = skel_init_search_op,
833
834         /* File operations */
835
836         .open_fn = skel_open,
837         .create_file_fn = skel_create_file,
838         .close_fn = skel_close_fn,
839         .read_fn = skel_vfs_read,
840         .pread_fn = skel_pread,
841         .pread_send_fn = skel_pread_send,
842         .pread_recv_fn = skel_pread_recv,
843         .write_fn = skel_write,
844         .pwrite_fn = skel_pwrite,
845         .pwrite_send_fn = skel_pwrite_send,
846         .pwrite_recv_fn = skel_pwrite_recv,
847         .lseek_fn = skel_lseek,
848         .sendfile_fn = skel_sendfile,
849         .recvfile_fn = skel_recvfile,
850         .rename_fn = skel_rename,
851         .fsync_fn = skel_fsync,
852         .stat_fn = skel_stat,
853         .fstat_fn = skel_fstat,
854         .lstat_fn = skel_lstat,
855         .get_alloc_size_fn = skel_get_alloc_size,
856         .unlink_fn = skel_unlink,
857         .chmod_fn = skel_chmod,
858         .fchmod_fn = skel_fchmod,
859         .chown_fn = skel_chown,
860         .fchown_fn = skel_fchown,
861         .lchown_fn = skel_lchown,
862         .chdir_fn = skel_chdir,
863         .getwd_fn = skel_getwd,
864         .ntimes_fn = skel_ntimes,
865         .ftruncate_fn = skel_ftruncate,
866         .fallocate_fn = skel_fallocate,
867         .lock_fn = skel_lock,
868         .kernel_flock_fn = skel_kernel_flock,
869         .linux_setlease_fn = skel_linux_setlease,
870         .getlock_fn = skel_getlock,
871         .symlink_fn = skel_symlink,
872         .readlink_fn = skel_vfs_readlink,
873         .link_fn = skel_link,
874         .mknod_fn = skel_mknod,
875         .realpath_fn = skel_realpath,
876         .notify_watch_fn = skel_notify_watch,
877         .chflags_fn = skel_chflags,
878         .file_id_create_fn = skel_file_id_create,
879
880         .streaminfo_fn = skel_streaminfo,
881         .get_real_filename_fn = skel_get_real_filename,
882         .connectpath_fn = skel_connectpath,
883         .brl_lock_windows_fn = skel_brl_lock_windows,
884         .brl_unlock_windows_fn = skel_brl_unlock_windows,
885         .brl_cancel_windows_fn = skel_brl_cancel_windows,
886         .strict_lock_fn = skel_strict_lock,
887         .strict_unlock_fn = skel_strict_unlock,
888         .translate_name_fn = skel_translate_name,
889         .fsctl_fn = skel_fsctl,
890
891         /* NT ACL operations. */
892
893         .fget_nt_acl_fn = skel_fget_nt_acl,
894         .get_nt_acl_fn = skel_get_nt_acl,
895         .fset_nt_acl_fn = skel_fset_nt_acl,
896
897         /* POSIX ACL operations. */
898
899         .chmod_acl_fn = skel_chmod_acl,
900         .fchmod_acl_fn = skel_fchmod_acl,
901
902         .sys_acl_get_entry_fn = skel_sys_acl_get_entry,
903         .sys_acl_get_tag_type_fn = skel_sys_acl_get_tag_type,
904         .sys_acl_get_permset_fn = skel_sys_acl_get_permset,
905         .sys_acl_get_qualifier_fn = skel_sys_acl_get_qualifier,
906         .sys_acl_get_file_fn = skel_sys_acl_get_file,
907         .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
908         .sys_acl_clear_perms_fn = skel_sys_acl_clear_perms,
909         .sys_acl_add_perm_fn = skel_sys_acl_add_perm,
910         .sys_acl_to_text_fn = skel_sys_acl_to_text,
911         .sys_acl_init_fn = skel_sys_acl_init,
912         .sys_acl_create_entry_fn = skel_sys_acl_create_entry,
913         .sys_acl_set_tag_type_fn = skel_sys_acl_set_tag_type,
914         .sys_acl_set_qualifier_fn = skel_sys_acl_set_qualifier,
915         .sys_acl_set_permset_fn = skel_sys_acl_set_permset,
916         .sys_acl_valid_fn = skel_sys_acl_valid,
917         .sys_acl_set_file_fn = skel_sys_acl_set_file,
918         .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
919         .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
920         .sys_acl_get_perm_fn = skel_sys_acl_get_perm,
921         .sys_acl_free_text_fn = skel_sys_acl_free_text,
922         .sys_acl_free_acl_fn = skel_sys_acl_free_acl,
923         .sys_acl_free_qualifier_fn = skel_sys_acl_free_qualifier,
924
925         /* EA operations. */
926         .getxattr_fn = skel_getxattr,
927         .fgetxattr_fn = skel_fgetxattr,
928         .listxattr_fn = skel_listxattr,
929         .flistxattr_fn = skel_flistxattr,
930         .removexattr_fn = skel_removexattr,
931         .fremovexattr_fn = skel_fremovexattr,
932         .setxattr_fn = skel_setxattr,
933         .fsetxattr_fn = skel_fsetxattr,
934
935         /* aio operations */
936         .aio_force_fn = skel_aio_force,
937
938         /* offline operations */
939         .is_offline_fn = skel_is_offline,
940         .set_offline_fn = skel_set_offline
941 };
942
943 NTSTATUS vfs_skel_transparent_init(void)
944 {
945         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", &skel_transparent_fns);
946 }