[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-77-g131c95e

Stefan Metzmacher metze at samba.org
Fri Jun 26 12:40:11 GMT 2009


The branch, master has been updated
       via  131c95eddaa23a1cc90ed81348f7f96548b5ca18 (commit)
      from  a4bc5bfa95be242fe1c8e0cd520a8f1e3d2a67f5 (commit)

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


- Log -----------------------------------------------------------------
commit 131c95eddaa23a1cc90ed81348f7f96548b5ca18
Author: Sam Liddicott <sam at liddicott.com>
Date:   Fri Jun 26 12:31:19 2009 +0100

    Upgrade ntvfs_map_*info to ntvfs_map_async_setup/ntvfs_map_async_finish
    
    ntvfs_map_fsinfo, ntvfs_map_qpathinfo, ntvfs_map_qfileinfo used an
    old synchronous mapping technique, acceptable on the grounds that
    they were only used by the simple vfs which was synchronous.
    
    Other vfs may/do use these functions, and by upgrading them to use the
    ntvfs_map_async_setup/ntvfs_map_async_finish framework, they can now be
    used asynchronously.
    
    Signed-off-by: Sam Liddicott <sam at liddicott.com>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 source4/ntvfs/ntvfs_generic.c |  113 +++++++++++++++++++++++++++++------------
 1 files changed, 80 insertions(+), 33 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c
index ad13f36..5838178 100644
--- a/source4/ntvfs/ntvfs_generic.c
+++ b/source4/ntvfs/ntvfs_generic.c
@@ -560,31 +560,14 @@ done:
 
 
 /* 
-   NTVFS fsinfo generic to any mapper
+   NTVFS any to fsinfo mapper
 */
-NTSTATUS ntvfs_map_fsinfo(struct ntvfs_module_context *ntvfs,
-				   struct ntvfs_request *req,
-				   union smb_fsinfo *fs)
+static NTSTATUS ntvfs_map_fsinfo_finish(struct ntvfs_module_context *ntvfs,
+				      struct ntvfs_request *req,
+				      union smb_fsinfo *fs,
+				      union smb_fsinfo *fs2,
+				      NTSTATUS status)
 {
-	NTSTATUS status;
-	union smb_fsinfo *fs2;
-
-	fs2 = talloc(req, union smb_fsinfo);
-	if (fs2 == NULL) {
-		return NT_STATUS_NO_MEMORY;
-	}
-
-	if (fs->generic.level == RAW_QFS_GENERIC) {
-		return NT_STATUS_INVALID_LEVEL;
-	}
-	
-	/* only used by the simple backend, which doesn't do async */
-	req->async_states->state &= ~NTVFS_ASYNC_STATE_MAY_ASYNC;
-
-	/* ask the backend for the generic info */
-	fs2->generic.level = RAW_QFS_GENERIC;
-
-	status = ntvfs->ops->fsinfo(ntvfs, req, fs2);
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
@@ -687,6 +670,38 @@ NTSTATUS ntvfs_map_fsinfo(struct ntvfs_module_context *ntvfs,
 	return NT_STATUS_INVALID_LEVEL;
 }
 
+/*
+   NTVFS fsinfo any to generic mapper
+*/
+NTSTATUS ntvfs_map_fsinfo(struct ntvfs_module_context *ntvfs,
+			  struct ntvfs_request *req,
+			  union smb_fsinfo *fs)
+{
+	NTSTATUS status;
+	union smb_fsinfo *fs2;
+
+	fs2 = talloc(req, union smb_fsinfo);
+	if (fs2 == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	if (fs->generic.level == RAW_QFS_GENERIC) {
+		return NT_STATUS_INVALID_LEVEL;
+	}
+
+	status = ntvfs_map_async_setup(ntvfs, req, fs, fs2,
+				       (second_stage_t)ntvfs_map_fsinfo_finish);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	/* ask the backend for the generic info */
+	fs2->generic.level = RAW_QFS_GENERIC;
+
+	status = ntvfs->ops->fsinfo(ntvfs, req, fs2);
+	return ntvfs_map_async_finish(req, status);
+}
+
 
 /* 
    NTVFS fileinfo generic to any mapper
@@ -920,6 +935,22 @@ NTSTATUS ntvfs_map_fileinfo(TALLOC_CTX *mem_ctx,
 }
 
 /* 
+   NTVFS any to fileinfo mapper
+*/
+static NTSTATUS ntvfs_map_qfileinfo_finish(struct ntvfs_module_context *ntvfs,
+				      struct ntvfs_request *req,
+				      union smb_fileinfo *info,
+				      union smb_fileinfo *info2,
+				      NTSTATUS status)
+{
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	return ntvfs_map_fileinfo(req, info, info2);
+}
+
+/*
    NTVFS fileinfo generic to any mapper
 */
 NTSTATUS ntvfs_map_qfileinfo(struct ntvfs_module_context *ntvfs,
@@ -938,17 +969,33 @@ NTSTATUS ntvfs_map_qfileinfo(struct ntvfs_module_context *ntvfs,
 		return NT_STATUS_INVALID_LEVEL;
 	}
 
+	status = ntvfs_map_async_setup(ntvfs, req, info, info2,
+				       (second_stage_t)ntvfs_map_qfileinfo_finish);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
 	/* ask the backend for the generic info */
 	info2->generic.level = RAW_FILEINFO_GENERIC;
 	info2->generic.in.file.ntvfs= info->generic.in.file.ntvfs;
 
-	/* only used by the simple backend, which doesn't do async */
-	req->async_states->state &= ~NTVFS_ASYNC_STATE_MAY_ASYNC;
-
 	status = ntvfs->ops->qfileinfo(ntvfs, req, info2);
+	return ntvfs_map_async_finish(req, status);
+}
+
+/*
+   NTVFS any to fileinfo mapper
+*/
+static NTSTATUS ntvfs_map_qpathinfo_finish(struct ntvfs_module_context *ntvfs,
+				      struct ntvfs_request *req,
+				      union smb_fileinfo *info,
+				      union smb_fileinfo *info2,
+				      NTSTATUS status)
+{
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
+
 	return ntvfs_map_fileinfo(req, info, info2);
 }
 
@@ -971,18 +1018,18 @@ NTSTATUS ntvfs_map_qpathinfo(struct ntvfs_module_context *ntvfs,
 		return NT_STATUS_INVALID_LEVEL;
 	}
 
+	status = ntvfs_map_async_setup(ntvfs, req, info, info2,
+				       (second_stage_t)ntvfs_map_qpathinfo_finish);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
 	/* ask the backend for the generic info */
 	info2->generic.level		= RAW_FILEINFO_GENERIC;
 	info2->generic.in.file.path	= info->generic.in.file.path;
 
-	/* only used by the simple backend, which doesn't do async */
-	req->async_states->state &= ~NTVFS_ASYNC_STATE_MAY_ASYNC;
-
 	status = ntvfs->ops->qpathinfo(ntvfs, req, info2);
-	if (!NT_STATUS_IS_OK(status)) {
-		return status;
-	}
-	return ntvfs_map_fileinfo(req, info, info2);
+	return ntvfs_map_async_finish(req, status);
 }
 
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list