scripting ntacls: Do not place a SACL in the GPO filesystem ACL
[Samba/bb.git] / examples / VFS / skel_transparent.c
blob02e818424d286c4e395373e7384bf1a27c6d0bd7
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/>.
24 #include "../source3/include/includes.h"
25 #include "lib/util/tevent_unix.h"
27 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE
28 SAMBA DEVELOPERS GUIDE!!!!!!
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.
36 * --metze
39 static int skel_connect(vfs_handle_struct *handle, const char *service,
40 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,
59 unid_t id, SMB_DISK_QUOTA *dq)
61 return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
64 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
65 unid_t id, SMB_DISK_QUOTA *dq)
67 return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
70 static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
71 files_struct *fsp,
72 struct shadow_copy_data *shadow_copy_data,
73 bool labels)
75 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data,
76 labels);
79 static int skel_statvfs(struct vfs_handle_struct *handle, const char *path,
80 struct vfs_statvfs_struct *statbuf)
82 return SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
85 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
86 enum timestamp_set_resolution *p_ts_res)
88 return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
91 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
92 struct dfs_GetDFSReferral *r)
94 return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
97 static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname,
98 const char *mask, uint32 attr)
100 return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
103 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
104 const char *mask, uint32 attr)
106 return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
109 static struct dirent *skel_readdir(vfs_handle_struct *handle,
110 DIR *dirp, SMB_STRUCT_STAT *sbuf)
112 return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
115 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
117 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
120 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
122 return SMB_VFS_NEXT_TELLDIR(handle, dirp);
125 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
127 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
130 static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
132 return SMB_VFS_NEXT_MKDIR(handle, path, mode);
135 static int skel_rmdir(vfs_handle_struct *handle, const char *path)
137 return SMB_VFS_NEXT_RMDIR(handle, path);
140 static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
142 return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
145 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
147 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
150 static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
151 files_struct *fsp, int flags, mode_t mode)
153 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
156 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
157 struct smb_request *req,
158 uint16_t root_dir_fid,
159 struct smb_filename *smb_fname,
160 uint32_t access_mask,
161 uint32_t share_access,
162 uint32_t create_disposition,
163 uint32_t create_options,
164 uint32_t file_attributes,
165 uint32_t oplock_request,
166 uint64_t allocation_size,
167 uint32_t private_flags,
168 struct security_descriptor *sd,
169 struct ea_list *ea_list,
170 files_struct ** result, int *pinfo)
172 return SMB_VFS_NEXT_CREATE_FILE(handle,
173 req,
174 root_dir_fid,
175 smb_fname,
176 access_mask,
177 share_access,
178 create_disposition,
179 create_options,
180 file_attributes,
181 oplock_request,
182 allocation_size,
183 private_flags,
184 sd, ea_list, result, pinfo);
187 static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
189 return SMB_VFS_NEXT_CLOSE(handle, fsp);
192 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
193 void *data, size_t n)
195 return SMB_VFS_NEXT_READ(handle, fsp, data, n);
198 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
199 void *data, size_t n, off_t offset)
201 return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
204 struct skel_pread_state {
205 ssize_t ret;
206 int err;
209 static void skel_pread_done(struct tevent_req *subreq);
211 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
212 TALLOC_CTX *mem_ctx,
213 struct tevent_context *ev,
214 struct files_struct *fsp,
215 void *data, size_t n, off_t offset)
217 struct tevent_req *req, *subreq;
218 struct skel_pread_state *state;
220 req = tevent_req_create(mem_ctx, &state, struct skel_pread_state);
221 if (req == NULL) {
222 return NULL;
224 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
225 n, offset);
226 if (tevent_req_nomem(subreq, req)) {
227 return tevent_req_post(req, ev);
229 tevent_req_set_callback(subreq, skel_pread_done, req);
230 return req;
233 static void skel_pread_done(struct tevent_req *subreq)
235 struct tevent_req *req =
236 tevent_req_callback_data(subreq, struct tevent_req);
237 struct skel_pread_state *state =
238 tevent_req_data(req, struct skel_pread_state);
240 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
241 TALLOC_FREE(subreq);
242 tevent_req_done(req);
245 static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
247 struct skel_pread_state *state =
248 tevent_req_data(req, struct skel_pread_state);
250 if (tevent_req_is_unix_error(req, err)) {
251 return -1;
253 *err = state->err;
254 return state->ret;
257 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
258 const void *data, size_t n)
260 return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
263 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
264 const void *data, size_t n, off_t offset)
266 return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
269 struct skel_pwrite_state {
270 ssize_t ret;
271 int err;
274 static void skel_pwrite_done(struct tevent_req *subreq);
276 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
277 TALLOC_CTX *mem_ctx,
278 struct tevent_context *ev,
279 struct files_struct *fsp,
280 const void *data,
281 size_t n, off_t offset)
283 struct tevent_req *req, *subreq;
284 struct skel_pwrite_state *state;
286 req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state);
287 if (req == NULL) {
288 return NULL;
290 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
291 n, offset);
292 if (tevent_req_nomem(subreq, req)) {
293 return tevent_req_post(req, ev);
295 tevent_req_set_callback(subreq, skel_pwrite_done, req);
296 return req;
299 static void skel_pwrite_done(struct tevent_req *subreq)
301 struct tevent_req *req =
302 tevent_req_callback_data(subreq, struct tevent_req);
303 struct skel_pwrite_state *state =
304 tevent_req_data(req, struct skel_pwrite_state);
306 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
307 TALLOC_FREE(subreq);
308 tevent_req_done(req);
311 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
313 struct skel_pwrite_state *state =
314 tevent_req_data(req, struct skel_pwrite_state);
316 if (tevent_req_is_unix_error(req, err)) {
317 return -1;
319 *err = state->err;
320 return state->ret;
323 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
324 off_t offset, int whence)
326 return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
329 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
330 files_struct *fromfsp, const DATA_BLOB *hdr,
331 off_t offset, size_t n)
333 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
336 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
337 files_struct *tofsp, off_t offset, size_t n)
339 return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
342 static int skel_rename(vfs_handle_struct *handle,
343 const struct smb_filename *smb_fname_src,
344 const struct smb_filename *smb_fname_dst)
346 return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
349 static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
351 return SMB_VFS_NEXT_FSYNC(handle, fsp);
354 struct skel_fsync_state {
355 int ret;
356 int err;
359 static void skel_fsync_done(struct tevent_req *subreq);
361 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
362 TALLOC_CTX *mem_ctx,
363 struct tevent_context *ev,
364 struct files_struct *fsp)
366 struct tevent_req *req, *subreq;
367 struct skel_fsync_state *state;
369 req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state);
370 if (req == NULL) {
371 return NULL;
373 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
374 if (tevent_req_nomem(subreq, req)) {
375 return tevent_req_post(req, ev);
377 tevent_req_set_callback(subreq, skel_fsync_done, req);
378 return req;
381 static void skel_fsync_done(struct tevent_req *subreq)
383 struct tevent_req *req =
384 tevent_req_callback_data(subreq, struct tevent_req);
385 struct skel_fsync_state *state =
386 tevent_req_data(req, struct skel_fsync_state);
388 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
389 TALLOC_FREE(subreq);
390 tevent_req_done(req);
393 static int skel_fsync_recv(struct tevent_req *req, int *err)
395 struct skel_fsync_state *state =
396 tevent_req_data(req, struct skel_fsync_state);
398 if (tevent_req_is_unix_error(req, err)) {
399 return -1;
401 *err = state->err;
402 return state->ret;
405 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
407 return SMB_VFS_NEXT_STAT(handle, smb_fname);
410 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
411 SMB_STRUCT_STAT *sbuf)
413 return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
416 static int skel_lstat(vfs_handle_struct *handle,
417 struct smb_filename *smb_fname)
419 return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
422 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
423 struct files_struct *fsp,
424 const SMB_STRUCT_STAT *sbuf)
426 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
429 static int skel_unlink(vfs_handle_struct *handle,
430 const struct smb_filename *smb_fname)
432 return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
435 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
437 return SMB_VFS_NEXT_CHMOD(handle, path, mode);
440 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
441 mode_t mode)
443 return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
446 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid,
447 gid_t gid)
449 return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
452 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
453 uid_t uid, gid_t gid)
455 return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
458 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid,
459 gid_t gid)
461 return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
464 static int skel_chdir(vfs_handle_struct *handle, const char *path)
466 return SMB_VFS_NEXT_CHDIR(handle, path);
469 static char *skel_getwd(vfs_handle_struct *handle)
471 return SMB_VFS_NEXT_GETWD(handle);
474 static int skel_ntimes(vfs_handle_struct *handle,
475 const struct smb_filename *smb_fname,
476 struct smb_file_time *ft)
478 return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
481 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
482 off_t offset)
484 return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
487 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
488 enum vfs_fallocate_mode mode, off_t offset, off_t len)
490 return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
493 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
494 off_t offset, off_t count, int type)
496 return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
499 static int skel_kernel_flock(struct vfs_handle_struct *handle,
500 struct files_struct *fsp, uint32 share_mode,
501 uint32 access_mask)
503 return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
506 static int skel_linux_setlease(struct vfs_handle_struct *handle,
507 struct files_struct *fsp, int leasetype)
509 return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
512 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
513 off_t *poffset, off_t *pcount, int *ptype,
514 pid_t *ppid)
516 return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
519 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
520 const char *newpath)
522 return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
525 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
526 char *buf, size_t bufsiz)
528 return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
531 static int skel_link(vfs_handle_struct *handle, const char *oldpath,
532 const char *newpath)
534 return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
537 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
538 SMB_DEV_T dev)
540 return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
543 static char *skel_realpath(vfs_handle_struct *handle, const char *path)
545 return SMB_VFS_NEXT_REALPATH(handle, path);
548 static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle,
549 struct sys_notify_context *ctx,
550 const char *path,
551 uint32_t *filter,
552 uint32_t *subdir_filter,
553 void (*callback) (struct sys_notify_context *ctx,
554 void *private_data,
555 struct notify_event *ev),
556 void *private_data, void *handle_p)
558 return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
559 filter, subdir_filter, callback,
560 private_data, handle_p);
563 static int skel_chflags(vfs_handle_struct *handle, const char *path,
564 uint flags)
566 return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
569 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
570 const SMB_STRUCT_STAT *sbuf)
572 return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
575 static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
576 struct files_struct *fsp,
577 const char *fname,
578 TALLOC_CTX *mem_ctx,
579 unsigned int *num_streams,
580 struct stream_struct **streams)
582 return SMB_VFS_NEXT_STREAMINFO(handle,
583 fsp,
584 fname, mem_ctx, num_streams, streams);
587 static int skel_get_real_filename(struct vfs_handle_struct *handle,
588 const char *path,
589 const char *name,
590 TALLOC_CTX *mem_ctx, char **found_name)
592 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
593 path, name, mem_ctx, found_name);
596 static const char *skel_connectpath(struct vfs_handle_struct *handle,
597 const char *filename)
599 return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
602 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
603 struct byte_range_lock *br_lck,
604 struct lock_struct *plock,
605 bool blocking_lock,
606 struct blocking_lock_record *blr)
608 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
609 br_lck, plock, blocking_lock, blr);
612 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
613 struct messaging_context *msg_ctx,
614 struct byte_range_lock *br_lck,
615 const struct lock_struct *plock)
617 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
620 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
621 struct byte_range_lock *br_lck,
622 struct lock_struct *plock,
623 struct blocking_lock_record *blr)
625 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
628 static bool skel_strict_lock(struct vfs_handle_struct *handle,
629 struct files_struct *fsp,
630 struct lock_struct *plock)
632 return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
635 static void skel_strict_unlock(struct vfs_handle_struct *handle,
636 struct files_struct *fsp,
637 struct lock_struct *plock)
639 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
642 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
643 const char *mapped_name,
644 enum vfs_translate_direction direction,
645 TALLOC_CTX *mem_ctx, char **pmapped_name)
647 return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
648 mem_ctx, pmapped_name);
651 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
652 struct files_struct *fsp,
653 TALLOC_CTX *ctx,
654 uint32_t function,
655 uint16_t req_flags, /* Needed for UNICODE ... */
656 const uint8_t *_in_data,
657 uint32_t in_len,
658 uint8_t ** _out_data,
659 uint32_t max_out_len, uint32_t *out_len)
661 return SMB_VFS_NEXT_FSCTL(handle,
662 fsp,
663 ctx,
664 function,
665 req_flags,
666 _in_data,
667 in_len, _out_data, max_out_len, out_len);
670 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
671 uint32 security_info,
672 TALLOC_CTX *mem_ctx,
673 struct security_descriptor **ppdesc)
675 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx,
676 ppdesc);
679 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
680 const char *name, uint32 security_info,
681 TALLOC_CTX *mem_ctx,
682 struct security_descriptor **ppdesc)
684 return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, mem_ctx,
685 ppdesc);
688 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
689 uint32 security_info_sent,
690 const struct security_descriptor *psd)
692 return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
695 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
696 mode_t mode)
698 return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
701 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
702 mode_t mode)
704 return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
707 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
708 const char *path_p,
709 SMB_ACL_TYPE_T type,
710 TALLOC_CTX *mem_ctx)
712 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
715 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
716 files_struct *fsp, TALLOC_CTX *mem_ctx)
718 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
721 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
722 const char *path_p, TALLOC_CTX *mem_ctx,
723 char **blob_description, DATA_BLOB *blob)
725 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx,
726 blob_description, blob);
729 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
730 files_struct *fsp, TALLOC_CTX *mem_ctx,
731 char **blob_description, DATA_BLOB *blob)
733 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx,
734 blob_description, blob);
737 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
738 SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
740 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
743 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
744 SMB_ACL_T theacl)
746 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
749 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
750 const char *path)
752 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
755 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
756 const char *name, void *value, size_t size)
758 return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
761 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
762 struct files_struct *fsp, const char *name,
763 void *value, size_t size)
765 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
768 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
769 char *list, size_t size)
771 return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
774 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
775 struct files_struct *fsp, char *list,
776 size_t size)
778 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
781 static int skel_removexattr(vfs_handle_struct *handle, const char *path,
782 const char *name)
784 return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
787 static int skel_fremovexattr(vfs_handle_struct *handle,
788 struct files_struct *fsp, const char *name)
790 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
793 static int skel_setxattr(vfs_handle_struct *handle, const char *path,
794 const char *name, const void *value, size_t size,
795 int flags)
797 return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
800 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
801 const char *name, const void *value, size_t size,
802 int flags)
804 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
807 static bool skel_aio_force(struct vfs_handle_struct *handle,
808 struct files_struct *fsp)
810 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
813 static bool skel_is_offline(struct vfs_handle_struct *handle,
814 const struct smb_filename *fname,
815 SMB_STRUCT_STAT *sbuf)
817 return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
820 static int skel_set_offline(struct vfs_handle_struct *handle,
821 const struct smb_filename *fname)
823 return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
826 /* VFS operations structure */
828 struct vfs_fn_pointers skel_transparent_fns = {
829 /* Disk operations */
831 .connect_fn = skel_connect,
832 .disconnect_fn = skel_disconnect,
833 .disk_free_fn = skel_disk_free,
834 .get_quota_fn = skel_get_quota,
835 .set_quota_fn = skel_set_quota,
836 .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
837 .statvfs_fn = skel_statvfs,
838 .fs_capabilities_fn = skel_fs_capabilities,
839 .get_dfs_referrals_fn = skel_get_dfs_referrals,
841 /* Directory operations */
843 .opendir_fn = skel_opendir,
844 .fdopendir_fn = skel_fdopendir,
845 .readdir_fn = skel_readdir,
846 .seekdir_fn = skel_seekdir,
847 .telldir_fn = skel_telldir,
848 .rewind_dir_fn = skel_rewind_dir,
849 .mkdir_fn = skel_mkdir,
850 .rmdir_fn = skel_rmdir,
851 .closedir_fn = skel_closedir,
852 .init_search_op_fn = skel_init_search_op,
854 /* File operations */
856 .open_fn = skel_open,
857 .create_file_fn = skel_create_file,
858 .close_fn = skel_close_fn,
859 .read_fn = skel_vfs_read,
860 .pread_fn = skel_pread,
861 .pread_send_fn = skel_pread_send,
862 .pread_recv_fn = skel_pread_recv,
863 .write_fn = skel_write,
864 .pwrite_fn = skel_pwrite,
865 .pwrite_send_fn = skel_pwrite_send,
866 .pwrite_recv_fn = skel_pwrite_recv,
867 .lseek_fn = skel_lseek,
868 .sendfile_fn = skel_sendfile,
869 .recvfile_fn = skel_recvfile,
870 .rename_fn = skel_rename,
871 .fsync_fn = skel_fsync,
872 .fsync_send_fn = skel_fsync_send,
873 .fsync_recv_fn = skel_fsync_recv,
874 .stat_fn = skel_stat,
875 .fstat_fn = skel_fstat,
876 .lstat_fn = skel_lstat,
877 .get_alloc_size_fn = skel_get_alloc_size,
878 .unlink_fn = skel_unlink,
879 .chmod_fn = skel_chmod,
880 .fchmod_fn = skel_fchmod,
881 .chown_fn = skel_chown,
882 .fchown_fn = skel_fchown,
883 .lchown_fn = skel_lchown,
884 .chdir_fn = skel_chdir,
885 .getwd_fn = skel_getwd,
886 .ntimes_fn = skel_ntimes,
887 .ftruncate_fn = skel_ftruncate,
888 .fallocate_fn = skel_fallocate,
889 .lock_fn = skel_lock,
890 .kernel_flock_fn = skel_kernel_flock,
891 .linux_setlease_fn = skel_linux_setlease,
892 .getlock_fn = skel_getlock,
893 .symlink_fn = skel_symlink,
894 .readlink_fn = skel_vfs_readlink,
895 .link_fn = skel_link,
896 .mknod_fn = skel_mknod,
897 .realpath_fn = skel_realpath,
898 .notify_watch_fn = skel_notify_watch,
899 .chflags_fn = skel_chflags,
900 .file_id_create_fn = skel_file_id_create,
902 .streaminfo_fn = skel_streaminfo,
903 .get_real_filename_fn = skel_get_real_filename,
904 .connectpath_fn = skel_connectpath,
905 .brl_lock_windows_fn = skel_brl_lock_windows,
906 .brl_unlock_windows_fn = skel_brl_unlock_windows,
907 .brl_cancel_windows_fn = skel_brl_cancel_windows,
908 .strict_lock_fn = skel_strict_lock,
909 .strict_unlock_fn = skel_strict_unlock,
910 .translate_name_fn = skel_translate_name,
911 .fsctl_fn = skel_fsctl,
913 /* NT ACL operations. */
915 .fget_nt_acl_fn = skel_fget_nt_acl,
916 .get_nt_acl_fn = skel_get_nt_acl,
917 .fset_nt_acl_fn = skel_fset_nt_acl,
919 /* POSIX ACL operations. */
921 .chmod_acl_fn = skel_chmod_acl,
922 .fchmod_acl_fn = skel_fchmod_acl,
924 .sys_acl_get_file_fn = skel_sys_acl_get_file,
925 .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
926 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
927 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
928 .sys_acl_set_file_fn = skel_sys_acl_set_file,
929 .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
930 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
932 /* EA operations. */
933 .getxattr_fn = skel_getxattr,
934 .fgetxattr_fn = skel_fgetxattr,
935 .listxattr_fn = skel_listxattr,
936 .flistxattr_fn = skel_flistxattr,
937 .removexattr_fn = skel_removexattr,
938 .fremovexattr_fn = skel_fremovexattr,
939 .setxattr_fn = skel_setxattr,
940 .fsetxattr_fn = skel_fsetxattr,
942 /* aio operations */
943 .aio_force_fn = skel_aio_force,
945 /* offline operations */
946 .is_offline_fn = skel_is_offline,
947 .set_offline_fn = skel_set_offline
950 NTSTATUS vfs_skel_transparent_init(void)
952 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
953 &skel_transparent_fns);