18 #include "SimBlockList.hpp" 
   19 #include <Emulator.hpp> 
   20 #include <SimulatedBlock.hpp> 
   30 #include <Ndbcntr.hpp> 
   40 #include <restore.hpp> 
   43 #include <LocalProxy.hpp> 
   44 #include <DblqhProxy.hpp> 
   45 #include <DbspjProxy.hpp> 
   46 #include <DbaccProxy.hpp> 
   47 #include <DbtupProxy.hpp> 
   48 #include <DbtuxProxy.hpp> 
   49 #include <BackupProxy.hpp> 
   50 #include <RestoreProxy.hpp> 
   51 #include <PgmanProxy.hpp> 
   55 #define NEW_BLOCK(B) new B 
   57 enum SIMBLOCKLIST_DUMMY { A_VALUE = 0 };
 
   59 void * 
operator new (
size_t sz, SIMBLOCKLIST_DUMMY dummy){
 
   60   char * tmp = (
char *)malloc(sz);
 
   66   const int initValue = 0xf3;
 
   68   const int initValue = 0x0;
 
   71   const int p = (sz / 4096);
 
   72   const int r = (sz % 4096);
 
   74   for(
int i = 0; 
i<p; 
i++)
 
   75     memset(tmp+(
i*4096), initValue, 4096);
 
   78     memset(tmp+p*4096, initValue, r);
 
   84 #define NEW_BLOCK(B) new(A_VALUE) B 
   89   noOfBlocks = NO_OF_BLOCKS;
 
   93     ERROR_SET(fatal, NDBD_EXIT_MEMALLOC,
 
   94               "Failed to create the block list", 
"");
 
   97   Block_context ctx(*data.theConfiguration, *data.m_mem_manager);
 
  103       ctx.m_config.getOwnConfigIterator();
 
  104     if(p && !ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &dl) && dl){
 
  105       fs = NEW_BLOCK(
VoidFs)(ctx);
 
  107       fs = NEW_BLOCK(
Ndbfs)(ctx);
 
  111   const bool mtLqh = globalData.isNdbMtLqh;
 
  114     theList[0] = NEW_BLOCK(
Pgman)(ctx);
 
  117   theList[1]  = NEW_BLOCK(
Lgman)(ctx);
 
  118   theList[2]  = NEW_BLOCK(
Tsman)(ctx);
 
  120     theList[3]  = NEW_BLOCK(
Dbacc)(ctx);
 
  123   theList[4]  = NEW_BLOCK(
Cmvmi)(ctx);
 
  125   theList[6]  = NEW_BLOCK(
Dbdict)(ctx);
 
  126   theList[7]  = NEW_BLOCK(
Dbdih)(ctx);
 
  128     theList[8]  = NEW_BLOCK(
Dblqh)(ctx);
 
  131   theList[9]  = NEW_BLOCK(
Dbtc)(ctx);
 
  133     theList[10] = NEW_BLOCK(
Dbtup)(ctx);
 
  136   theList[11] = NEW_BLOCK(
Ndbcntr)(ctx);
 
  137   theList[12] = NEW_BLOCK(
Qmgr)(ctx);
 
  138   theList[13] = NEW_BLOCK(
Trix)(ctx);
 
  140     theList[14] = NEW_BLOCK(
Backup)(ctx);
 
  143   theList[15] = NEW_BLOCK(
DbUtil)(ctx);
 
  144   theList[16] = NEW_BLOCK(
Suma)(ctx);
 
  146     theList[17] = NEW_BLOCK(
Dbtux)(ctx);
 
  150     theList[18] = NEW_BLOCK(
Restore)(ctx);
 
  153   theList[19] = NEW_BLOCK(
Dbinfo)(ctx);
 
  154   theList[20]  = NEW_BLOCK(
Dbspj)(ctx);
 
  155   assert(NO_OF_BLOCKS == 21);
 
  157   if (globalData.isNdbMt) {
 
  159     if (globalData.isNdbMtLqh) {
 
  160       for (
int i = 0; 
i < noOfBlocks; 
i++)
 
  161         theList[
i]->loadWorkers();
 
  167   for (
int i = 0; 
i < noOfBlocks; 
i++)
 
  171       ERROR_SET(fatal, NDBD_EXIT_MEMALLOC,
 
  172                 "Failed to create block", 
"");
 
  178 SimBlockList::unload(){
 
  180     for(
int i = 0; 
i<noOfBlocks; 
i++){
 
  183         theList[
i]->~SimulatedBlock();