Unix SMB/CIFS implementation.
Wrap disk only vfs functions to sidestep dodgy compilers.
Copyright (C) Tim Potter 1998
+ Copyright (C) Jeremy Allison 2007
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
return result;
}
-static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
+static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
{
int result;
#endif
}
+static int vfswrap_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
+{
+ int result;
+
+ START_PROFILE(syscall_lchown);
+ result = sys_lchown(path, uid, gid);
+ END_PROFILE(syscall_lchown);
+ return result;
+}
+
static int vfswrap_chdir(vfs_handle_struct *handle, const char *path)
{
int result;
return result;
}
-static int vfswrap_utime(vfs_handle_struct *handle, const char *path, struct utimbuf *times)
+/*********************************************************************
+ nsec timestamp resolution call. Convert down to whatever the underlying
+ system will support.
+**********************************************************************/
+
+static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2])
{
int result;
- START_PROFILE(syscall_utime);
- result = utime(path, times);
- END_PROFILE(syscall_utime);
+ START_PROFILE(syscall_ntimes);
+#if defined(HAVE_UTIMES)
+ {
+ struct timeval tv[2];
+ tv[0] = convert_timespec_to_timeval(ts[0]);
+ tv[1] = convert_timespec_to_timeval(ts[1]);
+ result = utimes(path, tv);
+ }
+#elif defined(HAVE_UTIME)
+ {
+ struct utimbuf times;
+ times.actime = convert_timespec_to_time_t(ts[0]);
+ times.modtime = convert_timespec_to_time_t(ts[1]);
+ result = utime(path, times);
+ }
+#else
+ errno = ENOSYS;
+ result = -1;
+#endif
+ END_PROFILE(syscall_ntimes);
return result;
}
static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, int fd,
int leasetype)
{
- int result;
+ int result = -1;
START_PROFILE(syscall_linux_setlease);
-#ifdef LINUX
+#ifdef HAVE_KERNEL_OPLOCKS_LINUX
/* first set the signal handler */
- if(linux_set_lease_sighandler(fd) == -1)
+ if(linux_set_lease_sighandler(fd) == -1) {
return -1;
+ }
result = linux_setlease(fd, leasetype);
-
+#else
+ errno = ENOSYS;
#endif
END_PROFILE(syscall_linux_setlease);
return result;
return NT_STATUS_OK;
}
+static int vfswrap_chflags(vfs_handle_struct *handle, const char *path, int flags)
+{
+#ifdef HAVE_CHFLAGS
+ return chflags(path, flags);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode)
+{
+ return file_id_create_dev(dev, inode);
+}
+
static size_t vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc)
{
size_t result;
return result;
}
-static BOOL vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
{
- BOOL result;
+ NTSTATUS result;
START_PROFILE(fset_nt_acl);
result = set_nt_acl(fsp, security_info_sent, psd);
return result;
}
-static BOOL vfswrap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS vfswrap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd)
{
- BOOL result;
+ NTSTATUS result;
START_PROFILE(set_nt_acl);
result = set_nt_acl(fsp, security_info_sent, psd);
SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_fchown), SMB_VFS_OP_FCHOWN,
SMB_VFS_LAYER_OPAQUE},
+ {SMB_VFS_OP(vfswrap_lchown), SMB_VFS_OP_LCHOWN,
+ SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_chdir), SMB_VFS_OP_CHDIR,
SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_getwd), SMB_VFS_OP_GETWD,
SMB_VFS_LAYER_OPAQUE},
- {SMB_VFS_OP(vfswrap_utime), SMB_VFS_OP_UTIME,
+ {SMB_VFS_OP(vfswrap_ntimes), SMB_VFS_OP_NTIMES,
SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_ftruncate), SMB_VFS_OP_FTRUNCATE,
SMB_VFS_LAYER_OPAQUE},
SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_notify_watch), SMB_VFS_OP_NOTIFY_WATCH,
SMB_VFS_LAYER_OPAQUE},
+ {SMB_VFS_OP(vfswrap_chflags), SMB_VFS_OP_CHFLAGS,
+ SMB_VFS_LAYER_OPAQUE},
+ {SMB_VFS_OP(vfswrap_file_id_create), SMB_VFS_OP_FILE_ID_CREATE,
+ SMB_VFS_LAYER_OPAQUE},
/* NT ACL operations. */