static int stmfOfflineTarget001() { int stmfRet; int ret = 0; int retries = 0; stmfDevidList *targetList; stmfTargetProperties targetProps; struct timespec rqtp; bzero(&rqtp, sizeof (rqtp)); rqtp.tv_nsec = 10000000; /* 10 ms sleep */ stmfRet = stmfGetTargetList(&targetList); if (stmfRet != STMF_STATUS_SUCCESS) { ret = 1; goto cleanup; } if (targetList->cnt > 0) { stmfRet = stmfOfflineTarget(&(targetList->devid[0])); if (stmfRet != STMF_STATUS_SUCCESS) { ret = 2; goto cleanup; } } else { ret = 3; goto cleanup; } targetProps.status = STMF_TARGET_PORT_ONLINE; while (targetProps.status != STMF_TARGET_PORT_OFFLINE && retries++ < 600) { stmfRet = stmfGetTargetProperties(&(targetList->devid[0]), &targetProps); if (stmfRet != STMF_STATUS_SUCCESS) { ret = 4; goto cleanup1; } if (targetProps.status != STMF_TARGET_PORT_OFFLINE) { (void) nanosleep(&rqtp, NULL); } } if (targetProps.status != STMF_TARGET_PORT_OFFLINE) { ret = 5; goto cleanup1; } cleanup1: (void) stmfOnlineTarget(&(targetList->devid[0])); cleanup: return (ret); }
static int stmfOnlineTarget002() { int stmfRet; int ret = 0; stmfRet = stmfOnlineTarget(NULL); if (stmfRet != STMF_ERROR_INVALID_ARG) { ret = 2; } return (ret); }