Changeset d71fcab in rtems


Ignore:
Timestamp:
10/12/99 18:44:40 (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
578a415
Parents:
cb5056b3
Message:

Added call to freenod to let each filesystem free its own internal
node used to manage file access.

Files:
46 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/chdir.c

    rcb5056b3 rd71fcab  
    3939   */
    4040
    41   if ( !loc.ops->node_type )
     41  if ( !loc.ops->node_type ) {
     42    if ( loc.ops->freenod )
     43      (*loc.ops->freenod)( &loc );
    4244    set_errno_and_return_minus_one( ENOTSUP );
     45  }
    4346
    44   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
     47  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
     48    if ( loc.ops->freenod )
     49      (*loc.ops->freenod)( &loc );
    4550    set_errno_and_return_minus_one( ENOTDIR );
    46 
     51  }
     52 
     53  if ( rtems_filesystem_current.ops->freenod )
     54    (*rtems_filesystem_current.ops->freenod)( &rtems_filesystem_current );
     55   
    4756  rtems_filesystem_current = loc;
    4857 
  • c/src/exec/libcsupport/src/chmod.c

    rcb5056b3 rd71fcab  
    2929  int                              status;
    3030  rtems_filesystem_location_info_t loc;
     31  int                              result;
    3132
    3233  status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
     
    3435    return -1;
    3536 
    36   if ( !loc.handlers->fchmod )
     37  if ( !loc.handlers->fchmod ){
     38    if ( loc.ops->freenod )
     39      (*loc.ops->freenod)( &loc );
    3740    set_errno_and_return_minus_one( ENOTSUP );
     41  }
    3842
    39   return (*loc.handlers->fchmod)( &loc, mode );
     43  result = (*loc.handlers->fchmod)( &loc, mode );
     44
     45  if ( loc.ops->freenod )
     46    (*loc.ops->freenod)( &loc );
     47 
     48  return result;
    4049}
  • c/src/exec/libcsupport/src/chown.c

    rcb5056b3 rd71fcab  
    2727)
    2828{
    29   rtems_filesystem_location_info_t   temp_loc;
     29  rtems_filesystem_location_info_t   loc;
     30  int                                result;
    3031
    31   if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
     32  if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, TRUE ) )
    3233    return -1;
    3334 
    34   if ( !temp_loc.ops->chown )
     35  if ( !loc.ops->chown ) {
     36    if ( loc.ops->freenod )
     37      (*loc.ops->freenod)( &loc );
    3538    set_errno_and_return_minus_one( ENOTSUP );
     39  }
    3640
    37   return (*temp_loc.ops->chown)( &temp_loc, owner, group );
     41  result = (*loc.ops->chown)( &loc, owner, group );
     42
     43  if ( loc.ops->freenod )
     44    (*loc.ops->freenod)( &loc );
     45 
     46  return result;
    3847}
  • c/src/exec/libcsupport/src/link.c

    rcb5056b3 rd71fcab  
    3333   * Get the node we are linking to.
    3434   */
     35
    3536  result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
    3637  if ( result != 0 )
     
    4344  rtems_filesystem_get_start_loc( new, &i, &parent_loc );
    4445  result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
    45   if ( result != 0 )
    46      set_errno_and_return_minus_one( result );
     46  if ( result != 0 ) {
     47    if ( existing_loc.ops->freenod )
     48      (*existing_loc.ops->freenod)( &parent_loc );
     49    set_errno_and_return_minus_one( result );
     50  }
    4751
    4852  /*
     
    5155   */
    5256
    53   if ( parent_loc.mt_entry != existing_loc.mt_entry )
     57  if ( parent_loc.mt_entry != existing_loc.mt_entry ) {
     58    if ( existing_loc.ops->freenod )
     59      (*existing_loc.ops->freenod)( &existing_loc );
     60
     61    if ( parent_loc.ops->freenod )
     62      (*parent_loc.ops->freenod)( &parent_loc );
     63
    5464    set_errno_and_return_minus_one( EXDEV );
     65  }
    5566
    56   if ( !parent_loc.ops->link )
     67  if ( !parent_loc.ops->link ) {
     68
     69    if ( existing_loc.ops->freenod )
     70      (*existing_loc.ops->freenod)( &existing_loc );
     71
     72    if ( parent_loc.ops->freenod )
     73      (*parent_loc.ops->freenod)( &parent_loc );
     74
    5775    set_errno_and_return_minus_one( ENOTSUP );
     76  }
    5877
    59   return (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
     78  result = (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
     79 
     80  if ( existing_loc.ops->freenod )
     81    (*existing_loc.ops->freenod)( &existing_loc );
     82
     83  if ( parent_loc.ops->freenod )
     84    (*parent_loc.ops->freenod)( &parent_loc );
     85
     86  return result;
    6087}
    6188
  • c/src/exec/libcsupport/src/mknod.c

    rcb5056b3 rd71fcab  
    5353    return -1;
    5454
    55   if ( !temp_loc.ops->mknod )
     55  if ( !temp_loc.ops->mknod ) {
     56    if ( temp_loc.ops->freenod )
     57      (*temp_loc.ops->freenod)( &temp_loc );
    5658    set_errno_and_return_minus_one( ENOTSUP );
     59  }
    5760
    58   return (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
     61  result =  (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
     62  if ( temp_loc.ops->freenod )
     63    (*temp_loc.ops->freenod)( &temp_loc );
     64
     65  return result;
    5966}
  • c/src/exec/libcsupport/src/mount.c

    rcb5056b3 rd71fcab  
    8989  rtems_filesystem_mount_table_entry_t **mt_entry,
    9090  rtems_filesystem_operations_table    *fs_ops,
    91   rtems_filesystem_options_t            fsoptions,
     91  rtems_filesystem_options_t            options,
    9292  char                                 *device,
    9393  char                                 *mount_point
    9494)
    9595{
    96   rtems_filesystem_location_info_t      temp_loc;
    97   rtems_filesystem_options_t            options;
     96  rtems_filesystem_location_info_t      loc;
    9897  rtems_filesystem_mount_table_entry_t *temp_mt_entry;
    9998
     
    113112   */
    114113
    115   if ( fsoptions != RTEMS_FILESYSTEM_READ_ONLY &&
    116        fsoptions != RTEMS_FILESYSTEM_READ_WRITE ) {
     114  if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
     115       options != RTEMS_FILESYSTEM_READ_WRITE ) {
    117116    errno = EINVAL;
    118117    return -1;
     
    146145       mount_point,
    147146       RTEMS_LIBIO_PERMS_RWX,
    148        &temp_loc ,
     147       &loc,
    149148       TRUE ) == -1 )
    150149       goto cleanup_and_bail;
     
    154153      */
    155154
    156      if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
     155     if ( loc.ops->node_type( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
    157156       errno = ENOTDIR;
    158157       goto cleanup_and_bail;
     
    163162      */
    164163
    165      if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
     164     if ( search_mt_for_mount_point( &loc ) == FOUND ) {
    166165       errno = EBUSY;
    167166       goto cleanup_and_bail;
     
    173172      */
    174173
    175      temp_mt_entry->mt_point_node.node_access = temp_loc.node_access;
    176      temp_mt_entry->mt_point_node.handlers = temp_loc.handlers;
    177      temp_mt_entry->mt_point_node.ops = temp_loc.ops;
    178      temp_mt_entry->mt_point_node.mt_entry = temp_loc.mt_entry;
     174     temp_mt_entry->mt_point_node.node_access = loc.node_access;
     175     temp_mt_entry->mt_point_node.handlers = loc.handlers;
     176     temp_mt_entry->mt_point_node.ops = loc.ops;
     177     temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry;
    179178
    180179     /*
     
    183182      */
    184183
    185      if ( !temp_loc.ops->mount ){
     184     if ( !loc.ops->mount ){
    186185       errno = ENOTSUP;
    187186       goto cleanup_and_bail;
    188187     }
    189188
    190      if ( temp_loc.ops->mount( temp_mt_entry ) ) {
     189     if ( loc.ops->mount( temp_mt_entry ) ) {
    191190        goto cleanup_and_bail;
    192191     }
     
    225224
    226225  *mt_entry = temp_mt_entry;
     226
     227  if ( loc.ops->freenod )
     228    (*loc.ops->freenod)( &loc );
     229 
    227230  return 0;
    228231
     
    230233
    231234  free( temp_mt_entry );
     235
     236  if ( loc.ops->freenod )
     237    (*loc.ops->freenod)( &loc );
     238 
    232239  return -1;
    233240}
  • c/src/exec/libcsupport/src/open.c

    rcb5056b3 rd71fcab  
    6363  rtems_libio_t                      *iop = 0;
    6464  int                                 status;
    65   rtems_filesystem_location_info_t    temp_loc;
     65  rtems_filesystem_location_info_t    loc;
    6666  int                                 eval_flags;
    6767
     
    105105
    106106  status = rtems_filesystem_evaluate_path(
    107      pathname, eval_flags, &temp_loc, TRUE );
     107     pathname, eval_flags, &loc, TRUE );
    108108
    109109  if ( status == -1 ) {
     
    127127
    128128    /* Sanity check to see if the file name exists after the mknod() */
    129     status = rtems_filesystem_evaluate_path( pathname, 0x0, &temp_loc, TRUE );
     129    status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE );
    130130    if ( status != 0 ) {   /* The file did not exist */
    131131      rc = EACCES;
     
    140140
    141141  /*
    142    *  Fill in the file control block based on the temp_loc structure
     142   *  Fill in the file control block based on the loc structure
    143143   *  returned by successful path evaluation.
    144144   */
    145145
    146146  iop->offset     = 0;
    147   iop->handlers   = temp_loc.handlers;
    148   iop->file_info  = temp_loc.node_access;
     147  iop->handlers   = loc.handlers;
     148  iop->file_info  = loc.node_access;
    149149  iop->flags     |= rtems_libio_fcntl_flags( flags );
    150   iop->pathinfo   = temp_loc;
     150  iop->pathinfo   = loc;
    151151
    152152  if ( !iop->handlers->open ) {
     
    179179    set_errno_and_return_minus_one( rc );
    180180  }
     181
     182  if ( loc.ops->freenod )
     183    (*loc.ops->freenod)( &loc );
     184   
    181185  return iop - rtems_libio_iops;
    182186}
  • c/src/exec/libcsupport/src/readlink.c

    rcb5056b3 rd71fcab  
    2424  int                               result;
    2525
     26  if (!buf)
     27    set_errno_and_return_minus_one( EFAULT );
     28
    2629  result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
    2730  if ( result != 0 )
    2831     return -1;
    2932 
    30   if (!buf)
    31     set_errno_and_return_minus_one( EFAULT );
     33  if ( !loc.ops->node_type ){
     34    if ( loc.ops->freenod )
     35      (*loc.ops->freenod)( &loc );
     36    set_errno_and_return_minus_one( ENOTSUP );
     37  }
    3238
    33   if ( !loc.ops->node_type )
     39  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
     40    if ( loc.ops->freenod )
     41      (*loc.ops->freenod)( &loc );
     42    set_errno_and_return_minus_one( EINVAL );
     43  }
     44
     45  if ( !loc.ops->readlink ){
     46    if ( loc.ops->freenod )
     47      (*loc.ops->freenod)( &loc );
    3448    set_errno_and_return_minus_one( ENOTSUP );
     49  }
    3550
    36   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK )
    37     set_errno_and_return_minus_one( EINVAL );
     51  result =  (*loc.ops->readlink)( &loc, buf, bufsize );
    3852
    39   if ( !loc.ops->readlink )
    40     set_errno_and_return_minus_one( ENOTSUP );
    41 
    42   return (*loc.ops->readlink)( &loc, buf, bufsize );
     53  if ( loc.ops->freenod )
     54    (*loc.ops->freenod)( &loc );
     55 
     56  return result;
    4357}
  • c/src/exec/libcsupport/src/rmdir.c

    rcb5056b3 rd71fcab  
    4040   */
    4141
    42   if ( !loc.ops->node_type )
     42  if ( !loc.ops->node_type ){
     43    if ( loc.ops->freenod )
     44      (*loc.ops->freenod)( &loc );
    4345    set_errno_and_return_minus_one( ENOTSUP );
     46  }
    4447
    45   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
     48  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
     49    if ( loc.ops->freenod )
     50      (*loc.ops->freenod)( &loc );
    4651    set_errno_and_return_minus_one( ENOTDIR );
     52  }
    4753
    4854  /*
     
    5056   */
    5157
    52   if ( !loc.ops->rmnod )
     58  if ( !loc.ops->rmnod ){
     59    if ( loc.ops->freenod )
     60      (*loc.ops->freenod)( &loc );
    5361    set_errno_and_return_minus_one( ENOTSUP );
     62  }
    5463
    55   return (*loc.ops->rmnod)( &loc ); 
     64  result =  (*loc.ops->rmnod)( &loc ); 
     65
     66  if ( loc.ops->freenod )
     67    (*loc.ops->freenod)( &loc );
     68 
     69  return result;
    5670}
  • c/src/exec/libcsupport/src/stat.c

    rcb5056b3 rd71fcab  
    5959    return -1;
    6060 
    61   if ( !loc.handlers->fstat )
     61  if ( !loc.handlers->fstat ){
     62    if ( loc.ops->freenod )
     63      (*loc.ops->freenod)( &loc );
    6264    set_errno_and_return_minus_one( ENOTSUP );
     65  }
    6366
    6467  /*
     
    6972  memset( buf, 0, sizeof(struct stat) );
    7073
    71   return (*loc.handlers->fstat)( &loc, buf );
     74  status =  (*loc.handlers->fstat)( &loc, buf );
     75
     76  if ( loc.ops->freenod )
     77    (*loc.ops->freenod)( &loc );
     78 
     79  return status;
    7280}
    7381#endif
  • c/src/exec/libcsupport/src/symlink.c

    rcb5056b3 rd71fcab  
    3030    return -1;
    3131
    32   return (*loc.ops->symlink)( &loc, actualpath, name_start);
     32  result = (*loc.ops->symlink)( &loc, actualpath, name_start);
     33
     34  if ( loc.ops->freenod )
     35    (*loc.ops->freenod)( &loc );
     36
     37  return result;
    3338}
    3439
  • c/src/exec/libcsupport/src/unlink.c

    rcb5056b3 rd71fcab  
    3232     return -1;
    3333 
    34   if ( !loc.ops->node_type )
     34  if ( !loc.ops->node_type ) {
     35    if ( loc.ops->freenod )
     36      (*loc.ops->freenod)( &loc );
    3537    set_errno_and_return_minus_one( ENOTSUP );
     38  }
    3639
    37   if (  (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
     40  if (  (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
     41    if ( loc.ops->freenod )
     42      (*loc.ops->freenod)( &loc );
    3843    set_errno_and_return_minus_one( EISDIR );
     44  }
     45
     46  if ( !loc.ops->unlink ) {
     47    if ( loc.ops->freenod )
     48      (*loc.ops->freenod)( &loc );
     49    set_errno_and_return_minus_one( ENOTSUP );
     50  }
     51
     52  result = (*loc.ops->unlink)( &loc );
     53
     54  if ( loc.ops->freenod )
     55    (*loc.ops->freenod)( &loc );
    3956 
    40   if ( !loc.ops->unlink )
    41     set_errno_and_return_minus_one( ENOTSUP );
    42 
    43   return (*loc.ops->unlink)( &loc );
     57  return result;
    4458}
    4559
  • c/src/exec/libcsupport/src/unmount.c

    rcb5056b3 rd71fcab  
    8484   */
    8585
    86   if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry )
     86  if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
     87    if ( temp_loc.ops->freenod )
     88      (*temp_loc.ops->freenod)( &temp_loc );
    8789    set_errno_and_return_minus_one( EBUSY );
     90  }
    8891
    8992  /*
     
    9396   */
    9497
    95   if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 )
     98  if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
     99    if ( temp_loc.ops->freenod )
     100      (*temp_loc.ops->freenod)( &temp_loc );
    96101    set_errno_and_return_minus_one( EBUSY );
     102  }
    97103 
    98104  /*
     
    104110   */
    105111
    106   if ( ( temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 )
     112  if ((temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 ) {
     113    if ( temp_loc.ops->freenod )
     114      (*temp_loc.ops->freenod)( &temp_loc );
     115    return -1;
     116  }
     117
     118  /*
     119   * Run the unmount function for the subordinate file system.
     120   */
     121
     122  if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0){
     123    if ( temp_loc.ops->freenod )
     124      (*temp_loc.ops->freenod)( &temp_loc );
    107125     return -1;
    108 
    109   /*
    110    * Run the unmount function for the subordinate file system.
    111    */
    112 
    113   if ( ( temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0 )
    114      return -1;
     126  }
    115127
    116128  /*
     
    131143
    132144  free( temp_loc.mt_entry );
     145  if ( temp_loc.ops->freenod )
     146    (*temp_loc.ops->freenod)( &temp_loc );
    133147
    134148  return result;
  • c/src/exec/libcsupport/src/utime.c

    rcb5056b3 rd71fcab  
    2525{
    2626  rtems_filesystem_location_info_t   temp_loc;
     27  int                                result;
     28
     29  if ( !temp_loc.ops->utime )
     30    set_errno_and_return_minus_one( ENOTSUP );
    2731
    2832  if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
    2933    return -1;
    3034
    31   if ( !temp_loc.ops->utime )
    32     set_errno_and_return_minus_one( ENOTSUP );
     35  result = (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
    3336
    34   return (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
     37  if ( temp_loc.ops->freenod )
     38    (*temp_loc.ops->freenod)( &temp_loc );
     39
     40  return result;
    3541}
  • c/src/exec/libfs/src/imfs/ioman.c

    rcb5056b3 rd71fcab  
    6262 *
    6363 *  This version is not reentrant.
     64 *
     65 *  XXX - This is dependent upon IMFS and should not be. 
     66 *        Suggest adding a filesystem routine to fill in the device_info.
    6467 */
    6568
     
    7174#if !defined(RTEMS_UNIX)
    7275  IMFS_jnode_t                      *the_jnode;
    73   rtems_filesystem_location_info_t   temp_loc;
     76  rtems_filesystem_location_info_t   loc;
    7477  static rtems_driver_name_t         device;
    7578  int                                result;
     79  rtems_filesystem_node_types_t      node_type;
    7680
    77   result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
    78   the_jnode = temp_loc.node_access;
     81  result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
     82  the_jnode = loc.node_access;
    7983
    80   if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
     84  node_type = (*loc.ops->node_type)( &loc );
     85
     86  if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
    8187    *device_info = 0;
     88    if ( loc.ops->freenod )
     89      (*loc.ops->freenod)( &loc );
    8290    return RTEMS_UNSATISFIED;
    8391  }
     
    8896  device.minor              = the_jnode->info.device.minor;
    8997  *device_info              = &device;
     98
     99  if ( loc.ops->freenod )
     100    (*loc.ops->freenod)( &loc );
     101   
    90102#endif
    91103  return RTEMS_SUCCESSFUL;
  • c/src/lib/libc/chdir.c

    rcb5056b3 rd71fcab  
    3939   */
    4040
    41   if ( !loc.ops->node_type )
     41  if ( !loc.ops->node_type ) {
     42    if ( loc.ops->freenod )
     43      (*loc.ops->freenod)( &loc );
    4244    set_errno_and_return_minus_one( ENOTSUP );
     45  }
    4346
    44   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
     47  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
     48    if ( loc.ops->freenod )
     49      (*loc.ops->freenod)( &loc );
    4550    set_errno_and_return_minus_one( ENOTDIR );
    46 
     51  }
     52 
     53  if ( rtems_filesystem_current.ops->freenod )
     54    (*rtems_filesystem_current.ops->freenod)( &rtems_filesystem_current );
     55   
    4756  rtems_filesystem_current = loc;
    4857 
  • c/src/lib/libc/chmod.c

    rcb5056b3 rd71fcab  
    2929  int                              status;
    3030  rtems_filesystem_location_info_t loc;
     31  int                              result;
    3132
    3233  status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
     
    3435    return -1;
    3536 
    36   if ( !loc.handlers->fchmod )
     37  if ( !loc.handlers->fchmod ){
     38    if ( loc.ops->freenod )
     39      (*loc.ops->freenod)( &loc );
    3740    set_errno_and_return_minus_one( ENOTSUP );
     41  }
    3842
    39   return (*loc.handlers->fchmod)( &loc, mode );
     43  result = (*loc.handlers->fchmod)( &loc, mode );
     44
     45  if ( loc.ops->freenod )
     46    (*loc.ops->freenod)( &loc );
     47 
     48  return result;
    4049}
  • c/src/lib/libc/chown.c

    rcb5056b3 rd71fcab  
    2727)
    2828{
    29   rtems_filesystem_location_info_t   temp_loc;
     29  rtems_filesystem_location_info_t   loc;
     30  int                                result;
    3031
    31   if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
     32  if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, TRUE ) )
    3233    return -1;
    3334 
    34   if ( !temp_loc.ops->chown )
     35  if ( !loc.ops->chown ) {
     36    if ( loc.ops->freenod )
     37      (*loc.ops->freenod)( &loc );
    3538    set_errno_and_return_minus_one( ENOTSUP );
     39  }
    3640
    37   return (*temp_loc.ops->chown)( &temp_loc, owner, group );
     41  result = (*loc.ops->chown)( &loc, owner, group );
     42
     43  if ( loc.ops->freenod )
     44    (*loc.ops->freenod)( &loc );
     45 
     46  return result;
    3847}
  • c/src/lib/libc/ioman.c

    rcb5056b3 rd71fcab  
    6262 *
    6363 *  This version is not reentrant.
     64 *
     65 *  XXX - This is dependent upon IMFS and should not be. 
     66 *        Suggest adding a filesystem routine to fill in the device_info.
    6467 */
    6568
     
    7174#if !defined(RTEMS_UNIX)
    7275  IMFS_jnode_t                      *the_jnode;
    73   rtems_filesystem_location_info_t   temp_loc;
     76  rtems_filesystem_location_info_t   loc;
    7477  static rtems_driver_name_t         device;
    7578  int                                result;
     79  rtems_filesystem_node_types_t      node_type;
    7680
    77   result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
    78   the_jnode = temp_loc.node_access;
     81  result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
     82  the_jnode = loc.node_access;
    7983
    80   if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
     84  node_type = (*loc.ops->node_type)( &loc );
     85
     86  if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
    8187    *device_info = 0;
     88    if ( loc.ops->freenod )
     89      (*loc.ops->freenod)( &loc );
    8290    return RTEMS_UNSATISFIED;
    8391  }
     
    8896  device.minor              = the_jnode->info.device.minor;
    8997  *device_info              = &device;
     98
     99  if ( loc.ops->freenod )
     100    (*loc.ops->freenod)( &loc );
     101   
    90102#endif
    91103  return RTEMS_SUCCESSFUL;
  • c/src/lib/libc/link.c

    rcb5056b3 rd71fcab  
    3333   * Get the node we are linking to.
    3434   */
     35
    3536  result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
    3637  if ( result != 0 )
     
    4344  rtems_filesystem_get_start_loc( new, &i, &parent_loc );
    4445  result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
    45   if ( result != 0 )
    46      set_errno_and_return_minus_one( result );
     46  if ( result != 0 ) {
     47    if ( existing_loc.ops->freenod )
     48      (*existing_loc.ops->freenod)( &parent_loc );
     49    set_errno_and_return_minus_one( result );
     50  }
    4751
    4852  /*
     
    5155   */
    5256
    53   if ( parent_loc.mt_entry != existing_loc.mt_entry )
     57  if ( parent_loc.mt_entry != existing_loc.mt_entry ) {
     58    if ( existing_loc.ops->freenod )
     59      (*existing_loc.ops->freenod)( &existing_loc );
     60
     61    if ( parent_loc.ops->freenod )
     62      (*parent_loc.ops->freenod)( &parent_loc );
     63
    5464    set_errno_and_return_minus_one( EXDEV );
     65  }
    5566
    56   if ( !parent_loc.ops->link )
     67  if ( !parent_loc.ops->link ) {
     68
     69    if ( existing_loc.ops->freenod )
     70      (*existing_loc.ops->freenod)( &existing_loc );
     71
     72    if ( parent_loc.ops->freenod )
     73      (*parent_loc.ops->freenod)( &parent_loc );
     74
    5775    set_errno_and_return_minus_one( ENOTSUP );
     76  }
    5877
    59   return (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
     78  result = (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
     79 
     80  if ( existing_loc.ops->freenod )
     81    (*existing_loc.ops->freenod)( &existing_loc );
     82
     83  if ( parent_loc.ops->freenod )
     84    (*parent_loc.ops->freenod)( &parent_loc );
     85
     86  return result;
    6087}
    6188
  • c/src/lib/libc/mknod.c

    rcb5056b3 rd71fcab  
    5353    return -1;
    5454
    55   if ( !temp_loc.ops->mknod )
     55  if ( !temp_loc.ops->mknod ) {
     56    if ( temp_loc.ops->freenod )
     57      (*temp_loc.ops->freenod)( &temp_loc );
    5658    set_errno_and_return_minus_one( ENOTSUP );
     59  }
    5760
    58   return (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
     61  result =  (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
     62  if ( temp_loc.ops->freenod )
     63    (*temp_loc.ops->freenod)( &temp_loc );
     64
     65  return result;
    5966}
  • c/src/lib/libc/mount.c

    rcb5056b3 rd71fcab  
    8989  rtems_filesystem_mount_table_entry_t **mt_entry,
    9090  rtems_filesystem_operations_table    *fs_ops,
    91   rtems_filesystem_options_t            fsoptions,
     91  rtems_filesystem_options_t            options,
    9292  char                                 *device,
    9393  char                                 *mount_point
    9494)
    9595{
    96   rtems_filesystem_location_info_t      temp_loc;
    97   rtems_filesystem_options_t            options;
     96  rtems_filesystem_location_info_t      loc;
    9897  rtems_filesystem_mount_table_entry_t *temp_mt_entry;
    9998
     
    113112   */
    114113
    115   if ( fsoptions != RTEMS_FILESYSTEM_READ_ONLY &&
    116        fsoptions != RTEMS_FILESYSTEM_READ_WRITE ) {
     114  if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
     115       options != RTEMS_FILESYSTEM_READ_WRITE ) {
    117116    errno = EINVAL;
    118117    return -1;
     
    146145       mount_point,
    147146       RTEMS_LIBIO_PERMS_RWX,
    148        &temp_loc ,
     147       &loc,
    149148       TRUE ) == -1 )
    150149       goto cleanup_and_bail;
     
    154153      */
    155154
    156      if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
     155     if ( loc.ops->node_type( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
    157156       errno = ENOTDIR;
    158157       goto cleanup_and_bail;
     
    163162      */
    164163
    165      if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
     164     if ( search_mt_for_mount_point( &loc ) == FOUND ) {
    166165       errno = EBUSY;
    167166       goto cleanup_and_bail;
     
    173172      */
    174173
    175      temp_mt_entry->mt_point_node.node_access = temp_loc.node_access;
    176      temp_mt_entry->mt_point_node.handlers = temp_loc.handlers;
    177      temp_mt_entry->mt_point_node.ops = temp_loc.ops;
    178      temp_mt_entry->mt_point_node.mt_entry = temp_loc.mt_entry;
     174     temp_mt_entry->mt_point_node.node_access = loc.node_access;
     175     temp_mt_entry->mt_point_node.handlers = loc.handlers;
     176     temp_mt_entry->mt_point_node.ops = loc.ops;
     177     temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry;
    179178
    180179     /*
     
    183182      */
    184183
    185      if ( !temp_loc.ops->mount ){
     184     if ( !loc.ops->mount ){
    186185       errno = ENOTSUP;
    187186       goto cleanup_and_bail;
    188187     }
    189188
    190      if ( temp_loc.ops->mount( temp_mt_entry ) ) {
     189     if ( loc.ops->mount( temp_mt_entry ) ) {
    191190        goto cleanup_and_bail;
    192191     }
     
    225224
    226225  *mt_entry = temp_mt_entry;
     226
     227  if ( loc.ops->freenod )
     228    (*loc.ops->freenod)( &loc );
     229 
    227230  return 0;
    228231
     
    230233
    231234  free( temp_mt_entry );
     235
     236  if ( loc.ops->freenod )
     237    (*loc.ops->freenod)( &loc );
     238 
    232239  return -1;
    233240}
  • c/src/lib/libc/open.c

    rcb5056b3 rd71fcab  
    6363  rtems_libio_t                      *iop = 0;
    6464  int                                 status;
    65   rtems_filesystem_location_info_t    temp_loc;
     65  rtems_filesystem_location_info_t    loc;
    6666  int                                 eval_flags;
    6767
     
    105105
    106106  status = rtems_filesystem_evaluate_path(
    107      pathname, eval_flags, &temp_loc, TRUE );
     107     pathname, eval_flags, &loc, TRUE );
    108108
    109109  if ( status == -1 ) {
     
    127127
    128128    /* Sanity check to see if the file name exists after the mknod() */
    129     status = rtems_filesystem_evaluate_path( pathname, 0x0, &temp_loc, TRUE );
     129    status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE );
    130130    if ( status != 0 ) {   /* The file did not exist */
    131131      rc = EACCES;
     
    140140
    141141  /*
    142    *  Fill in the file control block based on the temp_loc structure
     142   *  Fill in the file control block based on the loc structure
    143143   *  returned by successful path evaluation.
    144144   */
    145145
    146146  iop->offset     = 0;
    147   iop->handlers   = temp_loc.handlers;
    148   iop->file_info  = temp_loc.node_access;
     147  iop->handlers   = loc.handlers;
     148  iop->file_info  = loc.node_access;
    149149  iop->flags     |= rtems_libio_fcntl_flags( flags );
    150   iop->pathinfo   = temp_loc;
     150  iop->pathinfo   = loc;
    151151
    152152  if ( !iop->handlers->open ) {
     
    179179    set_errno_and_return_minus_one( rc );
    180180  }
     181
     182  if ( loc.ops->freenod )
     183    (*loc.ops->freenod)( &loc );
     184   
    181185  return iop - rtems_libio_iops;
    182186}
  • c/src/lib/libc/readlink.c

    rcb5056b3 rd71fcab  
    2424  int                               result;
    2525
     26  if (!buf)
     27    set_errno_and_return_minus_one( EFAULT );
     28
    2629  result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
    2730  if ( result != 0 )
    2831     return -1;
    2932 
    30   if (!buf)
    31     set_errno_and_return_minus_one( EFAULT );
     33  if ( !loc.ops->node_type ){
     34    if ( loc.ops->freenod )
     35      (*loc.ops->freenod)( &loc );
     36    set_errno_and_return_minus_one( ENOTSUP );
     37  }
    3238
    33   if ( !loc.ops->node_type )
     39  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
     40    if ( loc.ops->freenod )
     41      (*loc.ops->freenod)( &loc );
     42    set_errno_and_return_minus_one( EINVAL );
     43  }
     44
     45  if ( !loc.ops->readlink ){
     46    if ( loc.ops->freenod )
     47      (*loc.ops->freenod)( &loc );
    3448    set_errno_and_return_minus_one( ENOTSUP );
     49  }
    3550
    36   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK )
    37     set_errno_and_return_minus_one( EINVAL );
     51  result =  (*loc.ops->readlink)( &loc, buf, bufsize );
    3852
    39   if ( !loc.ops->readlink )
    40     set_errno_and_return_minus_one( ENOTSUP );
    41 
    42   return (*loc.ops->readlink)( &loc, buf, bufsize );
     53  if ( loc.ops->freenod )
     54    (*loc.ops->freenod)( &loc );
     55 
     56  return result;
    4357}
  • c/src/lib/libc/rmdir.c

    rcb5056b3 rd71fcab  
    4040   */
    4141
    42   if ( !loc.ops->node_type )
     42  if ( !loc.ops->node_type ){
     43    if ( loc.ops->freenod )
     44      (*loc.ops->freenod)( &loc );
    4345    set_errno_and_return_minus_one( ENOTSUP );
     46  }
    4447
    45   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
     48  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
     49    if ( loc.ops->freenod )
     50      (*loc.ops->freenod)( &loc );
    4651    set_errno_and_return_minus_one( ENOTDIR );
     52  }
    4753
    4854  /*
     
    5056   */
    5157
    52   if ( !loc.ops->rmnod )
     58  if ( !loc.ops->rmnod ){
     59    if ( loc.ops->freenod )
     60      (*loc.ops->freenod)( &loc );
    5361    set_errno_and_return_minus_one( ENOTSUP );
     62  }
    5463
    55   return (*loc.ops->rmnod)( &loc ); 
     64  result =  (*loc.ops->rmnod)( &loc ); 
     65
     66  if ( loc.ops->freenod )
     67    (*loc.ops->freenod)( &loc );
     68 
     69  return result;
    5670}
  • c/src/lib/libc/stat.c

    rcb5056b3 rd71fcab  
    5959    return -1;
    6060 
    61   if ( !loc.handlers->fstat )
     61  if ( !loc.handlers->fstat ){
     62    if ( loc.ops->freenod )
     63      (*loc.ops->freenod)( &loc );
    6264    set_errno_and_return_minus_one( ENOTSUP );
     65  }
    6366
    6467  /*
     
    6972  memset( buf, 0, sizeof(struct stat) );
    7073
    71   return (*loc.handlers->fstat)( &loc, buf );
     74  status =  (*loc.handlers->fstat)( &loc, buf );
     75
     76  if ( loc.ops->freenod )
     77    (*loc.ops->freenod)( &loc );
     78 
     79  return status;
    7280}
    7381#endif
  • c/src/lib/libc/symlink.c

    rcb5056b3 rd71fcab  
    3030    return -1;
    3131
    32   return (*loc.ops->symlink)( &loc, actualpath, name_start);
     32  result = (*loc.ops->symlink)( &loc, actualpath, name_start);
     33
     34  if ( loc.ops->freenod )
     35    (*loc.ops->freenod)( &loc );
     36
     37  return result;
    3338}
    3439
  • c/src/lib/libc/unlink.c

    rcb5056b3 rd71fcab  
    3232     return -1;
    3333 
    34   if ( !loc.ops->node_type )
     34  if ( !loc.ops->node_type ) {
     35    if ( loc.ops->freenod )
     36      (*loc.ops->freenod)( &loc );
    3537    set_errno_and_return_minus_one( ENOTSUP );
     38  }
    3639
    37   if (  (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
     40  if (  (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
     41    if ( loc.ops->freenod )
     42      (*loc.ops->freenod)( &loc );
    3843    set_errno_and_return_minus_one( EISDIR );
     44  }
     45
     46  if ( !loc.ops->unlink ) {
     47    if ( loc.ops->freenod )
     48      (*loc.ops->freenod)( &loc );
     49    set_errno_and_return_minus_one( ENOTSUP );
     50  }
     51
     52  result = (*loc.ops->unlink)( &loc );
     53
     54  if ( loc.ops->freenod )
     55    (*loc.ops->freenod)( &loc );
    3956 
    40   if ( !loc.ops->unlink )
    41     set_errno_and_return_minus_one( ENOTSUP );
    42 
    43   return (*loc.ops->unlink)( &loc );
     57  return result;
    4458}
    4559
  • c/src/lib/libc/unmount.c

    rcb5056b3 rd71fcab  
    8484   */
    8585
    86   if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry )
     86  if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
     87    if ( temp_loc.ops->freenod )
     88      (*temp_loc.ops->freenod)( &temp_loc );
    8789    set_errno_and_return_minus_one( EBUSY );
     90  }
    8891
    8992  /*
     
    9396   */
    9497
    95   if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 )
     98  if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
     99    if ( temp_loc.ops->freenod )
     100      (*temp_loc.ops->freenod)( &temp_loc );
    96101    set_errno_and_return_minus_one( EBUSY );
     102  }
    97103 
    98104  /*
     
    104110   */
    105111
    106   if ( ( temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 )
     112  if ((temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 ) {
     113    if ( temp_loc.ops->freenod )
     114      (*temp_loc.ops->freenod)( &temp_loc );
     115    return -1;
     116  }
     117
     118  /*
     119   * Run the unmount function for the subordinate file system.
     120   */
     121
     122  if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0){
     123    if ( temp_loc.ops->freenod )
     124      (*temp_loc.ops->freenod)( &temp_loc );
    107125     return -1;
    108 
    109   /*
    110    * Run the unmount function for the subordinate file system.
    111    */
    112 
    113   if ( ( temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0 )
    114      return -1;
     126  }
    115127
    116128  /*
     
    131143
    132144  free( temp_loc.mt_entry );
     145  if ( temp_loc.ops->freenod )
     146    (*temp_loc.ops->freenod)( &temp_loc );
    133147
    134148  return result;
  • c/src/lib/libc/utime.c

    rcb5056b3 rd71fcab  
    2525{
    2626  rtems_filesystem_location_info_t   temp_loc;
     27  int                                result;
     28
     29  if ( !temp_loc.ops->utime )
     30    set_errno_and_return_minus_one( ENOTSUP );
    2731
    2832  if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
    2933    return -1;
    3034
    31   if ( !temp_loc.ops->utime )
    32     set_errno_and_return_minus_one( ENOTSUP );
     35  result = (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
    3336
    34   return (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
     37  if ( temp_loc.ops->freenod )
     38    (*temp_loc.ops->freenod)( &temp_loc );
     39
     40  return result;
    3541}
  • c/src/libfs/src/imfs/ioman.c

    rcb5056b3 rd71fcab  
    6262 *
    6363 *  This version is not reentrant.
     64 *
     65 *  XXX - This is dependent upon IMFS and should not be. 
     66 *        Suggest adding a filesystem routine to fill in the device_info.
    6467 */
    6568
     
    7174#if !defined(RTEMS_UNIX)
    7275  IMFS_jnode_t                      *the_jnode;
    73   rtems_filesystem_location_info_t   temp_loc;
     76  rtems_filesystem_location_info_t   loc;
    7477  static rtems_driver_name_t         device;
    7578  int                                result;
     79  rtems_filesystem_node_types_t      node_type;
    7680
    77   result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
    78   the_jnode = temp_loc.node_access;
     81  result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
     82  the_jnode = loc.node_access;
    7983
    80   if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
     84  node_type = (*loc.ops->node_type)( &loc );
     85
     86  if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
    8187    *device_info = 0;
     88    if ( loc.ops->freenod )
     89      (*loc.ops->freenod)( &loc );
    8290    return RTEMS_UNSATISFIED;
    8391  }
     
    8896  device.minor              = the_jnode->info.device.minor;
    8997  *device_info              = &device;
     98
     99  if ( loc.ops->freenod )
     100    (*loc.ops->freenod)( &loc );
     101   
    90102#endif
    91103  return RTEMS_SUCCESSFUL;
  • cpukit/libcsupport/src/chdir.c

    rcb5056b3 rd71fcab  
    3939   */
    4040
    41   if ( !loc.ops->node_type )
     41  if ( !loc.ops->node_type ) {
     42    if ( loc.ops->freenod )
     43      (*loc.ops->freenod)( &loc );
    4244    set_errno_and_return_minus_one( ENOTSUP );
     45  }
    4346
    44   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
     47  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
     48    if ( loc.ops->freenod )
     49      (*loc.ops->freenod)( &loc );
    4550    set_errno_and_return_minus_one( ENOTDIR );
    46 
     51  }
     52 
     53  if ( rtems_filesystem_current.ops->freenod )
     54    (*rtems_filesystem_current.ops->freenod)( &rtems_filesystem_current );
     55   
    4756  rtems_filesystem_current = loc;
    4857 
  • cpukit/libcsupport/src/chmod.c

    rcb5056b3 rd71fcab  
    2929  int                              status;
    3030  rtems_filesystem_location_info_t loc;
     31  int                              result;
    3132
    3233  status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
     
    3435    return -1;
    3536 
    36   if ( !loc.handlers->fchmod )
     37  if ( !loc.handlers->fchmod ){
     38    if ( loc.ops->freenod )
     39      (*loc.ops->freenod)( &loc );
    3740    set_errno_and_return_minus_one( ENOTSUP );
     41  }
    3842
    39   return (*loc.handlers->fchmod)( &loc, mode );
     43  result = (*loc.handlers->fchmod)( &loc, mode );
     44
     45  if ( loc.ops->freenod )
     46    (*loc.ops->freenod)( &loc );
     47 
     48  return result;
    4049}
  • cpukit/libcsupport/src/chown.c

    rcb5056b3 rd71fcab  
    2727)
    2828{
    29   rtems_filesystem_location_info_t   temp_loc;
     29  rtems_filesystem_location_info_t   loc;
     30  int                                result;
    3031
    31   if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
     32  if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, TRUE ) )
    3233    return -1;
    3334 
    34   if ( !temp_loc.ops->chown )
     35  if ( !loc.ops->chown ) {
     36    if ( loc.ops->freenod )
     37      (*loc.ops->freenod)( &loc );
    3538    set_errno_and_return_minus_one( ENOTSUP );
     39  }
    3640
    37   return (*temp_loc.ops->chown)( &temp_loc, owner, group );
     41  result = (*loc.ops->chown)( &loc, owner, group );
     42
     43  if ( loc.ops->freenod )
     44    (*loc.ops->freenod)( &loc );
     45 
     46  return result;
    3847}
  • cpukit/libcsupport/src/link.c

    rcb5056b3 rd71fcab  
    3333   * Get the node we are linking to.
    3434   */
     35
    3536  result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
    3637  if ( result != 0 )
     
    4344  rtems_filesystem_get_start_loc( new, &i, &parent_loc );
    4445  result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
    45   if ( result != 0 )
    46      set_errno_and_return_minus_one( result );
     46  if ( result != 0 ) {
     47    if ( existing_loc.ops->freenod )
     48      (*existing_loc.ops->freenod)( &parent_loc );
     49    set_errno_and_return_minus_one( result );
     50  }
    4751
    4852  /*
     
    5155   */
    5256
    53   if ( parent_loc.mt_entry != existing_loc.mt_entry )
     57  if ( parent_loc.mt_entry != existing_loc.mt_entry ) {
     58    if ( existing_loc.ops->freenod )
     59      (*existing_loc.ops->freenod)( &existing_loc );
     60
     61    if ( parent_loc.ops->freenod )
     62      (*parent_loc.ops->freenod)( &parent_loc );
     63
    5464    set_errno_and_return_minus_one( EXDEV );
     65  }
    5566
    56   if ( !parent_loc.ops->link )
     67  if ( !parent_loc.ops->link ) {
     68
     69    if ( existing_loc.ops->freenod )
     70      (*existing_loc.ops->freenod)( &existing_loc );
     71
     72    if ( parent_loc.ops->freenod )
     73      (*parent_loc.ops->freenod)( &parent_loc );
     74
    5775    set_errno_and_return_minus_one( ENOTSUP );
     76  }
    5877
    59   return (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
     78  result = (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
     79 
     80  if ( existing_loc.ops->freenod )
     81    (*existing_loc.ops->freenod)( &existing_loc );
     82
     83  if ( parent_loc.ops->freenod )
     84    (*parent_loc.ops->freenod)( &parent_loc );
     85
     86  return result;
    6087}
    6188
  • cpukit/libcsupport/src/mknod.c

    rcb5056b3 rd71fcab  
    5353    return -1;
    5454
    55   if ( !temp_loc.ops->mknod )
     55  if ( !temp_loc.ops->mknod ) {
     56    if ( temp_loc.ops->freenod )
     57      (*temp_loc.ops->freenod)( &temp_loc );
    5658    set_errno_and_return_minus_one( ENOTSUP );
     59  }
    5760
    58   return (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
     61  result =  (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
     62  if ( temp_loc.ops->freenod )
     63    (*temp_loc.ops->freenod)( &temp_loc );
     64
     65  return result;
    5966}
  • cpukit/libcsupport/src/mount.c

    rcb5056b3 rd71fcab  
    8989  rtems_filesystem_mount_table_entry_t **mt_entry,
    9090  rtems_filesystem_operations_table    *fs_ops,
    91   rtems_filesystem_options_t            fsoptions,
     91  rtems_filesystem_options_t            options,
    9292  char                                 *device,
    9393  char                                 *mount_point
    9494)
    9595{
    96   rtems_filesystem_location_info_t      temp_loc;
    97   rtems_filesystem_options_t            options;
     96  rtems_filesystem_location_info_t      loc;
    9897  rtems_filesystem_mount_table_entry_t *temp_mt_entry;
    9998
     
    113112   */
    114113
    115   if ( fsoptions != RTEMS_FILESYSTEM_READ_ONLY &&
    116        fsoptions != RTEMS_FILESYSTEM_READ_WRITE ) {
     114  if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
     115       options != RTEMS_FILESYSTEM_READ_WRITE ) {
    117116    errno = EINVAL;
    118117    return -1;
     
    146145       mount_point,
    147146       RTEMS_LIBIO_PERMS_RWX,
    148        &temp_loc ,
     147       &loc,
    149148       TRUE ) == -1 )
    150149       goto cleanup_and_bail;
     
    154153      */
    155154
    156      if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
     155     if ( loc.ops->node_type( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
    157156       errno = ENOTDIR;
    158157       goto cleanup_and_bail;
     
    163162      */
    164163
    165      if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
     164     if ( search_mt_for_mount_point( &loc ) == FOUND ) {
    166165       errno = EBUSY;
    167166       goto cleanup_and_bail;
     
    173172      */
    174173
    175      temp_mt_entry->mt_point_node.node_access = temp_loc.node_access;
    176      temp_mt_entry->mt_point_node.handlers = temp_loc.handlers;
    177      temp_mt_entry->mt_point_node.ops = temp_loc.ops;
    178      temp_mt_entry->mt_point_node.mt_entry = temp_loc.mt_entry;
     174     temp_mt_entry->mt_point_node.node_access = loc.node_access;
     175     temp_mt_entry->mt_point_node.handlers = loc.handlers;
     176     temp_mt_entry->mt_point_node.ops = loc.ops;
     177     temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry;
    179178
    180179     /*
     
    183182      */
    184183
    185      if ( !temp_loc.ops->mount ){
     184     if ( !loc.ops->mount ){
    186185       errno = ENOTSUP;
    187186       goto cleanup_and_bail;
    188187     }
    189188
    190      if ( temp_loc.ops->mount( temp_mt_entry ) ) {
     189     if ( loc.ops->mount( temp_mt_entry ) ) {
    191190        goto cleanup_and_bail;
    192191     }
     
    225224
    226225  *mt_entry = temp_mt_entry;
     226
     227  if ( loc.ops->freenod )
     228    (*loc.ops->freenod)( &loc );
     229 
    227230  return 0;
    228231
     
    230233
    231234  free( temp_mt_entry );
     235
     236  if ( loc.ops->freenod )
     237    (*loc.ops->freenod)( &loc );
     238 
    232239  return -1;
    233240}
  • cpukit/libcsupport/src/open.c

    rcb5056b3 rd71fcab  
    6363  rtems_libio_t                      *iop = 0;
    6464  int                                 status;
    65   rtems_filesystem_location_info_t    temp_loc;
     65  rtems_filesystem_location_info_t    loc;
    6666  int                                 eval_flags;
    6767
     
    105105
    106106  status = rtems_filesystem_evaluate_path(
    107      pathname, eval_flags, &temp_loc, TRUE );
     107     pathname, eval_flags, &loc, TRUE );
    108108
    109109  if ( status == -1 ) {
     
    127127
    128128    /* Sanity check to see if the file name exists after the mknod() */
    129     status = rtems_filesystem_evaluate_path( pathname, 0x0, &temp_loc, TRUE );
     129    status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE );
    130130    if ( status != 0 ) {   /* The file did not exist */
    131131      rc = EACCES;
     
    140140
    141141  /*
    142    *  Fill in the file control block based on the temp_loc structure
     142   *  Fill in the file control block based on the loc structure
    143143   *  returned by successful path evaluation.
    144144   */
    145145
    146146  iop->offset     = 0;
    147   iop->handlers   = temp_loc.handlers;
    148   iop->file_info  = temp_loc.node_access;
     147  iop->handlers   = loc.handlers;
     148  iop->file_info  = loc.node_access;
    149149  iop->flags     |= rtems_libio_fcntl_flags( flags );
    150   iop->pathinfo   = temp_loc;
     150  iop->pathinfo   = loc;
    151151
    152152  if ( !iop->handlers->open ) {
     
    179179    set_errno_and_return_minus_one( rc );
    180180  }
     181
     182  if ( loc.ops->freenod )
     183    (*loc.ops->freenod)( &loc );
     184   
    181185  return iop - rtems_libio_iops;
    182186}
  • cpukit/libcsupport/src/readlink.c

    rcb5056b3 rd71fcab  
    2424  int                               result;
    2525
     26  if (!buf)
     27    set_errno_and_return_minus_one( EFAULT );
     28
    2629  result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
    2730  if ( result != 0 )
    2831     return -1;
    2932 
    30   if (!buf)
    31     set_errno_and_return_minus_one( EFAULT );
     33  if ( !loc.ops->node_type ){
     34    if ( loc.ops->freenod )
     35      (*loc.ops->freenod)( &loc );
     36    set_errno_and_return_minus_one( ENOTSUP );
     37  }
    3238
    33   if ( !loc.ops->node_type )
     39  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
     40    if ( loc.ops->freenod )
     41      (*loc.ops->freenod)( &loc );
     42    set_errno_and_return_minus_one( EINVAL );
     43  }
     44
     45  if ( !loc.ops->readlink ){
     46    if ( loc.ops->freenod )
     47      (*loc.ops->freenod)( &loc );
    3448    set_errno_and_return_minus_one( ENOTSUP );
     49  }
    3550
    36   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK )
    37     set_errno_and_return_minus_one( EINVAL );
     51  result =  (*loc.ops->readlink)( &loc, buf, bufsize );
    3852
    39   if ( !loc.ops->readlink )
    40     set_errno_and_return_minus_one( ENOTSUP );
    41 
    42   return (*loc.ops->readlink)( &loc, buf, bufsize );
     53  if ( loc.ops->freenod )
     54    (*loc.ops->freenod)( &loc );
     55 
     56  return result;
    4357}
  • cpukit/libcsupport/src/rmdir.c

    rcb5056b3 rd71fcab  
    4040   */
    4141
    42   if ( !loc.ops->node_type )
     42  if ( !loc.ops->node_type ){
     43    if ( loc.ops->freenod )
     44      (*loc.ops->freenod)( &loc );
    4345    set_errno_and_return_minus_one( ENOTSUP );
     46  }
    4447
    45   if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
     48  if (  (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
     49    if ( loc.ops->freenod )
     50      (*loc.ops->freenod)( &loc );
    4651    set_errno_and_return_minus_one( ENOTDIR );
     52  }
    4753
    4854  /*
     
    5056   */
    5157
    52   if ( !loc.ops->rmnod )
     58  if ( !loc.ops->rmnod ){
     59    if ( loc.ops->freenod )
     60      (*loc.ops->freenod)( &loc );
    5361    set_errno_and_return_minus_one( ENOTSUP );
     62  }
    5463
    55   return (*loc.ops->rmnod)( &loc ); 
     64  result =  (*loc.ops->rmnod)( &loc ); 
     65
     66  if ( loc.ops->freenod )
     67    (*loc.ops->freenod)( &loc );
     68 
     69  return result;
    5670}
  • cpukit/libcsupport/src/stat.c

    rcb5056b3 rd71fcab  
    5959    return -1;
    6060 
    61   if ( !loc.handlers->fstat )
     61  if ( !loc.handlers->fstat ){
     62    if ( loc.ops->freenod )
     63      (*loc.ops->freenod)( &loc );
    6264    set_errno_and_return_minus_one( ENOTSUP );
     65  }
    6366
    6467  /*
     
    6972  memset( buf, 0, sizeof(struct stat) );
    7073
    71   return (*loc.handlers->fstat)( &loc, buf );
     74  status =  (*loc.handlers->fstat)( &loc, buf );
     75
     76  if ( loc.ops->freenod )
     77    (*loc.ops->freenod)( &loc );
     78 
     79  return status;
    7280}
    7381#endif
  • cpukit/libcsupport/src/symlink.c

    rcb5056b3 rd71fcab  
    3030    return -1;
    3131
    32   return (*loc.ops->symlink)( &loc, actualpath, name_start);
     32  result = (*loc.ops->symlink)( &loc, actualpath, name_start);
     33
     34  if ( loc.ops->freenod )
     35    (*loc.ops->freenod)( &loc );
     36
     37  return result;
    3338}
    3439
  • cpukit/libcsupport/src/unlink.c

    rcb5056b3 rd71fcab  
    3232     return -1;
    3333 
    34   if ( !loc.ops->node_type )
     34  if ( !loc.ops->node_type ) {
     35    if ( loc.ops->freenod )
     36      (*loc.ops->freenod)( &loc );
    3537    set_errno_and_return_minus_one( ENOTSUP );
     38  }
    3639
    37   if (  (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
     40  if (  (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
     41    if ( loc.ops->freenod )
     42      (*loc.ops->freenod)( &loc );
    3843    set_errno_and_return_minus_one( EISDIR );
     44  }
     45
     46  if ( !loc.ops->unlink ) {
     47    if ( loc.ops->freenod )
     48      (*loc.ops->freenod)( &loc );
     49    set_errno_and_return_minus_one( ENOTSUP );
     50  }
     51
     52  result = (*loc.ops->unlink)( &loc );
     53
     54  if ( loc.ops->freenod )
     55    (*loc.ops->freenod)( &loc );
    3956 
    40   if ( !loc.ops->unlink )
    41     set_errno_and_return_minus_one( ENOTSUP );
    42 
    43   return (*loc.ops->unlink)( &loc );
     57  return result;
    4458}
    4559
  • cpukit/libcsupport/src/unmount.c

    rcb5056b3 rd71fcab  
    8484   */
    8585
    86   if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry )
     86  if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
     87    if ( temp_loc.ops->freenod )
     88      (*temp_loc.ops->freenod)( &temp_loc );
    8789    set_errno_and_return_minus_one( EBUSY );
     90  }
    8891
    8992  /*
     
    9396   */
    9497
    95   if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 )
     98  if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
     99    if ( temp_loc.ops->freenod )
     100      (*temp_loc.ops->freenod)( &temp_loc );
    96101    set_errno_and_return_minus_one( EBUSY );
     102  }
    97103 
    98104  /*
     
    104110   */
    105111
    106   if ( ( temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 )
     112  if ((temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 ) {
     113    if ( temp_loc.ops->freenod )
     114      (*temp_loc.ops->freenod)( &temp_loc );
     115    return -1;
     116  }
     117
     118  /*
     119   * Run the unmount function for the subordinate file system.
     120   */
     121
     122  if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0){
     123    if ( temp_loc.ops->freenod )
     124      (*temp_loc.ops->freenod)( &temp_loc );
    107125     return -1;
    108 
    109   /*
    110    * Run the unmount function for the subordinate file system.
    111    */
    112 
    113   if ( ( temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0 )
    114      return -1;
     126  }
    115127
    116128  /*
     
    131143
    132144  free( temp_loc.mt_entry );
     145  if ( temp_loc.ops->freenod )
     146    (*temp_loc.ops->freenod)( &temp_loc );
    133147
    134148  return result;
  • cpukit/libcsupport/src/utime.c

    rcb5056b3 rd71fcab  
    2525{
    2626  rtems_filesystem_location_info_t   temp_loc;
     27  int                                result;
     28
     29  if ( !temp_loc.ops->utime )
     30    set_errno_and_return_minus_one( ENOTSUP );
    2731
    2832  if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
    2933    return -1;
    3034
    31   if ( !temp_loc.ops->utime )
    32     set_errno_and_return_minus_one( ENOTSUP );
     35  result = (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
    3336
    34   return (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
     37  if ( temp_loc.ops->freenod )
     38    (*temp_loc.ops->freenod)( &temp_loc );
     39
     40  return result;
    3541}
  • cpukit/libfs/src/imfs/ioman.c

    rcb5056b3 rd71fcab  
    6262 *
    6363 *  This version is not reentrant.
     64 *
     65 *  XXX - This is dependent upon IMFS and should not be. 
     66 *        Suggest adding a filesystem routine to fill in the device_info.
    6467 */
    6568
     
    7174#if !defined(RTEMS_UNIX)
    7275  IMFS_jnode_t                      *the_jnode;
    73   rtems_filesystem_location_info_t   temp_loc;
     76  rtems_filesystem_location_info_t   loc;
    7477  static rtems_driver_name_t         device;
    7578  int                                result;
     79  rtems_filesystem_node_types_t      node_type;
    7680
    77   result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
    78   the_jnode = temp_loc.node_access;
     81  result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
     82  the_jnode = loc.node_access;
    7983
    80   if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
     84  node_type = (*loc.ops->node_type)( &loc );
     85
     86  if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
    8187    *device_info = 0;
     88    if ( loc.ops->freenod )
     89      (*loc.ops->freenod)( &loc );
    8290    return RTEMS_UNSATISFIED;
    8391  }
     
    8896  device.minor              = the_jnode->info.device.minor;
    8997  *device_info              = &device;
     98
     99  if ( loc.ops->freenod )
     100    (*loc.ops->freenod)( &loc );
     101   
    90102#endif
    91103  return RTEMS_SUCCESSFUL;
Note: See TracChangeset for help on using the changeset viewer.