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 if (!null_timespec(ft
->create_time
) &&
822 lp_store_create_time(SNUM(handle
->conn
))) {
823 set_create_timespec_ea(handle
->conn
,
830 END_PROFILE(syscall_ntimes
);
834 /*********************************************************************
835 A version of ftruncate that will write the space on disk if strict
837 **********************************************************************/
839 static int strict_allocate_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_OFF_T len
)
842 SMB_OFF_T currpos
= SMB_VFS_LSEEK(fsp
, 0, SEEK_CUR
);
843 unsigned char zero_space
[4096];
844 SMB_OFF_T space_to_write
;
849 if (SMB_VFS_FSTAT(fsp
, &st
) == -1)
852 space_to_write
= len
- st
.st_ex_size
;
855 if (S_ISFIFO(st
.st_ex_mode
))
859 if (st
.st_ex_size
== len
)
862 /* Shrink - just ftruncate. */
863 if (st
.st_ex_size
> len
)
864 return sys_ftruncate(fsp
->fh
->fd
, len
);
866 /* available disk space is enough or not? */
867 if (lp_strict_allocate(SNUM(fsp
->conn
))){
868 uint64_t space_avail
;
869 uint64_t bsize
,dfree
,dsize
;
871 space_avail
= get_dfree_info(fsp
->conn
,
872 fsp
->fsp_name
->base_name
, false,
873 &bsize
, &dfree
, &dsize
);
874 /* space_avail is 1k blocks */
875 if (space_avail
== (uint64_t)-1 ||
876 ((uint64_t)space_to_write
/1024 > space_avail
) ) {
882 /* Write out the real space on disk. */
883 if (SMB_VFS_LSEEK(fsp
, st
.st_ex_size
, SEEK_SET
) != st
.st_ex_size
)
886 space_to_write
= len
- st
.st_ex_size
;
888 memset(zero_space
, '\0', sizeof(zero_space
));
889 while ( space_to_write
> 0) {
891 SMB_OFF_T current_len_to_write
= MIN(sizeof(zero_space
),space_to_write
);
893 retlen
= SMB_VFS_WRITE(fsp
,(char *)zero_space
,current_len_to_write
);
897 space_to_write
-= retlen
;
900 /* Seek to where we were */
901 if (SMB_VFS_LSEEK(fsp
, currpos
, SEEK_SET
) != currpos
)
907 static int vfswrap_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_OFF_T len
)
914 START_PROFILE(syscall_ftruncate
);
916 if (lp_strict_allocate(SNUM(fsp
->conn
))) {
917 result
= strict_allocate_ftruncate(handle
, fsp
, len
);
918 END_PROFILE(syscall_ftruncate
);
922 /* we used to just check HAVE_FTRUNCATE_EXTEND and only use
923 sys_ftruncate if the system supports it. Then I discovered that
924 you can have some filesystems that support ftruncate
925 expansion and some that don't! On Linux fat can't do
926 ftruncate extend but ext2 can. */
928 result
= sys_ftruncate(fsp
->fh
->fd
, len
);
932 /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
933 extend a file with ftruncate. Provide alternate implementation
935 currpos
= SMB_VFS_LSEEK(fsp
, 0, SEEK_CUR
);
940 /* Do an fstat to see if the file is longer than the requested
941 size in which case the ftruncate above should have
942 succeeded or shorter, in which case seek to len - 1 and
943 write 1 byte of zero */
944 if (SMB_VFS_FSTAT(fsp
, &st
) == -1) {
949 if (S_ISFIFO(st
.st_ex_mode
)) {
955 if (st
.st_ex_size
== len
) {
960 if (st
.st_ex_size
> len
) {
961 /* the sys_ftruncate should have worked */
965 if (SMB_VFS_LSEEK(fsp
, len
-1, SEEK_SET
) != len
-1)
968 if (SMB_VFS_WRITE(fsp
, &c
, 1)!=1)
971 /* Seek to where we were */
972 if (SMB_VFS_LSEEK(fsp
, currpos
, SEEK_SET
) != currpos
)
978 END_PROFILE(syscall_ftruncate
);
982 static bool vfswrap_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int op
, SMB_OFF_T offset
, SMB_OFF_T count
, int type
)
986 START_PROFILE(syscall_fcntl_lock
);
987 result
= fcntl_lock(fsp
->fh
->fd
, op
, offset
, count
, type
);
988 END_PROFILE(syscall_fcntl_lock
);
992 static int vfswrap_kernel_flock(vfs_handle_struct
*handle
, files_struct
*fsp
,
995 START_PROFILE(syscall_kernel_flock
);
996 kernel_flock(fsp
->fh
->fd
, share_mode
);
997 END_PROFILE(syscall_kernel_flock
);
1001 static bool vfswrap_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_OFF_T
*poffset
, SMB_OFF_T
*pcount
, int *ptype
, pid_t
*ppid
)
1005 START_PROFILE(syscall_fcntl_getlock
);
1006 result
= fcntl_getlock(fsp
->fh
->fd
, poffset
, pcount
, ptype
, ppid
);
1007 END_PROFILE(syscall_fcntl_getlock
);
1011 static int vfswrap_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1016 START_PROFILE(syscall_linux_setlease
);
1018 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
1019 /* first set the signal handler */
1020 if(linux_set_lease_sighandler(fsp
->fh
->fd
) == -1) {
1024 result
= linux_setlease(fsp
->fh
->fd
, leasetype
);
1028 END_PROFILE(syscall_linux_setlease
);
1032 static int vfswrap_symlink(vfs_handle_struct
*handle
, const char *oldpath
, const char *newpath
)
1036 START_PROFILE(syscall_symlink
);
1037 result
= symlink(oldpath
, newpath
);
1038 END_PROFILE(syscall_symlink
);
1042 static int vfswrap_readlink(vfs_handle_struct
*handle
, const char *path
, char *buf
, size_t bufsiz
)
1046 START_PROFILE(syscall_readlink
);
1047 result
= readlink(path
, buf
, bufsiz
);
1048 END_PROFILE(syscall_readlink
);
1052 static int vfswrap_link(vfs_handle_struct
*handle
, const char *oldpath
, const char *newpath
)
1056 START_PROFILE(syscall_link
);
1057 result
= link(oldpath
, newpath
);
1058 END_PROFILE(syscall_link
);
1062 static int vfswrap_mknod(vfs_handle_struct
*handle
, const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
1066 START_PROFILE(syscall_mknod
);
1067 result
= sys_mknod(pathname
, mode
, dev
);
1068 END_PROFILE(syscall_mknod
);
1072 static char *vfswrap_realpath(vfs_handle_struct
*handle
, const char *path
, char *resolved_path
)
1076 START_PROFILE(syscall_realpath
);
1077 result
= realpath(path
, resolved_path
);
1078 END_PROFILE(syscall_realpath
);
1082 static NTSTATUS
vfswrap_notify_watch(vfs_handle_struct
*vfs_handle
,
1083 struct sys_notify_context
*ctx
,
1084 struct notify_entry
*e
,
1085 void (*callback
)(struct sys_notify_context
*ctx
,
1087 struct notify_event
*ev
),
1088 void *private_data
, void *handle
)
1091 * So far inotify is the only supported default notify mechanism. If
1092 * another platform like the the BSD's or a proprietary Unix comes
1093 * along and wants another default, we can play the same trick we
1094 * played with Posix ACLs.
1096 * Until that is the case, hard-code inotify here.
1099 if (lp_kernel_change_notify(ctx
->conn
->params
)) {
1100 return inotify_watch(ctx
, e
, callback
, private_data
, handle
);
1104 * Do nothing, leave everything to notify_internal.c
1106 return NT_STATUS_OK
;
1109 static int vfswrap_chflags(vfs_handle_struct
*handle
, const char *path
,
1113 return chflags(path
, flags
);
1120 static struct file_id
vfswrap_file_id_create(struct vfs_handle_struct
*handle
,
1121 const SMB_STRUCT_STAT
*sbuf
)
1125 /* the ZERO_STRUCT ensures padding doesn't break using the key as a
1129 key
.devid
= sbuf
->st_ex_dev
;
1130 key
.inode
= sbuf
->st_ex_ino
;
1131 /* key.extid is unused by default. */
1136 static NTSTATUS
vfswrap_streaminfo(vfs_handle_struct
*handle
,
1137 struct files_struct
*fsp
,
1139 TALLOC_CTX
*mem_ctx
,
1140 unsigned int *pnum_streams
,
1141 struct stream_struct
**pstreams
)
1143 SMB_STRUCT_STAT sbuf
;
1144 unsigned int num_streams
= 0;
1145 struct stream_struct
*streams
= NULL
;
1148 if ((fsp
!= NULL
) && (fsp
->is_directory
)) {
1150 * No default streams on directories
1155 if ((fsp
!= NULL
) && (fsp
->fh
->fd
!= -1)) {
1156 ret
= SMB_VFS_FSTAT(fsp
, &sbuf
);
1159 struct smb_filename
*smb_fname
= NULL
;
1162 status
= create_synthetic_smb_fname(talloc_tos(), fname
, NULL
,
1164 if (!NT_STATUS_IS_OK(status
)) {
1167 ret
= SMB_VFS_STAT(handle
->conn
, smb_fname
);
1168 sbuf
= smb_fname
->st
;
1169 TALLOC_FREE(smb_fname
);
1173 return map_nt_error_from_unix(errno
);
1176 if (S_ISDIR(sbuf
.st_ex_mode
)) {
1180 streams
= talloc(mem_ctx
, struct stream_struct
);
1182 if (streams
== NULL
) {
1183 return NT_STATUS_NO_MEMORY
;
1186 streams
->size
= sbuf
.st_ex_size
;
1187 streams
->alloc_size
= SMB_VFS_GET_ALLOC_SIZE(handle
->conn
, fsp
, &sbuf
);
1189 streams
->name
= talloc_strdup(streams
, "::$DATA");
1190 if (streams
->name
== NULL
) {
1191 TALLOC_FREE(streams
);
1192 return NT_STATUS_NO_MEMORY
;
1197 *pnum_streams
= num_streams
;
1198 *pstreams
= streams
;
1199 return NT_STATUS_OK
;
1202 static int vfswrap_get_real_filename(struct vfs_handle_struct
*handle
,
1205 TALLOC_CTX
*mem_ctx
,
1209 * Don't fall back to get_real_filename so callers can differentiate
1210 * between a full directory scan and an actual case-insensitive stat.
1216 static const char *vfswrap_connectpath(struct vfs_handle_struct
*handle
,
1219 return handle
->conn
->connectpath
;
1222 static NTSTATUS
vfswrap_brl_lock_windows(struct vfs_handle_struct
*handle
,
1223 struct byte_range_lock
*br_lck
,
1224 struct lock_struct
*plock
,
1226 struct blocking_lock_record
*blr
)
1228 SMB_ASSERT(plock
->lock_flav
== WINDOWS_LOCK
);
1230 /* Note: blr is not used in the default implementation. */
1231 return brl_lock_windows_default(br_lck
, plock
, blocking_lock
);
1234 static bool vfswrap_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1235 struct messaging_context
*msg_ctx
,
1236 struct byte_range_lock
*br_lck
,
1237 const struct lock_struct
*plock
)
1239 SMB_ASSERT(plock
->lock_flav
== WINDOWS_LOCK
);
1241 return brl_unlock_windows_default(msg_ctx
, br_lck
, plock
);
1244 static bool vfswrap_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1245 struct byte_range_lock
*br_lck
,
1246 struct lock_struct
*plock
,
1247 struct blocking_lock_record
*blr
)
1249 SMB_ASSERT(plock
->lock_flav
== WINDOWS_LOCK
);
1251 /* Note: blr is not used in the default implementation. */
1252 return brl_lock_cancel_default(br_lck
, plock
);
1255 static bool vfswrap_strict_lock(struct vfs_handle_struct
*handle
,
1257 struct lock_struct
*plock
)
1259 SMB_ASSERT(plock
->lock_type
== READ_LOCK
||
1260 plock
->lock_type
== WRITE_LOCK
);
1262 return strict_lock_default(fsp
, plock
);
1265 static void vfswrap_strict_unlock(struct vfs_handle_struct
*handle
,
1267 struct lock_struct
*plock
)
1269 SMB_ASSERT(plock
->lock_type
== READ_LOCK
||
1270 plock
->lock_type
== WRITE_LOCK
);
1272 strict_unlock_default(fsp
, plock
);
1275 /* NT ACL operations. */
1277 static NTSTATUS
vfswrap_fget_nt_acl(vfs_handle_struct
*handle
,
1279 uint32 security_info
, SEC_DESC
**ppdesc
)
1283 START_PROFILE(fget_nt_acl
);
1284 result
= posix_fget_nt_acl(fsp
, security_info
, ppdesc
);
1285 END_PROFILE(fget_nt_acl
);
1289 static NTSTATUS
vfswrap_get_nt_acl(vfs_handle_struct
*handle
,
1291 uint32 security_info
, SEC_DESC
**ppdesc
)
1295 START_PROFILE(get_nt_acl
);
1296 result
= posix_get_nt_acl(handle
->conn
, name
, security_info
, ppdesc
);
1297 END_PROFILE(get_nt_acl
);
1301 static NTSTATUS
vfswrap_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, uint32 security_info_sent
, const SEC_DESC
*psd
)
1305 START_PROFILE(fset_nt_acl
);
1306 result
= set_nt_acl(fsp
, security_info_sent
, psd
);
1307 END_PROFILE(fset_nt_acl
);
1311 static int vfswrap_chmod_acl(vfs_handle_struct
*handle
, const char *name
, mode_t mode
)
1319 START_PROFILE(chmod_acl
);
1320 result
= chmod_acl(handle
->conn
, name
, mode
);
1321 END_PROFILE(chmod_acl
);
1326 static int vfswrap_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, mode_t mode
)
1334 START_PROFILE(fchmod_acl
);
1335 result
= fchmod_acl(fsp
, mode
);
1336 END_PROFILE(fchmod_acl
);
1341 static int vfswrap_sys_acl_get_entry(vfs_handle_struct
*handle
, SMB_ACL_T theacl
, int entry_id
, SMB_ACL_ENTRY_T
*entry_p
)
1343 return sys_acl_get_entry(theacl
, entry_id
, entry_p
);
1346 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
)
1348 return sys_acl_get_tag_type(entry_d
, tag_type_p
);
1351 static int vfswrap_sys_acl_get_permset(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry_d
, SMB_ACL_PERMSET_T
*permset_p
)
1353 return sys_acl_get_permset(entry_d
, permset_p
);
1356 static void * vfswrap_sys_acl_get_qualifier(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry_d
)
1358 return sys_acl_get_qualifier(entry_d
);
1361 static SMB_ACL_T
vfswrap_sys_acl_get_file(vfs_handle_struct
*handle
, const char *path_p
, SMB_ACL_TYPE_T type
)
1363 return sys_acl_get_file(handle
, path_p
, type
);
1366 static SMB_ACL_T
vfswrap_sys_acl_get_fd(vfs_handle_struct
*handle
, files_struct
*fsp
)
1368 return sys_acl_get_fd(handle
, fsp
);
1371 static int vfswrap_sys_acl_clear_perms(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
)
1373 return sys_acl_clear_perms(permset
);
1376 static int vfswrap_sys_acl_add_perm(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
1378 return sys_acl_add_perm(permset
, perm
);
1381 static char * vfswrap_sys_acl_to_text(vfs_handle_struct
*handle
, SMB_ACL_T theacl
, ssize_t
*plen
)
1383 return sys_acl_to_text(theacl
, plen
);
1386 static SMB_ACL_T
vfswrap_sys_acl_init(vfs_handle_struct
*handle
, int count
)
1388 return sys_acl_init(count
);
1391 static int vfswrap_sys_acl_create_entry(vfs_handle_struct
*handle
, SMB_ACL_T
*pacl
, SMB_ACL_ENTRY_T
*pentry
)
1393 return sys_acl_create_entry(pacl
, pentry
);
1396 static int vfswrap_sys_acl_set_tag_type(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, SMB_ACL_TAG_T tagtype
)
1398 return sys_acl_set_tag_type(entry
, tagtype
);
1401 static int vfswrap_sys_acl_set_qualifier(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, void *qual
)
1403 return sys_acl_set_qualifier(entry
, qual
);
1406 static int vfswrap_sys_acl_set_permset(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, SMB_ACL_PERMSET_T permset
)
1408 return sys_acl_set_permset(entry
, permset
);
1411 static int vfswrap_sys_acl_valid(vfs_handle_struct
*handle
, SMB_ACL_T theacl
)
1413 return sys_acl_valid(theacl
);
1416 static int vfswrap_sys_acl_set_file(vfs_handle_struct
*handle
, const char *name
, SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
1418 return sys_acl_set_file(handle
, name
, acltype
, theacl
);
1421 static int vfswrap_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_ACL_T theacl
)
1423 return sys_acl_set_fd(handle
, fsp
, theacl
);
1426 static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct
*handle
, const char *path
)
1428 return sys_acl_delete_def_file(handle
, path
);
1431 static int vfswrap_sys_acl_get_perm(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
1433 return sys_acl_get_perm(permset
, perm
);
1436 static int vfswrap_sys_acl_free_text(vfs_handle_struct
*handle
, char *text
)
1438 return sys_acl_free_text(text
);
1441 static int vfswrap_sys_acl_free_acl(vfs_handle_struct
*handle
, SMB_ACL_T posix_acl
)
1443 return sys_acl_free_acl(posix_acl
);
1446 static int vfswrap_sys_acl_free_qualifier(vfs_handle_struct
*handle
, void *qualifier
, SMB_ACL_TAG_T tagtype
)
1448 return sys_acl_free_qualifier(qualifier
, tagtype
);
1451 /****************************************************************
1452 Extended attribute operations.
1453 *****************************************************************/
1455 static ssize_t
vfswrap_getxattr(struct vfs_handle_struct
*handle
,const char *path
, const char *name
, void *value
, size_t size
)
1457 return sys_getxattr(path
, name
, value
, size
);
1460 static ssize_t
vfswrap_lgetxattr(struct vfs_handle_struct
*handle
,const char *path
, const char *name
, void *value
, size_t size
)
1462 return sys_lgetxattr(path
, name
, value
, size
);
1465 static ssize_t
vfswrap_fgetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, void *value
, size_t size
)
1467 return sys_fgetxattr(fsp
->fh
->fd
, name
, value
, size
);
1470 static ssize_t
vfswrap_listxattr(struct vfs_handle_struct
*handle
, const char *path
, char *list
, size_t size
)
1472 return sys_listxattr(path
, list
, size
);
1475 ssize_t
vfswrap_llistxattr(struct vfs_handle_struct
*handle
, const char *path
, char *list
, size_t size
)
1477 return sys_llistxattr(path
, list
, size
);
1480 ssize_t
vfswrap_flistxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, char *list
, size_t size
)
1482 return sys_flistxattr(fsp
->fh
->fd
, list
, size
);
1485 static int vfswrap_removexattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
)
1487 return sys_removexattr(path
, name
);
1490 static int vfswrap_lremovexattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
)
1492 return sys_lremovexattr(path
, name
);
1495 static int vfswrap_fremovexattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
)
1497 return sys_fremovexattr(fsp
->fh
->fd
, name
);
1500 static int vfswrap_setxattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
, const void *value
, size_t size
, int flags
)
1502 return sys_setxattr(path
, name
, value
, size
, flags
);
1505 static int vfswrap_lsetxattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
, const void *value
, size_t size
, int flags
)
1507 return sys_lsetxattr(path
, name
, value
, size
, flags
);
1510 static int vfswrap_fsetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, const void *value
, size_t size
, int flags
)
1512 return sys_fsetxattr(fsp
->fh
->fd
, name
, value
, size
, flags
);
1515 static int vfswrap_aio_read(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
1519 * aio_read must be done as root, because in the glibc aio
1520 * implementation the helper thread needs to be able to send a signal
1521 * to the main thread, even when it has done a seteuid() to a
1525 ret
= sys_aio_read(aiocb
);
1530 static int vfswrap_aio_write(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
1534 * aio_write must be done as root, because in the glibc aio
1535 * implementation the helper thread needs to be able to send a signal
1536 * to the main thread, even when it has done a seteuid() to a
1540 ret
= sys_aio_write(aiocb
);
1545 static ssize_t
vfswrap_aio_return(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
1547 return sys_aio_return(aiocb
);
1550 static int vfswrap_aio_cancel(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
1552 return sys_aio_cancel(fsp
->fh
->fd
, aiocb
);
1555 static int vfswrap_aio_error(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
1557 return sys_aio_error(aiocb
);
1560 static int vfswrap_aio_fsync(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int op
, SMB_STRUCT_AIOCB
*aiocb
)
1562 return sys_aio_fsync(op
, aiocb
);
1565 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
)
1567 return sys_aio_suspend(aiocb
, n
, timeout
);
1570 static bool vfswrap_aio_force(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
)
1575 static bool vfswrap_is_offline(struct vfs_handle_struct
*handle
, const char *path
, SMB_STRUCT_STAT
*sbuf
)
1577 if (ISDOT(path
) || ISDOTDOT(path
)) {
1581 if (!lp_dmapi_support(SNUM(handle
->conn
)) || !dmapi_have_session()) {
1582 #if defined(ENOTSUP)
1588 return (dmapi_file_flags(path
) & FILE_ATTRIBUTE_OFFLINE
) != 0;
1591 static int vfswrap_set_offline(struct vfs_handle_struct
*handle
, const char *path
)
1593 /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */
1594 #if defined(ENOTSUP)
1600 static struct vfs_fn_pointers vfs_default_fns
= {
1601 /* Disk operations */
1603 .connect_fn
= vfswrap_connect
,
1604 .disconnect
= vfswrap_disconnect
,
1605 .disk_free
= vfswrap_disk_free
,
1606 .get_quota
= vfswrap_get_quota
,
1607 .set_quota
= vfswrap_set_quota
,
1608 .get_shadow_copy_data
= vfswrap_get_shadow_copy_data
,
1609 .statvfs
= vfswrap_statvfs
,
1610 .fs_capabilities
= vfswrap_fs_capabilities
,
1612 /* Directory operations */
1614 .opendir
= vfswrap_opendir
,
1615 .readdir
= vfswrap_readdir
,
1616 .seekdir
= vfswrap_seekdir
,
1617 .telldir
= vfswrap_telldir
,
1618 .rewind_dir
= vfswrap_rewinddir
,
1619 .mkdir
= vfswrap_mkdir
,
1620 .rmdir
= vfswrap_rmdir
,
1621 .closedir
= vfswrap_closedir
,
1622 .init_search_op
= vfswrap_init_search_op
,
1624 /* File operations */
1626 .open
= vfswrap_open
,
1627 .create_file
= vfswrap_create_file
,
1628 .close_fn
= vfswrap_close
,
1629 .vfs_read
= vfswrap_read
,
1630 .pread
= vfswrap_pread
,
1631 .write
= vfswrap_write
,
1632 .pwrite
= vfswrap_pwrite
,
1633 .lseek
= vfswrap_lseek
,
1634 .sendfile
= vfswrap_sendfile
,
1635 .recvfile
= vfswrap_recvfile
,
1636 .rename
= vfswrap_rename
,
1637 .fsync
= vfswrap_fsync
,
1638 .stat
= vfswrap_stat
,
1639 .fstat
= vfswrap_fstat
,
1640 .lstat
= vfswrap_lstat
,
1641 .get_alloc_size
= vfswrap_get_alloc_size
,
1642 .unlink
= vfswrap_unlink
,
1643 .chmod
= vfswrap_chmod
,
1644 .fchmod
= vfswrap_fchmod
,
1645 .chown
= vfswrap_chown
,
1646 .fchown
= vfswrap_fchown
,
1647 .lchown
= vfswrap_lchown
,
1648 .chdir
= vfswrap_chdir
,
1649 .getwd
= vfswrap_getwd
,
1650 .ntimes
= vfswrap_ntimes
,
1651 .ftruncate
= vfswrap_ftruncate
,
1652 .lock
= vfswrap_lock
,
1653 .kernel_flock
= vfswrap_kernel_flock
,
1654 .linux_setlease
= vfswrap_linux_setlease
,
1655 .getlock
= vfswrap_getlock
,
1656 .symlink
= vfswrap_symlink
,
1657 .vfs_readlink
= vfswrap_readlink
,
1658 .link
= vfswrap_link
,
1659 .mknod
= vfswrap_mknod
,
1660 .realpath
= vfswrap_realpath
,
1661 .notify_watch
= vfswrap_notify_watch
,
1662 .chflags
= vfswrap_chflags
,
1663 .file_id_create
= vfswrap_file_id_create
,
1664 .streaminfo
= vfswrap_streaminfo
,
1665 .get_real_filename
= vfswrap_get_real_filename
,
1666 .connectpath
= vfswrap_connectpath
,
1667 .brl_lock_windows
= vfswrap_brl_lock_windows
,
1668 .brl_unlock_windows
= vfswrap_brl_unlock_windows
,
1669 .brl_cancel_windows
= vfswrap_brl_cancel_windows
,
1670 .strict_lock
= vfswrap_strict_lock
,
1671 .strict_unlock
= vfswrap_strict_unlock
,
1673 /* NT ACL operations. */
1675 .fget_nt_acl
= vfswrap_fget_nt_acl
,
1676 .get_nt_acl
= vfswrap_get_nt_acl
,
1677 .fset_nt_acl
= vfswrap_fset_nt_acl
,
1679 /* POSIX ACL operations. */
1681 .chmod_acl
= vfswrap_chmod_acl
,
1682 .fchmod_acl
= vfswrap_fchmod_acl
,
1684 .sys_acl_get_entry
= vfswrap_sys_acl_get_entry
,
1685 .sys_acl_get_tag_type
= vfswrap_sys_acl_get_tag_type
,
1686 .sys_acl_get_permset
= vfswrap_sys_acl_get_permset
,
1687 .sys_acl_get_qualifier
= vfswrap_sys_acl_get_qualifier
,
1688 .sys_acl_get_file
= vfswrap_sys_acl_get_file
,
1689 .sys_acl_get_fd
= vfswrap_sys_acl_get_fd
,
1690 .sys_acl_clear_perms
= vfswrap_sys_acl_clear_perms
,
1691 .sys_acl_add_perm
= vfswrap_sys_acl_add_perm
,
1692 .sys_acl_to_text
= vfswrap_sys_acl_to_text
,
1693 .sys_acl_init
= vfswrap_sys_acl_init
,
1694 .sys_acl_create_entry
= vfswrap_sys_acl_create_entry
,
1695 .sys_acl_set_tag_type
= vfswrap_sys_acl_set_tag_type
,
1696 .sys_acl_set_qualifier
= vfswrap_sys_acl_set_qualifier
,
1697 .sys_acl_set_permset
= vfswrap_sys_acl_set_permset
,
1698 .sys_acl_valid
= vfswrap_sys_acl_valid
,
1699 .sys_acl_set_file
= vfswrap_sys_acl_set_file
,
1700 .sys_acl_set_fd
= vfswrap_sys_acl_set_fd
,
1701 .sys_acl_delete_def_file
= vfswrap_sys_acl_delete_def_file
,
1702 .sys_acl_get_perm
= vfswrap_sys_acl_get_perm
,
1703 .sys_acl_free_text
= vfswrap_sys_acl_free_text
,
1704 .sys_acl_free_acl
= vfswrap_sys_acl_free_acl
,
1705 .sys_acl_free_qualifier
= vfswrap_sys_acl_free_qualifier
,
1707 /* EA operations. */
1708 .getxattr
= vfswrap_getxattr
,
1709 .lgetxattr
= vfswrap_lgetxattr
,
1710 .fgetxattr
= vfswrap_fgetxattr
,
1711 .listxattr
= vfswrap_listxattr
,
1712 .llistxattr
= vfswrap_llistxattr
,
1713 .flistxattr
= vfswrap_flistxattr
,
1714 .removexattr
= vfswrap_removexattr
,
1715 .lremovexattr
= vfswrap_lremovexattr
,
1716 .fremovexattr
= vfswrap_fremovexattr
,
1717 .setxattr
= vfswrap_setxattr
,
1718 .lsetxattr
= vfswrap_lsetxattr
,
1719 .fsetxattr
= vfswrap_fsetxattr
,
1721 /* aio operations */
1722 .aio_read
= vfswrap_aio_read
,
1723 .aio_write
= vfswrap_aio_write
,
1724 .aio_return_fn
= vfswrap_aio_return
,
1725 .aio_cancel
= vfswrap_aio_cancel
,
1726 .aio_error_fn
= vfswrap_aio_error
,
1727 .aio_fsync
= vfswrap_aio_fsync
,
1728 .aio_suspend
= vfswrap_aio_suspend
,
1729 .aio_force
= vfswrap_aio_force
,
1731 /* offline operations */
1732 .is_offline
= vfswrap_is_offline
,
1733 .set_offline
= vfswrap_set_offline
1736 NTSTATUS
vfs_default_init(void);
1737 NTSTATUS
vfs_default_init(void)
1739 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
1740 DEFAULT_VFS_MODULE_NAME
, &vfs_default_fns
);