Pass arch/os in probe
authorJens Axboe <axboe@kernel.dk>
Fri, 7 Oct 2011 10:47:57 +0000 (12:47 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 7 Oct 2011 10:47:57 +0000 (12:47 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
28 files changed:
arch/arch-alpha.h
arch/arch-arm.h
arch/arch-generic.h
arch/arch-hppa.h
arch/arch-ia64.h
arch/arch-mips.h
arch/arch-ppc.h
arch/arch-s390.h
arch/arch-sh.h
arch/arch-sparc.h
arch/arch-sparc64.h
arch/arch-x86.h
arch/arch-x86_64.h
arch/arch.h
client.c
fio.c
fio.h
os/os-aix.h
os/os-freebsd.h
os/os-hpux.h
os/os-linux.h
os/os-mac.h
os/os-netbsd.h
os/os-solaris.h
os/os-windows.h
os/os.h
server.c
server.h

index e8132a048a1a56d90892957eb627107c72d546d2..c0f784f287baa2787da007a402c2880c98912071 100644 (file)
@@ -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
index b0cfd8087efbcd3361f087c2c960e444484f8203..658b6884e6cf57a5da054a4936c0425438caadc4 100644 (file)
@@ -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
index c7b0ca0f0e0b8fb4ee6700d879ccb625a128cb0c..a0b71f8c588dfde1acb38457bb9056ba3315a685 100644 (file)
@@ -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")
index c865a891a6afb18b45227deaf6064ac856c995a3..c1c079ed0165757c51e7a2be6c156f60d65a2698 100644 (file)
@@ -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
index 056f6365597424240c73d3129f8d6b74ac1e76f5..f4464c48b2fa146b6386d8c49cab5179f7484692 100644 (file)
@@ -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
index 759d3a9fba0fae0d643d0a85b17fa5a5aaba0297..0b781d1dad3d794b2a7c8363d95112f4a5e46fd0 100644 (file)
@@ -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
index d495a1b21aff4df9e4bd16c71f47435c04fa88dc..b790a55e898163cfc317c860403577f8b8bebb6c 100644 (file)
@@ -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
index 06477503be02859a41bd3186d1c2666ed7abc64f..fe5179134891d66d944797ee8132f2a306e4513c 100644 (file)
@@ -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
index f5f313d8f749d32974cf5e02924556aef7b30556..9acbbbee9c3fe3e0a93c146e2c3e161817f0a78a 100644 (file)
@@ -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
index cd552ab7c94fd8ce613e64b38739a4be6741c2f7..fe47b80374e6d1afb9a843134f46adfb0081de29 100644 (file)
@@ -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
index 332cf9179388377ebfc12bf85458f1dd6b73d5ea..e793ae52b7ee0cc100f02d910491f16e81d0bb2e 100644 (file)
@@ -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
index 2e803cbe5ba13c96e2f377516dca6def34bc013f..1ededd845a869b8751c64ed0a06e5bd41aad3273 100644 (file)
@@ -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
index f2dcf497f63ec89ca88c8c3817de407c7a1d80c9..29e681f2f8533926451e731460b69a499fc0aa53 100644 (file)
@@ -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
index d598652bb2e8ced3a44769d6d72fa440e3ade079..4ad49a42b74f0c5b08e4f245f49571ea0b96fc5e 100644 (file)
@@ -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 {
index 11ad1fe7f4c3ee84fb60967f2afe180072217857..8bd39a8bc7886990f835e4f89fa9dae94df46429 100644 (file)
--- 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 6e68723132dff9ceff5ca472226b86decb46d0d0..212b72e8706ac84b3ebe8c4fbaadc46b58eec688 100644 (file)
--- 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 ba6806757df21601a02eee747a506335e5bdb1f6..04963cd8b1680e6cb7062e8eb0696eba579310a9 100644 (file)
--- 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
index d21e57320a2edf8a6fbf709839476713aaed1afe..2f75bf8f3f45fec7f0bdcc1f0234cd3b43172a2c 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_AIX_H
 #define FIO_OS_AIX_H
 
+#define        FIO_OS  os_aix
+
 #include <errno.h>
 #include <unistd.h>
 #include <sys/devinfo.h>
index 1a4f11319b70fe118f2bdac80594362a22d7438b..875de9642b436dbc7f7ca4c2c28d97853edf5959 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_FREEBSD_H
 #define FIO_OS_FREEBSD_H
 
+#define        FIO_OS  os_freebsd
+
 #include <errno.h>
 #include <sys/sysctl.h>
 #include <sys/disk.h>
index 93240b364bfb528a6d2198e472291a9bca022360..5943938194cc71027556ae6d59f037e9ca0a5f6d 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_HPUX_H
 #define FIO_OS_HPUX_H
 
+#define        FIO_OS  os_hpux
+
 #include <errno.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
index 2599091b7fd41d8fbf6efdff0ee6190dfe6e9034..828b208136a393df16ed6d33c3da188da2025580 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_LINUX_H
 #define FIO_OS_LINUX_H
 
+#define        FIO_OS  os_linux
+
 #include <sys/ioctl.h>
 #include <sys/uio.h>
 #include <sys/syscall.h>
index 24e0eb5d157b8db0c292bd15fb1b3a6508e28981..80c49f474e007ea461bd22eb30d16d5b646125de 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_APPLE_H
 #define FIO_OS_APPLE_H
 
+#define        FIO_OS  os_mac
+
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/disk.h>
index 5d8258bd9460e2e6edaf14f441b291b1acb91fbb..78ac135f9ea035eddb02fb01e34e29a6e0e6eae6 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_NETBSD_H
 #define FIO_OS_NETBSD_H
 
+#define        FIO_OS  os_netbsd
+
 #include <errno.h>
 #include <sys/param.h>
 #include <sys/thr.h>
index ef37e499c26105e96ce16740c62198340384d7eb..5bf868ac8f527c3ed56c130ee633d12b5ab3b693 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_SOLARIS_H
 #define FIO_OS_SOLARIS_H
 
+#define        FIO_OS  os_solaris
+
 #include <errno.h>
 #include <malloc.h>
 #include <sys/types.h>
index 4af212d9d195a2a44e0f88bb7f9ce187bc14738c..65ba437751d4d5817a08446c95d25e492dc89ba8 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_WINDOWS_H\r
 #define FIO_OS_WINDOWS_H\r
 \r
+#define FIO_OS os_windows\r
+\r
 #include <sys/types.h>\r
 #include <errno.h>\r
 #include <windows.h>\r
diff --git a/os/os.h b/os/os.h
index e1c285ce5a5152e6e7cb76af71687efd473dc845..12188156cf280afea5ca29935d74ee794058228b 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -6,6 +6,19 @@
 #include <unistd.h>
 #include <stdlib.h>
 
+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__)
index 1e1e9d048b0b82694f31ac6716f75d384ccf443f..4f9b362455970dd54d22f965682402a3dc3e54ee 100644 (file)
--- 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));
 }
 
index e9a6a37fa14d3f126762542a7f8c34e0e61a9bf2..c6e9ce215b9c2e6ecb077ac61aa0d170cc05ff8e 100644 (file)
--- 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 {