int MAcctToXML( mgcred_t *A, mxml_t **EP, int *SAList) { int DAList[] = {mcaID, -1}; int aindex; int *AList; char tmpString[MAX_MLINE]; if ((A == NULL) || (EP == NULL)) return (FAILURE); if (SAList != NULL) AList = SAList; else AList = DAList; MXMLCreateE(EP, (char *)MXO[mxoAcct]); for (aindex = 0; AList[aindex] != -1; aindex++) { if ((MCredAToString((void *)A, mxoAcct, AList[aindex], tmpString, 0) == FAILURE) || (tmpString[0] == '\0')) { continue; } MXMLSetAttr(*EP, (char *)MCredAttr[AList[aindex]], tmpString, mdfString); } /* END for (aindex) */ return (SUCCESS); } /* END MAcctToXML() */
int MClassShow( mclass_t *CP, /* I */ char *SBuffer, /* O */ long *SBufSize, /* O */ int DMode) /* I */ { int cindex; int aindex; char tmpLine[MAX_MLINE]; char tmpQALString[MAX_MLINE]; char tmpLString[MAX_MLINE]; int findex; char QALChar; mclass_t *C; int ClAList[] = { mclaOCNode, mclaOCDProcFactor, mclaDefReqFeature, mclaMaxProcPerNode, mclaWCOverrun, -1 }; int CAList[] = { mcaMaxProcPerUser, mcaMaxNodePerUser, mcaDefWCLimit, mcaMaxWCLimit, mcaMaxNodePerJob, mcaMaxProcPerJob, mcaMaxJobPerUser, -1 }; char *BPtr; int BSpace; const char *FName = "MClassShow"; DBG(3,fUI) DPrint("%s(%s,SBuffer,SBufSize,%d)\n", FName, (CP != NULL) ? CP->Name : "NULL", DMode); if (SBuffer == NULL) { return(FAILURE); } BPtr = SBuffer; BSpace = *SBufSize; MUSNPrintF(&BPtr,&BSpace,"Class/Queue Status\n\n"); /* NAME PRI FLAG QDEF QLST M PLST FST Limits */ MUSNPrintF(&BPtr,&BSpace,"%-14s %-8s %-12s %-12s %12s%c %-20s %-6s %s\n\n", "Name", "Priority", "Flags", "QDef", "QOSList", '*', "PartitionList", "Target", "Limits"); for (cindex = 0;cindex < MAX_MCLASS;cindex++) { C = &MClass[cindex]; DBG(8,fUI) DPrint("INFO: checking MClass[%02d]: %s\n", cindex, C->Name); if (C->Name[0] == '\0') continue; if (!strcmp(C->Name,NONE) || !strcmp(C->Name,ALL)) continue; if ((CP != NULL) && (strcmp(CP->Name,NONE) != 0) && (C != CP)) continue; tmpLine[0] = '\0'; for (findex = 0;MJobFlags[findex] != NULL;findex++) { if (!(C->F.JobFlags & (1 << findex))) continue; if (tmpLine[0] != '\0') strcat(tmpLine,":"); strcat(tmpLine,MJobFlags[findex]); } /* END for (findex) */ if (C->F.QALType == qalAND) QALChar = '&'; else if (C->F.QALType == qalONLY) QALChar = '^'; else QALChar = ' '; MUStrCpy(tmpQALString,MQOSBMToString(C->F.QAL),sizeof(tmpQALString)); MUStrCpy(tmpLString, MCredShowAttrs( &C->L.AP, C->L.IP, NULL, NULL, NULL, &C->F, 0, (1 << mcsLimits) | (1 << mcsUsage)), sizeof(tmpLString)); /* NAME PRIO FLAG QDEF QLST M PLST FSTARG Limits */ MUSNPrintF(&BPtr,&BSpace,"%-14s %8ld %-12s %-12s %12s%c %-20s %5.2lf %7s\n", C->Name, C->F.Priority, (tmpLine[0] != '\0') ? tmpLine : NONE, ((mqos_t *)C->F.QDef) != NULL ? ((mqos_t *)C->F.QDef)->Name : NONE, (tmpQALString[0] != '\0') ? tmpQALString : NONE, QALChar, (C->F.PAL[0] == 0) ? NONE : MUListAttrs(ePartition,C->F.PAL[0]), C->F.FSTarget, (tmpLString[0] != '\0') ? tmpLString : NONE); /* list extended class attributes */ tmpLine[0] = '\0'; for (aindex = 0;ClAList[aindex] != -1;aindex++) { if ((MClassAToString(C,ClAList[aindex],tmpLString,mdfString,0) == SUCCESS) && (tmpLString[0] != '\0') && strcmp(tmpLString,NONE)) { sprintf(&tmpLine[strlen(tmpLine)]," %s=%s", MClassAttr[ClAList[aindex]], tmpLString); } } /* END for (aindex) */ /* list extended cred attributes */ for (aindex = 0;CAList[aindex] != -1;aindex++) { if ((MCredAToString((void *)C,mxoClass,CAList[aindex],tmpLString,mdfString) == SUCCESS) && (tmpLString[0] != '\0')) { sprintf(&tmpLine[strlen(tmpLine)]," %s=%s", MCredAttr[CAList[aindex]], tmpLString); } } /* END for (aindex) */ if (tmpLine[0] != '\0') { MUStrNCat(&BPtr,&BSpace,tmpLine); MUStrNCat(&BPtr,&BSpace,"\n"); } } /* END for (cindex) */ return(SUCCESS); } /* END MClassShow() */