Changeset 4b0d1ab in rtems


Ignore:
Timestamp:
Nov 17, 2000, 6:42:02 PM (20 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
13e47e2e
Parents:
ee6d205
Message:

2000-11-17 Jennifer Averret <jennifer@…>

  • libc/mount.c (search_mt_for_mount_point): Deleted routine.
  • libc/mount.c (Is_node_fs_root): Replacement for above that accounts for the imaginary root node being returned by the filesystem evaluation routine.
  • libc/unmount.c (unmount): Account for imaginary root node being returned and improved variable names to clarify code.
  • libc/unmount.c (file_systems_below_this_mountpoint): Body of routine replaced to account for imaginary root node being returned.
Files:
6 edited

Legend:

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

    ree6d205 r4b0d1ab  
    3636 */
    3737
    38 int search_mt_for_mount_point(
    39   rtems_filesystem_location_info_t *location_of_mount_point
     38int init_fs_mount_table( void );
     39static int Is_node_fs_root(
     40  rtems_filesystem_location_info_t  *loc
    4041);
    41 
    42 int init_fs_mount_table( void );
    4342
    4443
     
    141140     */
    142141
    143     if ( search_mt_for_mount_point( &loc ) == FOUND ) {
     142    if ( Is_node_fs_root(  &loc ) ){
    144143      errno = EBUSY;
    145144      goto cleanup_and_bail;
     
    233232}
    234233
    235 
    236 /*
    237  *  search_mt_for_mount_point
     234/*
     235 *  Is_node_fs_root
    238236 *
    239237 *  This routine will run through the entries that currently exist in the
    240238 *  mount table chain. For each entry in the mount table chain it will
    241  *  compare the mount tables mt_point_node to the node describing the selected
    242  *  mount point.. If any of the mount table file system mount point nodes
    243  *  match the new file system selected mount point node, we are attempting
    244  *  to mount the new file system onto a node that already has a file system
    245  *  mounted to it. This is not a permitted operation.
    246  */
    247 
    248 int search_mt_for_mount_point(
    249   rtems_filesystem_location_info_t *location_of_mount_point
     239 *  compare the mount tables root node to the node describing the selected
     240 *  mount point. If any match is found true is returned else false is
     241 *  returned.
     242 *
     243 */
     244
     245static int Is_node_fs_root(
     246  rtems_filesystem_location_info_t  *loc
    250247)
    251248{
     
    253250  rtems_filesystem_mount_table_entry_t *the_mount_entry;
    254251
     252  /*
     253   * For each mount table entry
     254   */
     255
    255256  for ( the_node = rtems_filesystem_mount_table_control.first;
    256257        !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    257258        the_node = the_node->next ) {
    258 
    259259     the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node;
    260      if ( the_mount_entry->mt_point_node.node_access  ==
    261              location_of_mount_point->node_access )
    262         return FOUND;
    263   }
    264   return NOT_FOUND;
     260     if ( the_mount_entry->mt_fs_root.node_access  == loc->node_access )
     261        return TRUE;
     262  }
     263  return FALSE;
    265264}
    266 
  • c/src/exec/libcsupport/src/unmount.c

    ree6d205 r4b0d1ab  
    4242
    4343int file_systems_below_this_mountpoint(
    44   const char                            *mount_path,
     44  const char                            *path,
    4545  rtems_filesystem_location_info_t      *temp_loc,
    4646  rtems_filesystem_mount_table_entry_t  *temp_mt_entry
     
    5151 *
    5252 *  This routine will attempt to unmount the file system that has been
    53  *  is mounted a mount_path.  If the operation is successful, 0 will
     53 *  is mounted a path.  If the operation is successful, 0 will
    5454 *  be returned to the calling routine.  Otherwise, 1 will be returned.
    5555 */
    5656
    5757int unmount(
    58   const char *mount_path
     58  const char *path
    5959)
    6060{
    6161  int                                   status;
    62   rtems_filesystem_location_info_t      temp_loc;
     62  rtems_filesystem_location_info_t      fs_root_loc;
    6363  rtems_filesystem_mount_table_entry_t  temp_mt_entry;
    6464
    6565  /*
    66    *  Are there any file systems below the mount_path specified
     66   *  Are there any file systems below the path specified
    6767   */
    6868
    6969  status = file_systems_below_this_mountpoint(
    70     mount_path,
    71     &temp_loc,
     70    path,
     71    &fs_root_loc,
    7272    &temp_mt_entry
    7373  );
     
    8181   */
    8282
    83   if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
    84     rtems_filesystem_freenode( &temp_loc );
     83  if ( rtems_filesystem_current.mt_entry == fs_root_loc.mt_entry ) {
     84    rtems_filesystem_freenode( &fs_root_loc );
    8585    set_errno_and_return_minus_one( EBUSY );
    8686  }
     
    9292   */
    9393
    94   if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
    95     rtems_filesystem_freenode( &temp_loc );
     94  if ( rtems_libio_is_open_files_in_fs( fs_root_loc.mt_entry ) == 1 ) {
     95    rtems_filesystem_freenode( &fs_root_loc );
    9696    set_errno_and_return_minus_one( EBUSY );
    9797  }
    9898 
    9999  /*
    100    * Allow the file system being mounted on to do its cleanup.
     100   * Allow the file system being unmounted on to do its cleanup.
    101101   */
    102102
    103   if ((temp_mt_entry.mt_point_node.ops->unmount_h )( temp_loc.mt_entry ) != 0 ) {
    104     rtems_filesystem_freenode( &temp_loc );
     103  if ((temp_mt_entry.mt_point_node.ops->unmount_h )( fs_root_loc.mt_entry ) != 0 ) {
     104    rtems_filesystem_freenode( &fs_root_loc );
    105105    return -1;
    106106  }
     
    110110   */
    111111
    112   if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me_h )( temp_loc.mt_entry ) != 0){
    113     rtems_filesystem_freenode( &temp_loc );
     112  if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me_h )( fs_root_loc.mt_entry ) != 0){
     113    rtems_filesystem_freenode( &fs_root_loc );
    114114    return -1;
    115115  }
     
    119119   */
    120120
    121   Chain_Extract( ( Chain_Node * ) temp_loc.mt_entry );
     121  Chain_Extract( ( Chain_Node * ) fs_root_loc.mt_entry );
    122122
    123123  /*
     
    125125   */
    126126
    127   rtems_filesystem_freenode( &temp_loc.mt_entry->mt_point_node );
    128   free( temp_loc.mt_entry );
    129   rtems_filesystem_freenode( &temp_loc );
     127  rtems_filesystem_freenode( &fs_root_loc.mt_entry->mt_point_node );
     128  free( fs_root_loc.mt_entry );
     129  rtems_filesystem_freenode( &fs_root_loc );
    130130
    131131  return 0;
     
    146146
    147147int file_systems_below_this_mountpoint(
    148   const char                            *mount_path,
    149   rtems_filesystem_location_info_t      *temp_loc,
    150   rtems_filesystem_mount_table_entry_t  *temp_mt_entry
     148  const char                            *path,
     149  rtems_filesystem_location_info_t      *fs_root_loc,
     150  rtems_filesystem_mount_table_entry_t  *fs_to_unmount
    151151)
    152152{
     
    156156
    157157  /*
    158    *  Is the mount_path even a valid node name in the existing tree?
     158   *  Is the path even a valid node name in the existing tree?
    159159   */
    160160
    161   if ( rtems_filesystem_evaluate_path( mount_path, 0x0, temp_loc, TRUE ) )
     161  if ( rtems_filesystem_evaluate_path( path, 0x0, fs_root_loc, TRUE ) )
    162162    return -1;
    163163 
    164164  /*
    165    *  Look for the node defined in temp_loc as a mount point in the
    166    *  mount table chain.
     165   * Verify this is the root node for the file system to be unmounted.
     166   */
     167
     168  *fs_to_unmount = *fs_root_loc->mt_entry;
     169  if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access )
     170    set_errno_and_return_minus_one( EACCES );
     171
     172  /*
     173   * Search the mount table for any mount entries referencing this
     174   * mount entry.
    167175   */
    168176
     
    170178        !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    171179        the_node = the_node->next ) {
    172 
    173180     the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
    174      if  (the_mount_entry->mt_point_node.node_access  ==
    175           temp_loc->node_access ) {
    176         current_fs_mt_entry = the_mount_entry;
    177         *temp_loc = current_fs_mt_entry->mt_fs_root;
    178         goto after_real_mount_point_found;
    179      }
    180   }
    181   set_errno_and_return_minus_one( EACCES );
    182 
    183 
    184 after_real_mount_point_found:
    185 
    186   for ( the_node = rtems_filesystem_mount_table_control.first;
    187         !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    188         the_node = the_node->next ) {
    189 
    190      the_mount_entry = (  rtems_filesystem_mount_table_entry_t * )the_node;
    191 
    192      /*
    193       *  Exclude the current file systems mount table entry from the test
    194       */
    195 
    196      if ( current_fs_mt_entry != the_mount_entry ) {
    197        if ( the_mount_entry->mt_point_node.mt_entry  == current_fs_mt_entry ) {
    198 
    199           /*
    200            *  There is at least one fs below the fs on the mount_path.
    201            */
     181     if (the_mount_entry->mt_point_node.mt_entry  == fs_root_loc->mt_entry ) {
    202182          set_errno_and_return_minus_one( EBUSY );
    203        }
    204183     }
    205184  }
    206185
    207   *temp_mt_entry = *current_fs_mt_entry;
    208 
    209186  return 0;
    210187}
  • c/src/lib/libc/mount.c

    ree6d205 r4b0d1ab  
    3636 */
    3737
    38 int search_mt_for_mount_point(
    39   rtems_filesystem_location_info_t *location_of_mount_point
     38int init_fs_mount_table( void );
     39static int Is_node_fs_root(
     40  rtems_filesystem_location_info_t  *loc
    4041);
    41 
    42 int init_fs_mount_table( void );
    4342
    4443
     
    141140     */
    142141
    143     if ( search_mt_for_mount_point( &loc ) == FOUND ) {
     142    if ( Is_node_fs_root(  &loc ) ){
    144143      errno = EBUSY;
    145144      goto cleanup_and_bail;
     
    233232}
    234233
    235 
    236 /*
    237  *  search_mt_for_mount_point
     234/*
     235 *  Is_node_fs_root
    238236 *
    239237 *  This routine will run through the entries that currently exist in the
    240238 *  mount table chain. For each entry in the mount table chain it will
    241  *  compare the mount tables mt_point_node to the node describing the selected
    242  *  mount point.. If any of the mount table file system mount point nodes
    243  *  match the new file system selected mount point node, we are attempting
    244  *  to mount the new file system onto a node that already has a file system
    245  *  mounted to it. This is not a permitted operation.
    246  */
    247 
    248 int search_mt_for_mount_point(
    249   rtems_filesystem_location_info_t *location_of_mount_point
     239 *  compare the mount tables root node to the node describing the selected
     240 *  mount point. If any match is found true is returned else false is
     241 *  returned.
     242 *
     243 */
     244
     245static int Is_node_fs_root(
     246  rtems_filesystem_location_info_t  *loc
    250247)
    251248{
     
    253250  rtems_filesystem_mount_table_entry_t *the_mount_entry;
    254251
     252  /*
     253   * For each mount table entry
     254   */
     255
    255256  for ( the_node = rtems_filesystem_mount_table_control.first;
    256257        !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    257258        the_node = the_node->next ) {
    258 
    259259     the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node;
    260      if ( the_mount_entry->mt_point_node.node_access  ==
    261              location_of_mount_point->node_access )
    262         return FOUND;
    263   }
    264   return NOT_FOUND;
     260     if ( the_mount_entry->mt_fs_root.node_access  == loc->node_access )
     261        return TRUE;
     262  }
     263  return FALSE;
    265264}
    266 
  • c/src/lib/libc/unmount.c

    ree6d205 r4b0d1ab  
    4242
    4343int file_systems_below_this_mountpoint(
    44   const char                            *mount_path,
     44  const char                            *path,
    4545  rtems_filesystem_location_info_t      *temp_loc,
    4646  rtems_filesystem_mount_table_entry_t  *temp_mt_entry
     
    5151 *
    5252 *  This routine will attempt to unmount the file system that has been
    53  *  is mounted a mount_path.  If the operation is successful, 0 will
     53 *  is mounted a path.  If the operation is successful, 0 will
    5454 *  be returned to the calling routine.  Otherwise, 1 will be returned.
    5555 */
    5656
    5757int unmount(
    58   const char *mount_path
     58  const char *path
    5959)
    6060{
    6161  int                                   status;
    62   rtems_filesystem_location_info_t      temp_loc;
     62  rtems_filesystem_location_info_t      fs_root_loc;
    6363  rtems_filesystem_mount_table_entry_t  temp_mt_entry;
    6464
    6565  /*
    66    *  Are there any file systems below the mount_path specified
     66   *  Are there any file systems below the path specified
    6767   */
    6868
    6969  status = file_systems_below_this_mountpoint(
    70     mount_path,
    71     &temp_loc,
     70    path,
     71    &fs_root_loc,
    7272    &temp_mt_entry
    7373  );
     
    8181   */
    8282
    83   if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
    84     rtems_filesystem_freenode( &temp_loc );
     83  if ( rtems_filesystem_current.mt_entry == fs_root_loc.mt_entry ) {
     84    rtems_filesystem_freenode( &fs_root_loc );
    8585    set_errno_and_return_minus_one( EBUSY );
    8686  }
     
    9292   */
    9393
    94   if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
    95     rtems_filesystem_freenode( &temp_loc );
     94  if ( rtems_libio_is_open_files_in_fs( fs_root_loc.mt_entry ) == 1 ) {
     95    rtems_filesystem_freenode( &fs_root_loc );
    9696    set_errno_and_return_minus_one( EBUSY );
    9797  }
    9898 
    9999  /*
    100    * Allow the file system being mounted on to do its cleanup.
     100   * Allow the file system being unmounted on to do its cleanup.
    101101   */
    102102
    103   if ((temp_mt_entry.mt_point_node.ops->unmount_h )( temp_loc.mt_entry ) != 0 ) {
    104     rtems_filesystem_freenode( &temp_loc );
     103  if ((temp_mt_entry.mt_point_node.ops->unmount_h )( fs_root_loc.mt_entry ) != 0 ) {
     104    rtems_filesystem_freenode( &fs_root_loc );
    105105    return -1;
    106106  }
     
    110110   */
    111111
    112   if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me_h )( temp_loc.mt_entry ) != 0){
    113     rtems_filesystem_freenode( &temp_loc );
     112  if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me_h )( fs_root_loc.mt_entry ) != 0){
     113    rtems_filesystem_freenode( &fs_root_loc );
    114114    return -1;
    115115  }
     
    119119   */
    120120
    121   Chain_Extract( ( Chain_Node * ) temp_loc.mt_entry );
     121  Chain_Extract( ( Chain_Node * ) fs_root_loc.mt_entry );
    122122
    123123  /*
     
    125125   */
    126126
    127   rtems_filesystem_freenode( &temp_loc.mt_entry->mt_point_node );
    128   free( temp_loc.mt_entry );
    129   rtems_filesystem_freenode( &temp_loc );
     127  rtems_filesystem_freenode( &fs_root_loc.mt_entry->mt_point_node );
     128  free( fs_root_loc.mt_entry );
     129  rtems_filesystem_freenode( &fs_root_loc );
    130130
    131131  return 0;
     
    146146
    147147int file_systems_below_this_mountpoint(
    148   const char                            *mount_path,
    149   rtems_filesystem_location_info_t      *temp_loc,
    150   rtems_filesystem_mount_table_entry_t  *temp_mt_entry
     148  const char                            *path,
     149  rtems_filesystem_location_info_t      *fs_root_loc,
     150  rtems_filesystem_mount_table_entry_t  *fs_to_unmount
    151151)
    152152{
     
    156156
    157157  /*
    158    *  Is the mount_path even a valid node name in the existing tree?
     158   *  Is the path even a valid node name in the existing tree?
    159159   */
    160160
    161   if ( rtems_filesystem_evaluate_path( mount_path, 0x0, temp_loc, TRUE ) )
     161  if ( rtems_filesystem_evaluate_path( path, 0x0, fs_root_loc, TRUE ) )
    162162    return -1;
    163163 
    164164  /*
    165    *  Look for the node defined in temp_loc as a mount point in the
    166    *  mount table chain.
     165   * Verify this is the root node for the file system to be unmounted.
     166   */
     167
     168  *fs_to_unmount = *fs_root_loc->mt_entry;
     169  if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access )
     170    set_errno_and_return_minus_one( EACCES );
     171
     172  /*
     173   * Search the mount table for any mount entries referencing this
     174   * mount entry.
    167175   */
    168176
     
    170178        !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    171179        the_node = the_node->next ) {
    172 
    173180     the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
    174      if  (the_mount_entry->mt_point_node.node_access  ==
    175           temp_loc->node_access ) {
    176         current_fs_mt_entry = the_mount_entry;
    177         *temp_loc = current_fs_mt_entry->mt_fs_root;
    178         goto after_real_mount_point_found;
    179      }
    180   }
    181   set_errno_and_return_minus_one( EACCES );
    182 
    183 
    184 after_real_mount_point_found:
    185 
    186   for ( the_node = rtems_filesystem_mount_table_control.first;
    187         !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    188         the_node = the_node->next ) {
    189 
    190      the_mount_entry = (  rtems_filesystem_mount_table_entry_t * )the_node;
    191 
    192      /*
    193       *  Exclude the current file systems mount table entry from the test
    194       */
    195 
    196      if ( current_fs_mt_entry != the_mount_entry ) {
    197        if ( the_mount_entry->mt_point_node.mt_entry  == current_fs_mt_entry ) {
    198 
    199           /*
    200            *  There is at least one fs below the fs on the mount_path.
    201            */
     181     if (the_mount_entry->mt_point_node.mt_entry  == fs_root_loc->mt_entry ) {
    202182          set_errno_and_return_minus_one( EBUSY );
    203        }
    204183     }
    205184  }
    206185
    207   *temp_mt_entry = *current_fs_mt_entry;
    208 
    209186  return 0;
    210187}
  • cpukit/libcsupport/src/mount.c

    ree6d205 r4b0d1ab  
    3636 */
    3737
    38 int search_mt_for_mount_point(
    39   rtems_filesystem_location_info_t *location_of_mount_point
     38int init_fs_mount_table( void );
     39static int Is_node_fs_root(
     40  rtems_filesystem_location_info_t  *loc
    4041);
    41 
    42 int init_fs_mount_table( void );
    4342
    4443
     
    141140     */
    142141
    143     if ( search_mt_for_mount_point( &loc ) == FOUND ) {
     142    if ( Is_node_fs_root(  &loc ) ){
    144143      errno = EBUSY;
    145144      goto cleanup_and_bail;
     
    233232}
    234233
    235 
    236 /*
    237  *  search_mt_for_mount_point
     234/*
     235 *  Is_node_fs_root
    238236 *
    239237 *  This routine will run through the entries that currently exist in the
    240238 *  mount table chain. For each entry in the mount table chain it will
    241  *  compare the mount tables mt_point_node to the node describing the selected
    242  *  mount point.. If any of the mount table file system mount point nodes
    243  *  match the new file system selected mount point node, we are attempting
    244  *  to mount the new file system onto a node that already has a file system
    245  *  mounted to it. This is not a permitted operation.
    246  */
    247 
    248 int search_mt_for_mount_point(
    249   rtems_filesystem_location_info_t *location_of_mount_point
     239 *  compare the mount tables root node to the node describing the selected
     240 *  mount point. If any match is found true is returned else false is
     241 *  returned.
     242 *
     243 */
     244
     245static int Is_node_fs_root(
     246  rtems_filesystem_location_info_t  *loc
    250247)
    251248{
     
    253250  rtems_filesystem_mount_table_entry_t *the_mount_entry;
    254251
     252  /*
     253   * For each mount table entry
     254   */
     255
    255256  for ( the_node = rtems_filesystem_mount_table_control.first;
    256257        !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    257258        the_node = the_node->next ) {
    258 
    259259     the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node;
    260      if ( the_mount_entry->mt_point_node.node_access  ==
    261              location_of_mount_point->node_access )
    262         return FOUND;
    263   }
    264   return NOT_FOUND;
     260     if ( the_mount_entry->mt_fs_root.node_access  == loc->node_access )
     261        return TRUE;
     262  }
     263  return FALSE;
    265264}
    266 
  • cpukit/libcsupport/src/unmount.c

    ree6d205 r4b0d1ab  
    4242
    4343int file_systems_below_this_mountpoint(
    44   const char                            *mount_path,
     44  const char                            *path,
    4545  rtems_filesystem_location_info_t      *temp_loc,
    4646  rtems_filesystem_mount_table_entry_t  *temp_mt_entry
     
    5151 *
    5252 *  This routine will attempt to unmount the file system that has been
    53  *  is mounted a mount_path.  If the operation is successful, 0 will
     53 *  is mounted a path.  If the operation is successful, 0 will
    5454 *  be returned to the calling routine.  Otherwise, 1 will be returned.
    5555 */
    5656
    5757int unmount(
    58   const char *mount_path
     58  const char *path
    5959)
    6060{
    6161  int                                   status;
    62   rtems_filesystem_location_info_t      temp_loc;
     62  rtems_filesystem_location_info_t      fs_root_loc;
    6363  rtems_filesystem_mount_table_entry_t  temp_mt_entry;
    6464
    6565  /*
    66    *  Are there any file systems below the mount_path specified
     66   *  Are there any file systems below the path specified
    6767   */
    6868
    6969  status = file_systems_below_this_mountpoint(
    70     mount_path,
    71     &temp_loc,
     70    path,
     71    &fs_root_loc,
    7272    &temp_mt_entry
    7373  );
     
    8181   */
    8282
    83   if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
    84     rtems_filesystem_freenode( &temp_loc );
     83  if ( rtems_filesystem_current.mt_entry == fs_root_loc.mt_entry ) {
     84    rtems_filesystem_freenode( &fs_root_loc );
    8585    set_errno_and_return_minus_one( EBUSY );
    8686  }
     
    9292   */
    9393
    94   if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
    95     rtems_filesystem_freenode( &temp_loc );
     94  if ( rtems_libio_is_open_files_in_fs( fs_root_loc.mt_entry ) == 1 ) {
     95    rtems_filesystem_freenode( &fs_root_loc );
    9696    set_errno_and_return_minus_one( EBUSY );
    9797  }
    9898 
    9999  /*
    100    * Allow the file system being mounted on to do its cleanup.
     100   * Allow the file system being unmounted on to do its cleanup.
    101101   */
    102102
    103   if ((temp_mt_entry.mt_point_node.ops->unmount_h )( temp_loc.mt_entry ) != 0 ) {
    104     rtems_filesystem_freenode( &temp_loc );
     103  if ((temp_mt_entry.mt_point_node.ops->unmount_h )( fs_root_loc.mt_entry ) != 0 ) {
     104    rtems_filesystem_freenode( &fs_root_loc );
    105105    return -1;
    106106  }
     
    110110   */
    111111
    112   if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me_h )( temp_loc.mt_entry ) != 0){
    113     rtems_filesystem_freenode( &temp_loc );
     112  if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me_h )( fs_root_loc.mt_entry ) != 0){
     113    rtems_filesystem_freenode( &fs_root_loc );
    114114    return -1;
    115115  }
     
    119119   */
    120120
    121   Chain_Extract( ( Chain_Node * ) temp_loc.mt_entry );
     121  Chain_Extract( ( Chain_Node * ) fs_root_loc.mt_entry );
    122122
    123123  /*
     
    125125   */
    126126
    127   rtems_filesystem_freenode( &temp_loc.mt_entry->mt_point_node );
    128   free( temp_loc.mt_entry );
    129   rtems_filesystem_freenode( &temp_loc );
     127  rtems_filesystem_freenode( &fs_root_loc.mt_entry->mt_point_node );
     128  free( fs_root_loc.mt_entry );
     129  rtems_filesystem_freenode( &fs_root_loc );
    130130
    131131  return 0;
     
    146146
    147147int file_systems_below_this_mountpoint(
    148   const char                            *mount_path,
    149   rtems_filesystem_location_info_t      *temp_loc,
    150   rtems_filesystem_mount_table_entry_t  *temp_mt_entry
     148  const char                            *path,
     149  rtems_filesystem_location_info_t      *fs_root_loc,
     150  rtems_filesystem_mount_table_entry_t  *fs_to_unmount
    151151)
    152152{
     
    156156
    157157  /*
    158    *  Is the mount_path even a valid node name in the existing tree?
     158   *  Is the path even a valid node name in the existing tree?
    159159   */
    160160
    161   if ( rtems_filesystem_evaluate_path( mount_path, 0x0, temp_loc, TRUE ) )
     161  if ( rtems_filesystem_evaluate_path( path, 0x0, fs_root_loc, TRUE ) )
    162162    return -1;
    163163 
    164164  /*
    165    *  Look for the node defined in temp_loc as a mount point in the
    166    *  mount table chain.
     165   * Verify this is the root node for the file system to be unmounted.
     166   */
     167
     168  *fs_to_unmount = *fs_root_loc->mt_entry;
     169  if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access )
     170    set_errno_and_return_minus_one( EACCES );
     171
     172  /*
     173   * Search the mount table for any mount entries referencing this
     174   * mount entry.
    167175   */
    168176
     
    170178        !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    171179        the_node = the_node->next ) {
    172 
    173180     the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
    174      if  (the_mount_entry->mt_point_node.node_access  ==
    175           temp_loc->node_access ) {
    176         current_fs_mt_entry = the_mount_entry;
    177         *temp_loc = current_fs_mt_entry->mt_fs_root;
    178         goto after_real_mount_point_found;
    179      }
    180   }
    181   set_errno_and_return_minus_one( EACCES );
    182 
    183 
    184 after_real_mount_point_found:
    185 
    186   for ( the_node = rtems_filesystem_mount_table_control.first;
    187         !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node );
    188         the_node = the_node->next ) {
    189 
    190      the_mount_entry = (  rtems_filesystem_mount_table_entry_t * )the_node;
    191 
    192      /*
    193       *  Exclude the current file systems mount table entry from the test
    194       */
    195 
    196      if ( current_fs_mt_entry != the_mount_entry ) {
    197        if ( the_mount_entry->mt_point_node.mt_entry  == current_fs_mt_entry ) {
    198 
    199           /*
    200            *  There is at least one fs below the fs on the mount_path.
    201            */
     181     if (the_mount_entry->mt_point_node.mt_entry  == fs_root_loc->mt_entry ) {
    202182          set_errno_and_return_minus_one( EBUSY );
    203        }
    204183     }
    205184  }
    206185
    207   *temp_mt_entry = *current_fs_mt_entry;
    208 
    209186  return 0;
    210187}
Note: See TracChangeset for help on using the changeset viewer.