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)
96 struct vfs_statvfs_struct statbuf;
98 sys_statvfs(handle->conn->connectpath, &statbuf);
99 return statbuf.FsCapabilities;
101 return FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
104 /* Directory operations */
106 static SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
108 SMB_STRUCT_DIR *result;
110 START_PROFILE(syscall_opendir);
111 result = sys_opendir(fname);
112 END_PROFILE(syscall_opendir);
116 static SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle,
117 SMB_STRUCT_DIR *dirp,
118 SMB_STRUCT_STAT *sbuf)
120 SMB_STRUCT_DIRENT *result;
122 START_PROFILE(syscall_readdir);
123 result = sys_readdir(dirp);
124 /* Default Posix readdir() does not give us stat info.
125 * Set to invalid to indicate we didn't return this info. */
127 SET_STAT_INVALID(*sbuf);
128 END_PROFILE(syscall_readdir);
132 static void vfswrap_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset)
134 START_PROFILE(syscall_seekdir);
135 sys_seekdir(dirp, offset);
136 END_PROFILE(syscall_seekdir);
139 static long vfswrap_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
142 START_PROFILE(syscall_telldir);
143 result = sys_telldir(dirp);
144 END_PROFILE(syscall_telldir);
148 static void vfswrap_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
150 START_PROFILE(syscall_rewinddir);
152 END_PROFILE(syscall_rewinddir);
155 static int vfswrap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
158 bool has_dacl = False;
161 START_PROFILE(syscall_mkdir);
163 if (lp_inherit_acls(SNUM(handle->conn))
164 && parent_dirname(talloc_tos(), path, &parent, NULL)
165 && (has_dacl = directory_has_default_acl(handle->conn, parent)))
170 result = mkdir(path, mode);
172 if (result == 0 && !has_dacl) {
174 * We need to do this as the default behavior of POSIX ACLs
175 * is to set the mask to be the requested group permission
176 * bits, not the group permission bits to be the requested
177 * group permission bits. This is not what we want, as it will
178 * mess up any inherited ACL bits that were set. JRA.
180 int saved_errno = errno; /* We may get ENOSYS */
181 if ((SMB_VFS_CHMOD_ACL(handle->conn, path, mode) == -1) && (errno == ENOSYS))
185 END_PROFILE(syscall_mkdir);
189 static int vfswrap_rmdir(vfs_handle_struct *handle, const char *path)
193 START_PROFILE(syscall_rmdir);
194 result = rmdir(path);
195 END_PROFILE(syscall_rmdir);
199 static int vfswrap_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
203 START_PROFILE(syscall_closedir);
204 result = sys_closedir(dirp);
205 END_PROFILE(syscall_closedir);
209 static void vfswrap_init_search_op(vfs_handle_struct *handle,
210 SMB_STRUCT_DIR *dirp)
212 /* Default behavior is a NOOP */
215 /* File operations */
217 static int vfswrap_open(vfs_handle_struct *handle,
218 struct smb_filename *smb_fname,
219 files_struct *fsp, int flags, mode_t mode)
223 START_PROFILE(syscall_open);
225 if (smb_fname->stream_name) {
230 result = sys_open(smb_fname->base_name, flags, mode);
232 END_PROFILE(syscall_open);
236 static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
237 struct smb_request *req,
238 uint16_t root_dir_fid,
239 struct smb_filename *smb_fname,
240 uint32_t access_mask,
241 uint32_t share_access,
242 uint32_t create_disposition,
243 uint32_t create_options,
244 uint32_t file_attributes,
245 uint32_t oplock_request,
246 uint64_t allocation_size,
247 struct security_descriptor *sd,
248 struct ea_list *ea_list,
249 files_struct **result,
252 return create_file_default(handle->conn, req, root_dir_fid, smb_fname,
253 access_mask, share_access,
254 create_disposition, create_options,
255 file_attributes, oplock_request,
256 allocation_size, sd, ea_list, result,
260 static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp)
264 START_PROFILE(syscall_close);
265 result = fd_close_posix(fsp);
266 END_PROFILE(syscall_close);
270 static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
274 START_PROFILE_BYTES(syscall_read, n);
275 result = sys_read(fsp->fh->fd, data, n);
276 END_PROFILE(syscall_read);
280 static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data,
281 size_t n, SMB_OFF_T offset)
285 #if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
286 START_PROFILE_BYTES(syscall_pread, n);
287 result = sys_pread(fsp->fh->fd, data, n, offset);
288 END_PROFILE(syscall_pread);
290 if (result == -1 && errno == ESPIPE) {
291 /* Maintain the fiction that pipes can be seeked (sought?) on. */
292 result = SMB_VFS_READ(fsp, data, n);
296 #else /* HAVE_PREAD */
300 curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
301 if (curr == -1 && errno == ESPIPE) {
302 /* Maintain the fiction that pipes can be seeked (sought?) on. */
303 result = SMB_VFS_READ(fsp, data, n);
308 if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
313 result = SMB_VFS_READ(fsp, data, n);
316 SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
319 #endif /* HAVE_PREAD */
324 static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
328 START_PROFILE_BYTES(syscall_write, n);
329 result = sys_write(fsp->fh->fd, data, n);
330 END_PROFILE(syscall_write);
334 static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data,
335 size_t n, SMB_OFF_T offset)
339 #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
340 START_PROFILE_BYTES(syscall_pwrite, n);
341 result = sys_pwrite(fsp->fh->fd, data, n, offset);
342 END_PROFILE(syscall_pwrite);
344 if (result == -1 && errno == ESPIPE) {
345 /* Maintain the fiction that pipes can be sought on. */
346 result = SMB_VFS_WRITE(fsp, data, n);
349 #else /* HAVE_PWRITE */
353 curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
358 if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
362 result = SMB_VFS_WRITE(fsp, data, n);
365 SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
368 #endif /* HAVE_PWRITE */
373 static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
375 SMB_OFF_T result = 0;
377 START_PROFILE(syscall_lseek);
379 /* Cope with 'stat' file opens. */
380 if (fsp->fh->fd != -1)
381 result = sys_lseek(fsp->fh->fd, offset, whence);
384 * We want to maintain the fiction that we can seek
385 * on a fifo for file system purposes. This allows
386 * people to set up UNIX fifo's that feed data to Windows
390 if((result == -1) && (errno == ESPIPE)) {
395 END_PROFILE(syscall_lseek);
399 static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr,
400 SMB_OFF_T offset, size_t n)
404 START_PROFILE_BYTES(syscall_sendfile, n);
405 result = sys_sendfile(tofd, fromfsp->fh->fd, hdr, offset, n);
406 END_PROFILE(syscall_sendfile);
410 static ssize_t vfswrap_recvfile(vfs_handle_struct *handle,
418 START_PROFILE_BYTES(syscall_recvfile, n);
419 result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n);
420 END_PROFILE(syscall_recvfile);
424 /*********************************************************
425 For rename across filesystems Patch from Warren Birnbaum
426 <warrenb@hpcvscdp.cv.hp.com>
427 **********************************************************/
429 static int copy_reg(const char *source, const char *dest)
431 SMB_STRUCT_STAT source_stats;
436 if (sys_lstat (source, &source_stats) == -1)
439 if (!S_ISREG (source_stats.st_ex_mode))
442 if((ifd = sys_open (source, O_RDONLY, 0)) < 0)
445 if (unlink (dest) && errno != ENOENT)
449 if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
451 if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC , 0600)) < 0 )
455 if (transfer_file(ifd, ofd, (size_t)-1) == -1)
459 * Try to preserve ownership. For non-root it might fail, but that's ok.
460 * But root probably wants to know, e.g. if NFS disallows it.
464 if ((fchown(ofd, source_stats.st_ex_uid, source_stats.st_ex_gid) == -1) && (errno != EPERM))
466 if ((chown(dest, source_stats.st_ex_uid, source_stats.st_ex_gid) == -1) && (errno != EPERM))
471 * fchown turns off set[ug]id bits for non-root,
472 * so do the chmod last.
475 #if defined(HAVE_FCHMOD)
476 if (fchmod (ofd, source_stats.st_ex_mode & 07777))
478 if (chmod (dest, source_stats.st_ex_mode & 07777))
482 if (close (ifd) == -1)
485 if (close (ofd) == -1)
488 /* Try to copy the old file's modtime and access time. */
492 tv.actime = convert_timespec_to_time_t(source_stats.st_ex_atime);
493 tv.modtime = convert_timespec_to_time_t(source_stats.st_ex_mtime);
497 if (unlink (source) == -1)
513 static int vfswrap_rename(vfs_handle_struct *handle,
514 const struct smb_filename *smb_fname_src,
515 const struct smb_filename *smb_fname_dst)
519 START_PROFILE(syscall_rename);
521 if (smb_fname_src->stream_name || smb_fname_dst->stream_name) {
526 result = rename(smb_fname_src->base_name, smb_fname_dst->base_name);
527 if ((result == -1) && (errno == EXDEV)) {
528 /* Rename across filesystems needed. */
529 result = copy_reg(smb_fname_src->base_name,
530 smb_fname_dst->base_name);
534 END_PROFILE(syscall_rename);
538 static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
543 START_PROFILE(syscall_fsync);
544 result = fsync(fsp->fh->fd);
545 END_PROFILE(syscall_fsync);
552 static int vfswrap_stat(vfs_handle_struct *handle,
553 struct smb_filename *smb_fname)
557 START_PROFILE(syscall_stat);
559 if (smb_fname->stream_name) {
564 result = sys_stat(smb_fname->base_name, &smb_fname->st);
566 END_PROFILE(syscall_stat);
570 static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
574 START_PROFILE(syscall_fstat);
575 result = sys_fstat(fsp->fh->fd, sbuf);
576 END_PROFILE(syscall_fstat);
580 static int vfswrap_lstat(vfs_handle_struct *handle,
581 struct smb_filename *smb_fname)
585 START_PROFILE(syscall_lstat);
587 if (smb_fname->stream_name) {
592 result = sys_lstat(smb_fname->base_name, &smb_fname->st);
594 END_PROFILE(syscall_lstat);
598 /********************************************************************
599 Given a stat buffer return the allocated size on disk, taking into
600 account sparse files.
601 ********************************************************************/
602 static uint64_t vfswrap_get_alloc_size(vfs_handle_struct *handle,
603 struct files_struct *fsp,
604 const SMB_STRUCT_STAT *sbuf)
608 START_PROFILE(syscall_get_alloc_size);
610 if(S_ISDIR(sbuf->st_ex_mode)) {
615 #if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
616 result = (uint64_t)STAT_ST_BLOCKSIZE * (uint64_t)sbuf->st_ex_blocks;
618 result = get_file_size_stat(sbuf);
621 if (fsp && fsp->initial_allocation_size)
622 result = MAX(result,fsp->initial_allocation_size);
624 result = smb_roundup(handle->conn, result);
627 END_PROFILE(syscall_get_alloc_size);
631 static int vfswrap_unlink(vfs_handle_struct *handle,
632 const struct smb_filename *smb_fname)
636 START_PROFILE(syscall_unlink);
638 if (smb_fname->stream_name) {
642 result = unlink(smb_fname->base_name);
645 END_PROFILE(syscall_unlink);
649 static int vfswrap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
653 START_PROFILE(syscall_chmod);
656 * We need to do this due to the fact that the default POSIX ACL
657 * chmod modifies the ACL *mask* for the group owner, not the
658 * group owner bits directly. JRA.
663 int saved_errno = errno; /* We might get ENOSYS */
664 if ((result = SMB_VFS_CHMOD_ACL(handle->conn, path, mode)) == 0) {
665 END_PROFILE(syscall_chmod);
668 /* Error - return the old errno. */
672 result = chmod(path, mode);
673 END_PROFILE(syscall_chmod);
677 static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
681 START_PROFILE(syscall_fchmod);
684 * We need to do this due to the fact that the default POSIX ACL
685 * chmod modifies the ACL *mask* for the group owner, not the
686 * group owner bits directly. JRA.
690 int saved_errno = errno; /* We might get ENOSYS */
691 if ((result = SMB_VFS_FCHMOD_ACL(fsp, mode)) == 0) {
692 END_PROFILE(syscall_fchmod);
695 /* Error - return the old errno. */
699 #if defined(HAVE_FCHMOD)
700 result = fchmod(fsp->fh->fd, mode);
706 END_PROFILE(syscall_fchmod);
710 static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
714 START_PROFILE(syscall_chown);
715 result = chown(path, uid, gid);
716 END_PROFILE(syscall_chown);
720 static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
725 START_PROFILE(syscall_fchown);
726 result = fchown(fsp->fh->fd, uid, gid);
727 END_PROFILE(syscall_fchown);
735 static int vfswrap_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
739 START_PROFILE(syscall_lchown);
740 result = lchown(path, uid, gid);
741 END_PROFILE(syscall_lchown);
745 static int vfswrap_chdir(vfs_handle_struct *handle, const char *path)
749 START_PROFILE(syscall_chdir);
750 result = chdir(path);
751 END_PROFILE(syscall_chdir);
755 static char *vfswrap_getwd(vfs_handle_struct *handle, char *path)
759 START_PROFILE(syscall_getwd);
760 result = sys_getwd(path);
761 END_PROFILE(syscall_getwd);
765 /*********************************************************************
766 nsec timestamp resolution call. Convert down to whatever the underlying
768 **********************************************************************/
770 static int vfswrap_ntimes(vfs_handle_struct *handle,
771 const struct smb_filename *smb_fname,
772 struct smb_file_time *ft)
776 START_PROFILE(syscall_ntimes);
778 if (smb_fname->stream_name) {
783 if (null_timespec(ft->atime)) {
784 ft->atime= smb_fname->st.st_ex_atime;
787 if (null_timespec(ft->mtime)) {
788 ft->mtime = smb_fname->st.st_ex_mtime;
791 if ((timespec_compare(&ft->atime,
792 &smb_fname->st.st_ex_atime) == 0) &&
793 (timespec_compare(&ft->mtime,
794 &smb_fname->st.st_ex_mtime) == 0)) {
798 #if defined(HAVE_UTIMES)
800 struct timeval tv[2];
801 tv[0] = convert_timespec_to_timeval(ft->atime);
802 tv[1] = convert_timespec_to_timeval(ft->mtime);
803 result = utimes(smb_fname->base_name, tv);
805 result = utimes(smb_fname->base_name, NULL);
807 #elif defined(HAVE_UTIME)
809 struct utimbuf times;
810 times.actime = convert_timespec_to_time_t(ft->atime);
811 times.modtime = convert_timespec_to_time_t(ft->mtime);
812 result = utime(smb_fname->base_name, ×);
814 result = utime(smb_fname->base_name, NULL);
821 END_PROFILE(syscall_ntimes);
825 /*********************************************************************
826 A version of ftruncate that will write the space on disk if strict
828 **********************************************************************/
830 static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
833 SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
834 unsigned char zero_space[4096];
835 SMB_OFF_T space_to_write;
840 if (SMB_VFS_FSTAT(fsp, &st) == -1)
843 space_to_write = len - st.st_ex_size;
846 if (S_ISFIFO(st.st_ex_mode))
850 if (st.st_ex_size == len)
853 /* Shrink - just ftruncate. */
854 if (st.st_ex_size > len)
855 return sys_ftruncate(fsp->fh->fd, len);
857 /* available disk space is enough or not? */
858 if (lp_strict_allocate(SNUM(fsp->conn))){
859 uint64_t space_avail;
860 uint64_t bsize,dfree,dsize;
862 space_avail = get_dfree_info(fsp->conn,
863 fsp->fsp_name->base_name, false,
864 &bsize, &dfree, &dsize);
865 /* space_avail is 1k blocks */
866 if (space_avail == (uint64_t)-1 ||
867 ((uint64_t)space_to_write/1024 > space_avail) ) {
873 /* Write out the real space on disk. */
874 if (SMB_VFS_LSEEK(fsp, st.st_ex_size, SEEK_SET) != st.st_ex_size)
877 space_to_write = len - st.st_ex_size;
879 memset(zero_space, '\0', sizeof(zero_space));
880 while ( space_to_write > 0) {
882 SMB_OFF_T current_len_to_write = MIN(sizeof(zero_space),space_to_write);
884 retlen = SMB_VFS_WRITE(fsp,(char *)zero_space,current_len_to_write);
888 space_to_write -= retlen;
891 /* Seek to where we were */
892 if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos)
898 static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
905 START_PROFILE(syscall_ftruncate);
907 if (lp_strict_allocate(SNUM(fsp->conn))) {
908 result = strict_allocate_ftruncate(handle, fsp, len);
909 END_PROFILE(syscall_ftruncate);
913 /* we used to just check HAVE_FTRUNCATE_EXTEND and only use
914 sys_ftruncate if the system supports it. Then I discovered that
915 you can have some filesystems that support ftruncate
916 expansion and some that don't! On Linux fat can't do
917 ftruncate extend but ext2 can. */
919 result = sys_ftruncate(fsp->fh->fd, len);
923 /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
924 extend a file with ftruncate. Provide alternate implementation
926 currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
931 /* Do an fstat to see if the file is longer than the requested
932 size in which case the ftruncate above should have
933 succeeded or shorter, in which case seek to len - 1 and
934 write 1 byte of zero */
935 if (SMB_VFS_FSTAT(fsp, &st) == -1) {
940 if (S_ISFIFO(st.st_ex_mode)) {
946 if (st.st_ex_size == len) {
951 if (st.st_ex_size > len) {
952 /* the sys_ftruncate should have worked */
956 if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1)
959 if (SMB_VFS_WRITE(fsp, &c, 1)!=1)
962 /* Seek to where we were */
963 if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos)
969 END_PROFILE(syscall_ftruncate);
973 static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
977 START_PROFILE(syscall_fcntl_lock);
978 result = fcntl_lock(fsp->fh->fd, op, offset, count, type);
979 END_PROFILE(syscall_fcntl_lock);
983 static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
986 START_PROFILE(syscall_kernel_flock);
987 kernel_flock(fsp->fh->fd, share_mode);
988 END_PROFILE(syscall_kernel_flock);
992 static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
996 START_PROFILE(syscall_fcntl_getlock);
997 result = fcntl_getlock(fsp->fh->fd, poffset, pcount, ptype, ppid);
998 END_PROFILE(syscall_fcntl_getlock);
1002 static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
1007 START_PROFILE(syscall_linux_setlease);
1009 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
1010 /* first set the signal handler */
1011 if(linux_set_lease_sighandler(fsp->fh->fd) == -1) {
1015 result = linux_setlease(fsp->fh->fd, leasetype);
1019 END_PROFILE(syscall_linux_setlease);
1023 static int vfswrap_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
1027 START_PROFILE(syscall_symlink);
1028 result = symlink(oldpath, newpath);
1029 END_PROFILE(syscall_symlink);
1033 static int vfswrap_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz)
1037 START_PROFILE(syscall_readlink);
1038 result = readlink(path, buf, bufsiz);
1039 END_PROFILE(syscall_readlink);
1043 static int vfswrap_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
1047 START_PROFILE(syscall_link);
1048 result = link(oldpath, newpath);
1049 END_PROFILE(syscall_link);
1053 static int vfswrap_mknod(vfs_handle_struct *handle, const char *pathname, mode_t mode, SMB_DEV_T dev)
1057 START_PROFILE(syscall_mknod);
1058 result = sys_mknod(pathname, mode, dev);
1059 END_PROFILE(syscall_mknod);
1063 static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path)
1067 START_PROFILE(syscall_realpath);
1068 result = realpath(path, resolved_path);
1069 END_PROFILE(syscall_realpath);
1073 static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
1074 struct sys_notify_context *ctx,
1075 struct notify_entry *e,
1076 void (*callback)(struct sys_notify_context *ctx,
1078 struct notify_event *ev),
1079 void *private_data, void *handle)
1082 * So far inotify is the only supported default notify mechanism. If
1083 * another platform like the the BSD's or a proprietary Unix comes
1084 * along and wants another default, we can play the same trick we
1085 * played with Posix ACLs.
1087 * Until that is the case, hard-code inotify here.
1090 if (lp_kernel_change_notify(ctx->conn->params)) {
1091 return inotify_watch(ctx, e, callback, private_data, handle);
1095 * Do nothing, leave everything to notify_internal.c
1097 return NT_STATUS_OK;
1100 static int vfswrap_chflags(vfs_handle_struct *handle, const char *path,
1104 return chflags(path, flags);
1111 static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle,
1112 const SMB_STRUCT_STAT *sbuf)
1116 /* the ZERO_STRUCT ensures padding doesn't break using the key as a
1120 key.devid = sbuf->st_ex_dev;
1121 key.inode = sbuf->st_ex_ino;
1122 /* key.extid is unused by default. */
1127 static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
1128 struct files_struct *fsp,
1130 TALLOC_CTX *mem_ctx,
1131 unsigned int *pnum_streams,
1132 struct stream_struct **pstreams)
1134 SMB_STRUCT_STAT sbuf;
1135 unsigned int num_streams = 0;
1136 struct stream_struct *streams = NULL;
1139 if ((fsp != NULL) && (fsp->is_directory)) {
1141 * No default streams on directories
1146 if ((fsp != NULL) && (fsp->fh->fd != -1)) {
1147 ret = SMB_VFS_FSTAT(fsp, &sbuf);
1150 struct smb_filename *smb_fname = NULL;
1153 status = create_synthetic_smb_fname(talloc_tos(), fname, NULL,
1155 if (!NT_STATUS_IS_OK(status)) {
1158 ret = SMB_VFS_STAT(handle->conn, smb_fname);
1159 sbuf = smb_fname->st;
1160 TALLOC_FREE(smb_fname);
1164 return map_nt_error_from_unix(errno);
1167 if (S_ISDIR(sbuf.st_ex_mode)) {
1171 streams = talloc(mem_ctx, struct stream_struct);
1173 if (streams == NULL) {
1174 return NT_STATUS_NO_MEMORY;
1177 streams->size = sbuf.st_ex_size;
1178 streams->alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf);
1180 streams->name = talloc_strdup(streams, "::$DATA");
1181 if (streams->name == NULL) {
1182 TALLOC_FREE(streams);
1183 return NT_STATUS_NO_MEMORY;
1188 *pnum_streams = num_streams;
1189 *pstreams = streams;
1190 return NT_STATUS_OK;
1193 static int vfswrap_get_real_filename(struct vfs_handle_struct *handle,
1196 TALLOC_CTX *mem_ctx,
1200 * Don't fall back to get_real_filename so callers can differentiate
1201 * between a full directory scan and an actual case-insensitive stat.
1207 static const char *vfswrap_connectpath(struct vfs_handle_struct *handle,
1210 return handle->conn->connectpath;
1213 static NTSTATUS vfswrap_brl_lock_windows(struct vfs_handle_struct *handle,
1214 struct byte_range_lock *br_lck,
1215 struct lock_struct *plock,
1217 struct blocking_lock_record *blr)
1219 SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
1221 /* Note: blr is not used in the default implementation. */
1222 return brl_lock_windows_default(br_lck, plock, blocking_lock);
1225 static bool vfswrap_brl_unlock_windows(struct vfs_handle_struct *handle,
1226 struct messaging_context *msg_ctx,
1227 struct byte_range_lock *br_lck,
1228 const struct lock_struct *plock)
1230 SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
1232 return brl_unlock_windows_default(msg_ctx, br_lck, plock);
1235 static bool vfswrap_brl_cancel_windows(struct vfs_handle_struct *handle,
1236 struct byte_range_lock *br_lck,
1237 struct lock_struct *plock,
1238 struct blocking_lock_record *blr)
1240 SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
1242 /* Note: blr is not used in the default implementation. */
1243 return brl_lock_cancel_default(br_lck, plock);
1246 static bool vfswrap_strict_lock(struct vfs_handle_struct *handle,
1248 struct lock_struct *plock)
1250 SMB_ASSERT(plock->lock_type == READ_LOCK ||
1251 plock->lock_type == WRITE_LOCK);
1253 return strict_lock_default(fsp, plock);
1256 static void vfswrap_strict_unlock(struct vfs_handle_struct *handle,
1258 struct lock_struct *plock)
1260 SMB_ASSERT(plock->lock_type == READ_LOCK ||
1261 plock->lock_type == WRITE_LOCK);
1263 strict_unlock_default(fsp, plock);
1266 /* NT ACL operations. */
1268 static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle,
1270 uint32 security_info, SEC_DESC **ppdesc)
1274 START_PROFILE(fget_nt_acl);
1275 result = posix_fget_nt_acl(fsp, security_info, ppdesc);
1276 END_PROFILE(fget_nt_acl);
1280 static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
1282 uint32 security_info, SEC_DESC **ppdesc)
1286 START_PROFILE(get_nt_acl);
1287 result = posix_get_nt_acl(handle->conn, name, security_info, ppdesc);
1288 END_PROFILE(get_nt_acl);
1292 static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
1296 START_PROFILE(fset_nt_acl);
1297 result = set_nt_acl(fsp, security_info_sent, psd);
1298 END_PROFILE(fset_nt_acl);
1302 static int vfswrap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode)
1310 START_PROFILE(chmod_acl);
1311 result = chmod_acl(handle->conn, name, mode);
1312 END_PROFILE(chmod_acl);
1317 static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
1325 START_PROFILE(fchmod_acl);
1326 result = fchmod_acl(fsp, mode);
1327 END_PROFILE(fchmod_acl);
1332 static int vfswrap_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
1334 return sys_acl_get_entry(theacl, entry_id, entry_p);
1337 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)
1339 return sys_acl_get_tag_type(entry_d, tag_type_p);
1342 static int vfswrap_sys_acl_get_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
1344 return sys_acl_get_permset(entry_d, permset_p);
1347 static void * vfswrap_sys_acl_get_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d)
1349 return sys_acl_get_qualifier(entry_d);
1352 static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
1354 return sys_acl_get_file(handle, path_p, type);
1357 static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
1359 return sys_acl_get_fd(handle, fsp);
1362 static int vfswrap_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset)
1364 return sys_acl_clear_perms(permset);
1367 static int vfswrap_sys_acl_add_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
1369 return sys_acl_add_perm(permset, perm);
1372 static char * vfswrap_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen)
1374 return sys_acl_to_text(theacl, plen);
1377 static SMB_ACL_T vfswrap_sys_acl_init(vfs_handle_struct *handle, int count)
1379 return sys_acl_init(count);
1382 static int vfswrap_sys_acl_create_entry(vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
1384 return sys_acl_create_entry(pacl, pentry);
1387 static int vfswrap_sys_acl_set_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
1389 return sys_acl_set_tag_type(entry, tagtype);
1392 static int vfswrap_sys_acl_set_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual)
1394 return sys_acl_set_qualifier(entry, qual);
1397 static int vfswrap_sys_acl_set_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
1399 return sys_acl_set_permset(entry, permset);
1402 static int vfswrap_sys_acl_valid(vfs_handle_struct *handle, SMB_ACL_T theacl )
1404 return sys_acl_valid(theacl );
1407 static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
1409 return sys_acl_set_file(handle, name, acltype, theacl);
1412 static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
1414 return sys_acl_set_fd(handle, fsp, theacl);
1417 static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
1419 return sys_acl_delete_def_file(handle, path);
1422 static int vfswrap_sys_acl_get_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
1424 return sys_acl_get_perm(permset, perm);
1427 static int vfswrap_sys_acl_free_text(vfs_handle_struct *handle, char *text)
1429 return sys_acl_free_text(text);
1432 static int vfswrap_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl)
1434 return sys_acl_free_acl(posix_acl);
1437 static int vfswrap_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype)
1439 return sys_acl_free_qualifier(qualifier, tagtype);
1442 /****************************************************************
1443 Extended attribute operations.
1444 *****************************************************************/
1446 static ssize_t vfswrap_getxattr(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size)
1448 return sys_getxattr(path, name, value, size);
1451 static ssize_t vfswrap_lgetxattr(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size)
1453 return sys_lgetxattr(path, name, value, size);
1456 static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
1458 return sys_fgetxattr(fsp->fh->fd, name, value, size);
1461 static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
1463 return sys_listxattr(path, list, size);
1466 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
1468 return sys_llistxattr(path, list, size);
1471 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
1473 return sys_flistxattr(fsp->fh->fd, list, size);
1476 static int vfswrap_removexattr(struct vfs_handle_struct *handle, const char *path, const char *name)
1478 return sys_removexattr(path, name);
1481 static int vfswrap_lremovexattr(struct vfs_handle_struct *handle, const char *path, const char *name)
1483 return sys_lremovexattr(path, name);
1486 static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
1488 return sys_fremovexattr(fsp->fh->fd, name);
1491 static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
1493 return sys_setxattr(path, name, value, size, flags);
1496 static int vfswrap_lsetxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
1498 return sys_lsetxattr(path, name, value, size, flags);
1501 static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
1503 return sys_fsetxattr(fsp->fh->fd, name, value, size, flags);
1506 static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1510 * aio_read must be done as root, because in the glibc aio
1511 * implementation the helper thread needs to be able to send a signal
1512 * to the main thread, even when it has done a seteuid() to a
1516 ret = sys_aio_read(aiocb);
1521 static int vfswrap_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1525 * aio_write must be done as root, because in the glibc aio
1526 * implementation the helper thread needs to be able to send a signal
1527 * to the main thread, even when it has done a seteuid() to a
1531 ret = sys_aio_write(aiocb);
1536 static ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1538 return sys_aio_return(aiocb);
1541 static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1543 return sys_aio_cancel(fsp->fh->fd, aiocb);
1546 static int vfswrap_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1548 return sys_aio_error(aiocb);
1551 static int vfswrap_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb)
1553 return sys_aio_fsync(op, aiocb);
1556 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)
1558 return sys_aio_suspend(aiocb, n, timeout);
1561 static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
1566 static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
1568 if (ISDOT(path) || ISDOTDOT(path)) {
1572 if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) {
1573 #if defined(ENOTSUP)
1579 return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0;
1582 static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *path)
1584 /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */
1585 #if defined(ENOTSUP)
1591 static struct vfs_fn_pointers vfs_default_fns = {
1592 /* Disk operations */
1594 .connect_fn = vfswrap_connect,
1595 .disconnect = vfswrap_disconnect,
1596 .disk_free = vfswrap_disk_free,
1597 .get_quota = vfswrap_get_quota,
1598 .set_quota = vfswrap_set_quota,
1599 .get_shadow_copy_data = vfswrap_get_shadow_copy_data,
1600 .statvfs = vfswrap_statvfs,
1601 .fs_capabilities = vfswrap_fs_capabilities,
1603 /* Directory operations */
1605 .opendir = vfswrap_opendir,
1606 .readdir = vfswrap_readdir,
1607 .seekdir = vfswrap_seekdir,
1608 .telldir = vfswrap_telldir,
1609 .rewind_dir = vfswrap_rewinddir,
1610 .mkdir = vfswrap_mkdir,
1611 .rmdir = vfswrap_rmdir,
1612 .closedir = vfswrap_closedir,
1613 .init_search_op = vfswrap_init_search_op,
1615 /* File operations */
1617 .open = vfswrap_open,
1618 .create_file = vfswrap_create_file,
1619 .close_fn = vfswrap_close,
1620 .vfs_read = vfswrap_read,
1621 .pread = vfswrap_pread,
1622 .write = vfswrap_write,
1623 .pwrite = vfswrap_pwrite,
1624 .lseek = vfswrap_lseek,
1625 .sendfile = vfswrap_sendfile,
1626 .recvfile = vfswrap_recvfile,
1627 .rename = vfswrap_rename,
1628 .fsync = vfswrap_fsync,
1629 .stat = vfswrap_stat,
1630 .fstat = vfswrap_fstat,
1631 .lstat = vfswrap_lstat,
1632 .get_alloc_size = vfswrap_get_alloc_size,
1633 .unlink = vfswrap_unlink,
1634 .chmod = vfswrap_chmod,
1635 .fchmod = vfswrap_fchmod,
1636 .chown = vfswrap_chown,
1637 .fchown = vfswrap_fchown,
1638 .lchown = vfswrap_lchown,
1639 .chdir = vfswrap_chdir,
1640 .getwd = vfswrap_getwd,
1641 .ntimes = vfswrap_ntimes,
1642 .ftruncate = vfswrap_ftruncate,
1643 .lock = vfswrap_lock,
1644 .kernel_flock = vfswrap_kernel_flock,
1645 .linux_setlease = vfswrap_linux_setlease,
1646 .getlock = vfswrap_getlock,
1647 .symlink = vfswrap_symlink,
1648 .vfs_readlink = vfswrap_readlink,
1649 .link = vfswrap_link,
1650 .mknod = vfswrap_mknod,
1651 .realpath = vfswrap_realpath,
1652 .notify_watch = vfswrap_notify_watch,
1653 .chflags = vfswrap_chflags,
1654 .file_id_create = vfswrap_file_id_create,
1655 .streaminfo = vfswrap_streaminfo,
1656 .get_real_filename = vfswrap_get_real_filename,
1657 .connectpath = vfswrap_connectpath,
1658 .brl_lock_windows = vfswrap_brl_lock_windows,
1659 .brl_unlock_windows = vfswrap_brl_unlock_windows,
1660 .brl_cancel_windows = vfswrap_brl_cancel_windows,
1661 .strict_lock = vfswrap_strict_lock,
1662 .strict_unlock = vfswrap_strict_unlock,
1664 /* NT ACL operations. */
1666 .fget_nt_acl = vfswrap_fget_nt_acl,
1667 .get_nt_acl = vfswrap_get_nt_acl,
1668 .fset_nt_acl = vfswrap_fset_nt_acl,
1670 /* POSIX ACL operations. */
1672 .chmod_acl = vfswrap_chmod_acl,
1673 .fchmod_acl = vfswrap_fchmod_acl,
1675 .sys_acl_get_entry = vfswrap_sys_acl_get_entry,
1676 .sys_acl_get_tag_type = vfswrap_sys_acl_get_tag_type,
1677 .sys_acl_get_permset = vfswrap_sys_acl_get_permset,
1678 .sys_acl_get_qualifier = vfswrap_sys_acl_get_qualifier,
1679 .sys_acl_get_file = vfswrap_sys_acl_get_file,
1680 .sys_acl_get_fd = vfswrap_sys_acl_get_fd,
1681 .sys_acl_clear_perms = vfswrap_sys_acl_clear_perms,
1682 .sys_acl_add_perm = vfswrap_sys_acl_add_perm,
1683 .sys_acl_to_text = vfswrap_sys_acl_to_text,
1684 .sys_acl_init = vfswrap_sys_acl_init,
1685 .sys_acl_create_entry = vfswrap_sys_acl_create_entry,
1686 .sys_acl_set_tag_type = vfswrap_sys_acl_set_tag_type,
1687 .sys_acl_set_qualifier = vfswrap_sys_acl_set_qualifier,
1688 .sys_acl_set_permset = vfswrap_sys_acl_set_permset,
1689 .sys_acl_valid = vfswrap_sys_acl_valid,
1690 .sys_acl_set_file = vfswrap_sys_acl_set_file,
1691 .sys_acl_set_fd = vfswrap_sys_acl_set_fd,
1692 .sys_acl_delete_def_file = vfswrap_sys_acl_delete_def_file,
1693 .sys_acl_get_perm = vfswrap_sys_acl_get_perm,
1694 .sys_acl_free_text = vfswrap_sys_acl_free_text,
1695 .sys_acl_free_acl = vfswrap_sys_acl_free_acl,
1696 .sys_acl_free_qualifier = vfswrap_sys_acl_free_qualifier,
1698 /* EA operations. */
1699 .getxattr = vfswrap_getxattr,
1700 .lgetxattr = vfswrap_lgetxattr,
1701 .fgetxattr = vfswrap_fgetxattr,
1702 .listxattr = vfswrap_listxattr,
1703 .llistxattr = vfswrap_llistxattr,
1704 .flistxattr = vfswrap_flistxattr,
1705 .removexattr = vfswrap_removexattr,
1706 .lremovexattr = vfswrap_lremovexattr,
1707 .fremovexattr = vfswrap_fremovexattr,
1708 .setxattr = vfswrap_setxattr,
1709 .lsetxattr = vfswrap_lsetxattr,
1710 .fsetxattr = vfswrap_fsetxattr,
1712 /* aio operations */
1713 .aio_read = vfswrap_aio_read,
1714 .aio_write = vfswrap_aio_write,
1715 .aio_return_fn = vfswrap_aio_return,
1716 .aio_cancel = vfswrap_aio_cancel,
1717 .aio_error_fn = vfswrap_aio_error,
1718 .aio_fsync = vfswrap_aio_fsync,
1719 .aio_suspend = vfswrap_aio_suspend,
1720 .aio_force = vfswrap_aio_force,
1722 /* offline operations */
1723 .is_offline = vfswrap_is_offline,
1724 .set_offline = vfswrap_set_offline
1727 NTSTATUS vfs_default_init(void);
1728 NTSTATUS vfs_default_init(void)
1730 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
1731 DEFAULT_VFS_MODULE_NAME, &vfs_default_fns);