From 6405e341b9fac7f0adead9a65f86c8082c5059ae Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 25 Feb 2011 06:50:19 -0700 Subject: s3: Ask GPFS for the IS_OFFLINE operation --- source3/modules/vfs_gpfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 4ee826b71b..b820eba07d 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1190,6 +1190,36 @@ static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp, return result; } +static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle, + const struct smb_filename *fname, + SMB_STRUCT_STAT *sbuf) +{ + struct gpfs_winattr attrs; + char *path = NULL; + NTSTATUS status; + int ret; + + status = get_full_smb_filename(talloc_tos(), fname, &path); + if (!NT_STATUS_IS_OK(status)) { + errno = map_errno_from_nt_status(status); + return -1; + } + ret = get_gpfs_winattrs(path, &attrs); + + if (ret == -1) { + TALLOC_FREE(path); + return false; + } + if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) { + DEBUG(10, ("%s is offline\n", path)); + TALLOC_FREE(path); + return true; + } + DEBUG(10, ("%s is online\n", path)); + TALLOC_FREE(path); + return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf); +} + int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service, const char *user) { @@ -1264,6 +1294,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = { .fstat = vfs_gpfs_fstat, .lstat = vfs_gpfs_lstat, .ntimes = vfs_gpfs_ntimes, + .is_offline = vfs_gpfs_is_offline, .ftruncate = vfs_gpfs_ftruncate }; -- cgit