📄 scs.c
字号:
if(readmem((char *) &scaddr_st, (int)scaddr_ptr, sizeof(c_scaaddr)) != sizeof(c_scaaddr)) { printf("could not read system identification number at 0x%x.\n", scaddr_ptr); return; } if (printmode & SCS_PRINTFULL) { /* * The type c_scaaddr is defined as "u_char val[ 6 ]" , the low 4 * bytes are an address and the upper 2 bytes is a port type. */ for (i=5; i >= 0; i--) { if (i%2) { printf("0x"); } printf("%x",scaddr_st.val[i]); if (((i%2) == 0) && (i != 0)) { printf(", "); } } } printf("\n");}/* * * Name: printscs_follow_pbq - Follow links in a path block queue. * * Abstract: Get to path blocks in a list. * * Inputs: pbq_ptr - Pointer to a path block queue head. * printmode - Controlls output level. * * Return NONE * Values: */int printscs_follow_pbq(pbq_ptr, printmode) pbq *pbq_ptr; int printmode;{ pbq pbq_st; PB pb_st; PB *pb_ptr; if(readmem((char *) &pbq_st, (int)pbq_ptr, sizeof(pbq)) != sizeof(pbq)) { printf("could not path block queue head at 0x%x.\n",pbq_ptr); return; } if (pbq_ptr == 0) { printf("\tNULL path block queue head.\n"); return; } if ((pbq_st.flink == pbq_st.blink) && (pbq_st.flink == pbq_ptr)) { printf("There are no allocated path blocks.\n"); return; } pb_ptr = (PB *)pbq_st.flink; do { printscs_pb(pb_ptr, printmode); if(readmem((char *) &pb_st, (int)pb_ptr, sizeof(PB)) != sizeof(PB)) { printf("could not read path block at 0x%x\n",pb_ptr); return; } pb_ptr = (PB *)pb_st.flink; } while (pb_ptr != (PB *)pbq_ptr);}/* * * Name: printscs_pb - Print contents of a path block structure. * * Abstract: Disect and display a path block. * * Inputs: pb_ptr - Pointer to a path block. * printmode - Controlls output level. * * Return NONE * Values: */int printscs_pb(pb_ptr, printmode) PB *pb_ptr; int printmode;{ PB pb_st; int offset; if (pb_ptr == 0) { printf("\tNULL path block pointer.\n"); return; } printf("\t\t---------------- PATH BLOCK ---------------------\n"); if(readmem((char *) &pb_st, (int)pb_ptr, sizeof(PB)) != sizeof(PB)) { printf("could not read path block at 0x%x.\n",pb_ptr); return; } if (printmode & SCS_PRINTFULL) { printf("\t\tPath block address is 0x%x\n",pb_ptr); printf("\t\tflink: 0x%x, blink: 0x%x\n",pb_st.flink, pb_st.blink); printf("\t\tsize: %d, type: %d\n",pb_st.size, pb_st.type); printf("\t\ttimeout queue: flink 0x%x, blink 0x%x ", pb_st.timeout.flink, pb_st.timeout.blink); offset = (int)(&pb_st.timeout.flink) - (int)(&pb_st.flink); if (((char *)pb_ptr + offset) == (char *)pb_st.timeout.flink) { printf("\(EMPTY\) "); } printf("\n"); printf("\t\tCB queue: flink 0x%x, blink 0x%x ", pb_st.cbs.flink, pb_st.cbs.blink); offset = (int)(&pb_st.cbs.flink) - (int)(&pb_st.flink); if (((char *)pb_ptr + offset) != (char *)pb_st.cbs.flink) { printf("\n"); printscs_cbq((char *) ((char *)pb_ptr + offset), printmode, X_CBS); } else { printf("\(EMPTY\)\n"); } printf("\t\tSCS waiting CB queue: flink 0x%x, blink 0x%x ", pb_st.scs_cb.flink, pb_st.scs_cb.blink); offset = (int)(&pb_st.scs_cb.flink) - (int)(&pb_st.flink); if (((char *)pb_ptr + offset) != (char *)pb_st.scs_cb.flink) { printf("\n"); printscs_cbq((char *) ((char *)pb_ptr + offset), printmode, X_SCS_CB); } else { printf("\(EMPTY\)\n"); } printf("\t\tsb: 0x%x, pccb: 0x%x, pdt: 0x%x\n", pb_st.sb, pb_st.pccb, pb_st.pdt); printf("\t\tSCS send message buffer pointer: 0x%x\n",pb_st.scs_msgbuf); offset = (int)(&pb_st.pb_lk) - (int)(&pb_st.flink); print_lockt((char *) ((char *)pb_ptr + offset), printmode); offset = (int)(&pb_st.pd) - (int)(&pb_st.flink); printscs_gvp((char *) ((char *)pb_ptr + offset), printmode); offset = (int)(&pb_st.ppd) - (int)(&pb_st.flink); printscs_cipppd((char *) ((char *)pb_ptr + offset), printmode); offset = (int)(&pb_st.pinfo) - (int)(&pb_st.flink); printscs_pib((char *) ((char *)pb_ptr + offset), printmode); }}/* * * Name: print_lockt - Print contents of a lock structure * * Abstract: Disect and display a lock struct. * * Inputs: lock_ptr - Pointer to a path block. * printmode - Controlls output level. * * Return NONE * Values: */int print_lockt(lock_ptr, printmode) struct lock_t *lock_ptr; int printmode;{ struct lock_t lock_st; if (lock_ptr == 0) { printf("\tNULL lock structure pointer.\n"); return; } printf("\t\t\t---------------- LOCK STRUCTURE ------------\n"); if(readmem((char *) &lock_st, (int)lock_ptr, sizeof(struct lock_t)) != sizeof(struct lock_t)) { printf("could not read lock structure at 0x%x.\n",lock_ptr); return; } if (printmode & SCS_PRINTFULL) { printf("\t\t\tl_hierpos: %d, l_type: %d, l_ipl: %d\n", lock_st.l_hierpos, lock_st.l_type, lock_st.l_ipl); printf("\t\t\tl_lock: %d, l_plock: 0x%x, l_pc: 0x%x\n", lock_st.l_lock, lock_st.l_plock, lock_st.l_pc); printf("\t\t\tl_lost: %d, l_spin: %d, l_won: %d, l_wanted: %d\n", lock_st.l_lost, lock_st.l_spin, lock_st.l_won,lock_st.l_wanted); }}/* * * Name: printscs_gvp - Print contents of a _gvppb structure * * Abstract: This routine is called to print out the "pd" element of the * path block data structure. That field is defined as a union of * only one element which is itself a union of type _gvppb which * itself is a union of only one element which is a structure of * type _cipb. (You can call me Fred, or you can call me Sam, ...) * So to make a long story short, this routine ammounts to only * reading in a struct of type _cipb. * * Inputs: ci_ptr - Pointer to a path block. * printmode - Controlls output level. * * Return NONE * Values: */int printscs_gvp(ci_ptr, printmode) CIPB *ci_ptr; int printmode;{ CIPB ci_st; if (ci_ptr == 0) { printf("\tNULL gvp structure pointer.\n"); return; } printf("\t\t\t---------------- GVP \(CIPB\) STRUCTURE -------\n"); if(readmem((char *) &ci_st, (int)ci_ptr, sizeof(CIPB)) != sizeof(CIPB)) { printf("could not read gvp structure at 0x%x.\n",ci_ptr); return; } if (printmode & SCS_PRINTFULL) { printf("\t\t\tscpkt: 0x%x, invtcpkt: 0x%x\n",ci_st.scpkt, ci_st.invtcpkt); printf("\t\t\tCable Status: Cable0 "); if (ci_st.pstatus.cable0) printf("Bad, "); else printf("Good, "); printf("Cable1 "); if (ci_st.pstatus.cable1) printf("Bad, "); else printf("Good, "); if (ci_st.pstatus.cables_crossed == 0) printf("not "); printf("crossed.\n"); }}/* * * Name: printscs_cipppd - Print contents of a _cippdpb structure * * Abstract: This routine is called to print out the "ppd" element of the * path block data structure. That field is defined as a union of * only one element which is a structure of type _cippdpb. * * Inputs: cippd_ptr - Pointer to a CIPPDPB block. * printmode - Controlls output level. * * Return NONE * Values: */int printscs_cipppd(cippd_ptr, printmode) CIPPDPB *cippd_ptr; int printmode;{ CIPPDPB cippd_st; int offset; if (cippd_ptr == 0) { printf("\tNULL _cippdpb structure pointer.\n"); return; } printf("\t\t\t---------------- CIPPDPB STRUCTURE ------------\n"); if(readmem((char *) &cippd_st, (int)cippd_ptr, sizeof(CIPPDPB)) != sizeof(CIPPDPB)) { printf("could not read cippdpb structure at 0x%x.\n",cippd_ptr); return; } if (printmode & SCS_PRINTFULL) { printf("\t\t\ttimer: %d, path_closed: %d, fkip: %d\n", cippd_st.fsmpstatus.timer, cippd_st.fsmpstatus.path_closed, cippd_st.fsmpstatus.fkip); printf("\t\t\tdbiip: 0x%x, due_time: %d, retry: %d\n", cippd_st.dbiip, cippd_st.due_time, cippd_st.retry); offset = (int)(&cippd_st.forkb) - (int)(&cippd_st.fsmpstatus); printscs_kschedblk((char *) ((char *)cippd_ptr + offset), printmode); }}/* * * Name: printscs_kschedblk - Print contents of a kschedblk * * Abstract: Print contents of a kschedblk. This is otherwise refered to * as a forkb. * * Inputs: kschedblk_ptr - Pointer to a kschedblk. * printmode - Controlls output level. * * Return NONE * Values: */int printscs_kschedblk(kschedblk_ptr, printmode) struct kschedblk *kschedblk_ptr; int printmode;{ struct kschedblk kschedblk_st; if (kschedblk_ptr == 0) { printf("\tNULL kschedblk structure pointer.\n"); return; } printf("\t\t\t\t---------- FORKB STRUCTURE ------------\n"); if(readmem((char *) &kschedblk_st, (int)kschedblk_ptr, sizeof(struct kschedblk)) != sizeof(struct kschedblk)) { printf("could not read kschedblk structure at 0x%x.\n", kschedblk_ptr); return; } if (printmode & SCS_PRINTFULL) { printf("\t\t\t\t"); /* * The following compilation error occurs when trying to display the * ipl element: "warning: illegal member use: ipl". I suspect that * this is due to some form of define in a header file. Skip the ipl * field for now. * printf("ipl: 0x%x, ", kschedblk_st.ipl); */ printf("arg: 0x%x, next: 0x%x\n", kschedblk_st.arg, kschedblk_st.next); printf("\t\t\t\t"); printf("func: 0x%x", kschedblk_st.func); if (kschedblk_st.func != 0) { printf(" \("); praddr(kschedblk_st.func); printf("\)"); } printf("\n"); }}/* * * Name: printscs_pib - Print contents of a path information block * * Abstract: Print contents of a pib. * * Inputs: pib_ptr - Pointer to a pib. * printmode - Controlls output level. * * Return NONE * Values: */int printscs_pib(pib_ptr, printmode) PIB *pib_ptr; int printmode;{ PIB pib_st; int i; int offset; u_char c; if (pib_ptr == 0) { printf("\tNULL path information block structure pointer.\n"); return; } printf("\t\t\t---------------- PIB STRUCTURE ------------\n"); if(readmem((char *) &pib_st, (int)pib_ptr, sizeof(PIB)) != sizeof(PIB)) { printf("could not read pib structure at 0x%x.\n", pib_ptr); return; } if (printmode & SCS_PRINTFULL) { printf("\t\t\tPath information block address is 0x%x\n",pib_ptr); printf("\t\t\tlport_name: "); for (i=0; i < 4; i++) { c = (u_char)(pib_st.lport_name >> 8*i); if (isprint(c)) printf("%c",c); } printf("\n"); printf("\t\t"); offset = (int)(&pib_st.rport_addr) - (int)(&pib_st.lport_name); printscs_scaddr((char *) ((char *)pib_ptr + offset), printmode); printf("\t\t\tstate: 0x%x \(",pib_st.state); switch (pib_st.state) { case PS_CLOSED: printf("PS_CLOSED"); break; case PS_START_SNT: printf("PS_START_SNT"); break; case PS_START_REC: printf("PS_START_REC"); break; case PS_STACK_SNT: printf("PS_STACK_SNT"); break; case PS_OPEN: printf("PS_OPEN"); break; case PS_PATH_FAILURE: printf("PS_PATH_FAILURE"); break; default: printf("UNKNOWN"); } printf("\), "); printf("hwtype: %d \(",pib_st.type.hwtype); switch (pib_st.type.hwtype) { case HPT_UQSSP: printf("HPT_UQSSP"); break; case HPT_CI780: printf("HPT_CI780"); break; case HPT_CI750: printf("HPT_CI750"); break; case HPT_HSC: printf("HPT_HSC"); break; case HPT_CIBCI: printf("HPT_CIBCI"); break; case HPT_KL10: printf("HPT_KL10"); break; case HPT_CIBCA_BA: printf("HPT_CIBCA_BA"); break; case HPT_CIBCA_AA: printf("HPT_CIBCA_AA"); break; case HPT_BVPSSP: printf("HPT_BVPSSP"); break; case HPT_CIXCD: printf("HPT_CIXCD"); break; case HPT_SII: printf("HPT_SII"); break; case HPT_KFQSA: printf("HPT_KFQSA"); break; case HPT_SHAC: printf("HPT_SHAC"); break; case HPT_KFXSA: printf("HPT_KFXSA"); break; case HPT_RF71: printf("HPT_RF71"); break; case HPT_RF30: printf("HPT_RF30"); break; case HPT_RF31: printf("HPT_RF31"); break; case HPT_TF70: printf("HPT_TF70"); break; case HPT_TF85: printf("HPT_TF85"); break; default: printf("UNKNOWN"); } printf("\)\n"); printf("\t\t\tdual_path: %d, reason 0x%x \n",pib_st.type.dual_path, pib_st.reason); printf("\t\t\tnconns: %d, duetime: %d, sanity: %d\n",pib_st.nconns, pib_st.duetime, pib_st.status.sanity); printf("\t\t\tprotocol: %d\n", pib_st.protocol);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -