From 72a703daa9acefd613fff1aa76dabc44a6842194 Mon Sep 17 00:00:00 2001 From: Ben England Date: Thu, 7 May 2015 09:27:16 -0400 Subject: [PATCH 1/1] allow --client to work with shared filesystem --- options.c | 9 ++++++++- options.h | 3 +++ server.c | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/options.c b/options.c index 3de1248c..4f8a910c 100644 --- 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; diff --git a/options.h b/options.h index 2cf435a0..bd97654b 100644 --- a/options.h +++ b/options.h @@ -6,6 +6,7 @@ #include #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); diff --git a/server.c b/server.c index 93c0987f..7a9b0a44 100644 --- 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); } -- 2.25.1