Changeset dd19c0b in rtems


Ignore:
Timestamp:
Aug 11, 2000, 8:04:27 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ee511076
Parents:
e7de167c
Message:

2000-08-11 Chris Johns <ccj@…>

  • libc/chmod.c: Return ENOTSUP if filesystem does not have handler.
  • libc/eval.c: Ditto.
  • libc/fcntl.c: Ditto.
  • libc/fsync.c: Ditto.
  • libc/ioctl.c: Ditto.
  • libc/ioman.c: Ditto.
  • libc/link.c: Ditto.
  • libc/memfile.c: Ditto.
  • libc/mknod.c: Ditto.
  • libc/symlink.c: Ditto.
  • libc/libio.h(rtems_filesystem_dev_major_t): New macro.
  • libc/libio.h(rtems_filesystem_dev_minor_t): New macro.
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/include/rtems/libio.h

    re7de167c rdd19c0b  
    467467  ((((dev_t)(_major)) << 32) | (dev_t)(_minor))
    468468
     469#define rtems_filesystem_dev_major_t( _dev ) \
     470  (rtems_device_major_number) ((_dev) >> 32)
     471
     472#define rtems_filesystem_dev_minor_t( _dev ) \
     473  (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF)
     474
    469475#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
    470476  do { \
    471     (_major) = (rtems_device_major_number) ((_dev) >> 32); \
    472     (_minor) = (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF); \
     477    (_major) = rtems_filesystem_dev_major_t ( _dev ); \
     478    (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
    473479  } while(0)
    474480
  • c/src/exec/libcsupport/src/chmod.c

    re7de167c rdd19c0b  
    3434    return -1;
    3535 
     36  if ( !loc.handlers ){
     37    rtems_filesystem_freenode( &loc );
     38    set_errno_and_return_minus_one( EBADF );
     39  }
     40
    3641  if ( !loc.handlers->fchmod ){
    3742    rtems_filesystem_freenode( &loc );
  • c/src/exec/libcsupport/src/eval.c

    re7de167c rdd19c0b  
    4444  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
    4545
     46  if ( !pathloc->ops->evalpath )
     47    set_errno_and_return_minus_one( ENOTSUP );
     48
    4649  result = (*pathloc->ops->evalpath)( &pathname[i], flags, pathloc );
    4750
  • c/src/exec/libcsupport/src/fcntl.c

    re7de167c rdd19c0b  
    132132      break;
    133133  }
    134   if ((ret >= 0) && iop->handlers->fcntl) {
    135     int err = (*iop->handlers->fcntl)( cmd, iop );
    136     if (err) {
    137       errno = err;
     134  if (ret >= 0) {   
     135    if (iop->handlers->fcntl) {
     136      int err = (*iop->handlers->fcntl)( cmd, iop );
     137      if (err) {
     138        errno = err;
     139        ret = -1;
     140      }
     141    }
     142    else {
     143      errno = ENOTSUP;
    138144      ret = -1;
    139145    }
  • c/src/exec/libcsupport/src/fsync.c

    re7de167c rdd19c0b  
    3131   */
    3232
     33  if ( !iop->handlers )
     34    set_errno_and_return_minus_one( EBADF );
     35
    3336  if ( !iop->handlers->fsync )
    3437    set_errno_and_return_minus_one( ENOTSUP );
  • c/src/exec/libcsupport/src/ioctl.c

    re7de167c rdd19c0b  
    4242   */
    4343
     44  if ( !iop->handlers )
     45    set_errno_and_return_minus_one( EBADF );
     46
    4447  if ( !iop->handlers->ioctl )
    4548    set_errno_and_return_minus_one( ENOTSUP );
  • c/src/exec/libcsupport/src/link.c

    re7de167c rdd19c0b  
    4242
    4343  rtems_filesystem_get_start_loc( new, &i, &parent_loc );
     44
     45  if ( !parent_loc.ops->evalformake ) {
     46    rtems_filesystem_freenode( &existing_loc );
     47    rtems_filesystem_freenode( &parent_loc );
     48    set_errno_and_return_minus_one( ENOTSUP );
     49  }
     50
    4451  result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
    4552  if ( result != 0 ) {
     53    rtems_filesystem_freenode( &existing_loc );
    4654    rtems_filesystem_freenode( &parent_loc );
    4755    set_errno_and_return_minus_one( result );
  • c/src/exec/libcsupport/src/mknod.c

    re7de167c rdd19c0b  
    4444  rtems_filesystem_get_start_loc( pathname, &i, &temp_loc );
    4545
     46  if ( !temp_loc.ops->evalformake ) {
     47    rtems_filesystem_freenode( &temp_loc );
     48    set_errno_and_return_minus_one( ENOTSUP );
     49  }
     50
    4651  result = (*temp_loc.ops->evalformake)(
    4752    &pathname[i],
  • c/src/exec/libcsupport/src/symlink.c

    re7de167c rdd19c0b  
    2929    return -1;
    3030
     31  if ( !loc.ops->symlink ) {
     32    rtems_filesystem_freenode( &loc );
     33    set_errno_and_return_minus_one( ENOTSUP );
     34  }
     35
    3136  result = (*loc.ops->symlink)( &loc, actualpath, name_start);
    3237
  • c/src/exec/libfs/src/imfs/ioman.c

    re7de167c rdd19c0b  
    8181  the_jnode = loc.node_access;
    8282
     83  if ( !loc.ops->node_type ) {
     84    rtems_filesystem_freenode( &loc );
     85    set_errno_and_return_minus_one( ENOTSUP );
     86  }
     87
    8388  node_type = (*loc.ops->node_type)( &loc );
    8489
  • c/src/exec/libfs/src/imfs/memfile.c

    re7de167c rdd19c0b  
    112112
    113113  the_jnode = iop->file_info;
     114
     115  if (iop->flags & LIBIO_FLAGS_APPEND)
     116    iop->offset = the_jnode->info.file.size;
    114117
    115118  return 0;
     
    341344
    342345  memory = memfile_alloc_block();
    343   assert( memory );
    344346  if ( !memory )
    345347    return 1;
  • c/src/lib/ChangeLog

    re7de167c rdd19c0b  
     1
     22000-08-11  Chris Johns <ccj@acm.org>
     3
     4        * libc/chmod.c: Return ENOTSUP if filesystem does not have handler.
     5        * libc/eval.c: Ditto.
     6        * libc/fcntl.c: Ditto.
     7        * libc/fsync.c: Ditto.
     8        * libc/ioctl.c: Ditto.
     9        * libc/ioman.c: Ditto.
     10        * libc/memfile.c: Ditto.
     11        * libc/link.c: Ditto.
     12        * libc/mknod.c: Ditto.
     13        * libc/symlink.c: Ditto.
     14        * libc/libio.h(rtems_filesystem_dev_major_t): New macro.
     15        appending to a file.
    116
    2172000-08-10      Joel Sherrill <joel@OARcorp.com>
  • c/src/lib/include/rtems/libio.h

    re7de167c rdd19c0b  
    467467  ((((dev_t)(_major)) << 32) | (dev_t)(_minor))
    468468
     469#define rtems_filesystem_dev_major_t( _dev ) \
     470  (rtems_device_major_number) ((_dev) >> 32)
     471
     472#define rtems_filesystem_dev_minor_t( _dev ) \
     473  (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF)
     474
    469475#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
    470476  do { \
    471     (_major) = (rtems_device_major_number) ((_dev) >> 32); \
    472     (_minor) = (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF); \
     477    (_major) = rtems_filesystem_dev_major_t ( _dev ); \
     478    (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
    473479  } while(0)
    474480
  • c/src/lib/libc/chmod.c

    re7de167c rdd19c0b  
    3434    return -1;
    3535 
     36  if ( !loc.handlers ){
     37    rtems_filesystem_freenode( &loc );
     38    set_errno_and_return_minus_one( EBADF );
     39  }
     40
    3641  if ( !loc.handlers->fchmod ){
    3742    rtems_filesystem_freenode( &loc );
  • c/src/lib/libc/eval.c

    re7de167c rdd19c0b  
    4444  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
    4545
     46  if ( !pathloc->ops->evalpath )
     47    set_errno_and_return_minus_one( ENOTSUP );
     48
    4649  result = (*pathloc->ops->evalpath)( &pathname[i], flags, pathloc );
    4750
  • c/src/lib/libc/fcntl.c

    re7de167c rdd19c0b  
    132132      break;
    133133  }
    134   if ((ret >= 0) && iop->handlers->fcntl) {
    135     int err = (*iop->handlers->fcntl)( cmd, iop );
    136     if (err) {
    137       errno = err;
     134  if (ret >= 0) {   
     135    if (iop->handlers->fcntl) {
     136      int err = (*iop->handlers->fcntl)( cmd, iop );
     137      if (err) {
     138        errno = err;
     139        ret = -1;
     140      }
     141    }
     142    else {
     143      errno = ENOTSUP;
    138144      ret = -1;
    139145    }
  • c/src/lib/libc/fsync.c

    re7de167c rdd19c0b  
    3131   */
    3232
     33  if ( !iop->handlers )
     34    set_errno_and_return_minus_one( EBADF );
     35
    3336  if ( !iop->handlers->fsync )
    3437    set_errno_and_return_minus_one( ENOTSUP );
  • c/src/lib/libc/ioctl.c

    re7de167c rdd19c0b  
    4242   */
    4343
     44  if ( !iop->handlers )
     45    set_errno_and_return_minus_one( EBADF );
     46
    4447  if ( !iop->handlers->ioctl )
    4548    set_errno_and_return_minus_one( ENOTSUP );
  • c/src/lib/libc/ioman.c

    re7de167c rdd19c0b  
    8181  the_jnode = loc.node_access;
    8282
     83  if ( !loc.ops->node_type ) {
     84    rtems_filesystem_freenode( &loc );
     85    set_errno_and_return_minus_one( ENOTSUP );
     86  }
     87
    8388  node_type = (*loc.ops->node_type)( &loc );
    8489
  • c/src/lib/libc/libio.h

    re7de167c rdd19c0b  
    467467  ((((dev_t)(_major)) << 32) | (dev_t)(_minor))
    468468
     469#define rtems_filesystem_dev_major_t( _dev ) \
     470  (rtems_device_major_number) ((_dev) >> 32)
     471
     472#define rtems_filesystem_dev_minor_t( _dev ) \
     473  (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF)
     474
    469475#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
    470476  do { \
    471     (_major) = (rtems_device_major_number) ((_dev) >> 32); \
    472     (_minor) = (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF); \
     477    (_major) = rtems_filesystem_dev_major_t ( _dev ); \
     478    (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
    473479  } while(0)
    474480
  • c/src/lib/libc/link.c

    re7de167c rdd19c0b  
    4242
    4343  rtems_filesystem_get_start_loc( new, &i, &parent_loc );
     44
     45  if ( !parent_loc.ops->evalformake ) {
     46    rtems_filesystem_freenode( &existing_loc );
     47    rtems_filesystem_freenode( &parent_loc );
     48    set_errno_and_return_minus_one( ENOTSUP );
     49  }
     50
    4451  result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
    4552  if ( result != 0 ) {
     53    rtems_filesystem_freenode( &existing_loc );
    4654    rtems_filesystem_freenode( &parent_loc );
    4755    set_errno_and_return_minus_one( result );
  • c/src/lib/libc/memfile.c

    re7de167c rdd19c0b  
    112112
    113113  the_jnode = iop->file_info;
     114
     115  if (iop->flags & LIBIO_FLAGS_APPEND)
     116    iop->offset = the_jnode->info.file.size;
    114117
    115118  return 0;
     
    341344
    342345  memory = memfile_alloc_block();
    343   assert( memory );
    344346  if ( !memory )
    345347    return 1;
  • c/src/lib/libc/mknod.c

    re7de167c rdd19c0b  
    4444  rtems_filesystem_get_start_loc( pathname, &i, &temp_loc );
    4545
     46  if ( !temp_loc.ops->evalformake ) {
     47    rtems_filesystem_freenode( &temp_loc );
     48    set_errno_and_return_minus_one( ENOTSUP );
     49  }
     50
    4651  result = (*temp_loc.ops->evalformake)(
    4752    &pathname[i],
  • c/src/lib/libc/symlink.c

    re7de167c rdd19c0b  
    2929    return -1;
    3030
     31  if ( !loc.ops->symlink ) {
     32    rtems_filesystem_freenode( &loc );
     33    set_errno_and_return_minus_one( ENOTSUP );
     34  }
     35
    3136  result = (*loc.ops->symlink)( &loc, actualpath, name_start);
    3237
  • c/src/libfs/src/imfs/ioman.c

    re7de167c rdd19c0b  
    8181  the_jnode = loc.node_access;
    8282
     83  if ( !loc.ops->node_type ) {
     84    rtems_filesystem_freenode( &loc );
     85    set_errno_and_return_minus_one( ENOTSUP );
     86  }
     87
    8388  node_type = (*loc.ops->node_type)( &loc );
    8489
  • c/src/libfs/src/imfs/memfile.c

    re7de167c rdd19c0b  
    112112
    113113  the_jnode = iop->file_info;
     114
     115  if (iop->flags & LIBIO_FLAGS_APPEND)
     116    iop->offset = the_jnode->info.file.size;
    114117
    115118  return 0;
     
    341344
    342345  memory = memfile_alloc_block();
    343   assert( memory );
    344346  if ( !memory )
    345347    return 1;
  • cpukit/libcsupport/include/rtems/libio.h

    re7de167c rdd19c0b  
    467467  ((((dev_t)(_major)) << 32) | (dev_t)(_minor))
    468468
     469#define rtems_filesystem_dev_major_t( _dev ) \
     470  (rtems_device_major_number) ((_dev) >> 32)
     471
     472#define rtems_filesystem_dev_minor_t( _dev ) \
     473  (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF)
     474
    469475#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
    470476  do { \
    471     (_major) = (rtems_device_major_number) ((_dev) >> 32); \
    472     (_minor) = (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF); \
     477    (_major) = rtems_filesystem_dev_major_t ( _dev ); \
     478    (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
    473479  } while(0)
    474480
  • cpukit/libcsupport/src/chmod.c

    re7de167c rdd19c0b  
    3434    return -1;
    3535 
     36  if ( !loc.handlers ){
     37    rtems_filesystem_freenode( &loc );
     38    set_errno_and_return_minus_one( EBADF );
     39  }
     40
    3641  if ( !loc.handlers->fchmod ){
    3742    rtems_filesystem_freenode( &loc );
  • cpukit/libcsupport/src/eval.c

    re7de167c rdd19c0b  
    4444  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
    4545
     46  if ( !pathloc->ops->evalpath )
     47    set_errno_and_return_minus_one( ENOTSUP );
     48
    4649  result = (*pathloc->ops->evalpath)( &pathname[i], flags, pathloc );
    4750
  • cpukit/libcsupport/src/fcntl.c

    re7de167c rdd19c0b  
    132132      break;
    133133  }
    134   if ((ret >= 0) && iop->handlers->fcntl) {
    135     int err = (*iop->handlers->fcntl)( cmd, iop );
    136     if (err) {
    137       errno = err;
     134  if (ret >= 0) {   
     135    if (iop->handlers->fcntl) {
     136      int err = (*iop->handlers->fcntl)( cmd, iop );
     137      if (err) {
     138        errno = err;
     139        ret = -1;
     140      }
     141    }
     142    else {
     143      errno = ENOTSUP;
    138144      ret = -1;
    139145    }
  • cpukit/libcsupport/src/fsync.c

    re7de167c rdd19c0b  
    3131   */
    3232
     33  if ( !iop->handlers )
     34    set_errno_and_return_minus_one( EBADF );
     35
    3336  if ( !iop->handlers->fsync )
    3437    set_errno_and_return_minus_one( ENOTSUP );
  • cpukit/libcsupport/src/ioctl.c

    re7de167c rdd19c0b  
    4242   */
    4343
     44  if ( !iop->handlers )
     45    set_errno_and_return_minus_one( EBADF );
     46
    4447  if ( !iop->handlers->ioctl )
    4548    set_errno_and_return_minus_one( ENOTSUP );
  • cpukit/libcsupport/src/link.c

    re7de167c rdd19c0b  
    4242
    4343  rtems_filesystem_get_start_loc( new, &i, &parent_loc );
     44
     45  if ( !parent_loc.ops->evalformake ) {
     46    rtems_filesystem_freenode( &existing_loc );
     47    rtems_filesystem_freenode( &parent_loc );
     48    set_errno_and_return_minus_one( ENOTSUP );
     49  }
     50
    4451  result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
    4552  if ( result != 0 ) {
     53    rtems_filesystem_freenode( &existing_loc );
    4654    rtems_filesystem_freenode( &parent_loc );
    4755    set_errno_and_return_minus_one( result );
  • cpukit/libcsupport/src/mknod.c

    re7de167c rdd19c0b  
    4444  rtems_filesystem_get_start_loc( pathname, &i, &temp_loc );
    4545
     46  if ( !temp_loc.ops->evalformake ) {
     47    rtems_filesystem_freenode( &temp_loc );
     48    set_errno_and_return_minus_one( ENOTSUP );
     49  }
     50
    4651  result = (*temp_loc.ops->evalformake)(
    4752    &pathname[i],
  • cpukit/libcsupport/src/symlink.c

    re7de167c rdd19c0b  
    2929    return -1;
    3030
     31  if ( !loc.ops->symlink ) {
     32    rtems_filesystem_freenode( &loc );
     33    set_errno_and_return_minus_one( ENOTSUP );
     34  }
     35
    3136  result = (*loc.ops->symlink)( &loc, actualpath, name_start);
    3237
  • cpukit/libfs/src/imfs/ioman.c

    re7de167c rdd19c0b  
    8181  the_jnode = loc.node_access;
    8282
     83  if ( !loc.ops->node_type ) {
     84    rtems_filesystem_freenode( &loc );
     85    set_errno_and_return_minus_one( ENOTSUP );
     86  }
     87
    8388  node_type = (*loc.ops->node_type)( &loc );
    8489
  • cpukit/libfs/src/imfs/memfile.c

    re7de167c rdd19c0b  
    112112
    113113  the_jnode = iop->file_info;
     114
     115  if (iop->flags & LIBIO_FLAGS_APPEND)
     116    iop->offset = the_jnode->info.file.size;
    114117
    115118  return 0;
     
    341344
    342345  memory = memfile_alloc_block();
    343   assert( memory );
    344346  if ( !memory )
    345347    return 1;
Note: See TracChangeset for help on using the changeset viewer.