Esempio n. 1
0
static void PrintSymbolHeader (void)
/* Output a header for a list of symbols */
{
    /* Header */
    PrintLine ("  id  name                    type  size  value  export  seg  scope parent");
    PrintSeparator ();
}
Esempio n. 2
0
static void PrintTypeHeader (void)
/* Output a header for a list of types */
{
    /* Header */
    PrintLine ("  id  description");
    PrintSeparator ();
}
Esempio n. 3
0
static void PrintSourceHeader (void)
/* Output a header for a list of source files */
{
    /* Header */
    PrintLine ("  id    name                            size   modification time");
    PrintSeparator ();
}
Esempio n. 4
0
static void PrintSpanHeader (void)
/* Output a header for a list of spans */
{
    /* Header */
    PrintLine ("  id    start    end     seg   type   lines  scopes");
    PrintSeparator ();
}
Esempio n. 5
0
static void PrintScopeHeader (void)
/* Output a header for a list of scopes */
{
    /* Header */
    PrintLine ("  id    name                    type    size   parent  symbol  module");
    PrintSeparator ();
}
Esempio n. 6
0
static void PrintSegmentHeader (void)
/* Output a header for a list of segments */
{
    /* Header */
    PrintLine ("  id    name            address  size   output file     offs");
    PrintSeparator ();
}
Esempio n. 7
0
static void PrintLineHeader (void)
/* Output a header for a line list */
{
    /* Header */
    PrintLine ("  id    source  line    type  count");
    PrintSeparator ();
}
Esempio n. 8
0
static void PrintModuleHeader (void)
/* Output a header for a module list */
{
    /* Header */
    PrintLine ("  id    name                    source  library  scope");
    PrintSeparator ();
}
Esempio n. 9
0
static void PrintCSymbolHeader (void)
/* Output a header for a list of C symbols */
{
    /* Header */
    PrintLine ("  id  name                        type  kind   sc   offs  symbol scope");
    PrintSeparator ();
}
Esempio n. 10
0
void PrintResults(void)
{
    int ix;
#ifdef DEBUG
    fprintf(ofp, "Debug dump of globals global struct:\n");
    fprintf(ofp, "  files_are_different = %d\n", globals.files_are_different);
    fprintf(ofp, "  file1_size          = %d\n", globals.file1_size);
    fprintf(ofp, "  file2_size          = %d\n", globals.file2_size);
    fprintf(ofp, "  compare_size        = %d\n", globals.compare_size);
    fprintf(ofp, "  filename1           = '%s'\n", globals.filename1);
    fprintf(ofp, "  filename2           = '%s'\n", globals.filename2);
    fprintf(ofp, "  rng_size            = %d\n", globals.rng_size);
    fprintf(ofp, "  rng_numel           = %d\n", globals.rng_numel);
    fprintf(ofp, "Debug dump of range array:\n");
    for (ix = 0; ix < globals.rng_numel; ix++) {
        fprintf(ofp, "  %8d %8d\n", globals.rng[ix].start, globals.rng[ix].end);
    }
#endif
    if (histogram) {
        PrintHistogram();
    } else {
        PrintHeader();
        PrintSeparator();
        for (ix = 0; ix < globals.rng_numel; ix++) {
            PrintRange(globals.rng[ix].start, globals.rng[ix].end);
        }
    }
}
Esempio n. 11
0
File: pma.c Progetto: nirmoy/opa-ff
static FSTATUS perform_stl_pma_query(uint8 method, uint16 attrid, uint32 attrmod, argrec *args, STL_PERF_MAD *mad, size_t send_size)
{
	FSTATUS status;
	uint32_t dlid;
    uint8_t sl;

    sl   = args->sl==0xff?DEFAULT_PMA_SL:args->sl;  // check if sl has been set, if not use default sl

	mad->common.BaseVersion = STL_BASE_VERSION;
	mad->common.ClassVersion = STL_PM_CLASS_VERSION;
	mad->common.MgmtClass = MCLASS_PERF;
	mad->common.u.NS.Status.AsReg16 = 0; 
	mad->common.mr.AsReg8 = 0;
	mad->common.mr.s.Method = method;
	mad->common.AttributeID = attrid;
	mad->common.TransactionID = (++g_transactID);
	mad->common.AttributeModifier = attrmod;

	if (oib_get_port_state(args->oib_port) != IB_PORT_ACTIVE) {
		fprintf(stderr, "WARNING port (%s:%d) is not ACTIVE!\n",
			oib_get_hfi_name(args->oib_port),
			oib_get_hfi_port_num(args->oib_port));
    	dlid = args->dlid?args->dlid:STL_LID_PERMISSIVE;// perm lid for local query
	} else {
	    dlid = args->dlid?args->dlid:args->slid;	// use slid for local query
	}

    // Determine which pkey to use (full or limited)
    // Attempt to use full at all times, otherwise, can
    // use the limited for queries of the local port.
    uint16_t pkey = oib_get_mgmt_pkey(args->oib_port, args->dlid, args->drpaths);
    if (pkey==0) {
        fprintf(stderr, "ERROR: Local port does not have management privileges\n");
        return (FPROTECTION);
    }

	if (g_verbose) {
		PrintFunc(&g_dest, "Sending MAD to 0x%08x:\n", dlid);
		PrintMadHeader(&g_dest, 2, &mad->common);
		PrintSeparator(&g_dest);
	}

	BSWAP_MAD_HEADER((MAD*)mad);
	{
		struct oib_mad_addr addr = {
			lid  : dlid,
			qpn  : 1,
			qkey : QP1_WELL_KNOWN_Q_KEY,
			pkey : pkey,
            sl   : sl
		};
        size_t recv_size = sizeof(*mad);
		status = oib_send_recv_mad_no_alloc(args->oib_port, (uint8_t *)mad, send_size+sizeof(MAD_COMMON), &addr,
											(uint8_t *)mad, &recv_size, RESP_WAIT_TIME, 0);
	}
Esempio n. 12
0
void PrintRange(int starting_offset, int ending_offset)
{
    char plural[2] = "";
    int num_bytes_diff;

    assert(starting_offset >= 0);
    assert(starting_offset <= ending_offset);
    if (starting_offset < ending_offset) {
        strcpy(plural, "s");
    }
    num_bytes_diff = ending_offset - starting_offset + 1;
    fprintf(ofp, "File %s:  %d (0x%x) byte%s different\n", 
                 globals.filename1, num_bytes_diff, num_bytes_diff, plural);
    HexDump(globals.ifp1, starting_offset, num_bytes_diff);
    fprintf(ofp, "File %s:\n", globals.filename2);
    HexDump(globals.ifp2, starting_offset, num_bytes_diff);
    PrintSeparator();
}
Esempio n. 13
0
    void TestBackTrace ()
    {
        bool rc = true;

        TestHeader("backtrace test");

        Tracker2 t;

        t.doTest(25);
        Progress(rc, "minimal functionality");
        t.doTest(25);
        rc = (t._codepoints[10] != 0);
        Progress(rc, "many levels");
        rc = (t.found() > 10);
        Progress(rc, "many levels retval");
        t.doTest(8);
        rc = (t.found() == 8);
        Progress(rc, "few levels retval");
        rc = (t._codepoints[8] == 0);
        Progress(rc, "few levels");

        PrintSeparator();
    }
Esempio n. 14
0
void showStlVFabrics(void) {
	STL_VFINFO_RECORD vFabricRecord;
	int vf;
	IB_GID mGid = (IB_GID){.Raw = {0}}; // only reported if in samad.header.mask
    PrintDest_t dest; 
	VirtualFabrics_t *VirtualFabrics = old_topology.vfs_ptr;

	if (!VirtualFabrics)
        return;

	memset(&vFabricRecord, 0, sizeof(vFabricRecord));
    PrintDestInitFile(&dest, stdout);
     
	(void)vs_rdlock(&old_topology_lock);

	for (vf=0; vf < VirtualFabrics->number_of_vfs; vf++) {
		sa_VFabric_Set((uint8_t *)&vFabricRecord, vf, NULL, 0, mGid);

        if (vf) PrintSeparator(&dest);
        PrintStlVfInfoRecord(&dest, 0, &vFabricRecord);
	}

	(void)vs_rwunlock(&old_topology_lock);
}
Esempio n. 15
0
File: sd.c Progetto: 01org/opa-ff
// display the results from a query
// Note: csv is ignored for all but OutputTypeVfInfoRecord
void PrintQueryResultValue(PrintDest_t *dest, int indent, PrintDest_t *dbgDest,
			   QUERY_RESULT_TYPE OutputType, int csv,
			   const QUERY_RESULT_VALUES *pResult)
{
	uint32 i;

	if (dbgDest) {
		PrintFunc(dbgDest, "OutputType (0x%x): %s\n", OutputType, 
				  iba_sd_query_result_type_msg(OutputType));
		PrintFunc(dbgDest, "MadStatus 0x%x: %s\n", pResult->MadStatus,
				   				iba_sd_mad_status_msg(pResult->MadStatus));
		PrintFunc(dbgDest, "%d Bytes Returned\n", pResult->ResultDataSize);
	}
	switch ((int)OutputType)
	{
	case OutputTypeSystemImageGuid:
	case OutputTypeNodeGuid:
	case OutputTypePortGuid:
	case OutputTypeStlSystemImageGuid:
	case OutputTypeStlNodeGuid:
	case OutputTypeStlPortGuid:
		{
		GUID_RESULTS *p = (GUID_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumGuids; ++i)
		{
			PrintGuid(dest, indent, p->Guids[i]);
		}
		break;
		}
	case OutputTypeClassPortInfo:
		{
		IB_CLASS_PORT_INFO_RESULTS *p = (IB_CLASS_PORT_INFO_RESULTS*)pResult->QueryResult;
		
		/* There should never be more than 1 ClassPortInfo in the results. */
		if (p->NumClassPortInfo)
			PrintClassPortInfo(dest, indent, &(p->ClassPortInfo[0]));
		break;
		}
	case OutputTypeStlClassPortInfo:
		{
		STL_CLASS_PORT_INFO_RESULT *p = (STL_CLASS_PORT_INFO_RESULT*)pResult->QueryResult;
		
		/* There should never be more than 1 ClassPortInfo in the results. */
		if (p->NumClassPortInfo)
			PrintStlClassPortInfo(dest, indent, &p->ClassPortInfo, MCLASS_SUBN_ADM);
		break;
		}
	case OutputTypeStlFabricInfoRecord:
		{
		STL_FABRICINFO_RECORD_RESULT *p = (STL_FABRICINFO_RECORD_RESULT*)pResult->QueryResult;
		
		/* There should never be more than 1 FaricInfoRecord in the results. */
		if (p->NumFabricInfoRecords)
			PrintStlFabricInfoRecord(dest, indent, &p->FabricInfoRecord);
		break;
		}
	case OutputTypeStlLid:
		{
		STL_LID_RESULTS *p = (STL_LID_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumLids; ++i)
		{
			PrintStlLid(dest, indent, p->Lids[i], 0);
		}
		break;
		}
	case OutputTypeGid:
		{
		GID_RESULTS *p = (GID_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumGids; ++i)
		{
			PrintGid(dest, indent, &p->Gids[i]);
		}
		break;
		}
	case OutputTypeNodeDesc:
		{
		NODEDESC_RESULTS *p = (NODEDESC_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumDescs; ++i)
		{
			PrintNodeDesc(dest, indent, &p->NodeDescs[i]);
		}
		break;
		}
	case OutputTypeStlNodeDesc:
		{
		STL_NODEDESC_RESULTS *p = (STL_NODEDESC_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumDescs; ++i)
		{
			PrintStlNodeDesc(dest, indent, &p->NodeDescs[i], 0);
		}
		break;
		}
	case OutputTypePathRecord:
		{
		PATH_RESULTS *p = (PATH_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPathRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintPathRecord(dest, indent, &p->PathRecords[i]);
		}
		break;
		}
	case OutputTypeNodeRecord:
		{
		NODE_RECORD_RESULTS *p = (NODE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumNodeRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintNodeRecord(dest, indent, &p->NodeRecords[i]);
		}
		break;
		}
	case OutputTypeStlNodeRecord:
		{
		STL_NODE_RECORD_RESULTS *p = (STL_NODE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumNodeRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlNodeRecord(dest, indent, &p->NodeRecords[i]);
		}
		break;
		}
	case OutputTypePortInfoRecord:
		{
		PORTINFO_RECORD_RESULTS *p = (PORTINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPortInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintPortInfoRecord(dest, indent, &p->PortInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlPortInfoRecord:
		{
		STL_PORTINFO_RECORD_RESULTS *p = (STL_PORTINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPortInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlPortInfoRecord(dest, indent, &p->PortInfoRecords[i]);
		}
		break;
		}
	case OutputTypeSMInfoRecord:
		{
		SMINFO_RECORD_RESULTS *p = (SMINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSMInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintSMInfoRecord(dest, indent, &p->SMInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlSMInfoRecord:
		{
		STL_SMINFO_RECORD_RESULTS *p = (STL_SMINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSMInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlSMInfo(dest, indent, &(p->SMInfoRecords[i].SMInfo), 
							p->SMInfoRecords[i].RID.LID, 0);
		}
		break;
		}
	case OutputTypeLinkRecord:
		{
		LINK_RECORD_RESULTS *p = (LINK_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumLinkRecords; ++i)
		{
			PrintLinkRecord(dest, indent, &p->LinkRecords[i]);
		}
		break;
		}
	case OutputTypeStlLinkRecord:
		{
		STL_LINK_RECORD_RESULTS *p = (STL_LINK_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumLinkRecords; ++i)
		{
			PrintStlLinkRecord(dest, indent, &p->LinkRecords[i]);
		}
		break;
		}
	case OutputTypeServiceRecord:
		{
		SERVICE_RECORD_RESULTS *p = (SERVICE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumServiceRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintServiceRecord(dest, indent, &p->ServiceRecords[i]);
		}
		break;
		}
#ifndef NO_STL_SERVICE_OUTPUT       // Don't output STL Service if defined
	case OutputTypeStlServiceRecord:
		{
		STL_SERVICE_RECORD_RESULTS *p = (STL_SERVICE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumServiceRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlServiceRecord(dest, indent, &p->ServiceRecords[i]);
		}
		break;
		}
#endif
#ifndef NO_STL_MCMEMBER_OUTPUT       // Don't output STL McMember if defined
	case OutputTypeStlMcMemberRecord:
		{
		STL_MCMEMBER_RECORD_RESULTS *p = (STL_MCMEMBER_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumMcMemberRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlMcMemberRecord(dest, indent, &p->McMemberRecords[i]);
		}
		break;
		}
#endif
	case OutputTypeMcMemberRecord:
		{
		MCMEMBER_RECORD_RESULTS *p = (MCMEMBER_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumMcMemberRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintMcMemberRecord(dest, indent, &p->McMemberRecords[i]);
		}
		break;
		}
	case OutputTypeInformInfoRecord:
		{
		INFORM_INFO_RECORD_RESULTS *p = (INFORM_INFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumInformInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintInformInfoRecord(dest, indent, &p->InformInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlInformInfoRecord:
		{
		STL_INFORM_INFO_RECORD_RESULTS *p = (STL_INFORM_INFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumInformInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlInformInfoRecord(dest, indent, &p->InformInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlTraceRecord:
		{
		STL_TRACE_RECORD_RESULTS *p = (STL_TRACE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumTraceRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlTraceRecord(dest, indent, &p->TraceRecords[i]);
		}
		break;
		}
	case OutputTypeSLVLMapRecord:
		{
		SLVLMAP_RECORD_RESULTS *p = (SLVLMAP_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSLVLMapRecords; ++i)
		{
			PrintSLVLMapRecord(dest, indent, &p->SLVLMapRecords[i]);
		}
		break;
		}
	case OutputTypeStlSCSCTableRecord:
		{
		STL_SC_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        uint32_t lid = p->SCSCRecords[0].RID.LID;
		for (i=0; i<p->NumSCSCTableRecords; ++i)
		{
            if (lid!=p->SCSCRecords[i].RID.LID) {
                PrintSeparator(dest);
                lid=p->SCSCRecords[i].RID.LID;
            }
			PrintStlSCSCTableRecord(dest, indent, &p->SCSCRecords[i]);
        }
		break;
		}
	case OutputTypeStlSLSCTableRecord:
		{
		STL_SL2SC_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SL2SC_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        uint32_t lid = p->SLSCRecords[0].RID.LID;
		for (i=0; i<p->NumSLSCTableRecords; ++i)
		{
            if (lid!=p->SLSCRecords[i].RID.LID) {
                PrintSeparator(dest);
                lid=p->SLSCRecords[i].RID.LID;
            }
			PrintStlSLSCTableRecord(dest, indent, &p->SLSCRecords[i]);
        }
		break;
		}
	case OutputTypeStlSCSLTableRecord:
		{
		STL_SC2SL_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC2SL_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		uint32_t lid = p->SCSLRecords[0].RID.LID;
		for (i=0; i<p->NumSCSLTableRecords; i++) {
			if (lid!=p->SCSLRecords[i].RID.LID) {
				PrintSeparator(dest);
				lid=p->SCSLRecords[i].RID.LID;
			}
			PrintStlSCSLTableRecord(dest, indent, &p->SCSLRecords[i]);
		}
		break;
		}
	case OutputTypeStlSCVLtTableRecord:
		{
		STL_SC2PVL_T_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC2PVL_T_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		uint32_t lid = p->SCVLtRecords[0].RID.LID;
		for (i=0; i<p->NumSCVLtTableRecords; i++) {
			if (lid!=p->SCVLtRecords[i].RID.LID) {
				PrintSeparator(dest);
				lid=p->SCVLtRecords[i].RID.LID;
			}
			PrintStlSCVLxTableRecord(dest, indent, &p->SCVLtRecords[i], STL_MCLASS_ATTRIB_ID_SC_VLT_MAPPING_TABLE);
		}
		break;
		}
	case OutputTypeStlSCVLntTableRecord:
		{
		STL_SC2PVL_NT_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC2PVL_NT_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		uint32_t lid=p->SCVLntRecords[0].RID.LID;
		for (i=0; i<p->NumSCVLntTableRecords; i++) {
			if (lid!=p->SCVLntRecords[i].RID.LID) {
				PrintSeparator(dest);
				lid=p->SCVLntRecords[i].RID.LID;
			}
			PrintStlSCVLxTableRecord(dest, indent, &p->SCVLntRecords[i], STL_MCLASS_ATTRIB_ID_SC_VLNT_MAPPING_TABLE);
		}
		break;
		}
	case OutputTypeSwitchInfoRecord:
		{
		SWITCHINFO_RECORD_RESULTS *p = (SWITCHINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSwitchInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintSwitchInfoRecord(dest, indent, &p->SwitchInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlSwitchInfoRecord:
		{
		STL_SWITCHINFO_RECORD_RESULTS *p = (STL_SWITCHINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSwitchInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlSwitchInfoRecord(dest, indent, &p->SwitchInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlLinearFDBRecord:
		{
		STL_LINEAR_FDB_RECORD_RESULTS *p = (STL_LINEAR_FDB_RECORD_RESULTS*)pResult->QueryResult;
		
		for (i=0; i<p->NumLinearFDBRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlLinearFDBRecord(dest, indent, &p->LinearFDBRecords[i]);
		}
		break;
		}
	case OutputTypeRandomFDBRecord:
		{
		RANDOM_FDB_RECORD_RESULTS *p = (RANDOM_FDB_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumRandomFDBRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintRandomFDBRecord(dest, indent, &p->RandomFDBRecords[i]);
		}
		break;
		}
	case OutputTypeStlMCastFDBRecord:
		{
		STL_MCAST_FDB_RECORD_RESULTS *p = (STL_MCAST_FDB_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumMCastFDBRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlMCastFDBRecord(dest, indent, &p->MCastFDBRecords[i]);
		}
		break;
		}
	case OutputTypeStlVLArbTableRecord:
		{
		STL_VLARBTABLE_RECORD_RESULTS *p = (STL_VLARBTABLE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumVLArbTableRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlVLArbTableRecord(dest, indent, &p->VLArbTableRecords[i]);
		}
		break;
		}
	case OutputTypeStlPKeyTableRecord:
		{
		STL_PKEYTABLE_RECORD_RESULTS *p = (STL_PKEYTABLE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPKeyTableRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlPKeyTableRecord(dest, indent, &p->PKeyTableRecords[i]);
		}
		break;
		}
	case OutputTypeStlVfInfoRecord:
		{
		STL_VFINFO_RECORD_RESULTS *p = (STL_VFINFO_RECORD_RESULTS*)pResult->QueryResult;

		for (i=0; i<p->NumVfInfoRecords; ++i) {
			if (csv == 1) {
				PrintStlVfInfoRecordCSV(dest, indent, &p->VfInfoRecords[i]);
			} else if (csv == 2) {
				PrintStlVfInfoRecordCSV2(dest, indent, &p->VfInfoRecords[i]);
			} else {
				if (i) PrintSeparator(dest);
				PrintStlVfInfoRecord(dest, indent, &p->VfInfoRecords[i]);
			}
		}
		break;
		}
	case OutputTypeStlQuarantinedNodeRecord:
		{
		STL_QUARANTINED_NODE_RECORD_RESULTS *p = (STL_QUARANTINED_NODE_RECORD_RESULTS*)pResult->QueryResult;
		int hasPrinted = 0;
		// Loop through and print out spoofing violations first
		PrintSeparator(dest);
		PrintFunc(dest, "%*sNodes Quarantined Due To Spoofing:\n", indent, "");
		PrintSeparator(dest);
		for(i = 0; i < p->NumQuarantinedNodeRecords; ++i)
		{
			if (i && hasPrinted) PrintSeparator(dest);

			if(p->QuarantinedNodeRecords[i].quarantineReasons & STL_QUARANTINE_REASON_SPOOF_GENERIC) {
				PrintQuarantinedNodeRecord(dest, indent, &p->QuarantinedNodeRecords[i]);
				hasPrinted = 1;
			}
		}

		if(!hasPrinted) {
			PrintFunc(dest, "%*s    None.\n\n", indent, "");
		} else {
			hasPrinted = 0;
		}

		// Then loop through and print out all other violations
		PrintSeparator(dest);
		PrintFunc(dest, "%*sNodes Quarantined Due To Other Violations:\n", indent, "");
		PrintSeparator(dest);
		for(i = 0; i < p->NumQuarantinedNodeRecords; ++i)
		{
			if (i && hasPrinted) PrintSeparator(dest);
			if(!(p->QuarantinedNodeRecords[i].quarantineReasons & STL_QUARANTINE_REASON_SPOOF_GENERIC)) {
				PrintQuarantinedNodeRecord(dest, indent, &p->QuarantinedNodeRecords[i]);
				hasPrinted = 1;
			}
		}

		if(!hasPrinted) {
			PrintFunc(dest, "%*s    None.\n\n", indent, "");
		}

		break;
		}
	case OutputTypeStlCongInfoRecord:
		{
		STL_CONGESTION_INFO_RECORD_RESULTS *p = (STL_CONGESTION_INFO_RECORD_RESULTS*)pResult->QueryResult;
		for(i = 0; i < p->NumRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlCongestionInfoRecord(dest, indent, &p->Records[i]);
		}
		break;
		}
	case OutputTypeStlSwitchCongRecord:
		{
        STL_SWITCH_CONGESTION_SETTING_RECORD_RESULTS *p = (STL_SWITCH_CONGESTION_SETTING_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlSwitchCongestionSettingRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlSwitchPortCongRecord:
		{
        STL_SWITCH_PORT_CONGESTION_SETTING_RECORD_RESULTS *p = (STL_SWITCH_PORT_CONGESTION_SETTING_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlSwitchPortCongestionSettingRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlHFICongRecord:
		{
        STL_HFI_CONGESTION_SETTING_RECORD_RESULTS *p = (STL_HFI_CONGESTION_SETTING_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlHfiCongestionSettingRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlHFICongCtrlRecord:
		{
        STL_HFI_CONGESTION_CONTROL_TABLE_RECORD_RESULTS *p = (STL_HFI_CONGESTION_CONTROL_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlHfiCongestionControlTabRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlBufCtrlTabRecord:
		{
		STL_BUFFER_CONTROL_TABLE_RECORD_RESULTS *p = (STL_BUFFER_CONTROL_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		for(i = 0; i < p->NumBufferControlRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintBfrCtlTableRecord(dest, indent, &p->BufferControlRecords[i]);
		}
		break;
		}
	case OutputTypeStlCableInfoRecord:
		{
		const uint32	max_records = 2;	// Max number of grouped records
											//  NOTE that CIR.Length is 7 bits (<= 127)
		STL_CABLE_INFO_RECORD_RESULTS *p = (STL_CABLE_INFO_RECORD_RESULTS*)pResult->QueryResult;
		STL_CABLE_INFO_RECORD *p_rec;
		uint32	ct_records = 0;			// Count of grouped records
		uint8	first_addr = 0;			// First CableInfo addr in bf_cable_info
		uint8	last_addr = 0;			// Last CableInfo addr in bf_cable_info
		uint32	prev_lid;
		uint8	prev_port;
		uint8	prev_addr;
		uint8	bf_cable_info[sizeof(STL_CABLE_INFO_RECORD) * max_records];
		for(i = 0; i < p->NumCableInfoRecords; ++i)
		{
			p_rec = &p->CableInfoRecords[i];
			// Skip unaligned or partial records
			if ( ( (p_rec->u1.s.Address != STL_CIB_STD_START_ADDR) &&
					(p_rec->u1.s.Address != STL_CIB_STD_START_ADDR + STL_CABLE_INFO_MAXLEN + 1) ) ||
					(p_rec->Length != STL_CABLE_INFO_MAXLEN) )
				continue;
			// Group multiple records for same LID and port into one
			if (! ct_records) {
				// First record for LID/Port
				memset(bf_cable_info, 0, sizeof(bf_cable_info));
				memcpy(bf_cable_info, p_rec, sizeof(STL_CABLE_INFO_RECORD));
				last_addr = 0;
			}
			else {
				if ((p_rec->LID == prev_lid) && (p_rec->Port == prev_port) &&
						(p_rec->u1.s.Address != prev_addr) && (ct_records < max_records)) {
					// Subsequent record for same LID/Port
					if (p_rec->u1.s.Address < first_addr) {
						memmove( ((STL_CABLE_INFO_RECORD *)bf_cable_info)->Data + first_addr - p_rec->u1.s.Address,
							((STL_CABLE_INFO_RECORD *)bf_cable_info)->Data,
							STL_CIR_DATA_SIZE * max_records - (first_addr - p_rec->u1.s.Address) );
						memcpy(bf_cable_info, p_rec, sizeof(STL_CABLE_INFO_RECORD));
					}
					else {
						memcpy( ((STL_CABLE_INFO_RECORD *)bf_cable_info)->Data + p_rec->u1.s.Address - first_addr,
							p_rec->Data, STL_CIR_DATA_SIZE );
					}
				}
				else {
					// Print grouped record
					if (i - ct_records) PrintSeparator(dest);
					PrintStlCableInfoRecord(dest, indent, (STL_CABLE_INFO_RECORD *)bf_cable_info);
					memset(bf_cable_info, 0, sizeof(bf_cable_info));
					memcpy(bf_cable_info, p_rec, sizeof(STL_CABLE_INFO_RECORD));
					last_addr = 0;
					ct_records = 0;
				}
			}
			prev_lid = p_rec->LID;
			prev_port = p_rec->Port;
			prev_addr = p_rec->u1.s.Address;
			if (prev_addr > last_addr)
				last_addr = prev_addr;
			ct_records += 1;
			first_addr = ((STL_CABLE_INFO_RECORD *)bf_cable_info)->u1.s.Address;
			((STL_CABLE_INFO_RECORD *)bf_cable_info)->Length = last_addr - first_addr + STL_CIR_DATA_SIZE - 1;
		}
		if (ct_records) {
			if (i - ct_records) PrintSeparator(dest);
			PrintStlCableInfoRecord(dest, indent, (STL_CABLE_INFO_RECORD *)bf_cable_info);
		}
		break;
		}
	case OutputTypeStlPortGroupRecord:
		{
        STL_PORT_GROUP_TABLE_RECORD_RESULTS *p = (STL_PORT_GROUP_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlPortGroupTabRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlPortGroupFwdRecord:
		{
        STL_PORT_GROUP_FORWARDING_TABLE_RECORD_RESULTS *p = (STL_PORT_GROUP_FORWARDING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlPortGroupFwdTabRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	default:
		PrintFunc(dest, "Unsupported OutputType\n");
	}
}
Esempio n. 16
0
static void PrintLibraryHeader (void)
/* Output the header for a library list */
{
    PrintLine ("  id    name");
    PrintSeparator ();
}