[dpdk-dev] [PATCH v3 4/5] telemetry: implement empty stubs for Windows
Narcisa Ana Maria Vasile
navasile at linux.microsoft.com
Tue Aug 4 03:26:50 CEST 2020
On Mon, Aug 03, 2020 at 01:38:42PM +0300, Fady Bader wrote:
> Telemetry didn't compile under Windows.
> Empty stubs implementation was added for Windows.
>
> Signed-off-by: Fady Bader <fady at mellanox.com>
> ---
> lib/librte_telemetry/rte_telemetry.h | 4 +++
> lib/librte_telemetry/telemetry.c | 52 ++++++++++++++++++++++++++++++++-
> lib/librte_telemetry/telemetry_legacy.c | 26 ++++++++++++++++-
> 3 files changed, 80 insertions(+), 2 deletions(-)
>
> +
> +#ifndef RTE_EXEC_ENV_WINDOWS
> /* list of command callbacks, with one command registered by default */
> static struct cmd_callback callbacks[TELEMETRY_MAX_CALLBACKS];
> static int num_callbacks; /* How many commands are registered */
> /* Used when accessing or modifying list of command callbacks */
> static rte_spinlock_t callback_sl = RTE_SPINLOCK_INITIALIZER;
> static uint16_t v2_clients;
> +int
Remove 'int'
> +#endif
>
> int
> rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help)
> {
> +#ifndef RTE_EXEC_ENV_WINDOWS
> +
> int i = 0;
>
> if (strlen(cmd) >= MAX_CMD_LEN || fn == NULL || cmd[0] != '/'
> @@ -76,8 +98,19 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help)
> rte_spinlock_unlock(&callback_sl);
>
> return 0;
> +
> +#else
> +
> + RTE_SET_USED(cmd);
> + RTE_SET_USED(fn);
> + RTE_SET_USED(help);
> +
> + return 0;
> +
> +#endif
Maybe add a comment like /* RTE_EXEC_ENV_WINDOWS */ next to each #else/#endif, to be easier to follow what's being guarded out. Your guards are rather small,
so it's easy to follow, but sometimes when big chunks of code are being guarded, it's harder to tell what the guard was for (e.g. line 446 it's the end of a big #ifdef/#endif).
> }
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
More information about the dev
mailing list