From 38fa35571ec9c86dfcd22ed603f9249c071771d8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 5 Feb 2002 01:31:47 +0000 Subject: rewrote smbtorture to use the new dbench 2 format and methods (This used to be commit 36f816a5e12a80f0184f43cbd44ef5fac53fcb81) --- source3/torture/nbio.c | 271 +++++++++++++++++++++++++++++-------------------- 1 file changed, 159 insertions(+), 112 deletions(-) (limited to 'source3/torture/nbio.c') diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 678f3ab556..0785c4e196 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -28,12 +28,68 @@ static char buf[70000]; extern int line_count; +extern int nbio_id; +static int nprocs; static struct { int fd; int handle; } ftable[MAX_FILES]; +static struct { + double bytes_in, bytes_out; + int line; +} *children; + +double nbio_total(void) +{ + int i; + double total = 0; + for (i=0;i st_size) { -#if NBDEBUG - printf("(%d) needs expanding %s to %d from %d\n", - line_count, fname, size, (int)st_size); -#endif - } else if (size < st_size) { -#if NBDEBUG - printf("(%d) needs truncating %s to %d from %d\n", - line_count, fname, size, (int)st_size); -#endif + if (fd != -1 && handle == -1) { + printf("ERROR: cli_nt_create_full succeeded for %s\n", fname); + exit(1); } + if (fd == -1) return; + for (i=0;iname[0] == '.') return; + + n = strdup(name); + n[strlen(n)-1] = 0; + asprintf(&s, "%s%s", n, finfo->name); + if (finfo->mode & aDIR) { + nb_deltree(s); + } else { + total_deleted++; + nb_unlink(s); } + free(s); + free(n); } -void nb_create(char *fname, int size) +void nb_deltree(char *dname) { - nb_open(fname, 5000, size); - nb_close(5000); + char *mask; + asprintf(&mask, "%s\\*", dname); + + total_deleted = 0; + + cli_list(c, mask, aDIR, delete_fn, NULL); + free(mask); + nb_rmdir(dname); + + if (total_deleted) printf("WARNING: Cleaned up %d files\n", total_deleted); } -- cgit