[PATCH v4 13/14] torture: split open from test_setup_create_fill

David Disseldorp ddiss at samba.org
Mon Nov 18 06:54:38 MST 2013


Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 source4/torture/smb2/ioctl.c | 44 ++++++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index d401c21..946cd6b 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -149,21 +149,15 @@ static bool check_pattern(struct torture_context *torture,
 	return true;
 }
 
-static bool test_setup_create_fill(struct torture_context *torture,
-				   struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
-				   const char *fname,
-				   struct smb2_handle *fh,
-				   uint64_t size,
-				   uint32_t desired_access,
-				   uint32_t file_attributes)
+static bool test_setup_open(struct torture_context *torture,
+			    struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
+			    const char *fname,
+			    struct smb2_handle *fh,
+			    uint32_t desired_access,
+			    uint32_t file_attributes)
 {
 	struct smb2_create io;
 	NTSTATUS status;
-	uint64_t i;
-	uint8_t *buf = talloc_zero_size(mem_ctx, size);
-	torture_assert(torture, (buf != NULL), "no memory for file data buf");
-
-	smb2_util_unlink(tree, fname);
 
 	ZERO_STRUCT(io);
 	io.in.desired_access = desired_access;
@@ -183,6 +177,32 @@ static bool test_setup_create_fill(struct torture_context *torture,
 
 	*fh = io.out.file.handle;
 
+	return true;
+}
+
+static bool test_setup_create_fill(struct torture_context *torture,
+				   struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
+				   const char *fname,
+				   struct smb2_handle *fh,
+				   uint64_t size,
+				   uint32_t desired_access,
+				   uint32_t file_attributes)
+{
+	NTSTATUS status;
+	bool ok;
+	uint64_t i;
+	uint8_t *buf = talloc_zero_size(mem_ctx, size);
+	torture_assert(torture, (buf != NULL), "no memory for file data buf");
+
+	smb2_util_unlink(tree, fname);
+
+	ok = test_setup_open(torture, tree, mem_ctx,
+			     fname,
+			     fh,
+			     desired_access,
+			     file_attributes);
+	torture_assert(torture, ok, "file open");
+
 	if (size > 0) {
 		uint64_t cur_off = 0;
 		for (i = 0; i <= size - 8; i += 8) {
-- 
1.8.1.4



More information about the samba-technical mailing list