allow --client to work with shared filesystem
authorBen England <bengland@redhat.com>
Thu, 7 May 2015 13:27:16 +0000 (09:27 -0400)
committerBen England <bengland@redhat.com>
Thu, 7 May 2015 13:27:16 +0000 (09:27 -0400)
options.c
options.h
server.c

index 3de1248cce9ef44da252ec41b4578a09b6e39da8..4f8a910c2fb885990b886e0ba12a6a4996c6846d 100644 (file)
--- a/options.c
+++ b/options.c
@@ -17,6 +17,8 @@
 
 #include "crc/crc32c.h"
 
+char client_sockaddr_str[INET6_ADDRSTRLEN] = {0};
+
 /*
  * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
  */
@@ -832,7 +834,12 @@ int set_name_idx(char *target, char *input, int index)
        for (cur_idx = 0; cur_idx <= index; cur_idx++)
                fname = get_next_name(&str);
 
-       len = sprintf(target, "%s/", fname);
+       if (client_sockaddr_str[0]) {
+               len = sprintf(target, "%s/%s.", fname, client_sockaddr_str);
+       } else {
+               len = sprintf(target, "%s/", fname);
+       }
+
        free(p);
 
        return len;
index 2cf435a06e2868ab8ba84bee60bd9a53116bf7a7..bd97654b57e38cf05e85c53fe006c154f51f21e3 100644 (file)
--- a/options.h
+++ b/options.h
@@ -6,6 +6,7 @@
 #include <string.h>
 #include "parse.h"
 #include "flist.h"
+#include "client.h"
 
 #define td_var_offset(var)     ((size_t) &((struct thread_options *)0)->var)
 
@@ -20,6 +21,8 @@ void fio_options_free(struct thread_data *);
 char *get_name_idx(char *, int);
 int set_name_idx(char *, char *, int);
 
+extern char client_sockaddr_str[INET6_ADDRSTRLEN];  /* used with --client option */
+
 extern struct fio_option fio_options[FIO_MAX_OPTS];
 
 extern int __fio_option_is_set(struct thread_options *, unsigned int off);
index 93c0987febaf486c3d08f92f3797782300b2acff..7a9b0a447d306b0e1be0928d2635c4e19a14b96a 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1007,6 +1007,7 @@ static int accept_loop(int listen_sk)
                }
 
                /* exits */
+               strncpy(client_sockaddr_str, from, INET6_ADDRSTRLEN);
                handle_connection(sk);
        }