From cca84643cc10cd72b0b453ff92ccb8643ba51493 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 7 Oct 2011 12:47:57 +0200 Subject: [PATCH] Pass arch/os in probe Signed-off-by: Jens Axboe --- arch/arch-alpha.h | 2 +- arch/arch-arm.h | 2 +- arch/arch-generic.h | 2 +- arch/arch-hppa.h | 2 +- arch/arch-ia64.h | 2 +- arch/arch-mips.h | 2 +- arch/arch-ppc.h | 2 +- arch/arch-s390.h | 2 +- arch/arch-sh.h | 2 +- arch/arch-sparc.h | 2 +- arch/arch-sparc64.h | 2 +- arch/arch-x86.h | 2 +- arch/arch-x86_64.h | 2 +- arch/arch.h | 4 +++- client.c | 13 +++++++++++-- fio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ fio.h | 3 +++ os/os-aix.h | 2 ++ os/os-freebsd.h | 2 ++ os/os-hpux.h | 2 ++ os/os-linux.h | 2 ++ os/os-mac.h | 2 ++ os/os-netbsd.h | 2 ++ os/os-solaris.h | 2 ++ os/os-windows.h | 2 ++ os/os.h | 13 +++++++++++++ server.c | 3 +++ server.h | 2 ++ 28 files changed, 108 insertions(+), 16 deletions(-) diff --git a/arch/arch-alpha.h b/arch/arch-alpha.h index e8132a04..c0f784f2 100644 --- a/arch/arch-alpha.h +++ b/arch/arch-alpha.h @@ -1,7 +1,7 @@ #ifndef ARCH_ALPHA_H #define ARCH_ALPHA_H -#define ARCH (arch_alpha) +#define FIO_ARCH (arch_alpha) #ifndef __NR_ioprio_set #define __NR_ioprio_set 442 diff --git a/arch/arch-arm.h b/arch/arch-arm.h index b0cfd808..658b6884 100644 --- a/arch/arch-arm.h +++ b/arch/arch-arm.h @@ -1,7 +1,7 @@ #ifndef ARCH_ARM_H #define ARCH_ARM_H -#define ARCH (arch_arm) +#define FIO_ARCH (arch_arm) #ifndef __NR_ioprio_set #define __NR_ioprio_set 314 diff --git a/arch/arch-generic.h b/arch/arch-generic.h index c7b0ca0f..a0b71f8c 100644 --- a/arch/arch-generic.h +++ b/arch/arch-generic.h @@ -1,7 +1,7 @@ #ifndef ARCH_GENERIC_H #define ARCH_GENERIC_H -#define ARCH (arch_generic) +#define FIO_ARCH (arch_generic) #define nop do { } while (0) #define read_barrier() __asm__ __volatile__("": : :"memory") diff --git a/arch/arch-hppa.h b/arch/arch-hppa.h index c865a891..c1c079ed 100644 --- a/arch/arch-hppa.h +++ b/arch/arch-hppa.h @@ -1,7 +1,7 @@ #ifndef ARCH_HPPA_H #define ARCH_HPPA_H -#define ARCH (arch_hppa) +#define FIO_ARCH (arch_hppa) #ifndef __NR_ioprio_set #define __NR_ioprio_set 267 diff --git a/arch/arch-ia64.h b/arch/arch-ia64.h index 056f6365..f4464c48 100644 --- a/arch/arch-ia64.h +++ b/arch/arch-ia64.h @@ -1,7 +1,7 @@ #ifndef ARCH_IA64_H #define ARCH_IA64_H -#define ARCH (arch_ia64) +#define FIO_ARCH (arch_ia64) #ifndef __NR_ioprio_set #define __NR_ioprio_set 1274 diff --git a/arch/arch-mips.h b/arch/arch-mips.h index 759d3a9f..0b781d1d 100644 --- a/arch/arch-mips.h +++ b/arch/arch-mips.h @@ -1,7 +1,7 @@ #ifndef ARCH_MIPS64_H #define ARCH_MIPS64_H -#define ARCH (arch_mips) +#define FIO_ARCH (arch_mips) #ifndef __NR_ioprio_set #define __NR_ioprio_set 314 diff --git a/arch/arch-ppc.h b/arch/arch-ppc.h index d495a1b2..b790a55e 100644 --- a/arch/arch-ppc.h +++ b/arch/arch-ppc.h @@ -1,7 +1,7 @@ #ifndef ARCH_PPC_H #define ARCH_PPH_H -#define ARCH (arch_ppc) +#define FIO_ARCH (arch_ppc) #ifndef __NR_ioprio_set #define __NR_ioprio_set 273 diff --git a/arch/arch-s390.h b/arch/arch-s390.h index 06477503..fe517913 100644 --- a/arch/arch-s390.h +++ b/arch/arch-s390.h @@ -1,7 +1,7 @@ #ifndef ARCH_S390_H #define ARCH_S390_H -#define ARCH (arch_s390) +#define FIO_ARCH (arch_s390) #ifndef __NR_ioprio_set #define __NR_ioprio_set 282 diff --git a/arch/arch-sh.h b/arch/arch-sh.h index f5f313d8..9acbbbee 100644 --- a/arch/arch-sh.h +++ b/arch/arch-sh.h @@ -3,7 +3,7 @@ #ifndef ARCH_SH_H #define ARCH_SH_H -#define ARCH (arch_sh) +#define FIO_ARCH (arch_sh) #ifndef __NR_ioprio_set #define __NR_ioprio_set 288 diff --git a/arch/arch-sparc.h b/arch/arch-sparc.h index cd552ab7..fe47b803 100644 --- a/arch/arch-sparc.h +++ b/arch/arch-sparc.h @@ -1,7 +1,7 @@ #ifndef ARCH_SPARC_H #define ARCH_SPARC_H -#define ARCH (arch_sparc) +#define FIO_ARCH (arch_sparc) #ifndef __NR_ioprio_set #define __NR_ioprio_set 196 diff --git a/arch/arch-sparc64.h b/arch/arch-sparc64.h index 332cf917..e793ae52 100644 --- a/arch/arch-sparc64.h +++ b/arch/arch-sparc64.h @@ -1,7 +1,7 @@ #ifndef ARCH_SPARC64_H #define ARCH_SPARC64_H -#define ARCH (arch_sparc64) +#define FIO_ARCH (arch_sparc64) #ifndef __NR_ioprio_set #define __NR_ioprio_set 196 diff --git a/arch/arch-x86.h b/arch/arch-x86.h index 2e803cbe..1ededd84 100644 --- a/arch/arch-x86.h +++ b/arch/arch-x86.h @@ -1,7 +1,7 @@ #ifndef ARCH_X86_H #define ARCH_X86_H -#define ARCH (arch_i386) +#define FIO_ARCH (arch_i386) #ifndef __NR_ioprio_set #define __NR_ioprio_set 289 diff --git a/arch/arch-x86_64.h b/arch/arch-x86_64.h index f2dcf497..29e681f2 100644 --- a/arch/arch-x86_64.h +++ b/arch/arch-x86_64.h @@ -1,7 +1,7 @@ #ifndef ARCH_X86_64_h #define ARCH_X86_64_h -#define ARCH (arch_x86_64) +#define FIO_ARCH (arch_x86_64) #ifndef __NR_ioprio_set #define __NR_ioprio_set 251 diff --git a/arch/arch.h b/arch/arch.h index d598652b..4ad49a42 100644 --- a/arch/arch.h +++ b/arch/arch.h @@ -8,7 +8,7 @@ #endif enum { - arch_x86_64, + arch_x86_64 = 1, arch_i386, arch_ppc, arch_ia64, @@ -21,6 +21,8 @@ enum { arch_hppa, arch_generic, + + arch_nr, }; enum { diff --git a/client.c b/client.c index 11ad1fe7..8bd39a8b 100644 --- a/client.c +++ b/client.c @@ -532,9 +532,18 @@ static void handle_eta(struct fio_net_cmd *cmd) static void handle_probe(struct fio_net_cmd *cmd) { struct cmd_probe_pdu *probe = (struct cmd_probe_pdu *) cmd->payload; + const char *os, *arch; - log_info("Probe: hostname=%s, be=%u, fio ver %u.%u.%u\n", - probe->hostname, probe->bigendian, probe->fio_major, + os = fio_get_os_string(probe->os); + if (!os) + os = "unknown"; + + arch = fio_get_arch_string(probe->arch); + if (!arch) + os = "unknown"; + + log_info("hostname=%s, be=%u, os=%s, arch=%s, fio ver %u.%u.%u\n", + probe->hostname, probe->bigendian, os, arch, probe->fio_major, probe->fio_minor, probe->fio_patch); } diff --git a/fio.c b/fio.c index 6e687231..212b72e8 100644 --- a/fio.c +++ b/fio.c @@ -77,6 +77,50 @@ struct io_log *agg_io_log[2]; #define JOB_START_TIMEOUT (5 * 1000) +static const char *fio_os_strings[os_nr] = { + "Invalid", + "Linux", + "AIX", + "FreeBSD", + "HP-UX", + "OSX", + "NetBSD", + "Solaris", + "Windows" +}; + +static const char *fio_arch_strings[arch_nr] = { + "Invalid", + "x86-64", + "x86", + "ppc", + "ia64", + "s390", + "alpha", + "sparc", + "sparc64", + "arm", + "sh", + "hppa", + "generic" +}; + +const char *fio_get_os_string(int nr) +{ + if (nr < os_nr) + return fio_os_strings[nr]; + + return NULL; +} + +const char *fio_get_arch_string(int nr) +{ + if (nr < arch_nr) + return fio_arch_strings[nr]; + + return NULL; +} + void td_set_runstate(struct thread_data *td, int runstate) { if (td->runstate == runstate) diff --git a/fio.h b/fio.h index ba680675..04963cd8 100644 --- a/fio.h +++ b/fio.h @@ -701,4 +701,7 @@ static inline void td_io_u_free_notify(struct thread_data *td) pthread_cond_signal(&td->free_cond); } +extern const char *fio_get_arch_string(int); +extern const char *fio_get_os_string(int); + #endif diff --git a/os/os-aix.h b/os/os-aix.h index d21e5732..2f75bf8f 100644 --- a/os/os-aix.h +++ b/os/os-aix.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_AIX_H #define FIO_OS_AIX_H +#define FIO_OS os_aix + #include #include #include diff --git a/os/os-freebsd.h b/os/os-freebsd.h index 1a4f1131..875de964 100644 --- a/os/os-freebsd.h +++ b/os/os-freebsd.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_FREEBSD_H #define FIO_OS_FREEBSD_H +#define FIO_OS os_freebsd + #include #include #include diff --git a/os/os-hpux.h b/os/os-hpux.h index 93240b36..59439381 100644 --- a/os/os-hpux.h +++ b/os/os-hpux.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_HPUX_H #define FIO_OS_HPUX_H +#define FIO_OS os_hpux + #include #include #include diff --git a/os/os-linux.h b/os/os-linux.h index 2599091b..828b2081 100644 --- a/os/os-linux.h +++ b/os/os-linux.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_LINUX_H #define FIO_OS_LINUX_H +#define FIO_OS os_linux + #include #include #include diff --git a/os/os-mac.h b/os/os-mac.h index 24e0eb5d..80c49f47 100644 --- a/os/os-mac.h +++ b/os/os-mac.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_APPLE_H #define FIO_OS_APPLE_H +#define FIO_OS os_mac + #include #include #include diff --git a/os/os-netbsd.h b/os/os-netbsd.h index 5d8258bd..78ac135f 100644 --- a/os/os-netbsd.h +++ b/os/os-netbsd.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_NETBSD_H #define FIO_OS_NETBSD_H +#define FIO_OS os_netbsd + #include #include #include diff --git a/os/os-solaris.h b/os/os-solaris.h index ef37e499..5bf868ac 100644 --- a/os/os-solaris.h +++ b/os/os-solaris.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_SOLARIS_H #define FIO_OS_SOLARIS_H +#define FIO_OS os_solaris + #include #include #include diff --git a/os/os-windows.h b/os/os-windows.h index 4af212d9..65ba4377 100644 --- a/os/os-windows.h +++ b/os/os-windows.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_WINDOWS_H #define FIO_OS_WINDOWS_H +#define FIO_OS os_windows + #include #include #include diff --git a/os/os.h b/os/os.h index e1c285ce..12188156 100644 --- a/os/os.h +++ b/os/os.h @@ -6,6 +6,19 @@ #include #include +enum { + os_linux = 1, + os_aix, + os_freebsd, + os_hpux, + os_mac, + os_netbsd, + os_solaris, + os_windows, + + os_nr, +}; + #if defined(__linux__) #include "os-linux.h" #elif defined(__FreeBSD__) diff --git a/server.c b/server.c index 1e1e9d04..4f9b3624 100644 --- a/server.c +++ b/server.c @@ -309,6 +309,9 @@ static int handle_probe_cmd(struct fio_net_cmd *cmd) probe.fio_minor = FIO_MINOR; probe.fio_patch = FIO_PATCH; + probe.os = FIO_OS; + probe.arch = FIO_ARCH; + return fio_net_send_cmd(server_fd, FIO_NET_CMD_PROBE, &probe, sizeof(probe)); } diff --git a/server.h b/server.h index e9a6a37f..c6e9ce21 100644 --- a/server.h +++ b/server.h @@ -63,6 +63,8 @@ struct cmd_probe_pdu { uint8_t fio_major; uint8_t fio_minor; uint8_t fio_patch; + uint8_t os; + uint8_t arch; }; struct cmd_line_pdu { -- 2.25.1