drivers eth_native_linux: Avoid using ssize

ssize is a POSIX.1-2001 extension, which may or may
not be provided by the C library, or may be defined
to a different size in the host and embedded C library.

Two internal functions were returning ssize.
As these functions were just trampolines
into the same host API, which are already provided
by the native simulator let's just use those.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-12-28 16:58:45 +01:00 committed by Henrik Brix Andersen
parent 5382f827d6
commit 5c06d60cce
3 changed files with 3 additions and 14 deletions

View file

@ -35,6 +35,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <zephyr/net/lldp.h>
#include "eth_native_posix_priv.h"
#include "nsi_host_trampolines.h"
#include "eth.h"
#define NET_BUF_TIMEOUT K_MSEC(100)
@ -193,7 +194,7 @@ static int eth_send(const struct device *dev, struct net_pkt *pkt)
LOG_DBG("Send pkt %p len %d", pkt, count);
ret = eth_write_data(ctx->dev_fd, ctx->send, count);
ret = nsi_host_write(ctx->dev_fd, ctx->send, count);
if (ret < 0) {
LOG_DBG("Cannot send pkt %p (%d)", pkt, ret);
}
@ -321,7 +322,7 @@ static int read_data(struct eth_context *ctx, int fd)
int status;
int count;
count = eth_read_data(fd, ctx->recv, sizeof(ctx->recv));
count = nsi_host_read(fd, ctx->recv, sizeof(ctx->recv));
if (count <= 0) {
return 0;
}

View file

@ -116,16 +116,6 @@ int eth_wait_data(int fd)
return -EAGAIN;
}
ssize_t eth_read_data(int fd, void *buf, size_t buf_len)
{
return read(fd, buf, buf_len);
}
ssize_t eth_write_data(int fd, void *buf, size_t buf_len)
{
return write(fd, buf, buf_len);
}
int eth_clock_gettime(uint64_t *second, uint32_t *nanosecond)
{
struct timespec tp;

View file

@ -14,8 +14,6 @@
int eth_iface_create(const char *dev_name, const char *if_name, bool tun_only);
int eth_iface_remove(int fd);
int eth_wait_data(int fd);
ssize_t eth_read_data(int fd, void *buf, size_t buf_len);
ssize_t eth_write_data(int fd, void *buf, size_t buf_len);
int eth_clock_gettime(uint64_t *second, uint32_t *nanosecond);
int eth_promisc_mode(const char *if_name, bool enable);