diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-13 10:35:45 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-15 10:27:12 +0200 |
commit | a937a5a5347cf945fe7eff17eccd97cc849a5349 (patch) | |
tree | 7eb9fbf30f59beef831d681afcb464b20fb76f7d | |
parent | libio: Add rtems_libio_iop_is_no_delay() (diff) | |
download | rtems-a937a5a5347cf945fe7eff17eccd97cc849a5349.tar.bz2 |
libio: Add rtems_libio_iop_is_readable()
Update #3132.
-rw-r--r-- | c/src/lib/libbsp/shared/console.c | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/include/rtems/libio.h | 10 | ||||
-rw-r--r-- | cpukit/libnetworking/lib/ftpfs.c | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c index fbeec253e6..6d287c8726 100644 --- a/c/src/lib/libbsp/shared/console.c +++ b/c/src/lib/libbsp/shared/console.c @@ -255,7 +255,7 @@ rtems_device_driver console_open( } } - if ( (args->iop->flags&LIBIO_FLAGS_READ) && + if (rtems_libio_iop_is_readable(args->iop) && cptr->pDeviceFlow && cptr->pDeviceFlow->deviceStartRemoteTx) { cptr->pDeviceFlow->deviceStartRemoteTx(minor); @@ -288,7 +288,7 @@ rtems_device_driver console_close( * Stop only if it's the last one opened. */ if ( (current_tty->refcount == 1) ) { - if ( (args->iop->flags&LIBIO_FLAGS_READ) && + if (rtems_libio_iop_is_readable(args->iop) && cptr->pDeviceFlow && cptr->pDeviceFlow->deviceStopRemoteTx) { cptr->pDeviceFlow->deviceStopRemoteTx(minor); diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index 702ec352b9..7d85fb7af3 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -1390,6 +1390,16 @@ static inline bool rtems_libio_iop_is_no_delay( const rtems_libio_t *iop ) } /** + * @brief Returns true if this is a readable iop, otherwise returns false. + * + * @param[in] iop The iop. + */ +static inline bool rtems_libio_iop_is_readable( const rtems_libio_t *iop ) +{ + return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_READ ) != 0; +} + +/** * @name External I/O Handlers */ /**@{**/ diff --git a/cpukit/libnetworking/lib/ftpfs.c b/cpukit/libnetworking/lib/ftpfs.c index 912ec82b39..deccddfa89 100644 --- a/cpukit/libnetworking/lib/ftpfs.c +++ b/cpukit/libnetworking/lib/ftpfs.c @@ -1037,7 +1037,7 @@ static int rtems_ftpfs_open( /* Check for either read-only or write-only flags */ if ( (iop->flags & LIBIO_FLAGS_WRITE) != 0 - && (iop->flags & LIBIO_FLAGS_READ) != 0 + && rtems_libio_iop_is_readable(iop) ) { eno = ENOTSUP; } |