3be5cf93369b6cd40721bb281094b791a5eb17af
[samba.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 "includes.h"
26
27 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE 
28    SAMBA DEVELOPERS GUIDE!!!!!!
29  */
30
31 /* If you take this file as template for your module
32  * please make sure that you remove all skel_XXX() functions you don't
33  * want to implement!! The passthrough operations are not
34  * neccessary in a real module.
35  *
36  * --metze
37  */
38
39 static int skel_connect(vfs_handle_struct *handle,  const char *service, const char *user)    
40 {
41         return SMB_VFS_NEXT_CONNECT(handle, service, user);
42 }
43
44 static void skel_disconnect(vfs_handle_struct *handle)
45 {
46         SMB_VFS_NEXT_DISCONNECT(handle);
47 }
48
49 static uint64_t skel_disk_free(vfs_handle_struct *handle,  const char *path,
50         bool small_query, uint64_t *bsize,
51         uint64_t *dfree, uint64_t *dsize)
52 {
53         return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, 
54                                          dfree, dsize);
55 }
56
57 static int skel_get_quota(vfs_handle_struct *handle,  enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
58 {
59         return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
60 }
61
62 static int skel_set_quota(vfs_handle_struct *handle,  enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
63 {
64         return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
65 }
66
67 static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
68 {
69         return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
70 }
71
72 static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf)
73 {
74         return SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
75 }
76
77 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
78 {
79         return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
80 }
81
82 static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle,  const char *fname, const char *mask, uint32 attr)
83 {
84         return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
85 }
86
87 static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,
88                                        SMB_STRUCT_DIR *dirp,
89                                        SMB_STRUCT_STAT *sbuf)
90 {
91         return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
92 }
93
94 static void skel_seekdir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp, long offset)
95 {
96         SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
97 }
98
99 static long skel_telldir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp)
100 {
101         return SMB_VFS_NEXT_TELLDIR(handle, dirp);
102 }
103
104 static void skel_rewind_dir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
105 {
106         SMB_VFS_NEXT_REWINDDIR(handle, dirp);
107 }
108
109 static int skel_mkdir(vfs_handle_struct *handle,  const char *path, mode_t mode)
110 {
111         return SMB_VFS_NEXT_MKDIR(handle, path, mode);
112 }
113
114 static int skel_rmdir(vfs_handle_struct *handle,  const char *path)
115 {
116         return SMB_VFS_NEXT_RMDIR(handle, path);
117 }
118
119 static int skel_closedir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dir)
120 {
121         return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
122 }
123
124 static void skel_init_search_op(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
125 {
126         SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
127 }
128
129 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
130                      files_struct *fsp, int flags, mode_t mode)
131 {
132         return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
133 }
134
135 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
136                                 struct smb_request *req,
137                                 uint16_t root_dir_fid,
138                                 struct smb_filename *smb_fname,
139                                 uint32_t access_mask,
140                                 uint32_t share_access,
141                                 uint32_t create_disposition,
142                                 uint32_t create_options,
143                                 uint32_t file_attributes,
144                                 uint32_t oplock_request,
145                                 uint64_t allocation_size,
146                                 uint32_t private_flags,
147                                 struct security_descriptor *sd,
148                                 struct ea_list *ea_list,
149                                 files_struct **result,
150                                 int *pinfo)
151 {
152         return SMB_VFS_NEXT_CREATE_FILE(handle,
153                                 req,
154                                 root_dir_fid,
155                                 smb_fname,
156                                 access_mask,
157                                 share_access,
158                                 create_disposition,
159                                 create_options,
160                                 file_attributes,
161                                 oplock_request,
162                                 allocation_size,
163                                 private_flags,
164                                 sd,
165                                 ea_list,
166                                 result,
167                                 pinfo);
168 }
169
170 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
171 {
172         return SMB_VFS_NEXT_CLOSE(handle, fsp);
173 }
174
175 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
176 {
177         return SMB_VFS_NEXT_READ(handle, fsp, data, n);
178 }
179
180 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
181 {
182         return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
183 }
184
185 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
186 {
187         return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
188 }
189
190 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
191 {
192         return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
193 }
194
195 static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
196 {
197         return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
198 }
199
200 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n)
201 {
202         return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
203 }
204
205 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n)
206 {
207         return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
208 }
209
210 static int skel_rename(vfs_handle_struct *handle,
211                        const struct smb_filename *smb_fname_src,
212                        const struct smb_filename *smb_fname_dst)
213 {
214         return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
215 }
216
217 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
218 {
219         return SMB_VFS_NEXT_FSYNC(handle, fsp);
220 }
221
222 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
223 {
224         return SMB_VFS_NEXT_STAT(handle, smb_fname);
225 }
226
227 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
228 {
229         return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
230 }
231
232 static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
233 {
234         return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
235 }
236
237 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
238 {
239         return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
240 }
241
242 static int skel_unlink(vfs_handle_struct *handle,
243                        const struct smb_filename *smb_fname)
244 {
245         return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
246 }
247
248 static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
249 {
250         return SMB_VFS_NEXT_CHMOD(handle, path, mode);
251 }
252
253 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
254 {
255         return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
256 }
257
258 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
259 {
260         return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
261 }
262
263 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
264 {
265         return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
266 }
267
268 static int skel_lchown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
269 {
270         return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
271 }
272
273 static int skel_chdir(vfs_handle_struct *handle,  const char *path)
274 {
275         return SMB_VFS_NEXT_CHDIR(handle, path);
276 }
277
278 static char *skel_getwd(vfs_handle_struct *handle,  char *buf)
279 {
280         return SMB_VFS_NEXT_GETWD(handle, buf);
281 }
282
283 static int skel_ntimes(vfs_handle_struct *handle,
284                        const struct smb_filename *smb_fname,
285                        struct smb_file_time *ft)
286 {
287         return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
288 }
289
290 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset)
291 {
292         return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
293 }
294
295 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
296 {
297         return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
298 }
299
300 static int skel_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32 access_mask)
301 {
302         return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
303 }
304
305 static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype)
306 {
307         return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
308 }
309
310 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
311 {
312         return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
313 }
314
315 static int skel_symlink(vfs_handle_struct *handle,  const char *oldpath, const char *newpath)
316 {
317         return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
318 }
319
320 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz)
321 {
322         return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
323 }
324
325 static int skel_link(vfs_handle_struct *handle,  const char *oldpath, const char *newpath)
326 {
327         return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
328 }
329
330 static int skel_mknod(vfs_handle_struct *handle,  const char *path, mode_t mode, SMB_DEV_T dev)
331 {
332         return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
333 }
334
335 static char *skel_realpath(vfs_handle_struct *handle,  const char *path, char *resolved_path)
336 {
337         return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path);
338 }
339
340 static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle,
341             struct sys_notify_context *ctx, struct notify_entry *e,
342             void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev),
343             void *private_data, void *handle_p)
344 {
345         return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback,
346                 private_data, handle_p);
347 }
348
349 static int skel_chflags(vfs_handle_struct *handle,  const char *path, uint flags)
350 {
351         return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
352 }
353
354 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
355                                           const SMB_STRUCT_STAT *sbuf)
356 {
357         return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
358 }
359
360 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
361                                 struct files_struct *fsp,
362                                 const char *fname,
363                                 TALLOC_CTX *mem_ctx,
364                                 unsigned int *num_streams,
365                                 struct stream_struct **streams)
366 {
367         return SMB_VFS_NEXT_STREAMINFO(handle,
368                                         fsp,
369                                         fname,
370                                         mem_ctx,
371                                         num_streams,
372                                         streams);
373 }
374
375 static int skel_get_real_filename(struct vfs_handle_struct *handle,
376                                 const char *path,
377                                 const char *name,
378                                 TALLOC_CTX *mem_ctx,
379                                 char **found_name)
380 {
381         return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
382                                         path,
383                                         name,
384                                         mem_ctx,
385                                         found_name);
386 }
387
388 static const char *skel_connectpath(struct vfs_handle_struct *handle,
389                                 const char *filename)
390 {
391         return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
392 }
393
394 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
395                                 struct byte_range_lock *br_lck,
396                                 struct lock_struct *plock,
397                                 bool blocking_lock,
398                                 struct blocking_lock_record *blr)
399 {
400         return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
401                                         br_lck,
402                                         plock,
403                                         blocking_lock,
404                                         blr);
405 }
406
407 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
408                                 struct messaging_context *msg_ctx,
409                                 struct byte_range_lock *br_lck,
410                                 const struct lock_struct *plock)
411 {
412         return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle,
413                                         msg_ctx,
414                                         br_lck,
415                                         plock);
416 }
417
418 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
419                                 struct byte_range_lock *br_lck,
420                                 struct lock_struct *plock,
421                                 struct blocking_lock_record *blr)
422 {
423         return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle,
424                                 br_lck,
425                                 plock,
426                                 blr);
427 }
428
429 static bool skel_strict_lock(struct vfs_handle_struct *handle,
430                                 struct files_struct *fsp,
431                                 struct lock_struct *plock)
432 {
433         return SMB_VFS_NEXT_STRICT_LOCK(handle,
434                                         fsp,
435                                         plock);
436 }
437
438 static void skel_strict_unlock(struct vfs_handle_struct *handle,
439                                 struct files_struct *fsp,
440                                 struct lock_struct *plock)
441 {
442         SMB_VFS_NEXT_STRICT_UNLOCK(handle,
443                                         fsp,
444                                         plock);
445 }
446
447 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
448                                 const char *mapped_name,
449                                 enum vfs_translate_direction direction,
450                                 TALLOC_CTX *mem_ctx,
451                                 char **pmapped_name)
452 {
453         return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
454                                            mem_ctx, pmapped_name);
455 }
456
457 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
458         uint32 security_info, SEC_DESC **ppdesc)
459 {
460         return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
461 }
462
463 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
464         const char *name, uint32 security_info, SEC_DESC **ppdesc)
465 {
466         return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
467 }
468
469 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
470         uint32 security_info_sent, const SEC_DESC *psd)
471 {
472         return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
473 }
474
475 static int skel_chmod_acl(vfs_handle_struct *handle,  const char *name, mode_t mode)
476 {
477         return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
478 }
479
480 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
481 {
482         return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
483 }
484
485 static int skel_sys_acl_get_entry(vfs_handle_struct *handle,  SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
486 {
487         return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p);
488 }
489
490 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)
491 {
492         return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p);
493 }
494
495 static int skel_sys_acl_get_permset(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
496 {
497         return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p);
498 }
499
500 static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry_d)
501 {
502         return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
503 }
504
505 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,  const char *path_p, SMB_ACL_TYPE_T type)
506 {
507         return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
508 }
509
510 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
511 {
512         return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
513 }
514
515 static int skel_sys_acl_clear_perms(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset)
516 {
517         return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
518 }
519
520 static int skel_sys_acl_add_perm(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
521 {
522         return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
523 }
524
525 static char *skel_sys_acl_to_text(vfs_handle_struct *handle,  SMB_ACL_T theacl, ssize_t *plen)
526 {
527         return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
528 }
529
530 static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle,  int count)
531 {
532         return SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
533 }
534
535 static int skel_sys_acl_create_entry(vfs_handle_struct *handle,  SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
536 {
537         return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
538 }
539
540 static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
541 {
542         return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry, tagtype);
543 }
544
545 static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry, void *qual)
546 {
547         return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
548 }
549
550 static int skel_sys_acl_set_permset(vfs_handle_struct *handle,  SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
551 {
552         return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
553 }
554
555 static int skel_sys_acl_valid(vfs_handle_struct *handle,  SMB_ACL_T theacl )
556 {
557         return SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
558 }
559
560 static int skel_sys_acl_set_file(vfs_handle_struct *handle,  const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
561 {
562         return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
563 }
564
565 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
566 {
567         return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
568 }
569
570 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,  const char *path)
571 {
572         return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
573 }
574
575 static int skel_sys_acl_get_perm(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
576 {
577         return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
578 }
579
580 static int skel_sys_acl_free_text(vfs_handle_struct *handle,  char *text)
581 {
582         return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
583 }
584
585 static int skel_sys_acl_free_acl(vfs_handle_struct *handle,  SMB_ACL_T posix_acl)
586 {
587         return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
588 }
589
590 static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle,  void *qualifier, SMB_ACL_TAG_T tagtype)
591 {
592         return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier, tagtype);
593 }
594
595 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size)
596 {
597         return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
598 }
599
600 static ssize_t skel_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t
601 size)
602 {
603         return SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size);
604 }
605
606 static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
607 {
608         return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
609 }
610
611 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
612 {
613         return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
614 }
615
616 static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
617 {
618         return SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size);
619 }
620
621 static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
622 {
623         return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
624 }
625
626 static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name)
627 {
628         return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
629 }
630
631 static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name)
632 {
633         return SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name);
634 }
635
636 static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
637 {
638         return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
639 }
640
641 static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
642 {
643         return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
644 }
645
646 static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
647 {
648         return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags);
649 }
650
651 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
652 {
653         return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
654 }
655
656 static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
657 {
658         return SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
659 }
660
661 static int skel_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
662 {
663         return SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
664 }
665
666 static ssize_t skel_aio_return_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
667 {
668         return SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
669 }
670
671 static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
672 {
673         return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
674 }
675
676 static int skel_aio_error_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
677 {
678         return SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
679 }
680
681 static int skel_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb)
682 {
683         return SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
684 }
685
686 static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts)
687 {
688         return SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
689 }
690
691 static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
692 {
693         return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
694 }
695
696 static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
697 {
698         return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf);
699 }
700
701 static int skel_set_offline(struct vfs_handle_struct *handle, const char *path)
702 {
703         return SMB_VFS_NEXT_SET_OFFLINE(handle, path);
704 }
705
706 /* VFS operations structure */
707
708 struct vfs_fn_pointers skel_transparent_fns = {
709         /* Disk operations */
710
711         .connect_fn = skel_connect,
712         .disconnect = skel_disconnect,
713         .disk_free = skel_disk_free,
714         .get_quota = skel_get_quota,
715         .set_quota = skel_set_quota,
716         .get_shadow_copy_data = skel_get_shadow_copy_data,
717         .statvfs = skel_statvfs,
718         .fs_capabilities = skel_fs_capabilities,
719
720         /* Directory operations */
721
722         .opendir = skel_opendir,
723         .readdir = skel_readdir,
724         .seekdir = skel_seekdir,
725         .telldir = skel_telldir,
726         .rewind_dir = skel_rewind_dir,
727         .mkdir = skel_mkdir,
728         .rmdir = skel_rmdir,
729         .closedir = skel_closedir,
730         .init_search_op = skel_init_search_op,
731
732         /* File operations */
733
734         .open = skel_open,
735         .create_file = skel_create_file,
736         .close_fn = skel_close_fn,
737         .vfs_read = skel_vfs_read,
738         .pread = skel_pread,
739         .write = skel_write,
740         .pwrite = skel_pwrite,
741         .lseek = skel_lseek,
742         .sendfile = skel_sendfile,
743         .recvfile = skel_recvfile,
744         .rename = skel_rename,
745         .fsync = skel_fsync,
746         .stat = skel_stat,
747         .fstat = skel_fstat,
748         .lstat = skel_lstat,
749         .get_alloc_size = skel_get_alloc_size,
750         .unlink = skel_unlink,
751         .chmod = skel_chmod,
752         .fchmod = skel_fchmod,
753         .chown = skel_chown,
754         .fchown = skel_fchown,
755         .lchown = skel_lchown,
756         .chdir = skel_chdir,
757         .getwd = skel_getwd,
758         .ntimes = skel_ntimes,
759         .ftruncate = skel_ftruncate,
760         .lock = skel_lock,
761         .kernel_flock = skel_kernel_flock,
762         .linux_setlease = skel_linux_setlease,
763         .getlock = skel_getlock,
764         .symlink = skel_symlink,
765         .vfs_readlink = skel_vfs_readlink,
766         .link = skel_link,
767         .mknod = skel_mknod,
768         .realpath = skel_realpath,
769         .notify_watch = skel_notify_watch,
770         .chflags = skel_chflags,
771         .file_id_create = skel_file_id_create,
772
773         .streaminfo = skel_streaminfo,
774         .get_real_filename = skel_get_real_filename,
775         .connectpath = skel_connectpath,
776         .brl_lock_windows = skel_brl_lock_windows,
777         .brl_unlock_windows = skel_brl_unlock_windows,
778         .brl_cancel_windows = skel_brl_cancel_windows,
779         .strict_lock = skel_strict_lock,
780         .strict_unlock = skel_strict_unlock,
781         .translate_name = skel_translate_name,
782
783         /* NT ACL operations. */
784
785         .fget_nt_acl = skel_fget_nt_acl,
786         .get_nt_acl = skel_get_nt_acl,
787         .fset_nt_acl = skel_fset_nt_acl,
788
789         /* POSIX ACL operations. */
790
791         .chmod_acl = skel_chmod_acl,
792         .fchmod_acl = skel_fchmod_acl,
793
794         .sys_acl_get_entry = skel_sys_acl_get_entry,
795         .sys_acl_get_tag_type = skel_sys_acl_get_tag_type,
796         .sys_acl_get_permset = skel_sys_acl_get_permset,
797         .sys_acl_get_qualifier = skel_sys_acl_get_qualifier,
798         .sys_acl_get_file = skel_sys_acl_get_file,
799         .sys_acl_get_fd = skel_sys_acl_get_fd,
800         .sys_acl_clear_perms = skel_sys_acl_clear_perms,
801         .sys_acl_add_perm = skel_sys_acl_add_perm,
802         .sys_acl_to_text = skel_sys_acl_to_text,
803         .sys_acl_init = skel_sys_acl_init,
804         .sys_acl_create_entry = skel_sys_acl_create_entry,
805         .sys_acl_set_tag_type = skel_sys_acl_set_tag_type,
806         .sys_acl_set_qualifier = skel_sys_acl_set_qualifier,
807         .sys_acl_set_permset = skel_sys_acl_set_permset,
808         .sys_acl_valid = skel_sys_acl_valid,
809         .sys_acl_set_file = skel_sys_acl_set_file,
810         .sys_acl_set_fd = skel_sys_acl_set_fd,
811         .sys_acl_delete_def_file = skel_sys_acl_delete_def_file,
812         .sys_acl_get_perm = skel_sys_acl_get_perm,
813         .sys_acl_free_text = skel_sys_acl_free_text,
814         .sys_acl_free_acl = skel_sys_acl_free_acl,
815         .sys_acl_free_qualifier = skel_sys_acl_free_qualifier,
816
817         /* EA operations. */
818         .getxattr = skel_getxattr,
819         .lgetxattr = skel_lgetxattr,
820         .fgetxattr = skel_fgetxattr,
821         .listxattr = skel_listxattr,
822         .llistxattr = skel_llistxattr,
823         .flistxattr = skel_flistxattr,
824         .removexattr = skel_removexattr,
825         .lremovexattr = skel_lremovexattr,
826         .fremovexattr = skel_fremovexattr,
827         .setxattr = skel_setxattr,
828         .lsetxattr = skel_lsetxattr,
829         .fsetxattr = skel_fsetxattr,
830
831         /* aio operations */
832         .aio_read = skel_aio_read,
833         .aio_write = skel_aio_write,
834         .aio_return_fn = skel_aio_return_fn,
835         .aio_cancel = skel_aio_cancel,
836         .aio_error_fn = skel_aio_error_fn,
837         .aio_fsync = skel_aio_fsync,
838         .aio_suspend = skel_aio_suspend,
839         .aio_force = skel_aio_force,
840
841         /* offline operations */
842         .is_offline = skel_is_offline,
843         .set_offline = skel_set_offline
844 };
845
846 NTSTATUS vfs_skel_transparent_init(void)
847 {
848         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", &skel_transparent_fns);
849 }