From 052e10694d40bb49247ca99ca05b1f284767b2bf Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 21 Feb 2020 16:58:41 +0000 Subject: [PATCH] adding mio_dev_timedwritev() --- mio/lib/mio-sck.h | 11 +++++++++++ mio/lib/mio.c | 6 ++++++ mio/lib/mio.h | 17 +++++++++++++++++ mio/lib/sck.c | 6 ++++++ 4 files changed, 40 insertions(+) diff --git a/mio/lib/mio-sck.h b/mio/lib/mio-sck.h index c78e7bf..4013d50 100644 --- a/mio/lib/mio-sck.h +++ b/mio/lib/mio-sck.h @@ -463,6 +463,17 @@ MIO_EXPORT int mio_dev_sck_timedwrite ( const mio_skad_t* dstaddr ); + +MIO_EXPORT int mio_dev_sck_timedwritev ( + mio_dev_sck_t* dev, + const mio_iovec_t* iov, + mio_iolen_t iovcnt, + const mio_ntime_t* tmout, + void* wrctx, + const mio_skad_t* dstaddr +); + + #if defined(MIO_HAVE_INLINE) static MIO_INLINE void mio_dev_sck_kill (mio_dev_sck_t* sck) diff --git a/mio/lib/mio.c b/mio/lib/mio.c index f577675..328f259 100644 --- a/mio/lib/mio.c +++ b/mio/lib/mio.c @@ -1279,6 +1279,12 @@ int mio_dev_timedwrite (mio_dev_t* dev, const void* data, mio_iolen_t len, const return __dev_write(dev, data, len, tmout, wrctx, dstaddr); } +int mio_dev_timedwritev (mio_dev_t* dev, const mio_iovec_t* iov, mio_iolen_t iovcnt, const mio_ntime_t* tmout, void* wrctx, const mio_devaddr_t* dstaddr) +{ + //return __dev_write(dev, data, len, tmout, wrctx, dstaddr); + return -1; +} + /* -------------------------------------------------------------------------- */ void mio_gettime (mio_t* mio, mio_ntime_t* now) diff --git a/mio/lib/mio.h b/mio/lib/mio.h index a8e66d6..2a77d14 100644 --- a/mio/lib/mio.h +++ b/mio/lib/mio.h @@ -63,6 +63,13 @@ typedef struct mio_wq_t mio_wq_t; typedef struct mio_cwq_t mio_cwq_t; typedef mio_intptr_t mio_iolen_t; /* NOTE: this is a signed type */ +struct mio_iovec_t +{ + void* iov_ptr; + mio_oow_t iov_len; +}; +typedef struct mio_iovec_t mio_iovec_t; + enum mio_errnum_t { MIO_ENOERR, /**< no error */ @@ -807,6 +814,16 @@ MIO_EXPORT int mio_dev_timedwrite ( ); +MIO_EXPORT int mio_dev_timedwritev ( + mio_dev_t* dev, + const mio_iovec_t* iov, + mio_iolen_t iovcnt, + const mio_ntime_t* tmout, + void* wrctx, + const mio_devaddr_t* dstaddr +); + + /* ========================================================================= * TIMER MANAGEMENT * ========================================================================= */ diff --git a/mio/lib/sck.c b/mio/lib/sck.c index ba146b0..fa795e3 100644 --- a/mio/lib/sck.c +++ b/mio/lib/sck.c @@ -1601,6 +1601,12 @@ int mio_dev_sck_timedwrite (mio_dev_sck_t* dev, const void* data, mio_iolen_t dl return mio_dev_timedwrite((mio_dev_t*)dev, data, dlen, tmout, wrctx, skad_to_devaddr(dev, dstaddr, &devaddr)); } +int mio_dev_sck_timedwritev (mio_dev_sck_t* dev, const mio_iovec_t* iov, mio_iolen_t iovcnt, const mio_ntime_t* tmout, void* wrctx, const mio_skad_t* dstaddr) +{ + mio_devaddr_t devaddr; + return mio_dev_timedwrite((mio_dev_t*)dev, iov, iovcnt, tmout, wrctx, skad_to_devaddr(dev, dstaddr, &devaddr)); +} + /* ========================================================================= */