From e158c1729aa5ec3286c165267dfa26ebbc679d30 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Mar 2024 15:27:18 +0200 Subject: [PATCH] shell: mqtt: Avoid using POSIX function names This commit fixes this error seen in CI so that things work even if CONFIG_POSIX_API is enabled. subsys/shell/backends/shell_mqtt.c:727:12: error: conflicting types for 'write'; have 'int(const struct shell_transport *, const void *, size_t, size_t *)' 727 | static int write(const struct shell_transport *transport, const void *data, size_t length) include/zephyr/posix/unistd.h:230:9: note: previous declaration of 'write' with type 'ssize_t(int, const void *, size_t)' 230 | ssize_t write(int file, const void *buffer, size_t count); subsys/shell/backends/shell_mqtt.c:787:12: error: conflicting types for 'read'; have 'int(const struct shell_transport *, void *, size_t, size_t *)' 787 | static int read(const struct shell_transport *transport, void *data, size_t length, size_t *cnt) include/zephyr/posix/unistd.h:231:9: note: previous declaration of 'read' with type 'ssize_t(int, void *, size_t)' 231 | ssize_t read(int file, void *buffer, size_t count); Signed-off-by: Jukka Rissanen --- subsys/shell/backends/shell_mqtt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/subsys/shell/backends/shell_mqtt.c b/subsys/shell/backends/shell_mqtt.c index bb25296f8e..9b474436fd 100644 --- a/subsys/shell/backends/shell_mqtt.c +++ b/subsys/shell/backends/shell_mqtt.c @@ -724,8 +724,8 @@ static int enable(const struct shell_transport *transport, bool blocking) return 0; } -static int write(const struct shell_transport *transport, const void *data, size_t length, - size_t *cnt) +static int write_data(const struct shell_transport *transport, const void *data, size_t length, + size_t *cnt) { ARG_UNUSED(transport); int rc = 0; @@ -784,7 +784,8 @@ out: return rc; } -static int read(const struct shell_transport *transport, void *data, size_t length, size_t *cnt) +static int read_data(const struct shell_transport *transport, void *data, size_t length, + size_t *cnt) { ARG_UNUSED(transport); @@ -812,8 +813,8 @@ static int read(const struct shell_transport *transport, void *data, size_t leng const struct shell_transport_api shell_mqtt_transport_api = { .init = init, .uninit = uninit, .enable = enable, - .write = write, - .read = read }; + .write = write_data, + .read = read_data }; static int enable_shell_mqtt(void) {