Changeset 856ede4f in rtems


Ignore:
Timestamp:
Sep 13, 2017, 8:11:46 AM (22 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ca90c6c
Parents:
ec10d26
git-author:
Sebastian Huber <sebastian.huber@…> (09/13/17 08:11:46)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/15/17 05:48:03)
Message:

libio: Add iop set/clear flags

Update #3132.

Location:
cpukit
Files:
9 edited

Legend:

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

    rec10d26 r856ede4f  
    8989 */
    9090extern rtems_filesystem_global_location_t rtems_filesystem_global_location_null;
     91
     92/**
     93 * @brief Sets the specified flags in the iop.
     94 *
     95 * @param[in] iop The iop.
     96 * @param[in] set The flags to set.
     97 *
     98 * @return The previous flags.
     99 */
     100static inline uint32_t rtems_libio_iop_flags_set(
     101  rtems_libio_t *iop,
     102  uint32_t       set
     103)
     104{
     105  uint32_t flags;
     106
     107  flags = iop->flags;
     108  iop->flags = flags | set;
     109  return flags;
     110}
     111
     112/**
     113 * @brief Clears the specified flags in the iop.
     114 *
     115 * @param[in] iop The iop.
     116 * @param[in] clear The flags to clear.
     117 *
     118 * @return The previous flags.
     119 */
     120static inline uint32_t rtems_libio_iop_flags_clear(
     121  rtems_libio_t *iop,
     122  uint32_t       clear
     123)
     124{
     125  uint32_t flags;
     126
     127  flags = iop->flags;
     128  iop->flags = flags & ~clear;
     129  return flags;
     130}
    91131
    92132/**
  • cpukit/libcsupport/src/close.c

    rec10d26 r856ede4f  
    3232  rtems_libio_check_is_open(iop);
    3333
    34   iop->flags &= ~LIBIO_FLAGS_OPEN;
     34  rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_OPEN );
    3535
    3636  rc = (*iop->pathinfo.handlers->close_h)( iop );
  • cpukit/libcsupport/src/fcntl.c

    rec10d26 r856ede4f  
    3434    int oflag = rtems_libio_to_fcntl_flags( iop->flags );
    3535
    36     diop->flags |= rtems_libio_fcntl_flags( oflag );
     36    rtems_libio_iop_flags_set( diop, rtems_libio_fcntl_flags( oflag ) );
    3737
    3838    rtems_filesystem_instance_lock( &iop->pathinfo );
     
    7676    if (rv == 0) {
    7777      oflag = rtems_libio_to_fcntl_flags( iop->flags );
    78       iop2->flags |= rtems_libio_fcntl_flags( oflag );
     78      rtems_libio_iop_flags_set( iop2, rtems_libio_fcntl_flags( oflag ) );
    7979
    8080      rtems_filesystem_instance_lock( &iop->pathinfo );
     
    146146
    147147      if ( va_arg( ap, int ) )
    148         iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC;
     148        rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_CLOSE_ON_EXEC );
    149149      else
    150         iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC;
     150        rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_CLOSE_ON_EXEC );
    151151      break;
    152152
     
    163163       */
    164164
    165       iop->flags = (iop->flags & ~mask) | (flags & mask);
     165      rtems_libio_iop_flags_clear( iop, mask );
     166      rtems_libio_iop_flags_set( iop, flags & mask );
    166167      break;
    167168
  • cpukit/libcsupport/src/open.c

    rec10d26 r856ede4f  
    9797  }
    9898
    99   iop->flags |= rtems_libio_fcntl_flags( oflag );
     99  rtems_libio_iop_flags_set( iop, rtems_libio_fcntl_flags( oflag ) );
    100100  rtems_filesystem_eval_path_extract_currentloc( &ctx, &iop->pathinfo );
    101101  rtems_filesystem_eval_path_cleanup( &ctx );
  • cpukit/libfs/src/imfs/imfs_fifo.c

    rec10d26 r856ede4f  
    103103    else {
    104104      if (*(int *)buffer)
    105         iop->flags |= LIBIO_FLAGS_NO_DELAY;
     105        rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_NO_DELAY );
    106106      else
    107         iop->flags &= ~LIBIO_FLAGS_NO_DELAY;
     107        rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_NO_DELAY );
    108108      return 0;
    109109    }
  • cpukit/libfs/src/pipe/fifo.c

    rec10d26 r856ede4f  
    266266
    267267  /* This is safe for IMFS, but how about other FSes? */
    268   iop->flags &= ~LIBIO_FLAGS_OPEN;
     268  rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_OPEN );
    269269  if(iop->pathinfo.ops->unlink_h(&iop->pathinfo))
    270270    return;
  • cpukit/libfs/src/pipe/pipe.c

    rec10d26 r856ede4f  
    6565  /* Reset open file to blocking mode */
    6666    iop = rtems_libio_iop(filsdes[0]);
    67     iop->flags &= ~LIBIO_FLAGS_NO_DELAY;
     67    rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_NO_DELAY );
    6868
    6969    filsdes[1] = open(fifopath, O_WRONLY);
  • cpukit/libnetworking/rtems/rtems_syscall.c

    rec10d26 r856ede4f  
    8282
    8383  fd = rtems_libio_iop_to_descriptor(iop);
    84   iop->flags |= LIBIO_FLAGS_WRITE | LIBIO_FLAGS_READ;
     84  rtems_libio_iop_flags_set(iop, LIBIO_FLAGS_READ_WRITE);
    8585  iop->data0 = fd;
    8686  iop->data1 = so;
  • cpukit/posix/src/shmopen.c

    rec10d26 r856ede4f  
    276276
    277277  fd = rtems_libio_iop_to_descriptor( iop );
    278   iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC;
     278  rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_CLOSE_ON_EXEC );
    279279  if ( oflag & O_RDONLY ) {
    280     iop->flags |= LIBIO_FLAGS_READ;
     280    rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_READ );
    281281  } else {
    282     iop->flags |= LIBIO_FLAGS_READ_WRITE;
     282    rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_READ_WRITE );
    283283  }
    284284  iop->data0 = fd;
Note: See TracChangeset for help on using the changeset viewer.