[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-168-g6652646

Tim Prouty tprouty at samba.org
Thu Mar 5 02:55:05 GMT 2009


The branch, master has been updated
       via  66526464328ffb07d380973edf3002a2361ab996 (commit)
       via  cfb47573865610d2e02b08507f09b52c3b38d19e (commit)
       via  04f5f739056b535c71f0991b388f7f4b14c0b75e (commit)
       via  f61f1690548edbd1c6e3badfe8d2e7b50485d03e (commit)
      from  d526d340d8f5d70ea48bcaf535ea57d2c1cd48db (commit)

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


- Log -----------------------------------------------------------------
commit 66526464328ffb07d380973edf3002a2361ab996
Author: Tim Prouty <tprouty at samba.org>
Date:   Wed Mar 4 18:29:18 2009 -0800

    librpc: Re-run make idl_full from source3

commit cfb47573865610d2e02b08507f09b52c3b38d19e
Author: Tim Prouty <tprouty at samba.org>
Date:   Tue Mar 3 13:04:14 2009 -0800

    pidl: Don't generate variables declarations for pointless array counters.
    
    Code isn't generated to iterate over arrays of length 0, but the
    variable declarations still are.  The result is 'unused variable'
    warnings. This only seems to be happening in one place right now, so I
    targeted the fix to this case, but refactoring could be done to make
    all variable declarations do this zero length check.  Making it the
    default would be a much more invasive fix.
    
    Jelmer, please check!

commit 04f5f739056b535c71f0991b388f7f4b14c0b75e
Author: Tim Prouty <tprouty at samba.org>
Date:   Tue Mar 3 19:27:50 2009 -0800

    s3 OneFS: Use the public open_streams_for_delete

commit f61f1690548edbd1c6e3badfe8d2e7b50485d03e
Author: Tim Prouty <tprouty at samba.org>
Date:   Tue Mar 3 19:23:33 2009 -0800

    s3: Change open_streams_for_delete to call through the vfs layer
    
    This eliminates the last direct caller of create_file_unixpath

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

Summary of changes:
 librpc/gen_ndr/ndr_drsblobs.c            |    1 -
 pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm |   20 +++++-
 source3/include/proto.h                  |    2 +
 source3/modules/onefs_open.c             |  113 ------------------------------
 source3/smbd/open.c                      |   12 ++--
 5 files changed, 28 insertions(+), 120 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/gen_ndr/ndr_drsblobs.c b/librpc/gen_ndr/ndr_drsblobs.c
index ee7c993..426ade2 100644
--- a/librpc/gen_ndr/ndr_drsblobs.c
+++ b/librpc/gen_ndr/ndr_drsblobs.c
@@ -1856,7 +1856,6 @@ _PUBLIC_ void ndr_print_package_PrimaryKerberosKey4(struct ndr_print *ndr, const
 static enum ndr_err_code ndr_push_package_PrimaryKerberosCtr4(struct ndr_push *ndr, int ndr_flags, const struct package_PrimaryKerberosCtr4 *r)
 {
 	uint32_t cntr_keys_0;
-	uint32_t cntr_service_keys_0;
 	uint32_t cntr_old_keys_0;
 	uint32_t cntr_older_keys_0;
 	if (ndr_flags & NDR_SCALARS) {
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 34aebc7..7ce9708 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1256,7 +1256,7 @@ sub ParseStructPush($$$$)
 
 	EnvSubstituteValue($env, $struct);
 
-	$self->DeclareArrayVariables($_) foreach (@{$struct->{ELEMENTS}});
+	$self->DeclareArrayVariablesNoZero($_, $env) foreach (@{$struct->{ELEMENTS}});
 
 	$self->start_flags($struct, $ndr);
 
@@ -1481,6 +1481,24 @@ sub DeclareArrayVariables($$)
 	}
 }
 
+sub DeclareArrayVariablesNoZero($$$)
+{
+	my ($self,$e,$env) = @_;
+
+	foreach my $l (@{$e->{LEVELS}}) {
+		next if has_fast_array($e,$l);
+		next if is_charset_array($e,$l);
+		if ($l->{TYPE} eq "ARRAY") {
+		    my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
+		    if ($length eq "0") {
+			warning($e->{ORIGINAL}, "pointless array cntr: 'cntr_$e->{NAME}_$l->{LEVEL_INDEX}': length=$length");
+		    } else {
+			$self->pidl("uint32_t cntr_$e->{NAME}_$l->{LEVEL_INDEX};");
+		    }
+		}
+	}
+}
+
 sub DeclareMemCtxVariables($$)
 {
 	my ($self,$e) = @_;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 7811016..41e3618 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6723,6 +6723,8 @@ void msg_file_was_renamed(struct messaging_context *msg,
 struct case_semantics_state;
 struct case_semantics_state *set_posix_case_semantics(TALLOC_CTX *mem_ctx,
 						      connection_struct *conn);
+NTSTATUS open_streams_for_delete(connection_struct *conn,
+				 const char *fname);
 NTSTATUS create_file_default(connection_struct *conn,
 			     struct smb_request *req,
 			     uint16_t root_dir_fid,
diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c
index d3ba0ac..c5030f4 100644
--- a/source3/modules/onefs_open.c
+++ b/source3/modules/onefs_open.c
@@ -1649,119 +1649,6 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
 }
 
 /*
- * If a main file is opened for delete, all streams need to be checked for
- * !FILE_SHARE_DELETE. Do this by opening with DELETE_ACCESS.
- * If that works, delete them all by setting the delete on close and close.
- */
-
-static NTSTATUS open_streams_for_delete(connection_struct *conn,
-					const char *fname)
-{
-	struct stream_struct *stream_info;
-	files_struct **streams;
-	int i;
-	unsigned int num_streams;
-	TALLOC_CTX *frame = talloc_stackframe();
-	NTSTATUS status;
-
-	status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(),
-				    &num_streams, &stream_info);
-
-	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)
-	    || NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
-		DEBUG(10, ("no streams around\n"));
-		TALLOC_FREE(frame);
-		return NT_STATUS_OK;
-	}
-
-	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n",
-			   nt_errstr(status)));
-		goto fail;
-	}
-
-	DEBUG(10, ("open_streams_for_delete found %d streams\n",
-		   num_streams));
-
-	if (num_streams == 0) {
-		TALLOC_FREE(frame);
-		return NT_STATUS_OK;
-	}
-
-	streams = TALLOC_ARRAY(talloc_tos(), files_struct *, num_streams);
-	if (streams == NULL) {
-		DEBUG(0, ("talloc failed\n"));
-		status = NT_STATUS_NO_MEMORY;
-		goto fail;
-	}
-
-	/* Open the base file */
-
-	for (i=0; i<num_streams; i++) {
-		char *streamname;
-
-		if (strequal(stream_info[i].name, "::$DATA")) {
-			streams[i] = NULL;
-			continue;
-		}
-
-		streamname = talloc_asprintf(talloc_tos(), "%s%s", fname,
-					     stream_info[i].name);
-
-		if (streamname == NULL) {
-			DEBUG(0, ("talloc_aprintf failed\n"));
-			status = NT_STATUS_NO_MEMORY;
-			goto fail;
-		}
-
-		status = onefs_create_file_unixpath
-			(conn,			/* conn */
-			 NULL,			/* req */
-			 streamname,		/* fname */
-			 DELETE_ACCESS,		/* access_mask */
-			 FILE_SHARE_READ | FILE_SHARE_WRITE
-			 | FILE_SHARE_DELETE,	/* share_access */
-			 FILE_OPEN,		/* create_disposition*/
-			 NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE, /* create_options */
-			 FILE_ATTRIBUTE_NORMAL,	/* file_attributes */
-			 0,			/* oplock_request */
-			 0,			/* allocation_size */
-			 NULL,			/* sd */
-			 NULL,			/* ea_list */
-			 &streams[i],		/* result */
-			 NULL,			/* pinfo */
-			 NULL,			/* fsp_data */
-			 NULL);			/* psbuf */
-
-		TALLOC_FREE(streamname);
-
-		if (!NT_STATUS_IS_OK(status)) {
-			DEBUG(10, ("Could not open stream %s: %s\n",
-				   streamname, nt_errstr(status)));
-			break;
-		}
-	}
-
-	/*
-	 * don't touch the variable "status" beyond this point :-)
-	 */
-
-	for (i -= 1 ; i >= 0; i--) {
-		if (streams[i] == NULL) {
-			continue;
-		}
-
-		DEBUG(10, ("Closing stream # %d, %s\n", i,
-			   streams[i]->fsp_name));
-		close_file(NULL, streams[i], NORMAL_CLOSE);
-	}
-
- fail:
-	TALLOC_FREE(frame);
-	return status;
-}
-
-/*
  * Wrapper around onefs_open_file_ntcreate and onefs_open_directory.
  */
 static NTSTATUS onefs_create_file_unixpath(connection_struct *conn,
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index acd3475..ccc6fc7 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2719,7 +2719,7 @@ struct case_semantics_state *set_posix_case_semantics(TALLOC_CTX *mem_ctx,
  * If that works, delete them all by setting the delete on close and close.
  */
 
-static NTSTATUS open_streams_for_delete(connection_struct *conn,
+NTSTATUS open_streams_for_delete(connection_struct *conn,
 					const char *fname)
 {
 	struct stream_struct *stream_info;
@@ -2777,13 +2777,15 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
 			goto fail;
 		}
 
-		status = create_file_unixpath
-			(conn,			/* conn */
+		status = SMB_VFS_CREATE_FILE(
+			 conn,			/* conn */
 			 NULL,			/* req */
+			 0,			/* root_dir_fid */
 			 streamname,		/* fname */
+			 0,			/* create_file_flags */
 			 DELETE_ACCESS,		/* access_mask */
-			 FILE_SHARE_READ | FILE_SHARE_WRITE
-			 | FILE_SHARE_DELETE,	/* share_access */
+			 (FILE_SHARE_READ |	/* share_access */
+			     FILE_SHARE_WRITE | FILE_SHARE_DELETE),
 			 FILE_OPEN,		/* create_disposition*/
 			 NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE, /* create_options */
 			 FILE_ATTRIBUTE_NORMAL,	/* file_attributes */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list