2 Unix SMB/CIFS implementation.
3 Wrap disk only vfs functions to sidestep dodgy compilers.
4 Copyright (C) Tim Potter 1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #define DBGC_CLASS DBGC_VFS
27 /* Check for NULL pointer parameters in vfswrap_* functions */
29 /* We don't want to have NULL function pointers lying around. Someone
30 is sure to try and execute them. These stubs are used to prevent
33 int vfswrap_dummy_connect(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *service
, const char *user
)
35 return 0; /* Return >= 0 for success */
38 void vfswrap_dummy_disconnect(vfs_handle_struct
*handle
, connection_struct
*conn
)
44 SMB_BIG_UINT
vfswrap_disk_free(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, BOOL small_query
, SMB_BIG_UINT
*bsize
,
45 SMB_BIG_UINT
*dfree
, SMB_BIG_UINT
*dsize
)
49 result
= sys_disk_free(path
, small_query
, bsize
, dfree
, dsize
);
53 int vfswrap_get_quota(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*qt
)
55 #ifdef HAVE_SYS_QUOTAS
58 START_PROFILE(syscall_get_quota
);
59 result
= sys_get_quota(conn
->connectpath
, qtype
, id
, qt
);
60 END_PROFILE(syscall_get_quota
);
68 int vfswrap_set_quota(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*qt
)
70 #ifdef HAVE_SYS_QUOTAS
73 START_PROFILE(syscall_set_quota
);
74 result
= sys_set_quota(conn
->connectpath
, qtype
, id
, qt
);
75 END_PROFILE(syscall_set_quota
);
83 int vfswrap_get_shadow_copy_data(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SHADOW_COPY_DATA
*shadow_copy_data
, BOOL labels
)
86 return -1; /* Not implemented. */
89 /* Directory operations */
91 DIR *vfswrap_opendir(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *fname
)
95 START_PROFILE(syscall_opendir
);
96 result
= opendir(fname
);
97 END_PROFILE(syscall_opendir
);
101 struct dirent
*vfswrap_readdir(vfs_handle_struct
*handle
, connection_struct
*conn
, DIR *dirp
)
103 struct dirent
*result
;
105 START_PROFILE(syscall_readdir
);
106 result
= readdir(dirp
);
107 END_PROFILE(syscall_readdir
);
111 int vfswrap_mkdir(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, mode_t mode
)
114 BOOL has_dacl
= False
;
116 START_PROFILE(syscall_mkdir
);
118 if (lp_inherit_acls(SNUM(conn
)) && (has_dacl
= directory_has_default_acl(conn
, parent_dirname(path
))))
121 result
= mkdir(path
, mode
);
123 if (result
== 0 && !has_dacl
) {
125 * We need to do this as the default behavior of POSIX ACLs
126 * is to set the mask to be the requested group permission
127 * bits, not the group permission bits to be the requested
128 * group permission bits. This is not what we want, as it will
129 * mess up any inherited ACL bits that were set. JRA.
131 int saved_errno
= errno
; /* We may get ENOSYS */
132 if ((SMB_VFS_CHMOD_ACL(conn
, path
, mode
) == -1) && (errno
== ENOSYS
))
136 END_PROFILE(syscall_mkdir
);
140 int vfswrap_rmdir(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
)
144 START_PROFILE(syscall_rmdir
);
145 result
= rmdir(path
);
146 END_PROFILE(syscall_rmdir
);
150 int vfswrap_closedir(vfs_handle_struct
*handle
, connection_struct
*conn
, DIR *dirp
)
154 START_PROFILE(syscall_closedir
);
155 result
= closedir(dirp
);
156 END_PROFILE(syscall_closedir
);
160 /* File operations */
162 int vfswrap_open(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *fname
, int flags
, mode_t mode
)
166 START_PROFILE(syscall_open
);
167 result
= sys_open(fname
, flags
, mode
);
168 END_PROFILE(syscall_open
);
172 int vfswrap_close(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
)
176 START_PROFILE(syscall_close
);
179 END_PROFILE(syscall_close
);
183 ssize_t
vfswrap_read(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, void *data
, size_t n
)
187 START_PROFILE_BYTES(syscall_read
, n
);
188 result
= sys_read(fd
, data
, n
);
189 END_PROFILE(syscall_read
);
193 ssize_t
vfswrap_pread(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, void *data
,
194 size_t n
, SMB_OFF_T offset
)
198 #if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
199 START_PROFILE_BYTES(syscall_pread
, n
);
200 result
= sys_pread(fd
, data
, n
, offset
);
201 END_PROFILE(syscall_pread
);
203 if (result
== -1 && errno
== ESPIPE
) {
204 /* Maintain the fiction that pipes can be seeked (sought?) on. */
205 result
= SMB_VFS_READ(fsp
, fd
, data
, n
);
209 #else /* HAVE_PREAD */
213 curr
= SMB_VFS_LSEEK(fsp
, fd
, 0, SEEK_CUR
);
214 if (curr
== -1 && errno
== ESPIPE
) {
215 /* Maintain the fiction that pipes can be seeked (sought?) on. */
216 result
= SMB_VFS_READ(fsp
, fd
, data
, n
);
221 if (SMB_VFS_LSEEK(fsp
, fd
, offset
, SEEK_SET
) == -1) {
226 result
= SMB_VFS_READ(fsp
, fd
, data
, n
);
229 SMB_VFS_LSEEK(fsp
, fd
, curr
, SEEK_SET
);
232 #endif /* HAVE_PREAD */
237 ssize_t
vfswrap_write(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, const void *data
, size_t n
)
241 START_PROFILE_BYTES(syscall_write
, n
);
242 result
= sys_write(fd
, data
, n
);
243 END_PROFILE(syscall_write
);
247 ssize_t
vfswrap_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, const void *data
,
248 size_t n
, SMB_OFF_T offset
)
252 #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
253 START_PROFILE_BYTES(syscall_pwrite
, n
);
254 result
= sys_pwrite(fd
, data
, n
, offset
);
255 END_PROFILE(syscall_pwrite
);
257 if (result
== -1 && errno
== ESPIPE
) {
258 /* Maintain the fiction that pipes can be sought on. */
259 result
= SMB_VFS_WRITE(fsp
, fd
, data
, n
);
262 #else /* HAVE_PWRITE */
266 curr
= SMB_VFS_LSEEK(fsp
, fd
, 0, SEEK_CUR
);
271 if (SMB_VFS_LSEEK(fsp
, fd
, offset
, SEEK_SET
) == -1) {
275 result
= SMB_VFS_WRITE(fsp
, fd
, data
, n
);
278 SMB_VFS_LSEEK(fsp
, fd
, curr
, SEEK_SET
);
281 #endif /* HAVE_PWRITE */
286 SMB_OFF_T
vfswrap_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
, int filedes
, SMB_OFF_T offset
, int whence
)
288 SMB_OFF_T result
= 0;
290 START_PROFILE(syscall_lseek
);
292 /* Cope with 'stat' file opens. */
294 result
= sys_lseek(filedes
, offset
, whence
);
297 * We want to maintain the fiction that we can seek
298 * on a fifo for file system purposes. This allows
299 * people to set up UNIX fifo's that feed data to Windows
303 if((result
== -1) && (errno
== ESPIPE
)) {
308 END_PROFILE(syscall_lseek
);
312 ssize_t
vfswrap_sendfile(vfs_handle_struct
*handle
, int tofd
, files_struct
*fsp
, int fromfd
, const DATA_BLOB
*hdr
,
313 SMB_OFF_T offset
, size_t n
)
317 START_PROFILE_BYTES(syscall_sendfile
, n
);
318 result
= sys_sendfile(tofd
, fromfd
, hdr
, offset
, n
);
319 END_PROFILE(syscall_sendfile
);
323 /*********************************************************
324 For rename across filesystems Patch from Warren Birnbaum
325 <warrenb@hpcvscdp.cv.hp.com>
326 **********************************************************/
328 static int copy_reg(const char *source
, const char *dest
)
330 SMB_STRUCT_STAT source_stats
;
335 if (sys_lstat (source
, &source_stats
) == -1)
338 if (!S_ISREG (source_stats
.st_mode
))
341 if((ifd
= sys_open (source
, O_RDONLY
, 0)) < 0)
344 if (unlink (dest
) && errno
!= ENOENT
)
348 if((ofd
= sys_open (dest
, O_WRONLY
| O_CREAT
| O_TRUNC
| O_NOFOLLOW
, 0600)) < 0 )
350 if((ofd
= sys_open (dest
, O_WRONLY
| O_CREAT
| O_TRUNC
, 0600)) < 0 )
354 if (transfer_file(ifd
, ofd
, (size_t)-1) == -1)
358 * Try to preserve ownership. For non-root it might fail, but that's ok.
359 * But root probably wants to know, e.g. if NFS disallows it.
363 if ((fchown(ofd
, source_stats
.st_uid
, source_stats
.st_gid
) == -1) && (errno
!= EPERM
))
365 if ((chown(dest
, source_stats
.st_uid
, source_stats
.st_gid
) == -1) && (errno
!= EPERM
))
370 * fchown turns off set[ug]id bits for non-root,
371 * so do the chmod last.
374 #if defined(HAVE_FCHMOD)
375 if (fchmod (ofd
, source_stats
.st_mode
& 07777))
377 if (chmod (dest
, source_stats
.st_mode
& 07777))
381 if (close (ifd
) == -1)
384 if (close (ofd
) == -1)
387 /* Try to copy the old file's modtime and access time. */
391 tv
.actime
= source_stats
.st_atime
;
392 tv
.modtime
= source_stats
.st_mtime
;
396 if (unlink (source
) == -1)
412 int vfswrap_rename(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *old
, const char *new)
416 START_PROFILE(syscall_rename
);
417 result
= rename(old
, new);
418 if (errno
== EXDEV
) {
419 /* Rename across filesystems needed. */
420 result
= copy_reg(old
, new);
423 END_PROFILE(syscall_rename
);
427 int vfswrap_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
)
432 START_PROFILE(syscall_fsync
);
434 END_PROFILE(syscall_fsync
);
441 int vfswrap_stat(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *fname
, SMB_STRUCT_STAT
*sbuf
)
445 START_PROFILE(syscall_stat
);
446 result
= sys_stat(fname
, sbuf
);
447 END_PROFILE(syscall_stat
);
451 int vfswrap_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, SMB_STRUCT_STAT
*sbuf
)
455 START_PROFILE(syscall_fstat
);
456 result
= sys_fstat(fd
, sbuf
);
457 END_PROFILE(syscall_fstat
);
461 int vfswrap_lstat(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, SMB_STRUCT_STAT
*sbuf
)
465 START_PROFILE(syscall_lstat
);
466 result
= sys_lstat(path
, sbuf
);
467 END_PROFILE(syscall_lstat
);
471 int vfswrap_unlink(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
)
475 START_PROFILE(syscall_unlink
);
476 result
= unlink(path
);
477 END_PROFILE(syscall_unlink
);
481 int vfswrap_chmod(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, mode_t mode
)
485 START_PROFILE(syscall_chmod
);
488 * We need to do this due to the fact that the default POSIX ACL
489 * chmod modifies the ACL *mask* for the group owner, not the
490 * group owner bits directly. JRA.
495 int saved_errno
= errno
; /* We might get ENOSYS */
496 if ((result
= SMB_VFS_CHMOD_ACL(conn
, path
, mode
)) == 0) {
497 END_PROFILE(syscall_chmod
);
500 /* Error - return the old errno. */
504 result
= chmod(path
, mode
);
505 END_PROFILE(syscall_chmod
);
509 int vfswrap_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, mode_t mode
)
513 START_PROFILE(syscall_fchmod
);
516 * We need to do this due to the fact that the default POSIX ACL
517 * chmod modifies the ACL *mask* for the group owner, not the
518 * group owner bits directly. JRA.
522 int saved_errno
= errno
; /* We might get ENOSYS */
523 if ((result
= SMB_VFS_FCHMOD_ACL(fsp
, fd
, mode
)) == 0) {
524 END_PROFILE(syscall_chmod
);
527 /* Error - return the old errno. */
531 #if defined(HAVE_FCHMOD)
532 result
= fchmod(fd
, mode
);
538 END_PROFILE(syscall_fchmod
);
542 int vfswrap_chown(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, uid_t uid
, gid_t gid
)
546 START_PROFILE(syscall_chown
);
547 result
= sys_chown(path
, uid
, gid
);
548 END_PROFILE(syscall_chown
);
552 int vfswrap_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, uid_t uid
, gid_t gid
)
557 START_PROFILE(syscall_fchown
);
558 result
= fchown(fd
, uid
, gid
);
559 END_PROFILE(syscall_fchown
);
567 int vfswrap_chdir(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
)
571 START_PROFILE(syscall_chdir
);
572 result
= chdir(path
);
573 END_PROFILE(syscall_chdir
);
577 char *vfswrap_getwd(vfs_handle_struct
*handle
, connection_struct
*conn
, char *path
)
581 START_PROFILE(syscall_getwd
);
582 result
= sys_getwd(path
);
583 END_PROFILE(syscall_getwd
);
587 int vfswrap_utime(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, struct utimbuf
*times
)
591 START_PROFILE(syscall_utime
);
592 result
= utime(path
, times
);
593 END_PROFILE(syscall_utime
);
597 /*********************************************************************
598 A version of ftruncate that will write the space on disk if strict
600 **********************************************************************/
602 static int strict_allocate_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, SMB_OFF_T len
)
605 SMB_OFF_T currpos
= SMB_VFS_LSEEK(fsp
, fd
, 0, SEEK_CUR
);
606 unsigned char zero_space
[4096];
607 SMB_OFF_T space_to_write
;
612 if (SMB_VFS_FSTAT(fsp
, fd
, &st
) == -1)
615 space_to_write
= len
- st
.st_size
;
618 if (S_ISFIFO(st
.st_mode
))
622 if (st
.st_size
== len
)
625 /* Shrink - just ftruncate. */
626 if (st
.st_size
> len
)
627 return sys_ftruncate(fd
, len
);
629 /* Write out the real space on disk. */
630 if (SMB_VFS_LSEEK(fsp
, fd
, st
.st_size
, SEEK_SET
) != st
.st_size
)
633 space_to_write
= len
- st
.st_size
;
635 memset(zero_space
, '\0', sizeof(zero_space
));
636 while ( space_to_write
> 0) {
638 SMB_OFF_T current_len_to_write
= MIN(sizeof(zero_space
),space_to_write
);
640 retlen
= SMB_VFS_WRITE(fsp
,fsp
->fd
,(char *)zero_space
,current_len_to_write
);
644 space_to_write
-= retlen
;
647 /* Seek to where we were */
648 if (SMB_VFS_LSEEK(fsp
, fd
, currpos
, SEEK_SET
) != currpos
)
654 int vfswrap_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, SMB_OFF_T len
)
661 START_PROFILE(syscall_ftruncate
);
663 if (lp_strict_allocate(SNUM(fsp
->conn
))) {
664 result
= strict_allocate_ftruncate(handle
, fsp
, fd
, len
);
665 END_PROFILE(syscall_ftruncate
);
669 /* we used to just check HAVE_FTRUNCATE_EXTEND and only use
670 sys_ftruncate if the system supports it. Then I discovered that
671 you can have some filesystems that support ftruncate
672 expansion and some that don't! On Linux fat can't do
673 ftruncate extend but ext2 can. */
675 result
= sys_ftruncate(fd
, len
);
679 /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
680 extend a file with ftruncate. Provide alternate implementation
682 currpos
= SMB_VFS_LSEEK(fsp
, fd
, 0, SEEK_CUR
);
687 /* Do an fstat to see if the file is longer than the requested
688 size in which case the ftruncate above should have
689 succeeded or shorter, in which case seek to len - 1 and
690 write 1 byte of zero */
691 if (SMB_VFS_FSTAT(fsp
, fd
, &st
) == -1) {
696 if (S_ISFIFO(st
.st_mode
)) {
702 if (st
.st_size
== len
) {
707 if (st
.st_size
> len
) {
708 /* the sys_ftruncate should have worked */
712 if (SMB_VFS_LSEEK(fsp
, fd
, len
-1, SEEK_SET
) != len
-1)
715 if (SMB_VFS_WRITE(fsp
, fd
, &c
, 1)!=1)
718 /* Seek to where we were */
719 if (SMB_VFS_LSEEK(fsp
, fd
, currpos
, SEEK_SET
) != currpos
)
725 END_PROFILE(syscall_ftruncate
);
729 BOOL
vfswrap_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, int op
, SMB_OFF_T offset
, SMB_OFF_T count
, int type
)
733 START_PROFILE(syscall_fcntl_lock
);
734 result
= fcntl_lock(fd
, op
, offset
, count
,type
);
735 END_PROFILE(syscall_fcntl_lock
);
739 int vfswrap_symlink(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *oldpath
, const char *newpath
)
743 START_PROFILE(syscall_symlink
);
744 result
= sys_symlink(oldpath
, newpath
);
745 END_PROFILE(syscall_symlink
);
749 int vfswrap_readlink(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, char *buf
, size_t bufsiz
)
753 START_PROFILE(syscall_readlink
);
754 result
= sys_readlink(path
, buf
, bufsiz
);
755 END_PROFILE(syscall_readlink
);
759 int vfswrap_link(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *oldpath
, const char *newpath
)
763 START_PROFILE(syscall_link
);
764 result
= sys_link(oldpath
, newpath
);
765 END_PROFILE(syscall_link
);
769 int vfswrap_mknod(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
773 START_PROFILE(syscall_mknod
);
774 result
= sys_mknod(pathname
, mode
, dev
);
775 END_PROFILE(syscall_mknod
);
779 char *vfswrap_realpath(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
, char *resolved_path
)
783 START_PROFILE(syscall_realpath
);
784 result
= sys_realpath(path
, resolved_path
);
785 END_PROFILE(syscall_realpath
);
789 size_t vfswrap_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, uint32 security_info
, SEC_DESC
**ppdesc
)
793 START_PROFILE(fget_nt_acl
);
794 result
= get_nt_acl(fsp
, security_info
, ppdesc
);
795 END_PROFILE(fget_nt_acl
);
799 size_t vfswrap_get_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, const char *name
, uint32 security_info
, SEC_DESC
**ppdesc
)
803 START_PROFILE(get_nt_acl
);
804 result
= get_nt_acl(fsp
, security_info
, ppdesc
);
805 END_PROFILE(get_nt_acl
);
809 BOOL
vfswrap_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, uint32 security_info_sent
, SEC_DESC
*psd
)
813 START_PROFILE(fset_nt_acl
);
814 result
= set_nt_acl(fsp
, security_info_sent
, psd
);
815 END_PROFILE(fset_nt_acl
);
819 BOOL
vfswrap_set_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, const char *name
, uint32 security_info_sent
, SEC_DESC
*psd
)
823 START_PROFILE(set_nt_acl
);
824 result
= set_nt_acl(fsp
, security_info_sent
, psd
);
825 END_PROFILE(set_nt_acl
);
829 int vfswrap_chmod_acl(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *name
, mode_t mode
)
837 START_PROFILE(chmod_acl
);
838 result
= chmod_acl(conn
, name
, mode
);
839 END_PROFILE(chmod_acl
);
844 int vfswrap_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, mode_t mode
)
852 START_PROFILE(fchmod_acl
);
853 result
= fchmod_acl(fsp
, fd
, mode
);
854 END_PROFILE(fchmod_acl
);
859 int vfswrap_sys_acl_get_entry(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_T theacl
, int entry_id
, SMB_ACL_ENTRY_T
*entry_p
)
861 return sys_acl_get_entry(theacl
, entry_id
, entry_p
);
864 int vfswrap_sys_acl_get_tag_type(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_ENTRY_T entry_d
, SMB_ACL_TAG_T
*tag_type_p
)
866 return sys_acl_get_tag_type(entry_d
, tag_type_p
);
869 int vfswrap_sys_acl_get_permset(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_ENTRY_T entry_d
, SMB_ACL_PERMSET_T
*permset_p
)
871 return sys_acl_get_permset(entry_d
, permset_p
);
874 void * vfswrap_sys_acl_get_qualifier(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_ENTRY_T entry_d
)
876 return sys_acl_get_qualifier(entry_d
);
879 SMB_ACL_T
vfswrap_sys_acl_get_file(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path_p
, SMB_ACL_TYPE_T type
)
881 return sys_acl_get_file(path_p
, type
);
884 SMB_ACL_T
vfswrap_sys_acl_get_fd(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
)
886 return sys_acl_get_fd(fd
);
889 int vfswrap_sys_acl_clear_perms(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_PERMSET_T permset
)
891 return sys_acl_clear_perms(permset
);
894 int vfswrap_sys_acl_add_perm(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
896 return sys_acl_add_perm(permset
, perm
);
899 char * vfswrap_sys_acl_to_text(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_T theacl
, ssize_t
*plen
)
901 return sys_acl_to_text(theacl
, plen
);
904 SMB_ACL_T
vfswrap_sys_acl_init(vfs_handle_struct
*handle
, connection_struct
*conn
, int count
)
906 return sys_acl_init(count
);
909 int vfswrap_sys_acl_create_entry(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_T
*pacl
, SMB_ACL_ENTRY_T
*pentry
)
911 return sys_acl_create_entry(pacl
, pentry
);
914 int vfswrap_sys_acl_set_tag_type(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_ENTRY_T entry
, SMB_ACL_TAG_T tagtype
)
916 return sys_acl_set_tag_type(entry
, tagtype
);
919 int vfswrap_sys_acl_set_qualifier(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_ENTRY_T entry
, void *qual
)
921 return sys_acl_set_qualifier(entry
, qual
);
924 int vfswrap_sys_acl_set_permset(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_ENTRY_T entry
, SMB_ACL_PERMSET_T permset
)
926 return sys_acl_set_permset(entry
, permset
);
929 int vfswrap_sys_acl_valid(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_T theacl
)
931 return sys_acl_valid(theacl
);
934 int vfswrap_sys_acl_set_file(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *name
, SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
936 return sys_acl_set_file(name
, acltype
, theacl
);
939 int vfswrap_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
, int fd
, SMB_ACL_T theacl
)
941 return sys_acl_set_fd(fd
, theacl
);
944 int vfswrap_sys_acl_delete_def_file(vfs_handle_struct
*handle
, connection_struct
*conn
, const char *path
)
946 return sys_acl_delete_def_file(path
);
949 int vfswrap_sys_acl_get_perm(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
951 return sys_acl_get_perm(permset
, perm
);
954 int vfswrap_sys_acl_free_text(vfs_handle_struct
*handle
, connection_struct
*conn
, char *text
)
956 return sys_acl_free_text(text
);
959 int vfswrap_sys_acl_free_acl(vfs_handle_struct
*handle
, connection_struct
*conn
, SMB_ACL_T posix_acl
)
961 return sys_acl_free_acl(posix_acl
);
964 int vfswrap_sys_acl_free_qualifier(vfs_handle_struct
*handle
, connection_struct
*conn
, void *qualifier
, SMB_ACL_TAG_T tagtype
)
966 return sys_acl_free_qualifier(qualifier
, tagtype
);
969 /****************************************************************
970 Extended attribute operations.
971 *****************************************************************/
973 ssize_t
vfswrap_getxattr(struct vfs_handle_struct
*handle
,struct connection_struct
*conn
,const char *path
, const char *name
, void *value
, size_t size
)
975 return sys_getxattr(path
, name
, value
, size
);
978 ssize_t
vfswrap_lgetxattr(struct vfs_handle_struct
*handle
,struct connection_struct
*conn
,const char *path
, const char *name
, void *value
, size_t size
)
980 return sys_lgetxattr(path
, name
, value
, size
);
983 ssize_t
vfswrap_fgetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int fd
, const char *name
, void *value
, size_t size
)
985 return sys_fgetxattr(fd
, name
, value
, size
);
988 ssize_t
vfswrap_listxattr(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, char *list
, size_t size
)
990 return sys_listxattr(path
, list
, size
);
993 ssize_t
vfswrap_llistxattr(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, char *list
, size_t size
)
995 return sys_llistxattr(path
, list
, size
);
998 ssize_t
vfswrap_flistxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int fd
, char *list
, size_t size
)
1000 return sys_flistxattr(fd
, list
, size
);
1003 int vfswrap_removexattr(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, const char *name
)
1005 return sys_removexattr(path
, name
);
1008 int vfswrap_lremovexattr(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, const char *name
)
1010 return sys_lremovexattr(path
, name
);
1013 int vfswrap_fremovexattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int fd
, const char *name
)
1015 return sys_fremovexattr(fd
, name
);
1018 int vfswrap_setxattr(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, const char *name
, const void *value
, size_t size
, int flags
)
1020 return sys_setxattr(path
, name
, value
, size
, flags
);
1023 int vfswrap_lsetxattr(struct vfs_handle_struct
*handle
, struct connection_struct
*conn
,const char *path
, const char *name
, const void *value
, size_t size
, int flags
)
1025 return sys_lsetxattr(path
, name
, value
, size
, flags
);
1028 int vfswrap_fsetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
,int fd
, const char *name
, const void *value
, size_t size
, int flags
)
1030 return sys_fsetxattr(fd
, name
, value
, size
, flags
);