#include #include #include #include "hddMgr.h" int usage() { printf("HDD phy index to drv index\n"); printf("Usage: drvslot2phy chassis slot phy [exp]\n"); printf("chassis - Ebbets/Joshua/Camden/Alder/Wembley/Trafford\n"); printf("slot - A or B, the SAS slot to HDD\n"); printf("phy -the phy number for looking up, 0-11(EBBETS), 0-23(CAMDEN), 0-59(WEMBLEY)\n"); printf("exp -the exp for looking up, 0-5(WEMBLEY), no use(EBBETS/CAMDEN)\n"); return -1; } int main(int argc, char **argv) { int chassis; int path; int phy; int drv; int exp_no; if(argc<4) { return usage(); } if(0==strcmp(argv[1], "Ebbets")) { chassis=0; if(argc!=4) return usage(); } else if(0==strcmp(argv[1], "Camden")) { chassis=1; if(argc!=4) return usage(); } else if(0==strcmp(argv[1], "Joshua")) { chassis=3; if(argc!=4) return usage(); } else if(0==strcmp(argv[1], "Alder")) { chassis=4; if(argc!=4) return usage(); } else if(0==strcmp(argv[1], "Wembley") || 0==strcmp(argv[1], "Trafford")) { if(argc!=5) return usage(); } else return usage(); if(0==strcmp(argv[2], "A")) { path=0; } else if(0==strcmp(argv[2], "B")) { path=1; } else { return usage(); } phy = strtol(argv[3], NULL, 10); if(0==strcmp(argv[1], "Wembley")) { exp_no = strtol(argv[4], NULL, 10); drv = findWsasDrvByExpAndPhy(path, exp_no, phy); } else if(0==strcmp(argv[1], "Trafford")) { exp_no = strtol(argv[4], NULL, 10); drv = findTsasDrvByExpAndPhy(path, exp_no, phy); } else drv = findSasDrvByPhy( chassis, path, phy ); printf("%d\n", drv); return 0; }