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