summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/libcsupport/include/rtems/libio_.h20
-rw-r--r--cpukit/libcsupport/src/fstat.c2
2 files changed, 14 insertions, 8 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h
index c2fb975bf7..85f9c8e0a5 100644
--- a/cpukit/libcsupport/include/rtems/libio_.h
+++ b/cpukit/libcsupport/include/rtems/libio_.h
@@ -89,15 +89,21 @@ extern rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry;
*/
extern rtems_filesystem_global_location_t rtems_filesystem_global_location_null;
-/*
- * rtems_libio_iop
+/**
+ * @brief Maps a file descriptor to the iop.
+ *
+ * The file descriptor must be a valid index into the iop table.
+ *
+ * @param[in] fd The file descriptor.
*
- * Macro to return the file descriptor pointer.
+ * @return The iop corresponding to the specified file descriptor.
+ *
+ * @see rtems_libio_check_fd().
*/
-
-#define rtems_libio_iop(_fd) \
- ((((uint32_t)(_fd)) < rtems_libio_number_iops) ? \
- &rtems_libio_iops[_fd] : 0)
+static inline rtems_libio_t *rtems_libio_iop( int fd )
+{
+ return &rtems_libio_iops[ fd ];
+}
/*
* rtems_libio_iop_to_descriptor
diff --git a/cpukit/libcsupport/src/fstat.c b/cpukit/libcsupport/src/fstat.c
index 8b39c438f4..4c284bd408 100644
--- a/cpukit/libcsupport/src/fstat.c
+++ b/cpukit/libcsupport/src/fstat.c
@@ -36,8 +36,8 @@ int fstat(
/*
* Now process the stat() request.
*/
- iop = rtems_libio_iop( fd );
rtems_libio_check_fd( fd );
+ iop = rtems_libio_iop( fd );
rtems_libio_check_is_open(iop);
/*