rem: struct ResourceIOArea* io; struct ResourceIOArea* new_io; struct Node*           position = NULL;
add: struct ResourceIteratorRef* io; struct ResourceIteratorRef* new_io; struct Node*                position = NULL;
context: LockResource( struct ResourceIterator* iter,              struct ResourceContext*  ctx ){  BOOL rc = FALSE;  switch( iter->m_Resource->m_Type )  {    case ISAPNP_NT_IRQ_RESOURCE:    {      if( ctx->m_IRQ[ iter->m_IRQBit ] == NULL )      {        ctx->m_IRQ[ iter->m_IRQBit ] = iter;//        KPrintF( "Locked IRQ %ld\n", iter->m_IRQBit );        rc = TRUE;      }      else      {//        KPrintF( "Failed to lock IRQ %ld\n", iter->m_IRQBit );      }            break;    }    case ISAPNP_NT_DMA_RESOURCE:    {      if( ctx->m_DMA[ iter->m_ChannelBit ] == NULL )      {        ctx->m_DMA[ iter->m_ChannelBit ] = iter;//        KPrintF( "Locked DMA %ld\n", iter->m_ChannelBit );        rc = TRUE;      }      else      {//        KPrintF( "Failed to lock DMA %ld\n", iter->m_ChannelBit );      }      break;    }    case ISAPNP_NT_IO_RESOURCE:    {      struct ResourceIOArea* io;      struct ResourceIOArea* new_io;      struct Node*           position = NULL;      UWORD base   = iter->m_Base;      UWORD length = iter->m_Length;      rc = TRUE;      for( io = (struct ResourceIOArea*) ctx->m_IO.mlh_Head;           io->m_MinNode.mln_Succ != NULL;           io = (struct ResourceIOArea*) io->m_MinNode.mln_Succ )      {        UWORD io_base   = io->m_Iterator->m_Base;        UWORD io_length = io->m_Iterator->m_Length;        if( ( base <= io_base && ( base + length ) > io_base )    ||            ( base >= io_base && base < ( io_base + io_length ) ) )        {          // Collision!          //          KPrintF( "Failed to lock IO 0x%04lx, length %ld\n", base, length );          rc = FALSE;          break;        }                if( base >= io_base + io_length )        {          // No more collisions possible; insert before this one              if( io->m_MinNode.mln_Pred->mln_Pred != NULL )          {            position = (struct Node*) io->m_MinNode.mln_Pred;          }              break;        }      }          if( rc )      {        // Insert the node            new_io = AllocVec( sizeof( *new_io ), MEMF_PUBLIC | MEMF_CLEAR );        if( new_io == NULL )        {          rc = FALSE;        }        else        {          new_io->m_Iterator = iter;              Insert( (struct List*) &ctx->m_IO, (struct Node*) new_io, position );    //          KPrintF( "Locked IO 0x%04lx, length %ld\n", base, length );        }      }      break;    }    case ISAPNP_NT_MEMORY_RESOURCE:    default:      break;  }  iter->m_HasLock = rc;  return rc;}