예제 #1
0
void
prim_conboot(PRIM_PROTOTYPE)
{
    /* int --  */
    CHECKOP(1);
    if (mlev < (tp_compatible_muf ? LMAGE : LARCH))
	abort_interp(tp_compatible_muf ? "Mage prim" : "Arch prim");
    oper1 = POP();
    if (oper1->type != PROG_INTEGER)
	abort_interp("Argument not an integer (1)");
    result = oper1->data.number;
    if ((result < 1) || (result > pcount()))
	abort_interp("Invalid connection number (1)");
    CLEAR(oper1);
    pboot(result);
}
예제 #2
0
파일: wb_pkg.cpp 프로젝트: Strongc/proview
void wb_pkg::readConfig()
{
  char fname[200];
  char line[200];
  char line_item[7][80];
  int num;
  int sts;

  dcli_translate_filename( fname, load_cNameDistribute);
  ifstream is( fname);

  while ( is.getline( line, sizeof(line))) {
    dcli_trim( line, line);
    if ( line[0] == '#' || line[0] == '!')
      continue;

    num = dcli_parse( line, " 	", "", (char *)line_item,
		     sizeof(line_item)/sizeof(line_item[0]),
		     sizeof(line_item[0]), 0);
    if ( !num)
      continue;

    if ( strcmp( cdh_Low(line_item[0]), "node") == 0) {
      pwr_mOpSys opsys;
      int bus;
      pwr_tMask dstatus;
      char bootnode[80];
      pwr_tString80 custom_platform;

      if ( num != 7)
	throw wb_error_str("File corrupt " load_cNameDistribute);

      sts = sscanf( line_item[2], "%d", (int *)&opsys);
      if ( sts != 1)
	throw wb_error_str("File corrupt " load_cNameDistribute);

      sts = sscanf( line_item[3], "%d", &bus);
      if ( sts != 1)
	throw wb_error_str("File corrupt " load_cNameDistribute);

      sts = sscanf( line_item[4], "%d", (int *)&dstatus);
      if ( sts != 1)
	throw wb_error_str("File corrupt " load_cNameDistribute);

      strcpy( bootnode, line_item[5]);
      strcpy( custom_platform, line_item[6]);
	
      if ( m_allnodes) {
	pkg_node node( line_item[1], opsys, bus, dstatus, bootnode, custom_platform);
	m_nodelist.push_back( node);
      }
      else {
	bool found = false;
	for ( int i = 0; i < (int) m_nodelist.size(); i++) {
	  if ( strcmp( m_nodelist[i].name(), cdh_Low(line_item[1])) == 0) {
	    found = true;
	    m_nodelist[i].setOpsys( opsys);
	    m_nodelist[i].setBus( bus);
	    m_nodelist[i].setDStatus( dstatus);
	    m_nodelist[i].setBootnode( bootnode);
	    m_nodelist[i].setCustomPlatform( custom_platform);
	    m_nodelist[i].setValid();
	    break;
	  }
	}
      }
    }
    else if ( strcmp( cdh_Low(line_item[0]), "appl") == 0) {
      if ( !(num == 4 || num == 5))
	throw wb_error_str("File corrupt " load_cNameDistribute);

      char severity = line_item[2][0];
      try {
	pkg_node& n = getNode( line_item[1]);
	if ( num == 4) {
	  pkg_pattern p( line_item[3], "", severity);
	  n.push_back( p);
	}
	else {
	  pkg_pattern p( line_item[3], line_item[4], severity);
	  n.push_back( p);
	}
      } catch ( wb_error &e) {
	continue;
      }
    }
    else if ( strcmp( cdh_Low(line_item[0]), "load") == 0) {
      pwr_tVolumeId *vollist;
      pwr_tString40 *volnamelist;
      int       volcount;
      pwr_tString80 *plclist;
      int	plccount;
      char     	systemname[80];
      char     	systemgroup[80];
      pwr_tTime date;

      if ( !(num == 2))
	throw wb_error_str("File corrupt " load_cNameDistribute);

      try {
        pkg_node &n = getNode( line_item[1]);

	// Add ld_node file
	sprintf( fname, load_cNameNode, load_cDirectory, n.name(), n.bus());
	pkg_pattern pnode( fname, "", 'E');
	n.push_back( pnode);

	// Add bootfile
	sprintf( fname, load_cNameBoot, load_cDirectory, n.name(), n.bus());
	pkg_pattern pboot( fname, "", 'E');
	n.push_back( pboot);

	// Read bootfile, get plc and volumes
	sts = lfu_ReadBootFile( fname, &date, systemname, 
				systemgroup, &vollist, &volnamelist, &volcount, &plclist, &plccount);
	if ( EVEN(sts))
	  throw wb_error_str("Bootfile is corrupt");

	// Add plc
	for ( int j = 0; j < plccount; j++) {
	  pwr_tFileName dir;
	
	  if ( n.opsys() == pwr_mOpSys_CustomBuild && 
	       strcmp( n.customPlatform(), "-") != 0)
	    sprintf( dir, "$pwrp_root/bld/%s/exe/", n.customPlatform());
	  else
	    sprintf( dir, "$pwrp_root/bld/%s/exe/", cdh_OpSysToStr( n.opsys()));
	  sprintf( fname, "%s%s", dir, plclist[j]);
	  sprintf( dir, "$pwrp_exe/");
	  pkg_pattern pplc( fname, dir, 'W');
	  n.push_back( pplc);
	}

	// Add volumes
	for ( int j = 0; j < volcount; j++) {
	  char dir[80];

	  if ( (vollist[j] >= cdh_cManufactClassVolMin && 
		vollist[j] <= cdh_cManufactClassVolMax) ||
	       (vollist[j] >= cdh_cSystemClassVolMin && 
		vollist[j] <= cdh_cSystemClassVolMax)) {
	    // Base volume, skip
	    continue;
	  }	       

	  strcpy( dir, "$pwrp_load/");
	  sprintf( fname, "%s%s.dbs", dir, cdh_Low( (char *)(volnamelist + j))); 
	  n.checkVolume( fname);

	  // Check if there are any rtt-files for Root or Sub Volumes
	  if ( vollist[j] >= cdh_cUserVolMin &&
	       vollist[j] <= cdh_cUserVolMax) {
	    cdh_uVolumeId	vid;
	    vid.pwr = vollist[j];

	    // RttCrr-file
	    strcpy( dir, "$pwrp_load/");
	    sprintf( fname, "%s" load_cNameRttCrr,
		dir, vid.v.vid_3, vid.v.vid_2, vid.v.vid_1, vid.v.vid_0);
	    pkg_pattern rttcrr( fname);
	    n.push_back( rttcrr);

	    // RttCrrObj-file
	    strcpy( dir, "$pwrp_load/");
	    sprintf( fname, "%s" load_cNameRttCrrObj,
		dir, vid.v.vid_3, vid.v.vid_2, vid.v.vid_1, vid.v.vid_0);
	    pkg_pattern rttcrrobj( fname);
	    n.push_back( rttcrrobj);

	    // RttCrrCode-file
	    strcpy( dir, "$pwrp_load/");
	    sprintf( fname, "%s" load_cNameRttCrrCode,
		dir, vid.v.vid_3, vid.v.vid_2, vid.v.vid_1, vid.v.vid_0);
	    pkg_pattern rttcrrcode( fname);
	    n.push_back( rttcrrcode);

	    // RttSignals

	    strcpy( dir, "$pwrp_load/");
	    sprintf( fname, "%s" load_cNameRttSignals,
		dir, vid.v.vid_3, vid.v.vid_2, vid.v.vid_1, vid.v.vid_0);
	    pkg_pattern rttsignals( fname);
	    n.push_back( rttsignals);

	  }
	}

	free( volnamelist);
	free( vollist);

      } catch ( wb_error &e) {
	if  ( e.what() == string("No such node"))
	  continue;
	throw wb_error_str(e.what());
      }
    }
    else if ( strcmp( cdh_Low(line_item[0]), "boot") == 0) {
      // A Sev node, only node and bootfile
      try {
	if ( !(num == 2))
	  throw wb_error_str("File corrupt " load_cNameDistribute);

	pkg_node &n = getNode( line_item[1]);
	// Add ld_node file
	sprintf( fname, load_cNameNode, load_cDirectory, n.name(), n.bus());
	pkg_pattern pnode( fname, "", 'E');
	n.push_back( pnode);
	
	// Add bootfile
	sprintf( fname, load_cNameBoot, load_cDirectory, n.name(), n.bus());
	pkg_pattern pboot( fname, "", 'E');
	n.push_back( pboot);
      } catch ( wb_error &e) {
	if  ( e.what() == string("No such node"))
	  continue;
	throw wb_error_str(e.what());
      }
    }
  }

  is.close();

  // Check that all nodes are valid
  for ( int i = 0; i < (int) m_nodelist.size(); i++) {
    if ( !m_nodelist[i].valid())
      throw wb_error_str( "Unknown node name");
  }
}