From 66ff30efb4d786ac15a4ef03a81bbe7a3f315690 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 7 Oct 2024 16:45:40 +0200 Subject: [PATCH] net: sockets: Move msghdr_non_empty_iov_count() to common file msghdr_non_empty_iov_count() is used by TLS sockets too therefore should be available regardless of native IP sockets being enabled or not. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets.c | 13 +++++++++++++ subsys/net/lib/sockets/sockets_inet.c | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 8b420cc9e68d..be7ba5ad9678 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -74,6 +74,19 @@ static inline void *get_sock_vtable(int sock, return ctx; } +size_t msghdr_non_empty_iov_count(const struct msghdr *msg) +{ + size_t non_empty_iov_count = 0; + + for (size_t i = 0; i < msg->msg_iovlen; i++) { + if (msg->msg_iov[i].iov_len) { + non_empty_iov_count++; + } + } + + return non_empty_iov_count; +} + void *z_impl_zsock_get_context_object(int sock) { const struct socket_op_vtable *ignored; diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index 10de541fc8f7..88e4e47bfe4a 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -640,19 +640,6 @@ ssize_t zsock_sendto_ctx(struct net_context *ctx, const void *buf, size_t len, return status; } -size_t msghdr_non_empty_iov_count(const struct msghdr *msg) -{ - size_t non_empty_iov_count = 0; - - for (size_t i = 0; i < msg->msg_iovlen; i++) { - if (msg->msg_iov[i].iov_len) { - non_empty_iov_count++; - } - } - - return non_empty_iov_count; -} - ssize_t zsock_sendmsg_ctx(struct net_context *ctx, const struct msghdr *msg, int flags) {