X-Git-Url: http://git.alex.org.uk diff --git a/nbd-tester-client.c b/nbd-tester-client.c index 8572f29..3169ab1 100644 --- a/nbd-tester-client.c +++ b/nbd-tester-client.c @@ -40,6 +40,8 @@ static gchar errstr[1024]; const static int errstr_len=1024; +static uint64_t size; + typedef enum { CONNECTION_TYPE_NONE, CONNECTION_TYPE_CONNECT, @@ -69,12 +71,14 @@ inline int read_all(int f, void *buf, size_t len) { return retval; } -int setup_connection(gchar *hostname, int port, CONNECTION_TYPE ctype) { +int setup_connection(gchar *hostname, int port, gchar* name, CONNECTION_TYPE ctype) { int sock; struct hostent *host; struct sockaddr_in addr; char buf[256]; + uint64_t mymagic = (name ? opts_magic : cliserv_magic); u64 tmp64; + uint32_t tmp32 = 0; sock=0; if(ctype ", (int)getpid(), argv[0]); + g_message("%d: Or: %s -N ", (int)getpid(), argv[0]); exit(EXIT_FAILURE); } logging(); hostname=g_strdup(argv[1]); - p=(strtol(argv[2], NULL, 0)); - if(p==LONG_MIN||p==LONG_MAX) { - g_critical("Could not parse port number: %s", strerror(errno)); - exit(EXIT_FAILURE); + if(!strncmp(argv[2], "-N", 2)) { + name = g_strdup(argv[3]); + p = 10809; + } else { + p=(strtol(argv[2], NULL, 0)); + if(p==LONG_MIN||p==LONG_MAX) { + g_critical("Could not parse port number: %s", strerror(errno)); + exit(EXIT_FAILURE); + } } port=(int)p; - if(throughput_test(hostname, port, sock, FALSE, TRUE)<0) { + if(throughput_test(hostname, port, name, sock, FALSE, TRUE)<0) { g_warning("Could not run throughput test: %s", errstr); exit(EXIT_FAILURE); }