Skip to content

Commit 20e2052

Browse files
committed
[nrf fromtree] 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 <[email protected]> (cherry picked from commit 66ff30e)
1 parent e3f4f4f commit 20e2052

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

subsys/net/lib/sockets/sockets.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ static inline void *get_sock_vtable(int sock,
7474
return ctx;
7575
}
7676

77+
size_t msghdr_non_empty_iov_count(const struct msghdr *msg)
78+
{
79+
size_t non_empty_iov_count = 0;
80+
81+
for (size_t i = 0; i < msg->msg_iovlen; i++) {
82+
if (msg->msg_iov[i].iov_len) {
83+
non_empty_iov_count++;
84+
}
85+
}
86+
87+
return non_empty_iov_count;
88+
}
89+
7790
void *z_impl_zsock_get_context_object(int sock)
7891
{
7992
const struct socket_op_vtable *ignored;

subsys/net/lib/sockets/sockets_inet.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -640,19 +640,6 @@ ssize_t zsock_sendto_ctx(struct net_context *ctx, const void *buf, size_t len,
640640
return status;
641641
}
642642

643-
size_t msghdr_non_empty_iov_count(const struct msghdr *msg)
644-
{
645-
size_t non_empty_iov_count = 0;
646-
647-
for (size_t i = 0; i < msg->msg_iovlen; i++) {
648-
if (msg->msg_iov[i].iov_len) {
649-
non_empty_iov_count++;
650-
}
651-
}
652-
653-
return non_empty_iov_count;
654-
}
655-
656643
ssize_t zsock_sendmsg_ctx(struct net_context *ctx, const struct msghdr *msg,
657644
int flags)
658645
{

0 commit comments

Comments
 (0)