[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Oct 11 12:45:04 UTC 2016


The branch, master has been updated
       via  3031815 s3/vfs: remove now unused is_offline/set_offline VFS functions
       via  6f3b421 s3/vfs: merge offline functionality into DOS attributes handling
      from  e56fa1f nfs4acls: Fix SMB_ACE4_MAX_TYPE define

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3031815f982e365be50148564d47d7d5afab46e0
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 10 17:10:43 2016 +0200

    s3/vfs: remove now unused is_offline/set_offline VFS functions
    
    The previous commit removed all callers of this, so lets remove it.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Tue Oct 11 14:44:03 CEST 2016 on sn-devel-144

commit 6f3b421c4a29e63e87a5987f54c925b8668f813c
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Sep 11 12:39:13 2016 +0200

    s3/vfs: merge offline functionality into DOS attributes handling
    
    The offline VFS functions predate the SMB_VFS_{GET|SET}_DOS_ATTRIBUTES()
    functions, now that we have these, we can use them for the offline
    attribute as well.
    
    The primary reason for this is: performance. Merging both functions has
    the benefit that in VFS modules that use same backing store bits for
    both offline attribute and DOS attributes (like gpfs), we avoid calling
    the backing store twice in dos_mode() and file_set_dosmode().
    
    This commit modifies all existing users of the offline attribute to
    adapt to the change, the next commit will then remove the obsolete
    offline functions.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 examples/VFS/skel_opaque.c          |  19 -------
 examples/VFS/skel_transparent.c     |  17 ------
 libcli/smb/smb_constants.h          |   3 +-
 source3/include/vfs.h               |  11 ++--
 source3/include/vfs_macros.h        |  10 ----
 source3/modules/vfs_ceph.c          |  18 -------
 source3/modules/vfs_default.c       |  32 ++++++-----
 source3/modules/vfs_full_audit.c    |  25 ---------
 source3/modules/vfs_glusterfs.c     |  20 -------
 source3/modules/vfs_gpfs.c          |   7 ++-
 source3/modules/vfs_media_harmony.c |  77 ---------------------------
 source3/modules/vfs_offline.c       |  20 +++++--
 source3/modules/vfs_time_audit.c    |  41 ---------------
 source3/modules/vfs_tsmsm.c         | 102 ++++++++++++++++++++++++++++++++----
 source3/modules/vfs_unityed_media.c |  59 ---------------------
 source3/smbd/dosmode.c              |  45 +++-------------
 source3/smbd/vfs.c                  |  15 ------
 17 files changed, 144 insertions(+), 377 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 81ce184..9479595 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -860,21 +860,6 @@ static bool skel_aio_force(struct vfs_handle_struct *handle,
 	return false;
 }
 
-static bool skel_is_offline(struct vfs_handle_struct *handle,
-			    const struct smb_filename *fname,
-			    SMB_STRUCT_STAT *sbuf)
-{
-	errno = ENOSYS;
-	return false;
-}
-
-static int skel_set_offline(struct vfs_handle_struct *handle,
-			    const struct smb_filename *fname)
-{
-	errno = ENOSYS;
-	return -1;
-}
-
 /* VFS operations structure */
 
 struct vfs_fn_pointers skel_opaque_fns = {
@@ -1006,10 +991,6 @@ struct vfs_fn_pointers skel_opaque_fns = {
 
 	/* aio operations */
 	.aio_force_fn = skel_aio_force,
-
-	/* offline operations */
-	.is_offline_fn = skel_is_offline,
-	.set_offline_fn = skel_set_offline
 };
 
 static_decl_vfs;
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 418ee24..f601312 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -985,19 +985,6 @@ static bool skel_aio_force(struct vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
 }
 
-static bool skel_is_offline(struct vfs_handle_struct *handle,
-			    const struct smb_filename *fname,
-			    SMB_STRUCT_STAT *sbuf)
-{
-	return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
-}
-
-static int skel_set_offline(struct vfs_handle_struct *handle,
-			    const struct smb_filename *fname)
-{
-	return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
-}
-
 /* VFS operations structure */
 
 struct vfs_fn_pointers skel_transparent_fns = {
@@ -1129,10 +1116,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
 
 	/* aio operations */
 	.aio_force_fn = skel_aio_force,
-
-	/* offline operations */
-	.is_offline_fn = skel_is_offline,
-	.set_offline_fn = skel_set_offline
 };
 
 static_decl_vfs;
diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
index b963c73..47b5629 100644
--- a/libcli/smb/smb_constants.h
+++ b/libcli/smb/smb_constants.h
@@ -341,7 +341,8 @@ enum csc_policy {
 					FILE_ATTRIBUTE_HIDDEN|\
 					FILE_ATTRIBUTE_SYSTEM|\
 					FILE_ATTRIBUTE_DIRECTORY|\
-					FILE_ATTRIBUTE_ARCHIVE)
+					FILE_ATTRIBUTE_ARCHIVE|\
+					FILE_ATTRIBUTE_OFFLINE)
 
 /* File type flags */
 #define FILE_TYPE_DISK  0
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index dca6cef..0810fc2 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -193,8 +193,10 @@
 /* Version 35 - Add uint32_t flags to struct smb_filename */
 /* Version 35 - Add get/set/fget/fset dos attribute functions. */
 /* Version 35 - Add bool use_ofd_locks to struct files_struct */
+/* Bump to version 36 - Samba 4.6 will ship with that */
+/* Version 36 - Remove is_offline and set_offline */
 
-#define SMB_VFS_INTERFACE_VERSION 35
+#define SMB_VFS_INTERFACE_VERSION 36
 
 /*
     All intercepted VFS operations must be declared as static functions inside module source
@@ -868,13 +870,6 @@ struct vfs_fn_pointers {
 	/* aio operations */
 	bool (*aio_force_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
 
-	/* offline operations */
-	bool (*is_offline_fn)(struct vfs_handle_struct *handle,
-			   const struct smb_filename *fname,
-			   SMB_STRUCT_STAT *sbuf);
-	int (*set_offline_fn)(struct vfs_handle_struct *handle,
-			   const struct smb_filename *fname);
-
 	/* durable handle operations */
 	NTSTATUS (*durable_cookie_fn)(struct vfs_handle_struct *handle,
 				      struct files_struct *fsp,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index c3c9a17..40c93f8 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -560,16 +560,6 @@
 #define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) \
 	smb_vfs_call_aio_force((handle)->next,(fsp))
 
-#define SMB_VFS_IS_OFFLINE(conn,fname,sbuf) \
-	smb_vfs_call_is_offline((conn)->vfs_handles,(fname),(sbuf))
-#define SMB_VFS_NEXT_IS_OFFLINE(handle,fname,sbuf) \
-	smb_vfs_call_is_offline((handle)->next,(fname),(sbuf))
-
-#define SMB_VFS_SET_OFFLINE(conn,fname) \
-	smb_vfs_call_set_offline((conn)->vfs_handles,(fname))
-#define SMB_VFS_NEXT_SET_OFFLINE(handle,fname) \
-	smb_vfs_call_set_offline((handle)->next, (fname))
-
 /* durable handle operations */
 
 #define SMB_VFS_DURABLE_COOKIE(fsp, mem_ctx, cookie) \
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 59e9b9c..8e02683 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1204,20 +1204,6 @@ static bool cephwrap_aio_force(struct vfs_handle_struct *handle, struct files_st
 	return false;
 }
 
-static bool cephwrap_is_offline(struct vfs_handle_struct *handle,
-				const struct smb_filename *fname,
-				SMB_STRUCT_STAT *sbuf)
-{
-	return false;
-}
-
-static int cephwrap_set_offline(struct vfs_handle_struct *handle,
-				const struct smb_filename *fname)
-{
-	errno = ENOTSUP;
-	return -1;
-}
-
 static struct vfs_fn_pointers ceph_fns = {
 	/* Disk operations */
 
@@ -1300,10 +1286,6 @@ static struct vfs_fn_pointers ceph_fns = {
 
 	/* aio operations */
 	.aio_force_fn = cephwrap_aio_force,
-
-	/* offline operations */
-	.is_offline_fn = cephwrap_is_offline,
-	.set_offline_fn = cephwrap_set_offline
 };
 
 NTSTATUS vfs_ceph_init(void);
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 53199b8..4e8605b 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1544,10 +1544,21 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 	return NT_STATUS_NOT_SUPPORTED;
 }
 
+static bool vfswrap_is_offline(struct vfs_handle_struct *handle,
+			       const struct smb_filename *fname,
+			       SMB_STRUCT_STAT *sbuf);
+
 static NTSTATUS vfswrap_get_dos_attributes(struct vfs_handle_struct *handle,
 					   struct smb_filename *smb_fname,
 					   uint32_t *dosmode)
 {
+	bool offline;
+
+	offline = vfswrap_is_offline(handle, smb_fname, &smb_fname->st);
+	if (offline) {
+		*dosmode |= FILE_ATTRIBUTE_OFFLINE;
+	}
+
 	return get_ea_dos_attribute(handle->conn, smb_fname, dosmode);
 }
 
@@ -1555,6 +1566,13 @@ static NTSTATUS vfswrap_fget_dos_attributes(struct vfs_handle_struct *handle,
 					    struct files_struct *fsp,
 					    uint32_t *dosmode)
 {
+	bool offline;
+
+	offline = vfswrap_is_offline(handle, fsp->fsp_name, &fsp->fsp_name->st);
+	if (offline) {
+		*dosmode |= FILE_ATTRIBUTE_OFFLINE;
+	}
+
 	return get_ea_dos_attribute(handle->conn, fsp->fsp_name, dosmode);
 }
 
@@ -2683,16 +2701,6 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *handle,
 	return offline;
 }
 
-static int vfswrap_set_offline(struct vfs_handle_struct *handle,
-			       const struct smb_filename *fname)
-{
-	/* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */
-#if defined(ENOTSUP)
-	errno = ENOTSUP;
-#endif
-	return -1;
-}
-
 static NTSTATUS vfswrap_durable_cookie(struct vfs_handle_struct *handle,
 				       struct files_struct *fsp,
 				       TALLOC_CTX *mem_ctx,
@@ -2852,10 +2860,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
 	/* aio operations */
 	.aio_force_fn = vfswrap_aio_force,
 
-	/* offline operations */
-	.is_offline_fn = vfswrap_is_offline,
-	.set_offline_fn = vfswrap_set_offline,
-
 	/* durable handle operations */
 	.durable_cookie_fn = vfswrap_durable_cookie,
 	.durable_disconnect_fn = vfswrap_durable_disconnect,
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index edff395..613ce6c 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -2376,29 +2376,6 @@ static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
 	return result;
 }
 
-static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
-				      const struct smb_filename *fname,
-				      SMB_STRUCT_STAT *sbuf)
-{
-	bool result;
-
-	result = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
-	do_log(SMB_VFS_OP_IS_OFFLINE, result, handle, "%s",
-	       smb_fname_str_do_log(fname));
-	return result;
-}
-
-static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
-				      const struct smb_filename *fname)
-{
-	int result;
-
-	result = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
-	do_log(SMB_VFS_OP_SET_OFFLINE, result >= 0, handle, "%s",
-	       smb_fname_str_do_log(fname));
-	return result;
-}
-
 static NTSTATUS smb_full_audit_durable_cookie(struct vfs_handle_struct *handle,
 				struct files_struct *fsp,
 				TALLOC_CTX *mem_ctx,
@@ -2575,8 +2552,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
 	.setxattr_fn = smb_full_audit_setxattr,
 	.fsetxattr_fn = smb_full_audit_fsetxattr,
 	.aio_force_fn = smb_full_audit_aio_force,
-	.is_offline_fn = smb_full_audit_is_offline,
-	.set_offline_fn = smb_full_audit_set_offline,
 	.durable_cookie_fn = smb_full_audit_durable_cookie,
 	.durable_disconnect_fn = smb_full_audit_durable_disconnect,
 	.durable_reconnect_fn = smb_full_audit_durable_reconnect,
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 732ca51..b0ff0f6 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1246,22 +1246,6 @@ static bool vfs_gluster_aio_force(struct vfs_handle_struct *handle,
 	return false;
 }
 
-/* Offline Operations */
-
-static bool vfs_gluster_is_offline(struct vfs_handle_struct *handle,
-				   const struct smb_filename *fname,
-				   SMB_STRUCT_STAT *sbuf)
-{
-	return false;
-}
-
-static int vfs_gluster_set_offline(struct vfs_handle_struct *handle,
-				   const struct smb_filename *fname)
-{
-	errno = ENOTSUP;
-	return -1;
-}
-
 static struct vfs_fn_pointers glusterfs_fns = {
 
 	/* Disk Operations */
@@ -1381,10 +1365,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
 	/* AIO Operations */
 	.aio_force_fn = vfs_gluster_aio_force,
 
-	/* Offline Operations */
-	.is_offline_fn = vfs_gluster_is_offline,
-	.set_offline_fn = vfs_gluster_set_offline,
-
 	/* Durable handle Operations */
 	.durable_cookie_fn = NULL,
 	.durable_disconnect_fn = NULL,
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 730dda2..28da8e2 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1502,6 +1502,9 @@ static uint32_t vfs_gpfs_winattrs_to_dosmode(unsigned int winattrs)
 	if (winattrs & GPFS_WINATTR_SPARSE_FILE) {
 		dosmode |= FILE_ATTRIBUTE_SPARSE;
 	}
+	if (winattrs & GPFS_WINATTR_OFFLINE) {
+		dosmode |= FILE_ATTRIBUTE_OFFLINE;
+	}
 
 	return dosmode;
 }
@@ -1525,6 +1528,9 @@ static unsigned int vfs_gpfs_dosmode_to_winattrs(uint32_t dosmode)
 	if (dosmode & FILE_ATTRIBUTE_SPARSE) {
 		winattrs |= GPFS_WINATTR_SPARSE_FILE;
 	}
+	if (dosmode & FILE_ATTRIBUTE_OFFLINE) {
+		winattrs |= GPFS_WINATTR_OFFLINE;
+	}
 
 	return winattrs;
 }
