Ejemplo n.º 1
0
int  memfile_check_rmnod( IMFS_jnode_t *the_jnode ){

  /*
   * The file cannot be open and the link must be less than 1 to free.
   */

  if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {

    /*
     * Is the rtems_filesystem_current is this node?
     */

    if ( rtems_filesystem_current.node_access == the_jnode )
       rtems_filesystem_current.node_access = NULL;

    /*
     * Free memory associated with a memory file.
     */
    if (the_jnode->type != IMFS_LINEAR_FILE)
      IMFS_memfile_remove( the_jnode );

    free( the_jnode );
  }

  return 0;
}
Ejemplo n.º 2
0
void IMFS_check_node_remove( IMFS_jnode_t *jnode )
{
  if ( !rtems_libio_is_file_open( jnode ) && jnode->st_nlink < 1 ) {
    if ( rtems_filesystem_current.node_access == jnode )
       rtems_filesystem_current.node_access = NULL;

    switch ( jnode->type ) {
      case IMFS_MEMORY_FILE:
        IMFS_memfile_remove( jnode );
        break;
      case IMFS_SYM_LINK:
        free( jnode->info.sym_link.name );
        break;
      default:
        break;
    }

    free( jnode );
  }
}