net: move more common code out of posix routines

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9a94bf22e36ae58ea98888e4a8ab295169d01dc5

Reviewed-on: https://review.gerrithub.io/400435
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2018-02-18 21:12:55 -07:00 committed by Daniel Verkamp
parent 7ae63b0d5c
commit 8181153da0

View File

@ -343,11 +343,6 @@ spdk_posix_sock_recv(struct spdk_sock *_sock, void *buf, size_t len)
{
struct spdk_posix_sock *sock = __posix_sock(_sock);
if (sock == NULL) {
errno = EBADF;
return -1;
}
return recv(sock->fd, buf, len, MSG_DONTWAIT);
}
@ -356,11 +351,6 @@ spdk_posix_sock_writev(struct spdk_sock *_sock, struct iovec *iov, int iovcnt)
{
struct spdk_posix_sock *sock = __posix_sock(_sock);
if (sock == NULL) {
errno = EBADF;
return -1;
}
return writev(sock->fd, iov, iovcnt);
}
@ -616,12 +606,22 @@ spdk_sock_close(struct spdk_sock **sock)
ssize_t
spdk_sock_recv(struct spdk_sock *sock, void *buf, size_t len)
{
if (sock == NULL) {
errno = EBADF;
return -1;
}
return spdk_posix_sock_recv(sock, buf, len);
}
ssize_t
spdk_sock_writev(struct spdk_sock *sock, struct iovec *iov, int iovcnt)
{
if (sock == NULL) {
errno = EBADF;
return -1;
}
return spdk_posix_sock_writev(sock, iov, iovcnt);
}