#include <sys/types.h>
#include <unistd.h>
+#include <getopt.h>
#include <limits.h>
#include <time.h>
#include <strings.h>
off_t biggest = 0;
unsigned long testcalls = 0; /* calls to function "test" */
+const char* cluster_name = "ceph"; /* --cluster optional */
+const char* client_id = "admin"; /* --id optional */
+
unsigned long simulatedopcount = 0; /* -b flag */
int closeprob = 0; /* -c flag */
int debug = 0; /* -d flag */
int r;
int order = 0;
char buf[32];
+ char client_name[256];
+
+ sprintf(client_name, "client.%s", client_id);
- r = rados_create(&cluster, NULL);
+ r = rados_create2(&cluster, cluster_name, client_name, 0);
if (r < 0) {
simple_err("Could not create cluster handle", r);
return r;
int
main(int argc, char **argv)
{
+ enum {
+ LONG_OPT_CLUSTER = 1000,
+ LONG_OPT_ID = 1001
+ };
+
int i, style, ch, ret;
char *endp;
char goodfile[1024];
char logfile[1024];
+ const char* optstring = "b:c:dfgh:jkl:m:no:p:qr:s:t:w:xyCD:FGHKMLN:OP:RS:UWZ";
+ const struct option longopts[] = {
+ {"cluster", 1, NULL, LONG_OPT_CLUSTER},
+ {"id", 1, NULL, LONG_OPT_ID}};
+
goodfile[0] = 0;
logfile[0] = 0;
setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */
- while ((ch = getopt(argc, argv, "b:c:dfgh:jkl:m:no:p:qr:s:t:w:xyCD:FGHKMLN:OP:RS:UWZ"))
- != EOF)
+ while ((ch = getopt_long(argc, argv, optstring, longopts, NULL)) != EOF) {
switch (ch) {
+ case LONG_OPT_CLUSTER:
+ cluster_name = optarg;
+ break;
+ case LONG_OPT_ID:
+ client_id = optarg;
+ break;
case 'b':
simulatedopcount = getnum(optarg, &endp);
if (!quiet)
usage();
/* NOTREACHED */
}
+ }
argc -= optind;
argv += optind;
if (argc != 2)