From 4aa4528d28b136f52713a59d29cabe99a2929d27 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 27 Apr 2020 04:11:49 +0000 Subject: [PATCH] added mio_dev_getmio() --- mio/lib/mio.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mio/lib/mio.h b/mio/lib/mio.h index d8c084a..deafdae 100644 --- a/mio/lib/mio.h +++ b/mio/lib/mio.h @@ -429,8 +429,6 @@ struct mio_svc_t else (mio)->actsvc.tail = (svc)->svc_prev; \ } while (0) -#define mio_svc_getmio(svc) (((mio_svc_t*)(svc))->mio) - /* ========================================================================= * MIO LOGGING * ========================================================================= */ @@ -764,6 +762,12 @@ MIO_EXPORT void mio_dev_halt ( mio_dev_t* dev ); +#if defined(MIO_HAVE_INLINE) +static MIO_INLINE mio_t* mio_dev_getmio (mio_dev_t* dev) { return dev->mio; } +#else +# define mio_dev_getmio(dev) (((mio_dev_t*)(dev))->mio) +#endif + MIO_EXPORT int mio_dev_ioctl ( mio_dev_t* dev, int cmd, @@ -832,6 +836,16 @@ MIO_EXPORT int mio_dev_timedwritev ( const mio_devaddr_t* dstaddr ); +/* ========================================================================= + * SERVICE + * ========================================================================= */ + +#if defined(MIO_HAVE_INLINE) +static MIO_INLINE mio_t* mio_svc_getmio (mio_svc_t* svc) { return svc->mio; } +#else +# define mio_svc_getmio(svc) (((mio_svc_t*)(svc))->mio) +#endif + /* ========================================================================= * TIMER MANAGEMENT