[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Tue Mar 30 17:24:53 MDT 2010


The branch, master has been updated
       via  2699db3... s4-torture: removed more uses of typeof()
       via  4fc0a6a... s4-torture: using typeof() is not portable
      from  32c8fea... Fix for bug #7233 - print fails with jobs >4GB from Win7 clients.

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


- Log -----------------------------------------------------------------
commit 2699db3fe033b2b048de0d9a3ef21aee6b0da16c
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Mar 31 09:18:09 2010 +1100

    s4-torture: removed more uses of typeof()
    
    not portable

commit 4fc0a6ab3151ca740e4d89b0ebca5d378f88ea50
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Mar 31 09:00:54 2010 +1100

    s4-torture: using typeof() is not portable
    
    this failed to compile on solaris8 with cc

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

Summary of changes:
 source4/torture/basic/denytest.c |  123 ++++++++++++++++++--------------------
 source4/torture/raw/open.c       |   27 +++-----
 2 files changed, 69 insertions(+), 81 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c
index 81e90f8..8a5c24c 100644
--- a/source4/torture/basic/denytest.c
+++ b/source4/torture/basic/denytest.c
@@ -2095,13 +2095,6 @@ static int cxd_find_known(struct createx_data *cxd)
 	return -1;
 }
 
-#define FILL_NTCREATEX(_struct, _init...)                            \
-	do {                                                         \
-		(_struct)->generic.level = RAW_OPEN_NTCREATEX;       \
-		(_struct)->ntcreatex.in                              \
-		    = (__typeof__((_struct)->ntcreatex.in)) {_init}; \
-	} while (0)
-
 #define CREATEX_NAME "\\createx_dir"
 
 static bool createx_make_dir(struct torture_context *tctx,
@@ -2124,15 +2117,16 @@ static bool createx_make_file(struct torture_context *tctx,
 	bool ret = true;
 	NTSTATUS status;
 
-	FILL_NTCREATEX(&open_parms,
-	    .flags = 0,
-	    .access_mask = SEC_RIGHTS_FILE_ALL,
-	    .file_attr = FILE_ATTRIBUTE_NORMAL,
-	    .share_access = 0,
-	    .open_disposition = NTCREATEX_DISP_CREATE,
-	    .create_options = 0,
-	    .fname = fname
-	);
+	ZERO_STRUCT(open_parms);
+	open_parms.generic.level = RAW_OPEN_NTCREATEX;
+	open_parms.ntcreatex.in.flags = 0;
+	open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+	open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+	open_parms.ntcreatex.in.share_access = 0;
+	open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+	open_parms.ntcreatex.in.create_options = 0;
+	open_parms.ntcreatex.in.fname = fname;
+
 	status = smb_raw_open(tree, mem_ctx, &open_parms);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
@@ -2146,30 +2140,30 @@ static bool createx_make_file(struct torture_context *tctx,
 static void createx_fill_dir(union smb_open *open_parms, int accessmode,
     int sharemode, const char *fname)
 {
-	FILL_NTCREATEX(open_parms,
-	    .flags = 0,
-	    .access_mask = accessmode,
-	    .file_attr = FILE_ATTRIBUTE_DIRECTORY,
-	    .share_access = sharemode,
-	    .open_disposition = NTCREATEX_DISP_OPEN_IF,
-	    .create_options = NTCREATEX_OPTIONS_DIRECTORY,
-	    .fname = fname
-	);
+	ZERO_STRUCTP(open_parms);
+	open_parms->generic.level = RAW_OPEN_NTCREATEX;
+	open_parms->ntcreatex.in.flags = 0;
+	open_parms->ntcreatex.in.access_mask = accessmode;
+	open_parms->ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY;
+	open_parms->ntcreatex.in.share_access = sharemode;
+	open_parms->ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+	open_parms->ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+	open_parms->ntcreatex.in.fname = fname;
 }
 
 static void createx_fill_file(union smb_open *open_parms, int accessmode,
     int sharemode, const char *fname)
 {
-	FILL_NTCREATEX(open_parms,
-	    .flags = 0,
-	    .access_mask = accessmode,
-	    .file_attr = FILE_ATTRIBUTE_NORMAL,
-	    .share_access = sharemode,
-	    .open_disposition = NTCREATEX_DISP_OPEN_IF,
-	    .create_options = 0,
-	    .fname = fname,
-            .root_fid = { .fnum = 0 }
-	);
+	ZERO_STRUCTP(open_parms);
+	open_parms->generic.level = RAW_OPEN_NTCREATEX;
+	open_parms->ntcreatex.in.flags = 0;
+	open_parms->ntcreatex.in.access_mask = accessmode;
+	open_parms->ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+	open_parms->ntcreatex.in.share_access = sharemode;
+	open_parms->ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+	open_parms->ntcreatex.in.create_options = 0;
+	open_parms->ntcreatex.in.fname = fname;
+	open_parms->ntcreatex.in.root_fid.fnum = 0;
 }
 
 static int data_file_fd = -1;
@@ -2184,15 +2178,16 @@ static bool createx_test_dir(struct torture_context *tctx,
 	union smb_open open_parms;
 
 	/* bypass original handle to guarantee creation */
-	FILL_NTCREATEX(&open_parms,
-	    .flags = 0,
-	    .access_mask = SEC_RIGHTS_FILE_ALL,
-	    .file_attr = FILE_ATTRIBUTE_NORMAL,
-	    .share_access = 0,
-	    .open_disposition = NTCREATEX_DISP_CREATE,
-	    .create_options = 0,
-	    .fname = CREATEX_NAME "\\" KNOWN
-	);
+	ZERO_STRUCT(open_parms);
+	open_parms.generic.level = RAW_OPEN_NTCREATEX;
+	open_parms.ntcreatex.in.flags = 0;
+	open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+	open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+	open_parms.ntcreatex.in.share_access = 0;
+	open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+	open_parms.ntcreatex.in.create_options = 0;
+	open_parms.ntcreatex.in.fname = CREATEX_NAME "\\" KNOWN;
+
 	status = smb_raw_open(tree, mem_ctx, &open_parms);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	smbcli_close(tree, open_parms.ntcreatex.out.file.fnum);
@@ -2200,32 +2195,32 @@ static bool createx_test_dir(struct torture_context *tctx,
 	result[CXD_DIR_ENUMERATE] = NT_STATUS_OK;
 
 	/* try to create a child */
-	FILL_NTCREATEX(&open_parms,
-	    .flags = 0,
-	    .access_mask = SEC_RIGHTS_FILE_ALL,
-	    .file_attr = FILE_ATTRIBUTE_NORMAL,
-	    .share_access = 0,
-	    .open_disposition = NTCREATEX_DISP_CREATE,
-	    .create_options = 0,
-	    .fname = CHILD,
-	    .root_fid = { .fnum = fnum }
-	);
+	ZERO_STRUCT(open_parms);
+	open_parms.generic.level = RAW_OPEN_NTCREATEX;
+	open_parms.ntcreatex.in.flags = 0;
+	open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+	open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+	open_parms.ntcreatex.in.share_access = 0;
+	open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+	open_parms.ntcreatex.in.create_options = 0;
+	open_parms.ntcreatex.in.fname = CHILD;
+	open_parms.ntcreatex.in.root_fid.fnum = fnum;
 
 	result[CXD_DIR_CREATE_CHILD] =
 	    smb_raw_open(tree, mem_ctx, &open_parms);
 	smbcli_close(tree, open_parms.ntcreatex.out.file.fnum);
 
 	/* try to traverse dir to known good file */
-	FILL_NTCREATEX(&open_parms,
-	    .flags = 0,
-	    .access_mask = SEC_RIGHTS_FILE_ALL,
-	    .file_attr = FILE_ATTRIBUTE_NORMAL,
-	    .share_access = 0,
-	    .open_disposition = NTCREATEX_DISP_OPEN,
-	    .create_options = 0,
-	    .fname = KNOWN,
-	    .root_fid = {.fnum = fnum}
-	);
+	ZERO_STRUCT(open_parms);
+	open_parms.generic.level = RAW_OPEN_NTCREATEX;
+	open_parms.ntcreatex.in.flags = 0;
+	open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+	open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+	open_parms.ntcreatex.in.share_access = 0;
+	open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
+	open_parms.ntcreatex.in.create_options = 0;
+	open_parms.ntcreatex.in.fname = KNOWN;
+	open_parms.ntcreatex.in.root_fid.fnum = fnum;
 
 	result[CXD_DIR_TRAVERSE] =
 	    smb_raw_open(tree, mem_ctx, &open_parms);
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index e37fd8e..42f693e 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -1787,17 +1787,9 @@ done:
 	return ret;
 }
 
-#define FILL_NTCREATEX(_struct, _init...)                       \
-	do {                                                    \
-		(_struct)->generic.level = RAW_OPEN_NTCREATEX;  \
-		(_struct)->ntcreatex.in                         \
-		    = (typeof((_struct)->ntcreatex.in)) {_init};\
-	} while (0)
-
 static bool test_ntcreatex_opendisp_dir(struct torture_context *tctx,
 					struct smbcli_state *cli)
 {
-	union smb_open io;
 	const char *dname = BASEDIR "\\torture_ntcreatex_opendisp_dir";
 	NTSTATUS status;
 	bool ret = true;
@@ -1822,20 +1814,21 @@ static bool test_ntcreatex_opendisp_dir(struct torture_context *tctx,
 		{ 6,                            true,  NT_STATUS_INVALID_PARAMETER },
 		{ 6,                            false, NT_STATUS_INVALID_PARAMETER },
 	};
+	union smb_open io;
+
+	ZERO_STRUCT(io);
+	io.generic.level = RAW_OPEN_NTCREATEX;
+	io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
+	io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+	io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY;
+	io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
+	io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+	io.ntcreatex.in.fname = dname;
 
 	if (!torture_setup_dir(cli, BASEDIR)) {
 		return false;
 	}
 
-	FILL_NTCREATEX(&io,
-	    .flags = NTCREATEX_FLAGS_EXTENDED,
-	    .access_mask = SEC_FLAG_MAXIMUM_ALLOWED,
-	    .file_attr = FILE_ATTRIBUTE_DIRECTORY,
-	    .share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE,
-	    .create_options = NTCREATEX_OPTIONS_DIRECTORY,
-	    .fname = dname,
-	);
-
 	smbcli_rmdir(cli->tree, dname);
 	smbcli_unlink(cli->tree, dname);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list