]> granicus.if.org Git - strace/commitdiff
netlink_smc_diag: decode smc_diag_msg.diag_fallback constant names
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 19 Aug 2018 09:56:21 +0000 (11:56 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 27 Aug 2018 23:41:41 +0000 (23:41 +0000)
Introduced by Linux commit v4.19-rc1~140^2~285^2~4.

* xlat/smc_diag_mode.in: New file.
* netlink_smc_diag.c: Include "xlat/smc_diag_mode.h".
(decode_smc_diag_msg): Print diag_fallback field using smc_diag_mode
xlat.
* tests/netlink_sock_diag.c (test_smc_diag_msg): Update expected output.
* tests/nlattr_smc_diag_msg.c (print_smc_diag_msg): Likewise.

netlink_smc_diag.c
tests/netlink_sock_diag.c
tests/nlattr_smc_diag_msg.c
xlat/smc_diag_mode.in [new file with mode: 0644]

index 42369ad89ba35609919c8d16b75a347c7e4e6935..c2e2c66a995d9cb4fb5b1543d2fdd25e33ca3270 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "xlat/smc_diag_attrs.h"
 #include "xlat/smc_diag_extended_flags.h"
+#include "xlat/smc_diag_mode.h"
 #include "xlat/smc_link_group_roles.h"
 #include "xlat/smc_states.h"
 
@@ -190,7 +191,9 @@ DECL_NETLINK_DIAG_DECODER(decode_smc_diag_msg)
                                         (void *) &msg + offset)) {
                        PRINT_FIELD_XVAL("", msg, diag_state,
                                         smc_states, "SMC_???");
-                       PRINT_FIELD_U(", ", msg, diag_fallback);
+                       PRINT_FIELD_XVAL_INDEX(", ", msg, diag_fallback,
+                                              smc_diag_mode,
+                                              "SMC_DIAG_MODE_???");
                        PRINT_FIELD_U(", ", msg, diag_shutdown);
                        /*
                         * AF_SMC protocol family socket handler
index 880069f36301457b8ad6769a97d3df0145fda59c..dfe3526499b09d72284dc470b71e7ed2e4bad9ff 100644 (file)
@@ -609,7 +609,7 @@ test_smc_diag_msg(const int fd)
        struct smc_diag_msg msg = {
                .diag_family = AF_SMC,
                .diag_state = SMC_ACTIVE,
-               .diag_fallback = 0xde,
+               .diag_fallback = 0x1,
                .diag_shutdown = 0xba,
                .id = {
                        .idiag_sport = 0xdead,
@@ -630,7 +630,7 @@ test_smc_diag_msg(const int fd)
                       SOCK_DIAG_BY_FAMILY, NLM_F_DUMP, msg,
                       printf("{diag_family=AF_SMC"),
                       printf(", diag_state=SMC_ACTIVE");
-                      PRINT_FIELD_U(", ", msg, diag_fallback);
+                      printf(", diag_fallback=SMC_DIAG_MODE_FALLBACK_TCP");
                       PRINT_FIELD_U(", ", msg, diag_shutdown);
                       printf(", id={idiag_sport=htons(%u)"
                              ", idiag_dport=htons(%u)"
index 227ade0380109feb565e8f516c69941c778e0e01..138902759fe59ba8190370f91e9dc94554cd86f0 100644 (file)
@@ -77,7 +77,7 @@ print_smc_diag_msg(const unsigned int msg_len)
        printf("{len=%u, type=SOCK_DIAG_BY_FAMILY"
               ", flags=NLM_F_DUMP, seq=0, pid=0}"
               ", {diag_family=AF_SMC, diag_state=SMC_ACTIVE"
-              ", diag_fallback=0, diag_shutdown=0"
+              ", diag_fallback=SMC_DIAG_MODE_SMCR, diag_shutdown=0"
               ", id={idiag_sport=htons(0), idiag_dport=htons(0)"
               ", idiag_src=inet_addr(\"%s\")"
               ", idiag_dst=inet_addr(\"%s\")"
diff --git a/xlat/smc_diag_mode.in b/xlat/smc_diag_mode.in
new file mode 100644 (file)
index 0000000..4ac3963
--- /dev/null
@@ -0,0 +1,4 @@
+#value_indexed
+SMC_DIAG_MODE_SMCR             0
+SMC_DIAG_MODE_FALLBACK_TCP     1
+SMC_DIAG_MODE_SMCD             2