@@ -2569,7 +2575,6 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
 	.fstat_fn = vfs_gpfs_fstat,
 	.lstat_fn = vfs_gpfs_lstat,
 	.ntimes_fn = vfs_gpfs_ntimes,
-	.is_offline_fn = vfs_gpfs_is_offline,
 	.aio_force_fn = vfs_gpfs_aio_force,
 	.sendfile_fn = vfs_gpfs_sendfile,
 	.fallocate_fn = vfs_gpfs_fallocate,
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index 8f80221..d6a93f8 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -2368,79 +2368,6 @@ out:
 	return status;
 }
 
-/*
- * Success: return true
- * Failure: set errno, return false
- */
-static bool mh_is_offline(struct vfs_handle_struct *handle,
-		const struct smb_filename *fname,
-		SMB_STRUCT_STAT *sbuf)
-{
-	// check if sbuf is modified further down the chain.
-	bool ret;
-	struct smb_filename *clientFname;
-	TALLOC_CTX *ctx;
-
-	DEBUG(MH_INFO_DEBUG, ("Entering mh_is_offline\n"));
-	if (!is_in_media_files(fname->base_name))
-	{
-		ret = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
-		goto out;
-	}
-
-	clientFname = NULL;
-	ctx = talloc_tos();
-
-	if(alloc_get_client_smb_fname(handle, ctx,
-				fname,
-				&clientFname))
-	{
-		ret = -1;
-		goto err;
-	}
-
-	ret = SMB_VFS_NEXT_IS_OFFLINE(handle, clientFname, sbuf);
-err:
-	TALLOC_FREE(clientFname);
-out:
-	return ret;
-}
-
-/*
- * Success: return 0 (?)
- * Failure: set errno, return -1
- */
-static int mh_set_offline(struct vfs_handle_struct *handle,
-		const struct smb_filename *fname)
-{
-	int status;
-	struct smb_filename *clientFname;
-	TALLOC_CTX *ctx;
-
-	DEBUG(MH_INFO_DEBUG, ("Entering mh_set_offline\n"));
-	if (!is_in_media_files(fname->base_name))
-	{
-		status = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
-		goto out;
-	}
-
-	clientFname = NULL;
-	ctx = talloc_tos();
-
-	if ((status = alloc_get_client_smb_fname(handle, ctx,
-				fname,
-				&clientFname)))
-	{
-		goto err;
-	}
-
-	status = SMB_VFS_NEXT_SET_OFFLINE(handle, clientFname);
-err:
-	TALLOC_FREE(clientFname);
-out:
-	return status;
-}
-
 /* VFS operations structure */
 
 static struct vfs_fn_pointers vfs_mh_fns = {
@@ -2502,10 +2429,6 @@ static struct vfs_fn_pointers vfs_mh_fns = {
 	.setxattr_fn = mh_setxattr,
 
 	/* aio operations */
-
-	/* offline operations */
-	.is_offline_fn = mh_is_offline,
-	.set_offline_fn = mh_set_offline
 };
 
 NTSTATUS vfs_media_harmony_init(void);
diff --git a/source3/modules/vfs_offline.c b/source3/modules/vfs_offline.c
index 5921f43..e2d66fa 100644
--- a/source3/modules/vfs_offline.c
+++ b/source3/modules/vfs_offline.c
@@ -27,16 +27,26 @@ static uint32_t offline_fs_capabilities(struct vfs_handle_struct *handle,
 	       FILE_SUPPORTS_REMOTE_STORAGE;
 }
 
-static bool offline_is_offline(struct vfs_handle_struct *handle,
-			       const struct smb_filename *fname,
-			       SMB_STRUCT_STAT *stbuf)
+static NTSTATUS offline_get_dos_attributes(struct vfs_handle_struct *handle,
+					   struct smb_filename *smb_fname,
+					   uint32_t *dosmode)
 {
-	return true;
+	*dosmode |= FILE_ATTRIBUTE_OFFLINE;
+	return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname, dosmode);
+}
+
+static NTSTATUS offline_fget_dos_attributes(struct vfs_handle_struct *handle,
+					    struct files_struct *fsp,
+					    uint32_t *dosmode)
+{
+	*dosmode |= FILE_ATTRIBUTE_OFFLINE;
+	return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode);
 }
 
 static struct vfs_fn_pointers offline_fns = {
     .fs_capabilities_fn = offline_fs_capabilities,
-    .is_offline_fn = offline_is_offline,
+	.get_dos_attributes_fn = offline_get_dos_attributes,
+	.fget_dos_attributes_fn = offline_fget_dos_attributes,
 };
 
 NTSTATUS vfs_offline_init(void);
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index b3610ee..986fe79 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -2495,45 +2495,6 @@ static bool smb_time_audit_aio_force(struct vfs_handle_struct *handle,
 	return result;
 }
 
-static bool smb_time_audit_is_offline(struct vfs_handle_struct *handle,
-				      const struct smb_filename *fname,
-				      SMB_STRUCT_STAT *sbuf)
-{
-	bool result;
-	struct timespec ts1,ts2;
-	double timediff;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list