svn commit: samba r11578 - in trunk: . examples/libsmbclient source/torture

jerry at samba.org jerry at samba.org
Tue Nov 8 16:32:51 GMT 2005


Author: jerry
Date: 2005-11-08 16:32:50 +0000 (Tue, 08 Nov 2005)
New Revision: 11578

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11578

Log:
syncing up a few small changes from the 3.0 tree
Added:
   trunk/examples/libsmbclient/testread.c
Modified:
   trunk/MAINTAINERS
   trunk/examples/libsmbclient/Makefile
   trunk/source/torture/torture.c


Changeset:
Modified: trunk/MAINTAINERS
===================================================================
--- trunk/MAINTAINERS	2005-11-08 16:29:15 UTC (rev 11577)
+++ trunk/MAINTAINERS	2005-11-08 16:32:50 UTC (rev 11578)
@@ -20,12 +20,13 @@
 Feature/Function	Developer
 ----------------	---------
 
+documentation 		John Terpstra <jht at samba.org>
+libmsrpc		Chris Nichols <skel at samba.org>
+libsmbclient		Derrell Lipman <derrell at samba.org>
+pdb_mysql		Jelmer Vernooij <jelmer at samba.org>
+printing		Gerald (Jerry) Carter <jerry at samba.org>
 samba-vscan		Rainer Link <rainer at openantivirus.org>
-pdb_mysql		Jelmer Vernooij <jelmer at samba.org>
-General Documentation	John Terpstra <jht at samba.org>
 
-Printing		Gerald (Jerry) Carter <jerry at samba.org>
 
-
 --
 Please report any errors in this file to <samba-technical at samba.org>

Modified: trunk/examples/libsmbclient/Makefile
===================================================================
--- trunk/examples/libsmbclient/Makefile	2005-11-08 16:29:15 UTC (rev 11577)
+++ trunk/examples/libsmbclient/Makefile	2005-11-08 16:32:50 UTC (rev 11578)
@@ -17,7 +17,8 @@
 	testbrowse \
 	teststat \
 	testchmod \
-	testutime
+	testutime \
+	testread
 
 all:	$(TESTS) smbsh
 
@@ -49,6 +50,10 @@
 	@echo Linking testutime
 	@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ /usr/local/samba/lib/libsmbclient.so -lpopt $<
 
+testread: testread.o
+	@echo Linking testread
+	@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ /usr/local/samba/lib/libsmbclient.so -lpopt $<
+
 smbsh:
 	make -C smbwrapper
 

Added: trunk/examples/libsmbclient/testread.c
===================================================================
--- trunk/examples/libsmbclient/testread.c	2005-11-08 16:29:15 UTC (rev 11577)
+++ trunk/examples/libsmbclient/testread.c	2005-11-08 16:32:50 UTC (rev 11578)
@@ -0,0 +1,74 @@
+#include <sys/types.h>
+#include <stdio.h> 
+#include <unistd.h>
+#include <string.h> 
+#include <time.h> 
+#include <errno.h>
+#include <libsmbclient.h> 
+#include "get_auth_data_fn.h"
+
+
+int main(int argc, char * argv[]) 
+{ 
+    int             fd;
+    int             ret;
+    int             debug = 0;
+    int             mode = 0666;
+    int             savedErrno;
+    char            buffer[2048]; 
+    char *          pSmbPath = NULL;
+    time_t          t0;
+    time_t          t1;
+    struct stat     st; 
+    
+    if (argc == 1)
+    {
+        pSmbPath = "smb://RANDOM/Public/bigfile";
+    }
+    else if (argc == 2)
+    {
+        pSmbPath = argv[1];
+    }
+    else
+    {
+        printf("usage: "
+               "%s [ smb://path/to/file ]\n",
+               argv[0]);
+        return 1;
+    }
+
+    smbc_init(get_auth_data_fn, debug); 
+    
+    printf("Open file %s\n", pSmbPath);
+    
+    t0 = time(NULL);
+
+    if ((fd = smbc_open(pSmbPath, O_RDONLY, 0)) < 0)
+    {
+        perror("smbc_open");
+        return 1;
+    }
+
+    printf("Beginning read loop.\n");
+
+    do
+    {
+        ret = smbc_read(fd, buffer, sizeof(buffer));
+        savedErrno = errno;
+    } while (ret > 0);
+
+    smbc_close(fd);
+
+    if (ret < 0)
+    {
+        errno = savedErrno;
+        perror("read");
+        return 1;
+    }
+
+    t1 = time(NULL);
+
+    printf("Elapsed time: %d seconds\n", t1 - t0);
+
+    return 0; 
+}

Modified: trunk/source/torture/torture.c
===================================================================
--- trunk/source/torture/torture.c	2005-11-08 16:29:15 UTC (rev 11577)
+++ trunk/source/torture/torture.c	2005-11-08 16:32:50 UTC (rev 11578)
@@ -4424,6 +4424,9 @@
 	/* Setting EA's to zero length deletes them. Test this */
 	printf("Now deleting all EA's - case indepenent....\n");
 
+#if 1
+	cli_set_ea_path(cli, fname, "", "", 0);
+#else
 	for (i = 0; i < 20; i++) {
 		fstring ea_name;
 		slprintf(ea_name, sizeof(ea_name), "ea_%d", i);
@@ -4432,7 +4435,8 @@
 			return False;
 		}
 	}
-	
+#endif
+
 	if (!cli_get_ea_list_path(cli, fname, mem_ctx, &num_eas, &ea_list)) {
 		printf("ea_get list failed - %s\n", cli_errstr(cli));
 		correct = False;



More information about the samba-cvs mailing list