Whamcloud - gitweb
- capability fixes on head
[fs/lustre-release.git] / lustre / tests / createmany.c
1 #include <stdio.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
4 #include <errno.h>
5 #include <string.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include <stdlib.h>
9
10 int main(int argc, char ** argv)
11 {
12         int i, rc, count;
13         char filename[4096];
14
15         if (argc < 3) { 
16                 printf("Usage %s filenamebase count\n", argv[0]);
17                 return 1;
18         }
19
20         if (strlen(argv[1]) > 4080) { 
21                 printf("name too long\n");
22                 return 1;
23         }
24
25         count = strtoul(argv[2], NULL, 0);
26
27             
28         for (i=0 ; i < count ; i++) { 
29                 sprintf(filename, "%s-%d", argv[1], i); 
30                 rc = mknod(filename, S_IFREG| 0444, 0);
31                 if (rc) { 
32                         printf("mknod(%s) error: %s\n", 
33                                filename, strerror(errno));
34                         break;
35                 }
36         }
37         return rc;
38