uid_t is a synonym for int on osX
[Samba/gbeck.git] / examples / VFS / skel_transparent.c
blob711b7fc13963029917430328b18c9e1c41dd418c
1 /*
2 * Skeleton VFS module. Implements passthrough operation of all VFS
3 * calls to disk functions.
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
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.
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.
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/>.
25 #include "../source3/include/includes.h"
26 #include "lib/util/tevent_unix.h"
28 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE
29 SAMBA DEVELOPERS GUIDE!!!!!!
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.
37 * --metze
40 static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user)
42 return SMB_VFS_NEXT_CONNECT(handle, service, user);
45 static void skel_disconnect(vfs_handle_struct *handle)
47 SMB_VFS_NEXT_DISCONNECT(handle);
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)
54 return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
55 dfree, dsize);
58 static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
60 return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
63 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
65 return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
68 static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels)
70 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
73 static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf)
75 return SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
78 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
80 return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
83 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
84 struct dfs_GetDFSReferral *r)
86 return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
89 static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
91 return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
94 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
96 return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
99 static struct dirent *skel_readdir(vfs_handle_struct *handle,
100 DIR *dirp,
101 SMB_STRUCT_STAT *sbuf)
103 return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
106 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
108 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
111 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
113 return SMB_VFS_NEXT_TELLDIR(handle, dirp);
116 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
118 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
121 static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
123 return SMB_VFS_NEXT_MKDIR(handle, path, mode);
126 static int skel_rmdir(vfs_handle_struct *handle, const char *path)
128 return SMB_VFS_NEXT_RMDIR(handle, path);
131 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
133 return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
136 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
138 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
141 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
142 files_struct *fsp, int flags, mode_t mode)
144 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
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)
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,
177 ea_list,
178 result,
179 pinfo);
182 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
184 return SMB_VFS_NEXT_CLOSE(handle, fsp);
187 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
189 return SMB_VFS_NEXT_READ(handle, fsp, data, n);
192 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, off_t offset)
194 return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
197 struct skel_pread_state {
198 ssize_t ret;
199 int err;
202 static void skel_pread_done(struct tevent_req *subreq);
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)
210 struct tevent_req *req, *subreq;
211 struct skel_pread_state *state;
213 req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
214 if (req == NULL) {
215 return NULL;
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);
222 tevent_req_set_callback(subreq, skel_pread_done, req);
223 return req;
226 static void skel_pread_done(struct tevent_req *subreq)
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);
233 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
234 TALLOC_FREE(subreq);
235 tevent_req_done(req);
238 static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
240 struct skel_pread_state *state = tevent_req_data(
241 req, struct skel_pread_state);
243 if (tevent_req_is_unix_error(req, err)) {
244 return -1;
246 *err = state->err;
247 return state->ret;
250 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
252 return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
255 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, off_t offset)
257 return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
260 struct skel_pwrite_state {
261 ssize_t ret;
262 int err;
265 static void skel_pwrite_done(struct tevent_req *subreq);
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)
274 struct tevent_req *req, *subreq;
275 struct skel_pwrite_state *state;
277 req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
278 if (req == NULL) {
279 return NULL;
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);
286 tevent_req_set_callback(subreq, skel_pwrite_done, req);
287 return req;
290 static void skel_pwrite_done(struct tevent_req *subreq)
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);
297 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
298 TALLOC_FREE(subreq);
299 tevent_req_done(req);
302 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
304 struct skel_pwrite_state *state = tevent_req_data(
305 req, struct skel_pwrite_state);
307 if (tevent_req_is_unix_error(req, err)) {
308 return -1;
310 *err = state->err;
311 return state->ret;
314 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp, off_t offset, int whence)
316 return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
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)
321 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
324 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t n)
326 return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
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)
333 return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
336 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
338 return SMB_VFS_NEXT_FSYNC(handle, fsp);
341 struct skel_fsync_state {
342 int ret;
343 int err;
346 static void skel_fsync_done(struct tevent_req *subreq);
348 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
349 TALLOC_CTX *mem_ctx,
350 struct tevent_context *ev,
351 struct files_struct *fsp)
353 struct tevent_req *req, *subreq;
354 struct skel_fsync_state *state;
356 req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
357 if (req == NULL) {
358 return NULL;
360 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
361 if (tevent_req_nomem(subreq, req)) {
362 return tevent_req_post(req, ev);
364 tevent_req_set_callback(subreq, skel_fsync_done, req);
365 return req;
368 static void skel_fsync_done(struct tevent_req *subreq)
370 struct tevent_req *req = tevent_req_callback_data(
371 subreq, struct tevent_req);
372 struct skel_fsync_state *state = tevent_req_data(
373 req, struct skel_fsync_state);
375 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
376 TALLOC_FREE(subreq);
377 tevent_req_done(req);
380 static int skel_fsync_recv(struct tevent_req *req, int *err)
382 struct skel_fsync_state *state = tevent_req_data(
383 req, struct skel_fsync_state);
385 if (tevent_req_is_unix_error(req, err)) {
386 return -1;
388 *err = state->err;
389 return state->ret;
392 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
394 return SMB_VFS_NEXT_STAT(handle, smb_fname);
397 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
399 return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
402 static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
404 return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
407 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
409 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
412 static int skel_unlink(vfs_handle_struct *handle,
413 const struct smb_filename *smb_fname)
415 return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
418 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
420 return SMB_VFS_NEXT_CHMOD(handle, path, mode);
423 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
425 return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
428 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
430 return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
433 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
435 return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
438 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
440 return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
443 static int skel_chdir(vfs_handle_struct *handle, const char *path)
445 return SMB_VFS_NEXT_CHDIR(handle, path);
448 static char *skel_getwd(vfs_handle_struct *handle)
450 return SMB_VFS_NEXT_GETWD(handle);
453 static int skel_ntimes(vfs_handle_struct *handle,
454 const struct smb_filename *smb_fname,
455 struct smb_file_time *ft)
457 return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
460 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t offset)
462 return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
465 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
466 enum vfs_fallocate_mode mode,
467 off_t offset,
468 off_t len)
470 return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
473 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, off_t offset, off_t count, int type)
475 return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
478 static int skel_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32 access_mask)
480 return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
483 static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype)
485 return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
488 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
490 return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
493 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
495 return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
498 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz)
500 return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
503 static int skel_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
505 return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
508 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev)
510 return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
513 static char *skel_realpath(vfs_handle_struct *handle, const char *path)
515 return SMB_VFS_NEXT_REALPATH(handle, path);
518 static NTSTATUS skel_notify_watch(
519 struct vfs_handle_struct *handle,
520 struct sys_notify_context *ctx,
521 const char *path,
522 uint32_t *filter,
523 uint32_t *subdir_filter,
524 void (*callback)(struct sys_notify_context *ctx, void *private_data,
525 struct notify_event *ev),
526 void *private_data, void *handle_p)
528 return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
529 filter, subdir_filter, callback,
530 private_data, handle_p);
533 static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags)
535 return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
538 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
539 const SMB_STRUCT_STAT *sbuf)
541 return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
544 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
545 struct files_struct *fsp,
546 const char *fname,
547 TALLOC_CTX *mem_ctx,
548 unsigned int *num_streams,
549 struct stream_struct **streams)
551 return SMB_VFS_NEXT_STREAMINFO(handle,
552 fsp,
553 fname,
554 mem_ctx,
555 num_streams,
556 streams);
559 static int skel_get_real_filename(struct vfs_handle_struct *handle,
560 const char *path,
561 const char *name,
562 TALLOC_CTX *mem_ctx,
563 char **found_name)
565 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
566 path,
567 name,
568 mem_ctx,
569 found_name);
572 static const char *skel_connectpath(struct vfs_handle_struct *handle,
573 const char *filename)
575 return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
578 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
579 struct byte_range_lock *br_lck,
580 struct lock_struct *plock,
581 bool blocking_lock,
582 struct blocking_lock_record *blr)
584 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
585 br_lck,
586 plock,
587 blocking_lock,
588 blr);
591 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
592 struct messaging_context *msg_ctx,
593 struct byte_range_lock *br_lck,
594 const struct lock_struct *plock)
596 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle,
597 msg_ctx,
598 br_lck,
599 plock);
602 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
603 struct byte_range_lock *br_lck,
604 struct lock_struct *plock,
605 struct blocking_lock_record *blr)
607 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle,
608 br_lck,
609 plock,
610 blr);
613 static bool skel_strict_lock(struct vfs_handle_struct *handle,
614 struct files_struct *fsp,
615 struct lock_struct *plock)
617 return SMB_VFS_NEXT_STRICT_LOCK(handle,
618 fsp,
619 plock);
622 static void skel_strict_unlock(struct vfs_handle_struct *handle,
623 struct files_struct *fsp,
624 struct lock_struct *plock)
626 SMB_VFS_NEXT_STRICT_UNLOCK(handle,
627 fsp,
628 plock);
631 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
632 const char *mapped_name,
633 enum vfs_translate_direction direction,
634 TALLOC_CTX *mem_ctx,
635 char **pmapped_name)
637 return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
638 mem_ctx, pmapped_name);
641 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
642 struct files_struct *fsp,
643 TALLOC_CTX *ctx,
644 uint32_t function,
645 uint16_t req_flags, /* Needed for UNICODE ... */
646 const uint8_t *_in_data,
647 uint32_t in_len,
648 uint8_t **_out_data,
649 uint32_t max_out_len,
650 uint32_t *out_len)
652 return SMB_VFS_NEXT_FSCTL(handle,
653 fsp,
654 ctx,
655 function,
656 req_flags,
657 _in_data,
658 in_len,
659 _out_data,
660 max_out_len,
661 out_len);
664 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
665 uint32 security_info, struct security_descriptor **ppdesc)
667 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
670 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
671 const char *name, uint32 security_info, struct security_descriptor **ppdesc)
673 return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
676 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
677 uint32 security_info_sent, const struct security_descriptor *psd)
679 return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
682 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode)
684 return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
687 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
689 return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
692 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
694 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
697 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
699 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
702 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
704 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
707 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
709 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
712 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
714 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
717 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size)
719 return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
722 static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
724 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
727 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
729 return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
732 static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
734 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
737 static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name)
739 return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
742 static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
744 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
747 static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
749 return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
752 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
754 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
757 static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
759 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
762 static bool skel_is_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname, SMB_STRUCT_STAT *sbuf)
764 return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
767 static int skel_set_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname)
769 return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
772 /* VFS operations structure */
774 struct vfs_fn_pointers skel_transparent_fns = {
775 /* Disk operations */
777 .connect_fn = skel_connect,
778 .disconnect_fn = skel_disconnect,
779 .disk_free_fn = skel_disk_free,
780 .get_quota_fn = skel_get_quota,
781 .set_quota_fn = skel_set_quota,
782 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
783 .statvfs_fn = skel_statvfs,
784 .fs_capabilities_fn = skel_fs_capabilities,
785 .get_dfs_referrals_fn = skel_get_dfs_referrals,
787 /* Directory operations */
789 .opendir_fn = skel_opendir,
790 .fdopendir_fn = skel_fdopendir,
791 .readdir_fn = skel_readdir,
792 .seekdir_fn = skel_seekdir,
793 .telldir_fn = skel_telldir,
794 .rewind_dir_fn = skel_rewind_dir,
795 .mkdir_fn = skel_mkdir,
796 .rmdir_fn = skel_rmdir,
797 .closedir_fn = skel_closedir,
798 .init_search_op_fn = skel_init_search_op,
800 /* File operations */
802 .open_fn = skel_open,
803 .create_file_fn = skel_create_file,
804 .close_fn = skel_close_fn,
805 .read_fn = skel_vfs_read,
806 .pread_fn = skel_pread,
807 .pread_send_fn = skel_pread_send,
808 .pread_recv_fn = skel_pread_recv,
809 .write_fn = skel_write,
810 .pwrite_fn = skel_pwrite,
811 .pwrite_send_fn = skel_pwrite_send,
812 .pwrite_recv_fn = skel_pwrite_recv,
813 .lseek_fn = skel_lseek,
814 .sendfile_fn = skel_sendfile,
815 .recvfile_fn = skel_recvfile,
816 .rename_fn = skel_rename,
817 .fsync_fn = skel_fsync,
818 .fsync_send_fn = skel_fsync_send,
819 .fsync_recv_fn = skel_fsync_recv,
820 .stat_fn = skel_stat,
821 .fstat_fn = skel_fstat,
822 .lstat_fn = skel_lstat,
823 .get_alloc_size_fn = skel_get_alloc_size,
824 .unlink_fn = skel_unlink,
825 .chmod_fn = skel_chmod,
826 .fchmod_fn = skel_fchmod,
827 .chown_fn = skel_chown,
828 .fchown_fn = skel_fchown,
829 .lchown_fn = skel_lchown,
830 .chdir_fn = skel_chdir,
831 .getwd_fn = skel_getwd,
832 .ntimes_fn = skel_ntimes,
833 .ftruncate_fn = skel_ftruncate,
834 .fallocate_fn = skel_fallocate,
835 .lock_fn = skel_lock,
836 .kernel_flock_fn = skel_kernel_flock,
837 .linux_setlease_fn = skel_linux_setlease,
838 .getlock_fn = skel_getlock,
839 .symlink_fn = skel_symlink,
840 .readlink_fn = skel_vfs_readlink,
841 .link_fn = skel_link,
842 .mknod_fn = skel_mknod,
843 .realpath_fn = skel_realpath,
844 .notify_watch_fn = skel_notify_watch,
845 .chflags_fn = skel_chflags,
846 .file_id_create_fn = skel_file_id_create,
848 .streaminfo_fn = skel_streaminfo,
849 .get_real_filename_fn = skel_get_real_filename,
850 .connectpath_fn = skel_connectpath,
851 .brl_lock_windows_fn = skel_brl_lock_windows,
852 .brl_unlock_windows_fn = skel_brl_unlock_windows,
853 .brl_cancel_windows_fn = skel_brl_cancel_windows,
854 .strict_lock_fn = skel_strict_lock,
855 .strict_unlock_fn = skel_strict_unlock,
856 .translate_name_fn = skel_translate_name,
857 .fsctl_fn = skel_fsctl,
859 /* NT ACL operations. */
861 .fget_nt_acl_fn = skel_fget_nt_acl,
862 .get_nt_acl_fn = skel_get_nt_acl,
863 .fset_nt_acl_fn = skel_fset_nt_acl,
865 /* POSIX ACL operations. */
867 .chmod_acl_fn = skel_chmod_acl,
868 .fchmod_acl_fn = skel_fchmod_acl,
870 .sys_acl_get_file_fn = skel_sys_acl_get_file,
871 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
872 .sys_acl_set_file_fn = skel_sys_acl_set_file,
873 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
874 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
876 /* EA operations. */
877 .getxattr_fn = skel_getxattr,
878 .fgetxattr_fn = skel_fgetxattr,
879 .listxattr_fn = skel_listxattr,
880 .flistxattr_fn = skel_flistxattr,
881 .removexattr_fn = skel_removexattr,
882 .fremovexattr_fn = skel_fremovexattr,
883 .setxattr_fn = skel_setxattr,
884 .fsetxattr_fn = skel_fsetxattr,
886 /* aio operations */
887 .aio_force_fn = skel_aio_force,
889 /* offline operations */
890 .is_offline_fn = skel_is_offline,
891 .set_offline_fn = skel_set_offline
894 NTSTATUS vfs_skel_transparent_init(void)
896 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", &skel_transparent_fns);