2 Unix SMB/CIFS implementation.
3 Wrap disk only vfs functions to sidestep dodgy compilers.
4 Copyright (C) Tim Potter 1998
5 Copyright (C) Jeremy Allison 2007
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #define DBGC_CLASS DBGC_VFS
26 /* Check for NULL pointer parameters in vfswrap_* functions */
28 /* We don't want to have NULL function pointers lying around. Someone
29 is sure to try and execute them. These stubs are used to prevent
32 static int vfswrap_connect(vfs_handle_struct *handle, const char *service, const char *user)
34 return 0; /* Return >= 0 for success */
37 static void vfswrap_disconnect(vfs_handle_struct *handle)
43 static uint64_t vfswrap_disk_free(vfs_handle_struct *handle, const char *path, bool small_query, uint64_t *bsize,
44 uint64_t *dfree, uint64_t *dsize)
48 result = sys_disk_free(handle->conn, path, small_query, bsize, dfree, dsize);
52 static int vfswrap_get_quota(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
54 #ifdef HAVE_SYS_QUOTAS
57 START_PROFILE(syscall_get_quota);
58 result = sys_get_quota(handle->conn->connectpath, qtype, id, qt);
59 END_PROFILE(syscall_get_quota);
67 static int vfswrap_set_quota(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
69 #ifdef HAVE_SYS_QUOTAS
72 START_PROFILE(syscall_set_quota);
73 result = sys_set_quota(handle->conn->connectpath, qtype, id, qt);
74 END_PROFILE(syscall_set_quota);
82 static int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
85 return -1; /* Not implemented. */
88 static int vfswrap_statvfs(struct vfs_handle_struct *handle, const char *path, vfs_statvfs_struct *statbuf)
90 return sys_statvfs(path, statbuf);
93 static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle,
94 enum timestamp_set_resolution *p_ts_res)
96 connection_struct *conn = handle->conn;
97 uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
98 struct smb_filename *smb_fname_cpath = NULL;
102 #if defined(DARWINOS)
103 struct vfs_statvfs_struct statbuf;
104 ZERO_STRUCT(statbuf);
105 sys_statvfs(conn->connectpath, &statbuf);
106 caps = statbuf.FsCapabilities;
109 *p_ts_res = TIMESTAMP_SET_SECONDS;
111 /* Work out what timestamp resolution we can
112 * use when setting a timestamp. */
114 status = create_synthetic_smb_fname(talloc_tos(),
119 if (!NT_STATUS_IS_OK(status)) {
123 ret = SMB_VFS_STAT(conn, smb_fname_cpath);
125 TALLOC_FREE(smb_fname_cpath);
129 if (smb_fname_cpath->st.st_ex_mtime.tv_nsec ||
130 smb_fname_cpath->st.st_ex_atime.tv_nsec ||
131 smb_fname_cpath->st.st_ex_ctime.tv_nsec) {
132 /* If any of the normal UNIX directory timestamps
133 * have a non-zero tv_nsec component assume
134 * we might be able to set sub-second timestamps.
135 * See what filetime set primitives we have.
137 #if defined(HAVE_UTIMENSAT)
138 *p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
139 #elif defined(HAVE_UTIMES)
140 /* utimes allows msec timestamps to be set. */
141 *p_ts_res = TIMESTAMP_SET_MSEC;
142 #elif defined(HAVE_UTIME)
143 /* utime only allows sec timestamps to be set. */
144 *p_ts_res = TIMESTAMP_SET_SECONDS;
147 DEBUG(10,("vfswrap_fs_capabilities: timestamp "
149 "available on share %s, directory %s\n",
150 *p_ts_res == TIMESTAMP_SET_MSEC ? "msec" : "sec",
151 lp_servicename(conn->params->service),
152 conn->connectpath ));
154 TALLOC_FREE(smb_fname_cpath);
158 /* Directory operations */
160 static SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
162 SMB_STRUCT_DIR *result;
164 START_PROFILE(syscall_opendir);
165 result = sys_opendir(fname);
166 END_PROFILE(syscall_opendir);
170 static SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle,
171 SMB_STRUCT_DIR *dirp,
172 SMB_STRUCT_STAT *sbuf)
174 SMB_STRUCT_DIRENT *result;
176 START_PROFILE(syscall_readdir);
177 result = sys_readdir(dirp);
178 /* Default Posix readdir() does not give us stat info.
179 * Set to invalid to indicate we didn't return this info. */
181 SET_STAT_INVALID(*sbuf);
182 END_PROFILE(syscall_readdir);
186 static void vfswrap_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset)
188 START_PROFILE(syscall_seekdir);
189 sys_seekdir(dirp, offset);
190 END_PROFILE(syscall_seekdir);
193 static long vfswrap_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
196 START_PROFILE(syscall_telldir);
197 result = sys_telldir(dirp);
198 END_PROFILE(syscall_telldir);
202 static void vfswrap_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
204 START_PROFILE(syscall_rewinddir);
206 END_PROFILE(syscall_rewinddir);
209 static int vfswrap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
212 bool has_dacl = False;
215 START_PROFILE(syscall_mkdir);
217 if (lp_inherit_acls(SNUM(handle->conn))
218 && parent_dirname(talloc_tos(), path, &parent, NULL)
219 && (has_dacl = directory_has_default_acl(handle->conn, parent)))
220 mode = (0777 & lp_dir_mask(SNUM(handle->conn)));
224 result = mkdir(path, mode);
226 if (result == 0 && !has_dacl) {
228 * We need to do this as the default behavior of POSIX ACLs
229 * is to set the mask to be the requested group permission
230 * bits, not the group permission bits to be the requested
231 * group permission bits. This is not what we want, as it will
232 * mess up any inherited ACL bits that were set. JRA.
234 int saved_errno = errno; /* We may get ENOSYS */
235 if ((SMB_VFS_CHMOD_ACL(handle->conn, path, mode) == -1) && (errno == ENOSYS))
239 END_PROFILE(syscall_mkdir);
243 static int vfswrap_rmdir(vfs_handle_struct *handle, const char *path)
247 START_PROFILE(syscall_rmdir);
248 result = rmdir(path);
249 END_PROFILE(syscall_rmdir);
253 static int vfswrap_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
257 START_PROFILE(syscall_closedir);
258 result = sys_closedir(dirp);
259 END_PROFILE(syscall_closedir);
263 static void vfswrap_init_search_op(vfs_handle_struct *handle,
264 SMB_STRUCT_DIR *dirp)
266 /* Default behavior is a NOOP */
269 /* File operations */
271 static int vfswrap_open(vfs_handle_struct *handle,
272 struct smb_filename *smb_fname,
273 files_struct *fsp, int flags, mode_t mode)
277 START_PROFILE(syscall_open);
279 if (smb_fname->stream_name) {
284 result = sys_open(smb_fname->base_name, flags, mode);
286 END_PROFILE(syscall_open);
290 static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
291 struct smb_request *req,
292 uint16_t root_dir_fid,
293 struct smb_filename *smb_fname,
294 uint32_t access_mask,
295 uint32_t share_access,
296 uint32_t create_disposition,
297 uint32_t create_options,
298 uint32_t file_attributes,
299 uint32_t oplock_request,
300 uint64_t allocation_size,
301 uint32_t private_flags,
302 struct security_descriptor *sd,
303 struct ea_list *ea_list,
304 files_struct **result,
307 return create_file_default(handle->conn, req, root_dir_fid, smb_fname,
308 access_mask, share_access,
309 create_disposition, create_options,
310 file_attributes, oplock_request,
311 allocation_size, private_flags,
316 static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp)
320 START_PROFILE(syscall_close);
321 result = fd_close_posix(fsp);
322 END_PROFILE(syscall_close);
326 static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
330 START_PROFILE_BYTES(syscall_read, n);
331 result = sys_read(fsp->fh->fd, data, n);
332 END_PROFILE(syscall_read);
336 static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data,
337 size_t n, SMB_OFF_T offset)
341 #if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
342 START_PROFILE_BYTES(syscall_pread, n);
343 result = sys_pread(fsp->fh->fd, data, n, offset);
344 END_PROFILE(syscall_pread);
346 if (result == -1 && errno == ESPIPE) {
347 /* Maintain the fiction that pipes can be seeked (sought?) on. */
348 result = SMB_VFS_READ(fsp, data, n);
352 #else /* HAVE_PREAD */
356 curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
357 if (curr == -1 && errno == ESPIPE) {
358 /* Maintain the fiction that pipes can be seeked (sought?) on. */
359 result = SMB_VFS_READ(fsp, data, n);
364 if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
369 result = SMB_VFS_READ(fsp, data, n);
372 SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
375 #endif /* HAVE_PREAD */
380 static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
384 START_PROFILE_BYTES(syscall_write, n);
385 result = sys_write(fsp->fh->fd, data, n);
386 END_PROFILE(syscall_write);
390 static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data,
391 size_t n, SMB_OFF_T offset)
395 #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
396 START_PROFILE_BYTES(syscall_pwrite, n);
397 result = sys_pwrite(fsp->fh->fd, data, n, offset);
398 END_PROFILE(syscall_pwrite);
400 if (result == -1 && errno == ESPIPE) {
401 /* Maintain the fiction that pipes can be sought on. */
402 result = SMB_VFS_WRITE(fsp, data, n);
405 #else /* HAVE_PWRITE */
409 curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
414 if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
418 result = SMB_VFS_WRITE(fsp, data, n);
421 SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
424 #endif /* HAVE_PWRITE */
429 static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
431 SMB_OFF_T result = 0;
433 START_PROFILE(syscall_lseek);
435 /* Cope with 'stat' file opens. */
436 if (fsp->fh->fd != -1)
437 result = sys_lseek(fsp->fh->fd, offset, whence);
440 * We want to maintain the fiction that we can seek
441 * on a fifo for file system purposes. This allows
442 * people to set up UNIX fifo's that feed data to Windows
446 if((result == -1) && (errno == ESPIPE)) {
451 END_PROFILE(syscall_lseek);
455 static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr,
456 SMB_OFF_T offset, size_t n)
460 START_PROFILE_BYTES(syscall_sendfile, n);
461 result = sys_sendfile(tofd, fromfsp->fh->fd, hdr, offset, n);
462 END_PROFILE(syscall_sendfile);
466 static ssize_t vfswrap_recvfile(vfs_handle_struct *handle,
474 START_PROFILE_BYTES(syscall_recvfile, n);
475 result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n);
476 END_PROFILE(syscall_recvfile);
480 static int vfswrap_rename(vfs_handle_struct *handle,
481 const struct smb_filename *smb_fname_src,
482 const struct smb_filename *smb_fname_dst)
486 START_PROFILE(syscall_rename);
488 if (smb_fname_src->stream_name || smb_fname_dst->stream_name) {
493 result = rename(smb_fname_src->base_name, smb_fname_dst->base_name);
496 END_PROFILE(syscall_rename);
500 static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
505 START_PROFILE(syscall_fsync);
506 result = fsync(fsp->fh->fd);
507 END_PROFILE(syscall_fsync);
514 static int vfswrap_stat(vfs_handle_struct *handle,
515 struct smb_filename *smb_fname)
519 START_PROFILE(syscall_stat);
521 if (smb_fname->stream_name) {
526 result = sys_stat(smb_fname->base_name, &smb_fname->st,
527 lp_fake_dir_create_times(SNUM(handle->conn)));
529 END_PROFILE(syscall_stat);
533 static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
537 START_PROFILE(syscall_fstat);
538 result = sys_fstat(fsp->fh->fd,
539 sbuf, lp_fake_dir_create_times(SNUM(handle->conn)));
540 END_PROFILE(syscall_fstat);
544 static int vfswrap_lstat(vfs_handle_struct *handle,
545 struct smb_filename *smb_fname)
549 START_PROFILE(syscall_lstat);
551 if (smb_fname->stream_name) {
556 result = sys_lstat(smb_fname->base_name, &smb_fname->st,
557 lp_fake_dir_create_times(SNUM(handle->conn)));
559 END_PROFILE(syscall_lstat);
563 static NTSTATUS vfswrap_translate_name(struct vfs_handle_struct *handle,
565 enum vfs_translate_direction direction,
569 return NT_STATUS_NONE_MAPPED;
572 /********************************************************************
573 Given a stat buffer return the allocated size on disk, taking into
574 account sparse files.
575 ********************************************************************/
576 static uint64_t vfswrap_get_alloc_size(vfs_handle_struct *handle,
577 struct files_struct *fsp,
578 const SMB_STRUCT_STAT *sbuf)
582 START_PROFILE(syscall_get_alloc_size);
584 if(S_ISDIR(sbuf->st_ex_mode)) {
589 #if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
590 result = (uint64_t)STAT_ST_BLOCKSIZE * (uint64_t)sbuf->st_ex_blocks;
592 result = get_file_size_stat(sbuf);
595 if (fsp && fsp->initial_allocation_size)
596 result = MAX(result,fsp->initial_allocation_size);
598 result = smb_roundup(handle->conn, result);
601 END_PROFILE(syscall_get_alloc_size);
605 static int vfswrap_unlink(vfs_handle_struct *handle,
606 const struct smb_filename *smb_fname)
610 START_PROFILE(syscall_unlink);
612 if (smb_fname->stream_name) {
616 result = unlink(smb_fname->base_name);
619 END_PROFILE(syscall_unlink);
623 static int vfswrap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
627 START_PROFILE(syscall_chmod);
630 * We need to do this due to the fact that the default POSIX ACL
631 * chmod modifies the ACL *mask* for the group owner, not the
632 * group owner bits directly. JRA.
637 int saved_errno = errno; /* We might get ENOSYS */
638 if ((result = SMB_VFS_CHMOD_ACL(handle->conn, path, mode)) == 0) {
639 END_PROFILE(syscall_chmod);
642 /* Error - return the old errno. */
646 result = chmod(path, mode);
647 END_PROFILE(syscall_chmod);
651 static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
655 START_PROFILE(syscall_fchmod);
658 * We need to do this due to the fact that the default POSIX ACL
659 * chmod modifies the ACL *mask* for the group owner, not the
660 * group owner bits directly. JRA.
664 int saved_errno = errno; /* We might get ENOSYS */
665 if ((result = SMB_VFS_FCHMOD_ACL(fsp, mode)) == 0) {
666 END_PROFILE(syscall_fchmod);
669 /* Error - return the old errno. */
673 #if defined(HAVE_FCHMOD)
674 result = fchmod(fsp->fh->fd, mode);
680 END_PROFILE(syscall_fchmod);
684 static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
688 START_PROFILE(syscall_chown);
689 result = chown(path, uid, gid);
690 END_PROFILE(syscall_chown);
694 static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
699 START_PROFILE(syscall_fchown);
700 result = fchown(fsp->fh->fd, uid, gid);
701 END_PROFILE(syscall_fchown);
709 static int vfswrap_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
713 START_PROFILE(syscall_lchown);
714 result = lchown(path, uid, gid);
715 END_PROFILE(syscall_lchown);
719 static int vfswrap_chdir(vfs_handle_struct *handle, const char *path)
723 START_PROFILE(syscall_chdir);
724 result = chdir(path);
725 END_PROFILE(syscall_chdir);
729 static char *vfswrap_getwd(vfs_handle_struct *handle, char *path)
733 START_PROFILE(syscall_getwd);
734 result = sys_getwd(path);
735 END_PROFILE(syscall_getwd);
739 /*********************************************************************
740 nsec timestamp resolution call. Convert down to whatever the underlying
742 **********************************************************************/
744 static int vfswrap_ntimes(vfs_handle_struct *handle,
745 const struct smb_filename *smb_fname,
746 struct smb_file_time *ft)
750 START_PROFILE(syscall_ntimes);
752 if (smb_fname->stream_name) {
758 if (null_timespec(ft->atime)) {
759 ft->atime= smb_fname->st.st_ex_atime;
762 if (null_timespec(ft->mtime)) {
763 ft->mtime = smb_fname->st.st_ex_mtime;
766 if (!null_timespec(ft->create_time)) {
767 set_create_timespec_ea(handle->conn,
772 if ((timespec_compare(&ft->atime,
773 &smb_fname->st.st_ex_atime) == 0) &&
774 (timespec_compare(&ft->mtime,
775 &smb_fname->st.st_ex_mtime) == 0)) {
780 #if defined(HAVE_UTIMENSAT)
782 struct timespec ts[2];
785 result = utimensat(AT_FDCWD, smb_fname->base_name, ts, 0);
787 result = utimensat(AT_FDCWD, smb_fname->base_name, NULL, 0);
789 if (!((result == -1) && (errno == ENOSYS))) {
793 #if defined(HAVE_UTIMES)
795 struct timeval tv[2];
796 tv[0] = convert_timespec_to_timeval(ft->atime);
797 tv[1] = convert_timespec_to_timeval(ft->mtime);
798 result = utimes(smb_fname->base_name, tv);
800 result = utimes(smb_fname->base_name, NULL);
802 if (!((result == -1) && (errno == ENOSYS))) {
806 #if defined(HAVE_UTIME)
808 struct utimbuf times;
809 times.actime = convert_timespec_to_time_t(ft->atime);
810 times.modtime = convert_timespec_to_time_t(ft->mtime);
811 result = utime(smb_fname->base_name, ×);
813 result = utime(smb_fname->base_name, NULL);
815 if (!((result == -1) && (errno == ENOSYS))) {
823 END_PROFILE(syscall_ntimes);
827 /*********************************************************************
828 A version of ftruncate that will write the space on disk if strict
830 **********************************************************************/
832 static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
834 SMB_OFF_T space_to_write;
835 uint64_t space_avail;
836 uint64_t bsize,dfree,dsize;
839 SMB_STRUCT_STAT *pst;
841 status = vfs_stat_fsp(fsp);
842 if (!NT_STATUS_IS_OK(status)) {
845 pst = &fsp->fsp_name->st;
848 if (S_ISFIFO(pst->st_ex_mode))
852 if (pst->st_ex_size == len)
855 /* Shrink - just ftruncate. */
856 if (pst->st_ex_size > len)
857 return sys_ftruncate(fsp->fh->fd, len);
859 space_to_write = len - pst->st_ex_size;
861 /* for allocation try fallocate first. This can fail on some
862 platforms e.g. when the filesystem doesn't support it and no
863 emulation is being done by the libc (like on AIX with JFS1). In that
864 case we do our own emulation. fallocate implementations can
865 return ENOTSUP or EINVAL in cases like that. */
866 ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_EXTEND_SIZE,
867 pst->st_ex_size, space_to_write);
875 DEBUG(10,("strict_allocate_ftruncate: SMB_VFS_FALLOCATE failed with "
876 "error %d. Falling back to slow manual allocation\n", ret));
878 /* available disk space is enough or not? */
879 space_avail = get_dfree_info(fsp->conn,
880 fsp->fsp_name->base_name, false,
881 &bsize,&dfree,&dsize);
882 /* space_avail is 1k blocks */
883 if (space_avail == (uint64_t)-1 ||
884 ((uint64_t)space_to_write/1024 > space_avail) ) {
889 /* Write out the real space on disk. */
890 ret = vfs_slow_fallocate(fsp, pst->st_ex_size, space_to_write);
899 static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
902 SMB_STRUCT_STAT *pst;
906 START_PROFILE(syscall_ftruncate);
908 if (lp_strict_allocate(SNUM(fsp->conn)) && !fsp->is_sparse) {
909 result = strict_allocate_ftruncate(handle, fsp, len);
910 END_PROFILE(syscall_ftruncate);
914 /* we used to just check HAVE_FTRUNCATE_EXTEND and only use
915 sys_ftruncate if the system supports it. Then I discovered that
916 you can have some filesystems that support ftruncate
917 expansion and some that don't! On Linux fat can't do
918 ftruncate extend but ext2 can. */
920 result = sys_ftruncate(fsp->fh->fd, len);
924 /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
925 extend a file with ftruncate. Provide alternate implementation
928 /* Do an fstat to see if the file is longer than the requested
929 size in which case the ftruncate above should have
930 succeeded or shorter, in which case seek to len - 1 and
931 write 1 byte of zero */
932 status = vfs_stat_fsp(fsp);
933 if (!NT_STATUS_IS_OK(status)) {
936 pst = &fsp->fsp_name->st;
939 if (S_ISFIFO(pst->st_ex_mode)) {
945 if (pst->st_ex_size == len) {
950 if (pst->st_ex_size > len) {
951 /* the sys_ftruncate should have worked */
955 if (SMB_VFS_PWRITE(fsp, &c, 1, len-1)!=1) {
963 END_PROFILE(syscall_ftruncate);
967 static int vfswrap_fallocate(vfs_handle_struct *handle,
969 enum vfs_fallocate_mode mode,
975 START_PROFILE(syscall_fallocate);
976 if (mode == VFS_FALLOCATE_EXTEND_SIZE) {
977 result = sys_posix_fallocate(fsp->fh->fd, offset, len);
978 } else if (mode == VFS_FALLOCATE_KEEP_SIZE) {
979 result = sys_fallocate(fsp->fh->fd, mode, offset, len);
984 END_PROFILE(syscall_fallocate);
988 static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
992 START_PROFILE(syscall_fcntl_lock);
993 result = fcntl_lock(fsp->fh->fd, op, offset, count, type);
994 END_PROFILE(syscall_fcntl_lock);
998 static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
999 uint32 share_mode, uint32 access_mask)
1001 START_PROFILE(syscall_kernel_flock);
1002 kernel_flock(fsp->fh->fd, share_mode, access_mask);
1003 END_PROFILE(syscall_kernel_flock);
1007 static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
1011 START_PROFILE(syscall_fcntl_getlock);
1012 result = fcntl_getlock(fsp->fh->fd, poffset, pcount, ptype, ppid);
1013 END_PROFILE(syscall_fcntl_getlock);
1017 static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
1022 START_PROFILE(syscall_linux_setlease);
1024 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
1025 /* first set the signal handler */
1026 if(linux_set_lease_sighandler(fsp->fh->fd) == -1) {
1030 result = linux_setlease(fsp->fh->fd, leasetype);
1034 END_PROFILE(syscall_linux_setlease);
1038 static int vfswrap_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
1042 START_PROFILE(syscall_symlink);
1043 result = symlink(oldpath, newpath);
1044 END_PROFILE(syscall_symlink);
1048 static int vfswrap_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz)
1052 START_PROFILE(syscall_readlink);
1053 result = readlink(path, buf, bufsiz);
1054 END_PROFILE(syscall_readlink);
1058 static int vfswrap_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
1062 START_PROFILE(syscall_link);
1063 result = link(oldpath, newpath);
1064 END_PROFILE(syscall_link);
1068 static int vfswrap_mknod(vfs_handle_struct *handle, const char *pathname, mode_t mode, SMB_DEV_T dev)
1072 START_PROFILE(syscall_mknod);
1073 result = sys_mknod(pathname, mode, dev);
1074 END_PROFILE(syscall_mknod);
1078 static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path)
1082 START_PROFILE(syscall_realpath);
1083 #ifdef REALPATH_TAKES_NULL
1084 result = realpath(path, NULL);
1086 result = SMB_MALLOC_ARRAY(char, PATH_MAX+1);
1088 char *resolved_path = realpath(path, result);
1089 if (!resolved_path) {
1092 /* SMB_ASSERT(result == resolved_path) ? */
1093 result = resolved_path;
1097 END_PROFILE(syscall_realpath);
1101 static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
1102 struct sys_notify_context *ctx,
1103 struct notify_entry *e,
1104 void (*callback)(struct sys_notify_context *ctx,
1106 struct notify_event *ev),
1107 void *private_data, void *handle)
1110 * So far inotify is the only supported default notify mechanism. If
1111 * another platform like the the BSD's or a proprietary Unix comes
1112 * along and wants another default, we can play the same trick we
1113 * played with Posix ACLs.
1115 * Until that is the case, hard-code inotify here.
1118 if (lp_kernel_change_notify(ctx->conn->params)) {
1119 return inotify_watch(ctx, e, callback, private_data, handle);
1123 * Do nothing, leave everything to notify_internal.c
1125 return NT_STATUS_OK;
1128 static int vfswrap_chflags(vfs_handle_struct *handle, const char *path,
1132 return chflags(path, flags);
1139 static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle,
1140 const SMB_STRUCT_STAT *sbuf)
1144 /* the ZERO_STRUCT ensures padding doesn't break using the key as a
1148 key.devid = sbuf->st_ex_dev;
1149 key.inode = sbuf->st_ex_ino;
1150 /* key.extid is unused by default. */
1155 static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
1156 struct files_struct *fsp,
1158 TALLOC_CTX *mem_ctx,
1159 unsigned int *pnum_streams,
1160 struct stream_struct **pstreams)
1162 SMB_STRUCT_STAT sbuf;
1163 unsigned int num_streams = 0;
1164 struct stream_struct *streams = NULL;
1167 if ((fsp != NULL) && (fsp->is_directory)) {
1169 * No default streams on directories
1174 if ((fsp != NULL) && (fsp->fh->fd != -1)) {
1175 ret = SMB_VFS_FSTAT(fsp, &sbuf);
1178 struct smb_filename smb_fname;
1180 ZERO_STRUCT(smb_fname);
1181 smb_fname.base_name = discard_const_p(char, fname);
1183 if (lp_posix_pathnames()) {
1184 ret = SMB_VFS_LSTAT(handle->conn, &smb_fname);
1186 ret = SMB_VFS_STAT(handle->conn, &smb_fname);
1188 sbuf = smb_fname.st;
1192 return map_nt_error_from_unix(errno);
1195 if (S_ISDIR(sbuf.st_ex_mode)) {
1199 streams = talloc(mem_ctx, struct stream_struct);
1201 if (streams == NULL) {
1202 return NT_STATUS_NO_MEMORY;
1205 streams->size = sbuf.st_ex_size;
1206 streams->alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf);
1208 streams->name = talloc_strdup(streams, "::$DATA");
1209 if (streams->name == NULL) {
1210 TALLOC_FREE(streams);
1211 return NT_STATUS_NO_MEMORY;
1216 *pnum_streams = num_streams;
1217 *pstreams = streams;
1218 return NT_STATUS_OK;
1221 static int vfswrap_get_real_filename(struct vfs_handle_struct *handle,
1224 TALLOC_CTX *mem_ctx,
1228 * Don't fall back to get_real_filename so callers can differentiate
1229 * between a full directory scan and an actual case-insensitive stat.
1235 static const char *vfswrap_connectpath(struct vfs_handle_struct *handle,
1238 return handle->conn->connectpath;
1241 static NTSTATUS vfswrap_brl_lock_windows(struct vfs_handle_struct *handle,
1242 struct byte_range_lock *br_lck,
1243 struct lock_struct *plock,
1245 struct blocking_lock_record *blr)
1247 SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
1249 /* Note: blr is not used in the default implementation. */
1250 return brl_lock_windows_default(br_lck, plock, blocking_lock);
1253 static bool vfswrap_brl_unlock_windows(struct vfs_handle_struct *handle,
1254 struct messaging_context *msg_ctx,
1255 struct byte_range_lock *br_lck,
1256 const struct lock_struct *plock)
1258 SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
1260 return brl_unlock_windows_default(msg_ctx, br_lck, plock);
1263 static bool vfswrap_brl_cancel_windows(struct vfs_handle_struct *handle,
1264 struct byte_range_lock *br_lck,
1265 struct lock_struct *plock,
1266 struct blocking_lock_record *blr)
1268 SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
1270 /* Note: blr is not used in the default implementation. */
1271 return brl_lock_cancel_default(br_lck, plock);
1274 static bool vfswrap_strict_lock(struct vfs_handle_struct *handle,
1276 struct lock_struct *plock)
1278 SMB_ASSERT(plock->lock_type == READ_LOCK ||
1279 plock->lock_type == WRITE_LOCK);
1281 return strict_lock_default(fsp, plock);
1284 static void vfswrap_strict_unlock(struct vfs_handle_struct *handle,
1286 struct lock_struct *plock)
1288 SMB_ASSERT(plock->lock_type == READ_LOCK ||
1289 plock->lock_type == WRITE_LOCK);
1291 strict_unlock_default(fsp, plock);
1294 /* NT ACL operations. */
1296 static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle,
1298 uint32 security_info,
1299 struct security_descriptor **ppdesc)
1303 START_PROFILE(fget_nt_acl);
1304 result = posix_fget_nt_acl(fsp, security_info, ppdesc);
1305 END_PROFILE(fget_nt_acl);
1309 static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
1311 uint32 security_info,
1312 struct security_descriptor **ppdesc)
1316 START_PROFILE(get_nt_acl);
1317 result = posix_get_nt_acl(handle->conn, name, security_info, ppdesc);
1318 END_PROFILE(get_nt_acl);
1322 static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd)
1326 START_PROFILE(fset_nt_acl);
1327 result = set_nt_acl(fsp, security_info_sent, psd);
1328 END_PROFILE(fset_nt_acl);
1332 static int vfswrap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode)
1340 START_PROFILE(chmod_acl);
1341 result = chmod_acl(handle->conn, name, mode);
1342 END_PROFILE(chmod_acl);
1347 static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
1355 START_PROFILE(fchmod_acl);
1356 result = fchmod_acl(fsp, mode);
1357 END_PROFILE(fchmod_acl);
1362 static int vfswrap_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
1364 return sys_acl_get_entry(theacl, entry_id, entry_p);
1367 static int vfswrap_sys_acl_get_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
1369 return sys_acl_get_tag_type(entry_d, tag_type_p);
1372 static int vfswrap_sys_acl_get_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
1374 return sys_acl_get_permset(entry_d, permset_p);
1377 static void * vfswrap_sys_acl_get_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d)
1379 return sys_acl_get_qualifier(entry_d);
1382 static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
1384 return sys_acl_get_file(handle, path_p, type);
1387 static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
1389 return sys_acl_get_fd(handle, fsp);
1392 static int vfswrap_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset)
1394 return sys_acl_clear_perms(permset);
1397 static int vfswrap_sys_acl_add_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
1399 return sys_acl_add_perm(permset, perm);
1402 static char * vfswrap_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen)
1404 return sys_acl_to_text(theacl, plen);
1407 static SMB_ACL_T vfswrap_sys_acl_init(vfs_handle_struct *handle, int count)
1409 return sys_acl_init(count);
1412 static int vfswrap_sys_acl_create_entry(vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
1414 return sys_acl_create_entry(pacl, pentry);
1417 static int vfswrap_sys_acl_set_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
1419 return sys_acl_set_tag_type(entry, tagtype);
1422 static int vfswrap_sys_acl_set_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual)
1424 return sys_acl_set_qualifier(entry, qual);
1427 static int vfswrap_sys_acl_set_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
1429 return sys_acl_set_permset(entry, permset);
1432 static int vfswrap_sys_acl_valid(vfs_handle_struct *handle, SMB_ACL_T theacl )
1434 return sys_acl_valid(theacl );
1437 static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
1439 return sys_acl_set_file(handle, name, acltype, theacl);
1442 static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
1444 return sys_acl_set_fd(handle, fsp, theacl);
1447 static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
1449 return sys_acl_delete_def_file(handle, path);
1452 static int vfswrap_sys_acl_get_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
1454 return sys_acl_get_perm(permset, perm);
1457 static int vfswrap_sys_acl_free_text(vfs_handle_struct *handle, char *text)
1459 return sys_acl_free_text(text);
1462 static int vfswrap_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl)
1464 return sys_acl_free_acl(posix_acl);
1467 static int vfswrap_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype)
1469 return sys_acl_free_qualifier(qualifier, tagtype);
1472 /****************************************************************
1473 Extended attribute operations.
1474 *****************************************************************/
1476 static ssize_t vfswrap_getxattr(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size)
1478 return sys_getxattr(path, name, value, size);
1481 static ssize_t vfswrap_lgetxattr(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size)
1483 return sys_lgetxattr(path, name, value, size);
1486 static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
1488 return sys_fgetxattr(fsp->fh->fd, name, value, size);
1491 static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
1493 return sys_listxattr(path, list, size);
1496 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
1498 return sys_llistxattr(path, list, size);
1501 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
1503 return sys_flistxattr(fsp->fh->fd, list, size);
1506 static int vfswrap_removexattr(struct vfs_handle_struct *handle, const char *path, const char *name)
1508 return sys_removexattr(path, name);
1511 static int vfswrap_lremovexattr(struct vfs_handle_struct *handle, const char *path, const char *name)
1513 return sys_lremovexattr(path, name);
1516 static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
1518 return sys_fremovexattr(fsp->fh->fd, name);
1521 static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
1523 return sys_setxattr(path, name, value, size, flags);
1526 static int vfswrap_lsetxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
1528 return sys_lsetxattr(path, name, value, size, flags);
1531 static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
1533 return sys_fsetxattr(fsp->fh->fd, name, value, size, flags);
1536 static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1540 * aio_read must be done as root, because in the glibc aio
1541 * implementation the helper thread needs to be able to send a signal
1542 * to the main thread, even when it has done a seteuid() to a
1546 ret = sys_aio_read(aiocb);
1551 static int vfswrap_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1555 * aio_write must be done as root, because in the glibc aio
1556 * implementation the helper thread needs to be able to send a signal
1557 * to the main thread, even when it has done a seteuid() to a
1561 ret = sys_aio_write(aiocb);
1566 static ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1568 return sys_aio_return(aiocb);
1571 static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1573 return sys_aio_cancel(fsp->fh->fd, aiocb);
1576 static int vfswrap_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1578 return sys_aio_error(aiocb);
1581 static int vfswrap_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb)
1583 return sys_aio_fsync(op, aiocb);
1586 static int vfswrap_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout)
1588 return sys_aio_suspend(aiocb, n, timeout);
1591 static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
1596 static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
1598 if (ISDOT(path) || ISDOTDOT(path)) {
1602 if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) {
1603 #if defined(ENOTSUP)
1609 return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0;
1612 static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *path)
1614 /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */
1615 #if defined(ENOTSUP)
1621 static struct vfs_fn_pointers vfs_default_fns = {
1622 /* Disk operations */
1624 .connect_fn = vfswrap_connect,
1625 .disconnect = vfswrap_disconnect,
1626 .disk_free = vfswrap_disk_free,
1627 .get_quota = vfswrap_get_quota,
1628 .set_quota = vfswrap_set_quota,
1629 .get_shadow_copy_data = vfswrap_get_shadow_copy_data,
1630 .statvfs = vfswrap_statvfs,
1631 .fs_capabilities = vfswrap_fs_capabilities,
1633 /* Directory operations */
1635 .opendir = vfswrap_opendir,
1636 .readdir = vfswrap_readdir,
1637 .seekdir = vfswrap_seekdir,
1638 .telldir = vfswrap_telldir,
1639 .rewind_dir = vfswrap_rewinddir,
1640 .mkdir = vfswrap_mkdir,
1641 .rmdir = vfswrap_rmdir,
1642 .closedir = vfswrap_closedir,
1643 .init_search_op = vfswrap_init_search_op,
1645 /* File operations */
1647 .open = vfswrap_open,
1648 .create_file = vfswrap_create_file,
1649 .close_fn = vfswrap_close,
1650 .vfs_read = vfswrap_read,
1651 .pread = vfswrap_pread,
1652 .write = vfswrap_write,
1653 .pwrite = vfswrap_pwrite,
1654 .lseek = vfswrap_lseek,
1655 .sendfile = vfswrap_sendfile,
1656 .recvfile = vfswrap_recvfile,
1657 .rename = vfswrap_rename,
1658 .fsync = vfswrap_fsync,
1659 .stat = vfswrap_stat,
1660 .fstat = vfswrap_fstat,
1661 .lstat = vfswrap_lstat,
1662 .get_alloc_size = vfswrap_get_alloc_size,
1663 .unlink = vfswrap_unlink,
1664 .chmod = vfswrap_chmod,
1665 .fchmod = vfswrap_fchmod,
1666 .chown = vfswrap_chown,
1667 .fchown = vfswrap_fchown,
1668 .lchown = vfswrap_lchown,
1669 .chdir = vfswrap_chdir,
1670 .getwd = vfswrap_getwd,
1671 .ntimes = vfswrap_ntimes,
1672 .ftruncate = vfswrap_ftruncate,
1673 .fallocate = vfswrap_fallocate,
1674 .lock = vfswrap_lock,
1675 .kernel_flock = vfswrap_kernel_flock,
1676 .linux_setlease = vfswrap_linux_setlease,
1677 .getlock = vfswrap_getlock,
1678 .symlink = vfswrap_symlink,
1679 .vfs_readlink = vfswrap_readlink,
1680 .link = vfswrap_link,
1681 .mknod = vfswrap_mknod,
1682 .realpath = vfswrap_realpath,
1683 .notify_watch = vfswrap_notify_watch,
1684 .chflags = vfswrap_chflags,
1685 .file_id_create = vfswrap_file_id_create,
1686 .streaminfo = vfswrap_streaminfo,
1687 .get_real_filename = vfswrap_get_real_filename,
1688 .connectpath = vfswrap_connectpath,
1689 .brl_lock_windows = vfswrap_brl_lock_windows,
1690 .brl_unlock_windows = vfswrap_brl_unlock_windows,
1691 .brl_cancel_windows = vfswrap_brl_cancel_windows,
1692 .strict_lock = vfswrap_strict_lock,
1693 .strict_unlock = vfswrap_strict_unlock,
1694 .translate_name = vfswrap_translate_name,
1696 /* NT ACL operations. */
1698 .fget_nt_acl = vfswrap_fget_nt_acl,
1699 .get_nt_acl = vfswrap_get_nt_acl,
1700 .fset_nt_acl = vfswrap_fset_nt_acl,
1702 /* POSIX ACL operations. */
1704 .chmod_acl = vfswrap_chmod_acl,
1705 .fchmod_acl = vfswrap_fchmod_acl,
1707 .sys_acl_get_entry = vfswrap_sys_acl_get_entry,
1708 .sys_acl_get_tag_type = vfswrap_sys_acl_get_tag_type,
1709 .sys_acl_get_permset = vfswrap_sys_acl_get_permset,
1710 .sys_acl_get_qualifier = vfswrap_sys_acl_get_qualifier,
1711 .sys_acl_get_file = vfswrap_sys_acl_get_file,
1712 .sys_acl_get_fd = vfswrap_sys_acl_get_fd,
1713 .sys_acl_clear_perms = vfswrap_sys_acl_clear_perms,
1714 .sys_acl_add_perm = vfswrap_sys_acl_add_perm,
1715 .sys_acl_to_text = vfswrap_sys_acl_to_text,
1716 .sys_acl_init = vfswrap_sys_acl_init,
1717 .sys_acl_create_entry = vfswrap_sys_acl_create_entry,
1718 .sys_acl_set_tag_type = vfswrap_sys_acl_set_tag_type,
1719 .sys_acl_set_qualifier = vfswrap_sys_acl_set_qualifier,
1720 .sys_acl_set_permset = vfswrap_sys_acl_set_permset,
1721 .sys_acl_valid = vfswrap_sys_acl_valid,
1722 .sys_acl_set_file = vfswrap_sys_acl_set_file,
1723 .sys_acl_set_fd = vfswrap_sys_acl_set_fd,
1724 .sys_acl_delete_def_file = vfswrap_sys_acl_delete_def_file,
1725 .sys_acl_get_perm = vfswrap_sys_acl_get_perm,
1726 .sys_acl_free_text = vfswrap_sys_acl_free_text,
1727 .sys_acl_free_acl = vfswrap_sys_acl_free_acl,
1728 .sys_acl_free_qualifier = vfswrap_sys_acl_free_qualifier,
1730 /* EA operations. */
1731 .getxattr = vfswrap_getxattr,
1732 .lgetxattr = vfswrap_lgetxattr,
1733 .fgetxattr = vfswrap_fgetxattr,
1734 .listxattr = vfswrap_listxattr,
1735 .llistxattr = vfswrap_llistxattr,
1736 .flistxattr = vfswrap_flistxattr,
1737 .removexattr = vfswrap_removexattr,
1738 .lremovexattr = vfswrap_lremovexattr,
1739 .fremovexattr = vfswrap_fremovexattr,
1740 .setxattr = vfswrap_setxattr,
1741 .lsetxattr = vfswrap_lsetxattr,
1742 .fsetxattr = vfswrap_fsetxattr,
1744 /* aio operations */
1745 .aio_read = vfswrap_aio_read,
1746 .aio_write = vfswrap_aio_write,
1747 .aio_return_fn = vfswrap_aio_return,
1748 .aio_cancel = vfswrap_aio_cancel,
1749 .aio_error_fn = vfswrap_aio_error,
1750 .aio_fsync = vfswrap_aio_fsync,
1751 .aio_suspend = vfswrap_aio_suspend,
1752 .aio_force = vfswrap_aio_force,
1754 /* offline operations */
1755 .is_offline = vfswrap_is_offline,
1756 .set_offline = vfswrap_set_offline
1759 NTSTATUS vfs_default_init(void);
1760 NTSTATUS vfs_default_init(void)
1762 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
1763 DEFAULT_VFS_MODULE_NAME, &vfs_default_fns);