From: Christoph Gysin Date: Tue, 29 Sep 2015 06:53:01 +0000 (+0300) Subject: eal: fix C++ build X-Git-Tag: spdx-start~8371 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7499ef45c375998a67c65b7eac0d9d4639ac5ac4;p=dpdk.git eal: fix C++ build 'virtual' is a keyword and can't be used if the code is to compile with C++ compilers. If rte_devargs.h was included in C++ code, compilation with clang++ failed with an error. g++ did not fail, but only because of a bug that treats it as an anonymous struct with a decl-specifier which it ignores. This simply renames the member to 'virt'. Reported-by: Ming Zhao Signed-off-by: Christoph Gysin Acked-by: Cristian Dumitrescu Acked-by: David Marchand --- diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c index f7fc59cdf4..049f32d43f 100644 --- a/app/test/test_devargs.c +++ b/app/test/test_devargs.c @@ -91,8 +91,8 @@ test_devargs(void) if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "eth_ring1,k1=val,k2=val2") < 0) goto fail; devargs = TAILQ_FIRST(&devargs_list); - if (strncmp(devargs->virtual.drv_name, "eth_ring1", - sizeof(devargs->virtual.drv_name)) != 0) + if (strncmp(devargs->virt.drv_name, "eth_ring1", + sizeof(devargs->virt.drv_name)) != 0) goto fail; if (!devargs->args || strcmp(devargs->args, "k1=val,k2=val2") != 0) goto fail; diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 4f75cff4b0..080fd9ffb0 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -94,6 +94,8 @@ API Changes * The deprecated ring PMD functions are removed: rte_eth_ring_pair_create() and rte_eth_ring_pair_attach(). +* The devargs union field virtual is renamed to virt for C++ compatibility. + ABI Changes ----------- diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 4089d6623e..a8a4146c63 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -107,10 +107,10 @@ rte_eal_dev_init(void) if (devargs->type != RTE_DEVTYPE_VIRTUAL) continue; - if (rte_eal_vdev_init(devargs->virtual.drv_name, + if (rte_eal_vdev_init(devargs->virt.drv_name, devargs->args)) { RTE_LOG(ERR, EAL, "failed to initialize %s device\n", - devargs->virtual.drv_name); + devargs->virt.drv_name); return -1; } } diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index ec56165886..5d075d0436 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -107,9 +107,9 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) break; case RTE_DEVTYPE_VIRTUAL: /* save driver name */ - ret = snprintf(devargs->virtual.drv_name, - sizeof(devargs->virtual.drv_name), "%s", buf); - if (ret < 0 || ret >= (int)sizeof(devargs->virtual.drv_name)) + ret = snprintf(devargs->virt.drv_name, + sizeof(devargs->virt.drv_name), "%s", buf); + if (ret < 0 || ret >= (int)sizeof(devargs->virt.drv_name)) goto fail; break; @@ -169,7 +169,7 @@ rte_eal_devargs_dump(FILE *f) devargs->args); else if (devargs->type == RTE_DEVTYPE_VIRTUAL) fprintf(f, " VIRTUAL %s %s\n", - devargs->virtual.drv_name, + devargs->virt.drv_name, devargs->args); else fprintf(f, " UNKNOWN %s\n", devargs->args); diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 7084ae26e5..53c59f5657 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -86,7 +86,7 @@ struct rte_devargs { struct { /** Driver name. */ char drv_name[32]; - } virtual; + } virt; }; /** Arguments string as given by user or "" for no argument. */ char *args;