[SCM] Samba Shared Repository - branch master updated - 097f40249c664cfc76794894440e27496ab82a76

Volker Lendecke vlendec at samba.org
Thu Oct 23 15:48:11 GMT 2008


The branch, master has been updated
       via  097f40249c664cfc76794894440e27496ab82a76 (commit)
       via  3f0406f609899e88f15f90688c0e49beadc72568 (commit)
      from  db65c3374ad337135a7bd4d67abced258c01c5bd (commit)

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


- Log -----------------------------------------------------------------
commit 097f40249c664cfc76794894440e27496ab82a76
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 23 17:42:45 2008 +0200

    Make use of a large buffer for smbclient put command

commit 3f0406f609899e88f15f90688c0e49beadc72568
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 23 15:43:36 2008 +0200

    Optimize x_fread to speed up the smbclient put command

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

Summary of changes:
 lib/util/xfile.c        |   25 ++++++++++++++++++++-----
 source3/client/client.c |    3 +++
 2 files changed, 23 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/xfile.c b/lib/util/xfile.c
index 94b0ee9..cf19570 100644
--- a/lib/util/xfile.c
+++ b/lib/util/xfile.c
@@ -329,12 +329,27 @@ int x_fgetc(XFILE *f)
 /** simulate fread */
 size_t x_fread(void *p, size_t size, size_t nmemb, XFILE *f)
 {
+	size_t remaining = size * nmemb;
 	size_t total = 0;
-	while (total < size*nmemb) {
-		int c = x_fgetc(f);
-		if (c == EOF) break;
-		(total+(char *)p)[0] = (char)c;
-		total++;
+
+	while (remaining > 0) {
+		size_t thistime;
+
+		x_fillbuf(f);
+
+		if (f->bufused == 0) {
+			f->flags |= X_FLAG_EOF;
+			break;
+		}
+
+		thistime = MIN(f->bufused, remaining);
+
+		memcpy((char *)p+total, f->next, thistime);
+
+		f->next += thistime;
+		f->bufused -= thistime;
+		remaining -= thistime;
+		total += thistime;
 	}
 	return total/size;
 }
diff --git a/source3/client/client.c b/source3/client/client.c
index 26badc4..39f8f90 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -1652,6 +1652,9 @@ static int do_put(const char *rname, const char *lname, bool reput)
 		d_printf("ERROR: Not enough memory!\n");
 		return 1;
 	}
+
+	x_setvbuf(f, NULL, X_IOFBF, maxwrite);
+
 	while (!x_feof(f)) {
 		int n = maxwrite;
 		int ret;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list