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 "smbd/proto.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
, 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
,
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
,
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
,
164 return SMB_VFS_NEXT_CREATE_FILE(handle
,
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 static ssize_t
skel_write(vfs_handle_struct
*handle
, files_struct
*fsp
, const void *data
, size_t n
)
199 return SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
202 static ssize_t
skel_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
, const void *data
, size_t n
, off_t offset
)
204 return SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
207 static off_t
skel_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
, off_t offset
, int whence
)
209 return SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
212 static ssize_t
skel_sendfile(vfs_handle_struct
*handle
, int tofd
, files_struct
*fromfsp
, const DATA_BLOB
*hdr
, off_t offset
, size_t n
)
214 return SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
217 static ssize_t
skel_recvfile(vfs_handle_struct
*handle
, int fromfd
, files_struct
*tofsp
, off_t offset
, size_t n
)
219 return SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
222 static int skel_rename(vfs_handle_struct
*handle
,
223 const struct smb_filename
*smb_fname_src
,
224 const struct smb_filename
*smb_fname_dst
)
226 return SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
229 static int skel_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
231 return SMB_VFS_NEXT_FSYNC(handle
, fsp
);
234 static int skel_stat(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
)
236 return SMB_VFS_NEXT_STAT(handle
, smb_fname
);
239 static int skel_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_STRUCT_STAT
*sbuf
)
241 return SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
244 static int skel_lstat(vfs_handle_struct
*handle
, struct smb_filename
*smb_fname
)
246 return SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
249 static uint64_t skel_get_alloc_size(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
)
251 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
254 static int skel_unlink(vfs_handle_struct
*handle
,
255 const struct smb_filename
*smb_fname
)
257 return SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
260 static int skel_chmod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
262 return SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
265 static int skel_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
, mode_t mode
)
267 return SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
270 static int skel_chown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
, gid_t gid
)
272 return SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
275 static int skel_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
, uid_t uid
, gid_t gid
)
277 return SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
280 static int skel_lchown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
, gid_t gid
)
282 return SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
285 static int skel_chdir(vfs_handle_struct
*handle
, const char *path
)
287 return SMB_VFS_NEXT_CHDIR(handle
, path
);
290 static char *skel_getwd(vfs_handle_struct
*handle
)
292 return SMB_VFS_NEXT_GETWD(handle
);
295 static int skel_ntimes(vfs_handle_struct
*handle
,
296 const struct smb_filename
*smb_fname
,
297 struct smb_file_time
*ft
)
299 return SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
302 static int skel_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
, off_t offset
)
304 return SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, offset
);
307 static int skel_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
308 enum vfs_fallocate_mode mode
,
312 return SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
315 static bool skel_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int op
, off_t offset
, off_t count
, int type
)
317 return SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
320 static int skel_kernel_flock(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, uint32 share_mode
, uint32 access_mask
)
322 return SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
325 static int skel_linux_setlease(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int leasetype
)
327 return SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
330 static bool skel_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
, off_t
*poffset
, off_t
*pcount
, int *ptype
, pid_t
*ppid
)
332 return SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
335 static int skel_symlink(vfs_handle_struct
*handle
, const char *oldpath
, const char *newpath
)
337 return SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
340 static int skel_vfs_readlink(vfs_handle_struct
*handle
, const char *path
, char *buf
, size_t bufsiz
)
342 return SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
345 static int skel_link(vfs_handle_struct
*handle
, const char *oldpath
, const char *newpath
)
347 return SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
350 static int skel_mknod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
, SMB_DEV_T dev
)
352 return SMB_VFS_NEXT_MKNOD(handle
, path
, mode
, dev
);
355 static char *skel_realpath(vfs_handle_struct
*handle
, const char *path
)
357 return SMB_VFS_NEXT_REALPATH(handle
, path
);
360 static NTSTATUS
skel_notify_watch(
361 struct vfs_handle_struct
*handle
,
362 struct sys_notify_context
*ctx
,
365 uint32_t *subdir_filter
,
366 void (*callback
)(struct sys_notify_context
*ctx
, void *private_data
,
367 struct notify_event
*ev
),
368 void *private_data
, void *handle_p
)
370 return SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
371 filter
, subdir_filter
, callback
,
372 private_data
, handle_p
);
375 static int skel_chflags(vfs_handle_struct
*handle
, const char *path
, uint flags
)
377 return SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
380 static struct file_id
skel_file_id_create(vfs_handle_struct
*handle
,
381 const SMB_STRUCT_STAT
*sbuf
)
383 return SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
386 static NTSTATUS
skel_streaminfo(struct vfs_handle_struct
*handle
,
387 struct files_struct
*fsp
,
390 unsigned int *num_streams
,
391 struct stream_struct
**streams
)
393 return SMB_VFS_NEXT_STREAMINFO(handle
,
401 static int skel_get_real_filename(struct vfs_handle_struct
*handle
,
407 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle
,
414 static const char *skel_connectpath(struct vfs_handle_struct
*handle
,
415 const char *filename
)
417 return SMB_VFS_NEXT_CONNECTPATH(handle
, filename
);
420 static NTSTATUS
skel_brl_lock_windows(struct vfs_handle_struct
*handle
,
421 struct byte_range_lock
*br_lck
,
422 struct lock_struct
*plock
,
424 struct blocking_lock_record
*blr
)
426 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
,
433 static bool skel_brl_unlock_windows(struct vfs_handle_struct
*handle
,
434 struct messaging_context
*msg_ctx
,
435 struct byte_range_lock
*br_lck
,
436 const struct lock_struct
*plock
)
438 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
,
444 static bool skel_brl_cancel_windows(struct vfs_handle_struct
*handle
,
445 struct byte_range_lock
*br_lck
,
446 struct lock_struct
*plock
,
447 struct blocking_lock_record
*blr
)
449 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
,
455 static bool skel_strict_lock(struct vfs_handle_struct
*handle
,
456 struct files_struct
*fsp
,
457 struct lock_struct
*plock
)
459 return SMB_VFS_NEXT_STRICT_LOCK(handle
,
464 static void skel_strict_unlock(struct vfs_handle_struct
*handle
,
465 struct files_struct
*fsp
,
466 struct lock_struct
*plock
)
468 SMB_VFS_NEXT_STRICT_UNLOCK(handle
,
473 static NTSTATUS
skel_translate_name(struct vfs_handle_struct
*handle
,
474 const char *mapped_name
,
475 enum vfs_translate_direction direction
,
479 return SMB_VFS_NEXT_TRANSLATE_NAME(handle
, mapped_name
, direction
,
480 mem_ctx
, pmapped_name
);
483 static NTSTATUS
skel_fsctl(struct vfs_handle_struct
*handle
,
484 struct files_struct
*fsp
,
487 uint16_t req_flags
, /* Needed for UNICODE ... */
488 const uint8_t *_in_data
,
491 uint32_t max_out_len
,
494 return SMB_VFS_NEXT_FSCTL(handle
,
506 static NTSTATUS
skel_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
507 uint32 security_info
, struct security_descriptor
**ppdesc
)
509 return SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, ppdesc
);
512 static NTSTATUS
skel_get_nt_acl(vfs_handle_struct
*handle
,
513 const char *name
, uint32 security_info
, struct security_descriptor
**ppdesc
)
515 return SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, ppdesc
);
518 static NTSTATUS
skel_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
519 uint32 security_info_sent
, const struct security_descriptor
*psd
)
521 return SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
524 static int skel_chmod_acl(vfs_handle_struct
*handle
, const char *name
, mode_t mode
)
526 return SMB_VFS_NEXT_CHMOD_ACL(handle
, name
, mode
);
529 static int skel_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, mode_t mode
)
531 return SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
534 static int skel_sys_acl_get_entry(vfs_handle_struct
*handle
, SMB_ACL_T theacl
, int entry_id
, SMB_ACL_ENTRY_T
*entry_p
)
536 return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle
, theacl
, entry_id
, entry_p
);
539 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
)
541 return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle
, entry_d
, tag_type_p
);
544 static int skel_sys_acl_get_permset(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry_d
, SMB_ACL_PERMSET_T
*permset_p
)
546 return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle
, entry_d
, permset_p
);
549 static void *skel_sys_acl_get_qualifier(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry_d
)
551 return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle
, entry_d
);
554 static SMB_ACL_T
skel_sys_acl_get_file(vfs_handle_struct
*handle
, const char *path_p
, SMB_ACL_TYPE_T type
)
556 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
);
559 static SMB_ACL_T
skel_sys_acl_get_fd(vfs_handle_struct
*handle
, files_struct
*fsp
)
561 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
);
564 static int skel_sys_acl_clear_perms(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
)
566 return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle
, permset
);
569 static int skel_sys_acl_add_perm(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
571 return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle
, permset
, perm
);
574 static char *skel_sys_acl_to_text(vfs_handle_struct
*handle
, SMB_ACL_T theacl
, ssize_t
*plen
)
576 return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle
, theacl
, plen
);
579 static SMB_ACL_T
skel_sys_acl_init(vfs_handle_struct
*handle
, int count
)
581 return SMB_VFS_NEXT_SYS_ACL_INIT(handle
, count
);
584 static int skel_sys_acl_create_entry(vfs_handle_struct
*handle
, SMB_ACL_T
*pacl
, SMB_ACL_ENTRY_T
*pentry
)
586 return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle
, pacl
, pentry
);
589 static int skel_sys_acl_set_tag_type(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, SMB_ACL_TAG_T tagtype
)
591 return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle
, entry
, tagtype
);
594 static int skel_sys_acl_set_qualifier(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, void *qual
)
596 return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle
, entry
, qual
);
599 static int skel_sys_acl_set_permset(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, SMB_ACL_PERMSET_T permset
)
601 return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle
, entry
, permset
);
604 static int skel_sys_acl_valid(vfs_handle_struct
*handle
, SMB_ACL_T theacl
)
606 return SMB_VFS_NEXT_SYS_ACL_VALID(handle
, theacl
);
609 static int skel_sys_acl_set_file(vfs_handle_struct
*handle
, const char *name
, SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
611 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
, theacl
);
614 static int skel_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_ACL_T theacl
)
616 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
619 static int skel_sys_acl_delete_def_file(vfs_handle_struct
*handle
, const char *path
)
621 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
624 static int skel_sys_acl_get_perm(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
626 return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle
, permset
, perm
);
629 static int skel_sys_acl_free_text(vfs_handle_struct
*handle
, char *text
)
631 return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle
, text
);
634 static int skel_sys_acl_free_acl(vfs_handle_struct
*handle
, SMB_ACL_T posix_acl
)
636 return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle
, posix_acl
);
639 static int skel_sys_acl_free_qualifier(vfs_handle_struct
*handle
, void *qualifier
, SMB_ACL_TAG_T tagtype
)
641 return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle
, qualifier
, tagtype
);
644 static ssize_t
skel_getxattr(vfs_handle_struct
*handle
, const char *path
, const char *name
, void *value
, size_t size
)
646 return SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
649 static ssize_t
skel_fgetxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, void *value
, size_t size
)
651 return SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
654 static ssize_t
skel_listxattr(vfs_handle_struct
*handle
, const char *path
, char *list
, size_t size
)
656 return SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
659 static ssize_t
skel_flistxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
, char *list
, size_t size
)
661 return SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
664 static int skel_removexattr(vfs_handle_struct
*handle
, const char *path
, const char *name
)
666 return SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
669 static int skel_fremovexattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
)
671 return SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
674 static int skel_setxattr(vfs_handle_struct
*handle
, const char *path
, const char *name
, const void *value
, size_t size
, int flags
)
676 return SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
, flags
);
679 static int skel_fsetxattr(vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, const void *value
, size_t size
, int flags
)
681 return SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
684 static int skel_aio_read(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
686 return SMB_VFS_NEXT_AIO_READ(handle
, fsp
, aiocb
);
689 static int skel_aio_write(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
691 return SMB_VFS_NEXT_AIO_WRITE(handle
, fsp
, aiocb
);
694 static ssize_t
skel_aio_return_fn(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
696 return SMB_VFS_NEXT_AIO_RETURN(handle
, fsp
, aiocb
);
699 static int skel_aio_cancel(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
701 return SMB_VFS_NEXT_AIO_CANCEL(handle
, fsp
, aiocb
);
704 static int skel_aio_error_fn(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
706 return SMB_VFS_NEXT_AIO_ERROR(handle
, fsp
, aiocb
);
709 static int skel_aio_fsync(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int op
, SMB_STRUCT_AIOCB
*aiocb
)
711 return SMB_VFS_NEXT_AIO_FSYNC(handle
, fsp
, op
, aiocb
);
714 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
)
716 return SMB_VFS_NEXT_AIO_SUSPEND(handle
, fsp
, aiocb
, n
, ts
);
719 static bool skel_aio_force(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
)
721 return SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
724 static bool skel_is_offline(struct vfs_handle_struct
*handle
, const struct smb_filename
*fname
, SMB_STRUCT_STAT
*sbuf
)
726 return SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
729 static int skel_set_offline(struct vfs_handle_struct
*handle
, const struct smb_filename
*fname
)
731 return SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
734 /* VFS operations structure */
736 struct vfs_fn_pointers skel_transparent_fns
= {
737 /* Disk operations */
739 .connect_fn
= skel_connect
,
740 .disconnect_fn
= skel_disconnect
,
741 .disk_free_fn
= skel_disk_free
,
742 .get_quota_fn
= skel_get_quota
,
743 .set_quota_fn
= skel_set_quota
,
744 .get_shadow_copy_data_fn
= skel_get_shadow_copy_data
,
745 .statvfs_fn
= skel_statvfs
,
746 .fs_capabilities_fn
= skel_fs_capabilities
,
747 .get_dfs_referrals_fn
= skel_get_dfs_referrals
,
749 /* Directory operations */
751 .opendir_fn
= skel_opendir
,
752 .fdopendir_fn
= skel_fdopendir
,
753 .readdir_fn
= skel_readdir
,
754 .seekdir_fn
= skel_seekdir
,
755 .telldir_fn
= skel_telldir
,
756 .rewind_dir_fn
= skel_rewind_dir
,
757 .mkdir_fn
= skel_mkdir
,
758 .rmdir_fn
= skel_rmdir
,
759 .closedir_fn
= skel_closedir
,
760 .init_search_op_fn
= skel_init_search_op
,
762 /* File operations */
764 .open_fn
= skel_open
,
765 .create_file_fn
= skel_create_file
,
766 .close_fn
= skel_close_fn
,
767 .read_fn
= skel_vfs_read
,
768 .pread_fn
= skel_pread
,
769 .write_fn
= skel_write
,
770 .pwrite_fn
= skel_pwrite
,
771 .lseek_fn
= skel_lseek
,
772 .sendfile_fn
= skel_sendfile
,
773 .recvfile_fn
= skel_recvfile
,
774 .rename_fn
= skel_rename
,
775 .fsync_fn
= skel_fsync
,
776 .stat_fn
= skel_stat
,
777 .fstat_fn
= skel_fstat
,
778 .lstat_fn
= skel_lstat
,
779 .get_alloc_size_fn
= skel_get_alloc_size
,
780 .unlink_fn
= skel_unlink
,
781 .chmod_fn
= skel_chmod
,
782 .fchmod_fn
= skel_fchmod
,
783 .chown_fn
= skel_chown
,
784 .fchown_fn
= skel_fchown
,
785 .lchown_fn
= skel_lchown
,
786 .chdir_fn
= skel_chdir
,
787 .getwd_fn
= skel_getwd
,
788 .ntimes_fn
= skel_ntimes
,
789 .ftruncate_fn
= skel_ftruncate
,
790 .fallocate_fn
= skel_fallocate
,
791 .lock_fn
= skel_lock
,
792 .kernel_flock_fn
= skel_kernel_flock
,
793 .linux_setlease_fn
= skel_linux_setlease
,
794 .getlock_fn
= skel_getlock
,
795 .symlink_fn
= skel_symlink
,
796 .readlink_fn
= skel_vfs_readlink
,
797 .link_fn
= skel_link
,
798 .mknod_fn
= skel_mknod
,
799 .realpath_fn
= skel_realpath
,
800 .notify_watch_fn
= skel_notify_watch
,
801 .chflags_fn
= skel_chflags
,
802 .file_id_create_fn
= skel_file_id_create
,
804 .streaminfo_fn
= skel_streaminfo
,
805 .get_real_filename_fn
= skel_get_real_filename
,
806 .connectpath_fn
= skel_connectpath
,
807 .brl_lock_windows_fn
= skel_brl_lock_windows
,
808 .brl_unlock_windows_fn
= skel_brl_unlock_windows
,
809 .brl_cancel_windows_fn
= skel_brl_cancel_windows
,
810 .strict_lock_fn
= skel_strict_lock
,
811 .strict_unlock_fn
= skel_strict_unlock
,
812 .translate_name_fn
= skel_translate_name
,
813 .fsctl_fn
= skel_fsctl
,
815 /* NT ACL operations. */
817 .fget_nt_acl_fn
= skel_fget_nt_acl
,
818 .get_nt_acl_fn
= skel_get_nt_acl
,
819 .fset_nt_acl_fn
= skel_fset_nt_acl
,
821 /* POSIX ACL operations. */
823 .chmod_acl_fn
= skel_chmod_acl
,
824 .fchmod_acl_fn
= skel_fchmod_acl
,
826 .sys_acl_get_entry_fn
= skel_sys_acl_get_entry
,
827 .sys_acl_get_tag_type_fn
= skel_sys_acl_get_tag_type
,
828 .sys_acl_get_permset_fn
= skel_sys_acl_get_permset
,
829 .sys_acl_get_qualifier_fn
= skel_sys_acl_get_qualifier
,
830 .sys_acl_get_file_fn
= skel_sys_acl_get_file
,
831 .sys_acl_get_fd_fn
= skel_sys_acl_get_fd
,
832 .sys_acl_clear_perms_fn
= skel_sys_acl_clear_perms
,
833 .sys_acl_add_perm_fn
= skel_sys_acl_add_perm
,
834 .sys_acl_to_text_fn
= skel_sys_acl_to_text
,
835 .sys_acl_init_fn
= skel_sys_acl_init
,
836 .sys_acl_create_entry_fn
= skel_sys_acl_create_entry
,
837 .sys_acl_set_tag_type_fn
= skel_sys_acl_set_tag_type
,
838 .sys_acl_set_qualifier_fn
= skel_sys_acl_set_qualifier
,
839 .sys_acl_set_permset_fn
= skel_sys_acl_set_permset
,
840 .sys_acl_valid_fn
= skel_sys_acl_valid
,
841 .sys_acl_set_file_fn
= skel_sys_acl_set_file
,
842 .sys_acl_set_fd_fn
= skel_sys_acl_set_fd
,
843 .sys_acl_delete_def_file_fn
= skel_sys_acl_delete_def_file
,
844 .sys_acl_get_perm_fn
= skel_sys_acl_get_perm
,
845 .sys_acl_free_text_fn
= skel_sys_acl_free_text
,
846 .sys_acl_free_acl_fn
= skel_sys_acl_free_acl
,
847 .sys_acl_free_qualifier_fn
= skel_sys_acl_free_qualifier
,
850 .getxattr_fn
= skel_getxattr
,
851 .fgetxattr_fn
= skel_fgetxattr
,
852 .listxattr_fn
= skel_listxattr
,
853 .flistxattr_fn
= skel_flistxattr
,
854 .removexattr_fn
= skel_removexattr
,
855 .fremovexattr_fn
= skel_fremovexattr
,
856 .setxattr_fn
= skel_setxattr
,
857 .fsetxattr_fn
= skel_fsetxattr
,
860 .aio_read_fn
= skel_aio_read
,
861 .aio_write_fn
= skel_aio_write
,
862 .aio_return_fn
= skel_aio_return_fn
,
863 .aio_cancel_fn
= skel_aio_cancel
,
864 .aio_error_fn
= skel_aio_error_fn
,
865 .aio_fsync_fn
= skel_aio_fsync
,
866 .aio_suspend_fn
= skel_aio_suspend
,
867 .aio_force_fn
= skel_aio_force
,
869 /* offline operations */
870 .is_offline_fn
= skel_is_offline
,
871 .set_offline_fn
= skel_set_offline
874 NTSTATUS
vfs_skel_transparent_init(void)
876 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "skel_transparent", &skel_transparent_fns
);