From aede4dc0a056709680998f7d7482868024442d7c Mon Sep 17 00:00:00 2001 From: braam Date: Thu, 7 Nov 2002 18:25:21 +0000 Subject: [PATCH] - new test program to make many files fast --- lustre/tests/createmany.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lustre/tests/createmany.c diff --git a/lustre/tests/createmany.c b/lustre/tests/createmany.c new file mode 100644 index 0000000..27ba3f7 --- /dev/null +++ b/lustre/tests/createmany.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char ** argv) +{ + int i, rc, count; + char filename[4096]; + + if (argc < 3) { + printf("Usage %s filenamebase count\n", argv[0]); + return 1; + } + + if (strlen(argv[1]) > 4080) { + printf("name too long\n"); + return 1; + } + + count = strtoul(argv[2], NULL, 0); + + + for (i=0 ; i < count ; i++) { + sprintf(filename, "%s-%d", argv[1], i); + rc = mknod(filename, S_IFREG| 0444, 0); + if (rc) { + printf("mknod(%s) error: %s\n", + filename, strerror(errno)); + break; + } + } + return rc; +} -- 1.8.3.1