void ExMsgResourceInfo::unpackObj(IpcMessageObjType objType,
				  IpcMessageObjVersion objVersion,
				  NABoolean sameEndianness,
				  IpcMessageObjSize objSize,
				  IpcConstMessageBufferPtr buffer)
{
  ExScratchFileOptions *sfo;
  IpcConstMessageBufferPtr start = buffer;

  ex_assert(objType == ESP_RESOURCE_INFO AND
	    objVersion == 100 AND
	    sameEndianness AND
	    objSize > sizeof(IpcMessageObj),
	    "invalid type or version for ExMsgResourceInfo::unpackObj()");
  unpackBaseClass(buffer);
  str_cpy_all((char *) &totalNameLength_,buffer,sizeof(totalNameLength_));
  buffer += sizeof(totalNameLength_);
  buffer += sizeof(spare_);
  if (bufferForDependentObjects_)
    {
      getHeap()->deallocateMemory(bufferForDependentObjects_);
      bufferForDependentObjects_ = NULL;
    }
  sfo = new(getHeap()) ExScratchFileOptions;

  // sfo_ is const
  sfo_ = sfo;

  sfo->ipcUnpackObj(objSize - (buffer-start),
		    buffer,
		    getHeap(),
		    totalNameLength_,
		    bufferForDependentObjects_);
}
ExScratchFileOptions *genScratchFileOptions(Generator *generator)
{
  Space *space = generator->getSpace();
  ExScratchFileOptions *result = new(space) ExScratchFileOptions;

  // ---------------------------------------------------------------------
  // Compile the defaults table entries into internal format
  // ---------------------------------------------------------------------

  NAString sDisks;
  NAString xDisks;
  NAString pDisks;
  enum DefaultConstants sEnum;
  enum DefaultConstants xEnum;
  enum DefaultConstants pEnum;
  const char *sDefaultName;
  const char *xDefaultName;
  const char *pDefaultName;

  // use two different sets of defaults, dependent on the platform

  sEnum = SCRATCH_DRIVE_LETTERS;
  xEnum = SCRATCH_DRIVE_LETTERS_EXCLUDED;
  pEnum = SCRATCH_DRIVE_LETTERS_PREFERRED;
  sDefaultName = "SCRATCH_DRIVE_LETTERS";
  xDefaultName = "SCRATCH_DRIVE_LETTERS_EXCLUDED";
  pDefaultName = "SCRATCH_DRIVE_LETTERS_PREFERRED";
 
  // look up defaults
  CmpCommon::getDefault(sEnum,sDisks,0);
  CmpCommon::getDefault(xEnum,xDisks,0);
  CmpCommon::getDefault(pEnum,pDisks,0);

  // convert into executor structures and give warnings for syntax errors
  Lng32 numEntries;
  ExScratchDiskDrive *l;

  l = genScratchDriveList(
       sDisks, numEntries, generator, sDefaultName);
  result->setSpecifiedScratchDisks(l,numEntries);

  l = genScratchDriveList(
       xDisks, numEntries, generator, xDefaultName);
  result->setExcludedScratchDisks(l,numEntries);

  l = genScratchDriveList(
       pDisks, numEntries, generator, pDefaultName);
  result->setPreferredScratchDisks(l,numEntries);

  NADefaults &defs = ActiveSchemaDB()->getDefaults(); 
  result->setScratchMgmtOption((Lng32)defs.getAsULong(SCRATCH_MGMT_OPTION));
  result->setScratchMaxOpensHash((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_HASH));
  result->setScratchMaxOpensSort((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_SORT));
  if(CmpCommon::getDefault(SCRATCH_PREALLOCATE_EXTENTS) == DF_ON)
    result->setScratchPreallocateExtents(TRUE);
  if(CmpCommon::getDefault(SCRATCH_DISK_LOGGING) == DF_ON)
    result->setScratchDiskLogging(TRUE);
  return result;
}
ExScratchFileOptions *genScratchFileOptions(Generator *generator)
{
  Space *space = generator->getSpace();
  ExScratchFileOptions *result = new(space) ExScratchFileOptions;

  // ---------------------------------------------------------------------
  // Compile the defaults table entries into internal format
  // ---------------------------------------------------------------------

  NAString sDirs;
  
  enum DefaultConstants sEnum;
  
  const char *sDefaultName;
  
  sEnum = SCRATCH_DIRS;
  sDefaultName = "SCRATCH_DIRS";
 
  // look up defaults
  CmpCommon::getDefault(sEnum,sDirs,0);
  
  // convert into executor structures and give warnings for syntax errors
  Lng32 numEntries;
  ExScratchDiskDrive *l;

  l = genScratchDisks(sDirs, numEntries, generator, sDefaultName);
  result->setSpecifiedScratchDirs(l,numEntries);
 
  NADefaults &defs = ActiveSchemaDB()->getDefaults(); 
  result->setScratchMgmtOption((Lng32)defs.getAsULong(SCRATCH_MGMT_OPTION));
  result->setScratchMaxOpensHash((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_HASH));
  result->setScratchMaxOpensSort((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_SORT));
  if(CmpCommon::getDefault(SCRATCH_PREALLOCATE_EXTENTS) == DF_ON)
    result->setScratchPreallocateExtents(TRUE);
  if(CmpCommon::getDefault(SCRATCH_DISK_LOGGING) == DF_ON)
    result->setScratchDiskLogging(TRUE);
  return result;
}