Lines Matching refs:ccb
67 cam_send_ccb(struct cam_device *device, union ccb *ccb) in cam_send_ccb() argument
69 return(ioctl(device->fd, CAMIOCOMMAND, ccb)); in cam_send_ccb()
75 union ccb *
78 union ccb *ccb; in cam_getccb() local
80 ccb = calloc(1, sizeof(*ccb)); in cam_getccb()
81 if (ccb != NULL) { in cam_getccb()
82 ccb->ccb_h.path_id = dev->path_id; in cam_getccb()
83 ccb->ccb_h.target_id = dev->target_id; in cam_getccb()
84 ccb->ccb_h.target_lun = dev->target_lun; in cam_getccb()
87 return(ccb); in cam_getccb()
94 cam_freeccb(union ccb *ccb) in cam_freeccb() argument
96 free(ccb); in cam_freeccb()
277 union ccb ccb; in cam_open_btl() local
288 bzero(&ccb, sizeof(union ccb)); in cam_open_btl()
289 ccb.ccb_h.func_code = XPT_DEV_MATCH; in cam_open_btl()
290 ccb.ccb_h.path_id = CAM_XPT_PATH_ID; in cam_open_btl()
291 ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; in cam_open_btl()
292 ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; in cam_open_btl()
296 ccb.cdm.match_buf_len = bufsize; in cam_open_btl()
297 ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize); in cam_open_btl()
298 if (ccb.cdm.matches == NULL) { in cam_open_btl()
304 ccb.cdm.num_matches = 0; in cam_open_btl()
307 ccb.cdm.num_patterns = 1; in cam_open_btl()
308 ccb.cdm.pattern_buf_len = sizeof(struct dev_match_pattern); in cam_open_btl()
309 ccb.cdm.patterns = (struct dev_match_pattern *)malloc( in cam_open_btl()
311 if (ccb.cdm.patterns == NULL) { in cam_open_btl()
314 free(ccb.cdm.matches); in cam_open_btl()
315 ccb.cdm.matches = NULL; in cam_open_btl()
319 ccb.cdm.patterns[0].type = DEV_MATCH_PERIPH; in cam_open_btl()
320 match_pat = &ccb.cdm.patterns[0].pattern.periph_pattern; in cam_open_btl()
334 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_open_btl()
344 if ((ccb.ccb_h.status != CAM_REQ_CMP) in cam_open_btl()
345 || ((ccb.cdm.status != CAM_DEV_MATCH_LAST) in cam_open_btl()
346 && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) { in cam_open_btl()
350 ccb.ccb_h.status, ccb.cdm.status); in cam_open_btl()
354 if (ccb.cdm.status == CAM_DEV_MATCH_MORE) { in cam_open_btl()
362 if (ccb.cdm.num_matches == 0) { in cam_open_btl()
370 switch(ccb.cdm.matches[0].type) { in cam_open_btl()
376 periph_result = &ccb.cdm.matches[0].result.periph_result; in cam_open_btl()
378 free(ccb.cdm.matches); in cam_open_btl()
379 ccb.cdm.matches = NULL; in cam_open_btl()
380 free(ccb.cdm.patterns); in cam_open_btl()
381 ccb.cdm.patterns = NULL; in cam_open_btl()
397 free(ccb.cdm.matches); in cam_open_btl()
398 ccb.cdm.matches = NULL; in cam_open_btl()
399 free(ccb.cdm.patterns); in cam_open_btl()
400 ccb.cdm.patterns = NULL; in cam_open_btl()
423 union ccb ccb; in cam_lookup_pass() local
439 ccb.ccb_h.func_code = XPT_GDEVLIST; in cam_lookup_pass()
442 strlcpy(ccb.cgdl.periph_name, dev_name, sizeof(ccb.cgdl.periph_name)); in cam_lookup_pass()
443 ccb.cgdl.unit_number = unit; in cam_lookup_pass()
450 if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) { in cam_lookup_pass()
482 if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { in cam_lookup_pass()
489 sprintf(dev_path, "/dev/%s%d", ccb.cgdl.periph_name, in cam_lookup_pass()
490 ccb.cgdl.unit_number); in cam_lookup_pass()
505 union ccb ccb; in cam_real_open_device() local
554 bzero(&ccb, sizeof(union ccb)); in cam_real_open_device()
560 ccb.ccb_h.func_code = XPT_GDEVLIST; in cam_real_open_device()
567 if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) { in cam_real_open_device()
585 if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { in cam_real_open_device()
591 device->dev_unit_num = ccb.cgdl.unit_number; in cam_real_open_device()
592 strlcpy(device->device_name, ccb.cgdl.periph_name, in cam_real_open_device()
594 device->path_id = ccb.ccb_h.path_id; in cam_real_open_device()
595 device->target_id = ccb.ccb_h.target_id; in cam_real_open_device()
596 device->target_lun = ccb.ccb_h.target_lun; in cam_real_open_device()
598 ccb.ccb_h.func_code = XPT_PATH_INQ; in cam_real_open_device()
599 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
605 strlcpy(device->sim_name, ccb.cpi.dev_name, sizeof(device->sim_name)); in cam_real_open_device()
606 device->sim_unit_number = ccb.cpi.unit_number; in cam_real_open_device()
607 device->bus_id = ccb.cpi.bus_id; in cam_real_open_device()
613 ccb.ccb_h.func_code = XPT_GDEV_TYPE; in cam_real_open_device()
614 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
620 device->pd_type = SID_TYPE(&ccb.cgd.inq_data); in cam_real_open_device()
621 bcopy(&ccb.cgd.inq_data, &device->inq_data, in cam_real_open_device()
623 device->serial_num_len = ccb.cgd.serial_num_len; in cam_real_open_device()
624 bcopy(&ccb.cgd.serial_num, &device->serial_num, device->serial_num_len); in cam_real_open_device()
629 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb.cts); in cam_real_open_device()
634 ccb.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; in cam_real_open_device()
636 ccb.cts.type = CTS_TYPE_CURRENT_SETTINGS; in cam_real_open_device()
638 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
644 if (ccb.cts.transport == XPORT_SPI) { in cam_real_open_device()
646 &ccb.cts.xport_specific.spi; in cam_real_open_device()