Changeset c17d0b3 in rtems


Ignore:
Timestamp:
Oct 2, 2012, 1:44:59 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
39d7d51
Parents:
9b83a66
git-author:
Sebastian Huber <sebastian.huber@…> (10/02/12 13:44:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/07/12 15:03:20)
Message:

Filesystem: Reject removal of root nodes

Reject the removal of file system instance root nodes in rmdir() and
unlink() and return the EBUSY error status. File system instances can
be removed with unmount(). Remove root node special cases in IMFS,
DOSFS, and RFS.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/rmdir.c

    r9b83a66 rc17d0b3  
    3939
    4040  if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
    41     rv = (*ops->rmnod_h)( &parentloc, currentloc );
     41    if ( !rtems_filesystem_location_is_root( currentloc ) ) {
     42      rv = (*ops->rmnod_h)( &parentloc, currentloc );
     43    } else {
     44      rtems_filesystem_eval_path_error( &ctx, EBUSY );
     45      rv = -1;
     46    }
    4247  } else {
    4348    rtems_filesystem_eval_path_error( &ctx, ENOTDIR );
  • cpukit/libcsupport/src/unlink.c

    r9b83a66 rc17d0b3  
    3535      parent_eval_flags
    3636    );
    37   const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
    3837
    39   rv = (*ops->rmnod_h)( &parentloc, currentloc );
     38  if ( !rtems_filesystem_location_is_root( currentloc ) ) {
     39    const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
     40
     41    rv = (*ops->rmnod_h)( &parentloc, currentloc );
     42  } else {
     43    rtems_filesystem_eval_path_error( &ctx, EBUSY );
     44    rv = -1;
     45  }
    4046
    4147  rtems_filesystem_eval_path_cleanup_with_parent( &ctx, &parentloc );
  • cpukit/libfs/src/dosfs/msdos_rmnod.c

    r9b83a66 rc17d0b3  
    5252
    5353        /*
    54          * You cannot remove the file system root node.
    55          */
    56         if (rtems_filesystem_location_is_root(pathloc))
    57         {
    58             rtems_set_errno_and_return_minus_one(EBUSY);
    59         }
    60 
    61         /*
    6254         * You cannot remove a mountpoint.
    6355         * not used - mount() not implemenetd yet.
  • cpukit/libfs/src/imfs/imfs.h

    r9b83a66 rc17d0b3  
    170170
    171171typedef IMFS_jnode_t *(*IMFS_node_control_remove)(
    172   IMFS_jnode_t *node,
    173   const IMFS_jnode_t *root_node
     172  IMFS_jnode_t *node
    174173);
    175174
    176175IMFS_jnode_t *IMFS_node_remove_default(
    177   IMFS_jnode_t *node,
    178   const IMFS_jnode_t *root_node
     176  IMFS_jnode_t *node
    179177);
    180178
  • cpukit/libfs/src/imfs/imfs_handlers_directory.c

    r9b83a66 rc17d0b3  
    7575
    7676static IMFS_jnode_t *IMFS_node_remove_directory(
    77   IMFS_jnode_t *node,
    78   const IMFS_jnode_t *root_node
     77  IMFS_jnode_t *node
    7978)
    8079{
     
    8281    errno = ENOTEMPTY;
    8382    node = NULL;
    84   } else if ( node == root_node || IMFS_is_mount_point( node ) ) {
     83  } else if ( IMFS_is_mount_point( node ) ) {
    8584    errno = EBUSY;
    8685    node = NULL;
  • cpukit/libfs/src/imfs/imfs_handlers_link.c

    r9b83a66 rc17d0b3  
    6565
    6666static IMFS_jnode_t *IMFS_node_remove_hard_link(
    67   IMFS_jnode_t *node,
    68   const IMFS_jnode_t *root_node
     67  IMFS_jnode_t *node
    6968)
    7069{
     
    7271
    7372  if ( target->st_nlink == 1) {
    74     target = (*target->control->node_remove)( target, root_node );
     73    target = (*target->control->node_remove)( target );
    7574    if ( target == NULL ) {
    7675      node = NULL;
  • cpukit/libfs/src/imfs/imfs_initsupp.c

    r9b83a66 rc17d0b3  
    142142
    143143IMFS_jnode_t *IMFS_node_remove_default(
    144   IMFS_jnode_t *node,
    145   const IMFS_jnode_t *root_node
     144  IMFS_jnode_t *node
    146145)
    147146{
  • cpukit/libfs/src/imfs/imfs_rmnod.c

    r9b83a66 rc17d0b3  
    3030  IMFS_jnode_t *node = loc->node_access;
    3131
    32   node = (*node->control->node_remove)(
    33     node,
    34     loc->mt_entry->mt_fs_root->location.node_access
    35   );
     32  node = (*node->control->node_remove)( node );
    3633  if ( node != NULL ) {
    3734    --node->reference_count;
  • cpukit/libfs/src/rfs/rtems-rfs-rtems.c

    r9b83a66 rc17d0b3  
    678678    printf ("rtems-rfs: rmnod: parent:%" PRId32 " doff:%" PRIu32 ", ino:%" PRId32 "\n",
    679679            parent, doff, ino);
    680 
    681   if (ino == RTEMS_RFS_ROOT_INO)
    682     return rtems_rfs_rtems_error ("rmnod: root inode", EBUSY);
    683680
    684681  rc = rtems_rfs_unlink (fs, parent, ino, doff, rtems_rfs_unlink_dir_if_empty);
  • testsuites/fstests/fsimfsgeneric01/init.c

    r9b83a66 rc17d0b3  
    234234}
    235235
    236 static IMFS_jnode_t *node_remove(
    237   IMFS_jnode_t *node,
    238   const IMFS_jnode_t *root_node
    239 )
     236static IMFS_jnode_t *node_remove(IMFS_jnode_t *node)
    240237{
    241238  test_state *state = IMFS_generic_get_context_by_node(node);
Note: See TracChangeset for help on using the changeset viewer.