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"
26 #include "lib/util/tevent_ntstatus.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.
40 static int skel_connect(vfs_handle_struct
*handle
, const char *service
,
43 return SMB_VFS_NEXT_CONNECT(handle
, service
, user
);
46 static void skel_disconnect(vfs_handle_struct
*handle
)
48 SMB_VFS_NEXT_DISCONNECT(handle
);
51 static uint64_t skel_disk_free(vfs_handle_struct
*handle
, const char *path
,
53 uint64_t *dfree
, uint64_t *dsize
)
55 return SMB_VFS_NEXT_DISK_FREE(handle
, path
, bsize
, dfree
, dsize
);
58 static int skel_get_quota(vfs_handle_struct
*handle
, const char *path
,
59 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
62 return SMB_VFS_NEXT_GET_QUOTA(handle
, path
, qtype
, id
, dq
);
65 static int skel_set_quota(vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
,
66 unid_t id
, SMB_DISK_QUOTA
*dq
)
68 return SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, dq
);
71 static int skel_get_shadow_copy_data(vfs_handle_struct
*handle
,
73 struct shadow_copy_data
*shadow_copy_data
,
76 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
,
80 static int skel_statvfs(struct vfs_handle_struct
*handle
, const char *path
,
81 struct vfs_statvfs_struct
*statbuf
)
83 return SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
86 static uint32_t skel_fs_capabilities(struct vfs_handle_struct
*handle
,
87 enum timestamp_set_resolution
*p_ts_res
)
89 return SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
92 static NTSTATUS
skel_get_dfs_referrals(struct vfs_handle_struct
*handle
,
93 struct dfs_GetDFSReferral
*r
)
95 return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle
, r
);
98 static DIR *skel_opendir(vfs_handle_struct
*handle
,
99 const struct smb_filename
*smb_fname
,
103 return SMB_VFS_NEXT_OPENDIR(handle
, smb_fname
, mask
, attr
);
106 static NTSTATUS
skel_snap_check_path(struct vfs_handle_struct
*handle
,
108 const char *service_path
,
111 return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle
, mem_ctx
, service_path
,
115 static NTSTATUS
skel_snap_create(struct vfs_handle_struct
*handle
,
117 const char *base_volume
,
123 return SMB_VFS_NEXT_SNAP_CREATE(handle
, mem_ctx
, base_volume
, tstamp
,
124 rw
, base_path
, snap_path
);
127 static NTSTATUS
skel_snap_delete(struct vfs_handle_struct
*handle
,
132 return SMB_VFS_NEXT_SNAP_DELETE(handle
, mem_ctx
, base_path
, snap_path
);
135 static DIR *skel_fdopendir(vfs_handle_struct
*handle
, files_struct
*fsp
,
136 const char *mask
, uint32_t attr
)
138 return SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
141 static struct dirent
*skel_readdir(vfs_handle_struct
*handle
,
142 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
144 return SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
147 static void skel_seekdir(vfs_handle_struct
*handle
, DIR *dirp
, long offset
)
149 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
152 static long skel_telldir(vfs_handle_struct
*handle
, DIR *dirp
)
154 return SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
157 static void skel_rewind_dir(vfs_handle_struct
*handle
, DIR *dirp
)
159 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
162 static int skel_mkdir(vfs_handle_struct
*handle
,
163 const struct smb_filename
*smb_fname
,
166 return SMB_VFS_NEXT_MKDIR(handle
, smb_fname
, mode
);
169 static int skel_rmdir(vfs_handle_struct
*handle
,
170 const struct smb_filename
*smb_fname
)
172 return SMB_VFS_NEXT_RMDIR(handle
, smb_fname
);
175 static int skel_closedir(vfs_handle_struct
*handle
, DIR *dir
)
177 return SMB_VFS_NEXT_CLOSEDIR(handle
, dir
);
180 static void skel_init_search_op(struct vfs_handle_struct
*handle
, DIR *dirp
)
182 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
185 static int skel_open(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
,
186 files_struct
*fsp
, int flags
, mode_t mode
)
188 return SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
191 static NTSTATUS
skel_create_file(struct vfs_handle_struct
*handle
,
192 struct smb_request
*req
,
193 uint16_t root_dir_fid
,
194 struct smb_filename
*smb_fname
,
195 uint32_t access_mask
,
196 uint32_t share_access
,
197 uint32_t create_disposition
,
198 uint32_t create_options
,
199 uint32_t file_attributes
,
200 uint32_t oplock_request
,
201 struct smb2_lease
*lease
,
202 uint64_t allocation_size
,
203 uint32_t private_flags
,
204 struct security_descriptor
*sd
,
205 struct ea_list
*ea_list
,
206 files_struct
** result
, int *pinfo
,
207 const struct smb2_create_blobs
*in_context_blobs
,
208 struct smb2_create_blobs
*out_context_blobs
)
210 return SMB_VFS_NEXT_CREATE_FILE(handle
,
223 sd
, ea_list
, result
, pinfo
,
224 in_context_blobs
, out_context_blobs
);
227 static int skel_close_fn(vfs_handle_struct
*handle
, files_struct
*fsp
)
229 return SMB_VFS_NEXT_CLOSE(handle
, fsp
);
232 static ssize_t
skel_vfs_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
233 void *data
, size_t n
)
235 return SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
238 static ssize_t
skel_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
239 void *data
, size_t n
, off_t offset
)
241 return SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
244 struct skel_pread_state
{
246 struct vfs_aio_state vfs_aio_state
;
249 static void skel_pread_done(struct tevent_req
*subreq
);
251 static struct tevent_req
*skel_pread_send(struct vfs_handle_struct
*handle
,
253 struct tevent_context
*ev
,
254 struct files_struct
*fsp
,
255 void *data
, size_t n
, off_t offset
)
257 struct tevent_req
*req
, *subreq
;
258 struct skel_pread_state
*state
;
260 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pread_state
);
264 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
266 if (tevent_req_nomem(subreq
, req
)) {
267 return tevent_req_post(req
, ev
);
269 tevent_req_set_callback(subreq
, skel_pread_done
, req
);
273 static void skel_pread_done(struct tevent_req
*subreq
)
275 struct tevent_req
*req
=
276 tevent_req_callback_data(subreq
, struct tevent_req
);
277 struct skel_pread_state
*state
=
278 tevent_req_data(req
, struct skel_pread_state
);
280 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->vfs_aio_state
);
282 tevent_req_done(req
);
285 static ssize_t
skel_pread_recv(struct tevent_req
*req
,
286 struct vfs_aio_state
*vfs_aio_state
)
288 struct skel_pread_state
*state
=
289 tevent_req_data(req
, struct skel_pread_state
);
291 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
294 *vfs_aio_state
= state
->vfs_aio_state
;
298 static ssize_t
skel_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
299 const void *data
, size_t n
)
301 return SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
304 static ssize_t
skel_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
305 const void *data
, size_t n
, off_t offset
)
307 return SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
310 struct skel_pwrite_state
{
312 struct vfs_aio_state vfs_aio_state
;
315 static void skel_pwrite_done(struct tevent_req
*subreq
);
317 static struct tevent_req
*skel_pwrite_send(struct vfs_handle_struct
*handle
,
319 struct tevent_context
*ev
,
320 struct files_struct
*fsp
,
322 size_t n
, off_t offset
)
324 struct tevent_req
*req
, *subreq
;
325 struct skel_pwrite_state
*state
;
327 req
= tevent_req_create(mem_ctx
, &state
, struct skel_pwrite_state
);
331 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
333 if (tevent_req_nomem(subreq
, req
)) {
334 return tevent_req_post(req
, ev
);
336 tevent_req_set_callback(subreq
, skel_pwrite_done
, req
);
340 static void skel_pwrite_done(struct tevent_req
*subreq
)
342 struct tevent_req
*req
=
343 tevent_req_callback_data(subreq
, struct tevent_req
);
344 struct skel_pwrite_state
*state
=
345 tevent_req_data(req
, struct skel_pwrite_state
);
347 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->vfs_aio_state
);
349 tevent_req_done(req
);
352 static ssize_t
skel_pwrite_recv(struct tevent_req
*req
,
353 struct vfs_aio_state
*vfs_aio_state
)
355 struct skel_pwrite_state
*state
=
356 tevent_req_data(req
, struct skel_pwrite_state
);
358 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
361 *vfs_aio_state
= state
->vfs_aio_state
;
365 static off_t
skel_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
366 off_t offset
, int whence
)
368 return SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
371 static ssize_t
skel_sendfile(vfs_handle_struct
*handle
, int tofd
,
372 files_struct
*fromfsp
, const DATA_BLOB
*hdr
,
373 off_t offset
, size_t n
)
375 return SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
378 static ssize_t
skel_recvfile(vfs_handle_struct
*handle
, int fromfd
,
379 files_struct
*tofsp
, off_t offset
, size_t n
)
381 return SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
384 static int skel_rename(vfs_handle_struct
*handle
,
385 const struct smb_filename
*smb_fname_src
,
386 const struct smb_filename
*smb_fname_dst
)
388 return SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
391 static int skel_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
393 return SMB_VFS_NEXT_FSYNC(handle
, fsp
);
396 struct skel_fsync_state
{
398 struct vfs_aio_state vfs_aio_state
;
401 static void skel_fsync_done(struct tevent_req
*subreq
);
403 static struct tevent_req
*skel_fsync_send(struct vfs_handle_struct
*handle
,
405 struct tevent_context
*ev
,
406 struct files_struct
*fsp
)
408 struct tevent_req
*req
, *subreq
;
409 struct skel_fsync_state
*state
;
411 req
= tevent_req_create(mem_ctx
, &state
, struct skel_fsync_state
);
415 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
416 if (tevent_req_nomem(subreq
, req
)) {
417 return tevent_req_post(req
, ev
);
419 tevent_req_set_callback(subreq
, skel_fsync_done
, req
);
423 static void skel_fsync_done(struct tevent_req
*subreq
)
425 struct tevent_req
*req
=
426 tevent_req_callback_data(subreq
, struct tevent_req
);
427 struct skel_fsync_state
*state
=
428 tevent_req_data(req
, struct skel_fsync_state
);
430 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->vfs_aio_state
);
432 tevent_req_done(req
);
435 static int skel_fsync_recv(struct tevent_req
*req
,
436 struct vfs_aio_state
*vfs_aio_state
)
438 struct skel_fsync_state
*state
=
439 tevent_req_data(req
, struct skel_fsync_state
);
441 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
444 *vfs_aio_state
= state
->vfs_aio_state
;
448 static int skel_stat(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
)
450 return SMB_VFS_NEXT_STAT(handle
, smb_fname
);
453 static int skel_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
454 SMB_STRUCT_STAT
*sbuf
)
456 return SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
459 static int skel_lstat(vfs_handle_struct
*handle
,
460 struct smb_filename
*smb_fname
)
462 return SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
465 static uint64_t skel_get_alloc_size(struct vfs_handle_struct
*handle
,
466 struct files_struct
*fsp
,
467 const SMB_STRUCT_STAT
*sbuf
)
469 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
472 static int skel_unlink(vfs_handle_struct
*handle
,
473 const struct smb_filename
*smb_fname
)
475 return SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
478 static int skel_chmod(vfs_handle_struct
*handle
,
479 const struct smb_filename
*smb_fname
,
482 return SMB_VFS_NEXT_CHMOD(handle
, smb_fname
, mode
);
485 static int skel_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
488 return SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
491 static int skel_chown(vfs_handle_struct
*handle
,
492 const struct smb_filename
*smb_fname
,
496 return SMB_VFS_NEXT_CHOWN(handle
, smb_fname
, uid
, gid
);
499 static int skel_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
500 uid_t uid
, gid_t gid
)
502 return SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
505 static int skel_lchown(vfs_handle_struct
*handle
,
506 const struct smb_filename
*smb_fname
,
510 return SMB_VFS_NEXT_LCHOWN(handle
, smb_fname
, uid
, gid
);
513 static int skel_chdir(vfs_handle_struct
*handle
, const char *path
)
515 return SMB_VFS_NEXT_CHDIR(handle
, path
);
518 static char *skel_getwd(vfs_handle_struct
*handle
)
520 return SMB_VFS_NEXT_GETWD(handle
);
523 static int skel_ntimes(vfs_handle_struct
*handle
,
524 const struct smb_filename
*smb_fname
,
525 struct smb_file_time
*ft
)
527 return SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
530 static int skel_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
533 return SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, offset
);
536 static int skel_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
537 uint32_t mode
, off_t offset
, off_t len
)
539 return SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
542 static bool skel_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int op
,
543 off_t offset
, off_t count
, int type
)
545 return SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
548 static int skel_kernel_flock(struct vfs_handle_struct
*handle
,
549 struct files_struct
*fsp
, uint32_t share_mode
,
550 uint32_t access_mask
)
552 return SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
555 static int skel_linux_setlease(struct vfs_handle_struct
*handle
,
556 struct files_struct
*fsp
, int leasetype
)
558 return SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
561 static bool skel_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
562 off_t
*poffset
, off_t
*pcount
, int *ptype
,
565 return SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
568 static int skel_symlink(vfs_handle_struct
*handle
, const char *oldpath
,
571 return SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
574 static int skel_vfs_readlink(vfs_handle_struct
*handle
, const char *path
,
575 char *buf
, size_t bufsiz
)
577 return SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
580 static int skel_link(vfs_handle_struct
*handle
, const char *oldpath
,
583 return SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
586 static int skel_mknod(vfs_handle_struct
*handle
,
587 const struct smb_filename
*smb_fname
,
591 return SMB_VFS_NEXT_MKNOD(handle
, smb_fname
, mode
, dev
);
594 static char *skel_realpath(vfs_handle_struct
*handle
, const char *path
)
596 return SMB_VFS_NEXT_REALPATH(handle
, path
);
599 static int skel_chflags(vfs_handle_struct
*handle
, const char *path
,
602 return SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
605 static struct file_id
skel_file_id_create(vfs_handle_struct
*handle
,
606 const SMB_STRUCT_STAT
*sbuf
)
608 return SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
611 struct skel_cc_state
{
612 struct vfs_handle_struct
*handle
;
615 static void skel_copy_chunk_done(struct tevent_req
*subreq
);
617 static struct tevent_req
*skel_copy_chunk_send(struct vfs_handle_struct
*handle
,
619 struct tevent_context
*ev
,
620 struct files_struct
*src_fsp
,
622 struct files_struct
*dest_fsp
,
627 struct tevent_req
*req
;
628 struct tevent_req
*subreq
;
629 struct skel_cc_state
*cc_state
;
631 req
= tevent_req_create(mem_ctx
, &cc_state
, struct skel_cc_state
);
636 cc_state
->handle
= handle
;
637 subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, cc_state
, ev
,
639 dest_fsp
, dest_off
, num
, flags
);
640 if (tevent_req_nomem(subreq
, req
)) {
641 return tevent_req_post(req
, ev
);
644 tevent_req_set_callback(subreq
, skel_copy_chunk_done
, req
);
648 static void skel_copy_chunk_done(struct tevent_req
*subreq
)
650 struct tevent_req
*req
= tevent_req_callback_data(
651 subreq
, struct tevent_req
);
652 struct skel_cc_state
*cc_state
653 = tevent_req_data(req
, struct skel_cc_state
);
656 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
660 if (tevent_req_nterror(req
, status
)) {
663 tevent_req_done(req
);
666 static NTSTATUS
skel_copy_chunk_recv(struct vfs_handle_struct
*handle
,
667 struct tevent_req
*req
,
670 struct skel_cc_state
*cc_state
671 = tevent_req_data(req
, struct skel_cc_state
);
674 *copied
= cc_state
->copied
;
675 if (tevent_req_is_nterror(req
, &status
)) {
676 tevent_req_received(req
);
680 tevent_req_received(req
);
684 static NTSTATUS
skel_get_compression(struct vfs_handle_struct
*handle
,
686 struct files_struct
*fsp
,
687 struct smb_filename
*smb_fname
,
688 uint16_t *_compression_fmt
)
690 return SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
694 static NTSTATUS
skel_set_compression(struct vfs_handle_struct
*handle
,
696 struct files_struct
*fsp
,
697 uint16_t compression_fmt
)
699 return SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
703 static NTSTATUS
skel_streaminfo(struct vfs_handle_struct
*handle
,
704 struct files_struct
*fsp
,
705 const struct smb_filename
*smb_fname
,
707 unsigned int *num_streams
,
708 struct stream_struct
**streams
)
710 return SMB_VFS_NEXT_STREAMINFO(handle
,
718 static int skel_get_real_filename(struct vfs_handle_struct
*handle
,
721 TALLOC_CTX
*mem_ctx
, char **found_name
)
723 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle
,
724 path
, name
, mem_ctx
, found_name
);
727 static const char *skel_connectpath(struct vfs_handle_struct
*handle
,
728 const char *filename
)
730 return SMB_VFS_NEXT_CONNECTPATH(handle
, filename
);
733 static NTSTATUS
skel_brl_lock_windows(struct vfs_handle_struct
*handle
,
734 struct byte_range_lock
*br_lck
,
735 struct lock_struct
*plock
,
738 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
,
739 br_lck
, plock
, blocking_lock
);
742 static bool skel_brl_unlock_windows(struct vfs_handle_struct
*handle
,
743 struct messaging_context
*msg_ctx
,
744 struct byte_range_lock
*br_lck
,
745 const struct lock_struct
*plock
)
747 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
, plock
);
750 static bool skel_brl_cancel_windows(struct vfs_handle_struct
*handle
,
751 struct byte_range_lock
*br_lck
,
752 struct lock_struct
*plock
)
754 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
757 static bool skel_strict_lock(struct vfs_handle_struct
*handle
,
758 struct files_struct
*fsp
,
759 struct lock_struct
*plock
)
761 return SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
764 static void skel_strict_unlock(struct vfs_handle_struct
*handle
,
765 struct files_struct
*fsp
,
766 struct lock_struct
*plock
)
768 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
771 static NTSTATUS
skel_translate_name(struct vfs_handle_struct
*handle
,
772 const char *mapped_name
,
773 enum vfs_translate_direction direction
,
774 TALLOC_CTX
*mem_ctx
, char **pmapped_name
)
776 return SMB_VFS_NEXT_TRANSLATE_NAME(handle
, mapped_name
, direction
,
777 mem_ctx
, pmapped_name
);
780 static NTSTATUS
skel_fsctl(struct vfs_handle_struct
*handle
,
781 struct files_struct
*fsp
,
784 uint16_t req_flags
, /* Needed for UNICODE ... */
785 const uint8_t *_in_data
,
787 uint8_t ** _out_data
,
788 uint32_t max_out_len
, uint32_t *out_len
)
790 return SMB_VFS_NEXT_FSCTL(handle
,
796 in_len
, _out_data
, max_out_len
, out_len
);
799 static NTSTATUS
skel_readdir_attr(struct vfs_handle_struct
*handle
,
800 const struct smb_filename
*fname
,
802 struct readdir_attr_data
**pattr_data
)
804 return SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
807 static NTSTATUS
skel_get_dos_attributes(struct vfs_handle_struct
*handle
,
808 struct smb_filename
*smb_fname
,
811 return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle
,
816 static NTSTATUS
skel_fget_dos_attributes(struct vfs_handle_struct
*handle
,
817 struct files_struct
*fsp
,
820 return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle
,
825 static NTSTATUS
skel_set_dos_attributes(struct vfs_handle_struct
*handle
,
826 const struct smb_filename
*smb_fname
,
829 return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle
,
834 static NTSTATUS
skel_fset_dos_attributes(struct vfs_handle_struct
*handle
,
835 struct files_struct
*fsp
,
838 return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle
,
843 static NTSTATUS
skel_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
844 uint32_t security_info
,
846 struct security_descriptor
**ppdesc
)
848 return SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, mem_ctx
,
852 static NTSTATUS
skel_get_nt_acl(vfs_handle_struct
*handle
,
853 const struct smb_filename
*smb_fname
,
854 uint32_t security_info
,
856 struct security_descriptor
**ppdesc
)
858 return SMB_VFS_NEXT_GET_NT_ACL(handle
,
865 static NTSTATUS
skel_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
866 uint32_t security_info_sent
,
867 const struct security_descriptor
*psd
)
869 return SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
872 static int skel_chmod_acl(vfs_handle_struct
*handle
,
873 const struct smb_filename
*smb_fname
,
876 return SMB_VFS_NEXT_CHMOD_ACL(handle
, smb_fname
, mode
);
879 static int skel_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
882 return SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
885 static SMB_ACL_T
skel_sys_acl_get_file(vfs_handle_struct
*handle
,
886 const struct smb_filename
*smb_fname
,
890 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, smb_fname
, type
, mem_ctx
);
893 static SMB_ACL_T
skel_sys_acl_get_fd(vfs_handle_struct
*handle
,
894 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
896 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
899 static int skel_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
900 const struct smb_filename
*smb_fname
,
902 char **blob_description
,
905 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, smb_fname
, mem_ctx
,
906 blob_description
, blob
);
909 static int skel_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
910 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
,
911 char **blob_description
, DATA_BLOB
*blob
)
913 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
,
914 blob_description
, blob
);
917 static int skel_sys_acl_set_file(vfs_handle_struct
*handle
,
918 const struct smb_filename
*smb_fname
,
919 SMB_ACL_TYPE_T acltype
,
922 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, smb_fname
,
926 static int skel_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
929 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
932 static int skel_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
933 const struct smb_filename
*smb_fname
)
935 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, smb_fname
);
938 static ssize_t
skel_getxattr(vfs_handle_struct
*handle
,
939 const struct smb_filename
*smb_fname
,
944 return SMB_VFS_NEXT_GETXATTR(handle
, smb_fname
, name
, value
, size
);
947 static ssize_t
skel_fgetxattr(vfs_handle_struct
*handle
,
948 struct files_struct
*fsp
, const char *name
,
949 void *value
, size_t size
)
951 return SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
954 static ssize_t
skel_listxattr(vfs_handle_struct
*handle
,
955 const struct smb_filename
*smb_fname
,
959 return SMB_VFS_NEXT_LISTXATTR(handle
, smb_fname
, list
, size
);
962 static ssize_t
skel_flistxattr(vfs_handle_struct
*handle
,
963 struct files_struct
*fsp
, char *list
,
966 return SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
969 static int skel_removexattr(vfs_handle_struct
*handle
,
970 const struct smb_filename
*smb_fname
,
973 return SMB_VFS_NEXT_REMOVEXATTR(handle
, smb_fname
, name
);
976 static int skel_fremovexattr(vfs_handle_struct
*handle
,
977 struct files_struct
*fsp
, const char *name
)
979 return SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
982 static int skel_setxattr(vfs_handle_struct
*handle
,
983 const struct smb_filename
*smb_fname
,
989 return SMB_VFS_NEXT_SETXATTR(handle
, smb_fname
,
990 name
, value
, size
, flags
);
993 static int skel_fsetxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
,
994 const char *name
, const void *value
, size_t size
,
997 return SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
1000 static bool skel_aio_force(struct vfs_handle_struct
*handle
,
1001 struct files_struct
*fsp
)
1003 return SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
1006 /* VFS operations structure */
1008 struct vfs_fn_pointers skel_transparent_fns
= {
1009 /* Disk operations */
1011 .connect_fn
= skel_connect
,
1012 .disconnect_fn
= skel_disconnect
,
1013 .disk_free_fn
= skel_disk_free
,
1014 .get_quota_fn
= skel_get_quota
,
1015 .set_quota_fn
= skel_set_quota
,
1016 .get_shadow_copy_data_fn
= skel_get_shadow_copy_data
,
1017 .statvfs_fn
= skel_statvfs
,
1018 .fs_capabilities_fn
= skel_fs_capabilities
,
1019 .get_dfs_referrals_fn
= skel_get_dfs_referrals
,
1020 .snap_check_path_fn
= skel_snap_check_path
,
1021 .snap_create_fn
= skel_snap_create
,
1022 .snap_delete_fn
= skel_snap_delete
,
1024 /* Directory operations */
1026 .opendir_fn
= skel_opendir
,
1027 .fdopendir_fn
= skel_fdopendir
,
1028 .readdir_fn
= skel_readdir
,
1029 .seekdir_fn
= skel_seekdir
,
1030 .telldir_fn
= skel_telldir
,
1031 .rewind_dir_fn
= skel_rewind_dir
,
1032 .mkdir_fn
= skel_mkdir
,
1033 .rmdir_fn
= skel_rmdir
,
1034 .closedir_fn
= skel_closedir
,
1035 .init_search_op_fn
= skel_init_search_op
,
1037 /* File operations */
1039 .open_fn
= skel_open
,
1040 .create_file_fn
= skel_create_file
,
1041 .close_fn
= skel_close_fn
,
1042 .read_fn
= skel_vfs_read
,
1043 .pread_fn
= skel_pread
,
1044 .pread_send_fn
= skel_pread_send
,
1045 .pread_recv_fn
= skel_pread_recv
,
1046 .write_fn
= skel_write
,
1047 .pwrite_fn
= skel_pwrite
,
1048 .pwrite_send_fn
= skel_pwrite_send
,
1049 .pwrite_recv_fn
= skel_pwrite_recv
,
1050 .lseek_fn
= skel_lseek
,
1051 .sendfile_fn
= skel_sendfile
,
1052 .recvfile_fn
= skel_recvfile
,
1053 .rename_fn
= skel_rename
,
1054 .fsync_fn
= skel_fsync
,
1055 .fsync_send_fn
= skel_fsync_send
,
1056 .fsync_recv_fn
= skel_fsync_recv
,
1057 .stat_fn
= skel_stat
,
1058 .fstat_fn
= skel_fstat
,
1059 .lstat_fn
= skel_lstat
,
1060 .get_alloc_size_fn
= skel_get_alloc_size
,
1061 .unlink_fn
= skel_unlink
,
1062 .chmod_fn
= skel_chmod
,
1063 .fchmod_fn
= skel_fchmod
,
1064 .chown_fn
= skel_chown
,
1065 .fchown_fn
= skel_fchown
,
1066 .lchown_fn
= skel_lchown
,
1067 .chdir_fn
= skel_chdir
,
1068 .getwd_fn
= skel_getwd
,
1069 .ntimes_fn
= skel_ntimes
,
1070 .ftruncate_fn
= skel_ftruncate
,
1071 .fallocate_fn
= skel_fallocate
,
1072 .lock_fn
= skel_lock
,
1073 .kernel_flock_fn
= skel_kernel_flock
,
1074 .linux_setlease_fn
= skel_linux_setlease
,
1075 .getlock_fn
= skel_getlock
,
1076 .symlink_fn
= skel_symlink
,
1077 .readlink_fn
= skel_vfs_readlink
,
1078 .link_fn
= skel_link
,
1079 .mknod_fn
= skel_mknod
,
1080 .realpath_fn
= skel_realpath
,
1081 .chflags_fn
= skel_chflags
,
1082 .file_id_create_fn
= skel_file_id_create
,
1083 .copy_chunk_send_fn
= skel_copy_chunk_send
,
1084 .copy_chunk_recv_fn
= skel_copy_chunk_recv
,
1085 .get_compression_fn
= skel_get_compression
,
1086 .set_compression_fn
= skel_set_compression
,
1088 .streaminfo_fn
= skel_streaminfo
,
1089 .get_real_filename_fn
= skel_get_real_filename
,
1090 .connectpath_fn
= skel_connectpath
,
1091 .brl_lock_windows_fn
= skel_brl_lock_windows
,
1092 .brl_unlock_windows_fn
= skel_brl_unlock_windows
,
1093 .brl_cancel_windows_fn
= skel_brl_cancel_windows
,
1094 .strict_lock_fn
= skel_strict_lock
,
1095 .strict_unlock_fn
= skel_strict_unlock
,
1096 .translate_name_fn
= skel_translate_name
,
1097 .fsctl_fn
= skel_fsctl
,
1098 .readdir_attr_fn
= skel_readdir_attr
,
1100 /* DOS attributes. */
1101 .get_dos_attributes_fn
= skel_get_dos_attributes
,
1102 .fget_dos_attributes_fn
= skel_fget_dos_attributes
,
1103 .set_dos_attributes_fn
= skel_set_dos_attributes
,
1104 .fset_dos_attributes_fn
= skel_fset_dos_attributes
,
1106 /* NT ACL operations. */
1108 .fget_nt_acl_fn
= skel_fget_nt_acl
,
1109 .get_nt_acl_fn
= skel_get_nt_acl
,
1110 .fset_nt_acl_fn
= skel_fset_nt_acl
,
1112 /* POSIX ACL operations. */
1114 .chmod_acl_fn
= skel_chmod_acl
,
1115 .fchmod_acl_fn
= skel_fchmod_acl
,
1117 .sys_acl_get_file_fn
= skel_sys_acl_get_file
,
1118 .sys_acl_get_fd_fn
= skel_sys_acl_get_fd
,
1119 .sys_acl_blob_get_file_fn
= skel_sys_acl_blob_get_file
,
1120 .sys_acl_blob_get_fd_fn
= skel_sys_acl_blob_get_fd
,
1121 .sys_acl_set_file_fn
= skel_sys_acl_set_file
,
1122 .sys_acl_set_fd_fn
= skel_sys_acl_set_fd
,
1123 .sys_acl_delete_def_file_fn
= skel_sys_acl_delete_def_file
,
1125 /* EA operations. */
1126 .getxattr_fn
= skel_getxattr
,
1127 .fgetxattr_fn
= skel_fgetxattr
,
1128 .listxattr_fn
= skel_listxattr
,
1129 .flistxattr_fn
= skel_flistxattr
,
1130 .removexattr_fn
= skel_removexattr
,
1131 .fremovexattr_fn
= skel_fremovexattr
,
1132 .setxattr_fn
= skel_setxattr
,
1133 .fsetxattr_fn
= skel_fsetxattr
,
1135 /* aio operations */
1136 .aio_force_fn
= skel_aio_force
,
1140 NTSTATUS
vfs_skel_transparent_init(TALLOC_CTX
*ctx
)
1142 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "skel_transparent",
1143 &skel_transparent_fns
);