Changeset 7b45202 in rtems


Ignore:
Timestamp:
Sep 13, 2017, 6:25:33 AM (22 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
4b759b1
Parents:
5eb67f3
git-author:
Sebastian Huber <sebastian.huber@…> (09/13/17 06:25:33)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/14/17 05:02:29)
Message:

libio: Simplify rtems_libio_iop()

Remove the file descriptor validation. This is the job of
rtems_libio_check_fd(). Use an inline function instread of a macro.

Update #3132.

Location:
cpukit/libcsupport
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/include/rtems/libio_.h

    r5eb67f3 r7b45202  
    9090extern rtems_filesystem_global_location_t rtems_filesystem_global_location_null;
    9191
    92 /*
    93  *  rtems_libio_iop
    94  *
    95  *  Macro to return the file descriptor pointer.
    96  */
    97 
    98 #define rtems_libio_iop(_fd) \
    99   ((((uint32_t)(_fd)) < rtems_libio_number_iops) ? \
    100          &rtems_libio_iops[_fd] : 0)
     92/**
     93 * @brief Maps a file descriptor to the iop.
     94 *
     95 * The file descriptor must be a valid index into the iop table.
     96 *
     97 * @param[in] fd The file descriptor.
     98 *
     99 * @return The iop corresponding to the specified file descriptor.
     100 *
     101 * @see rtems_libio_check_fd().
     102 */
     103static inline rtems_libio_t *rtems_libio_iop( int fd )
     104{
     105  return &rtems_libio_iops[ fd ];
     106}
    101107
    102108/*
  • cpukit/libcsupport/src/fstat.c

    r5eb67f3 r7b45202  
    3737   *  Now process the stat() request.
    3838   */
     39  rtems_libio_check_fd( fd );
    3940  iop = rtems_libio_iop( fd );
    40   rtems_libio_check_fd( fd );
    4141  rtems_libio_check_is_open(iop);
    4242
Note: See TracChangeset for help on using the changeset viewer.