Lines Matching refs:ccb

69 cam_send_ccb(struct cam_device *device, union ccb *ccb)  in cam_send_ccb()  argument
71 return(ioctl(device->fd, CAMIOCOMMAND, ccb)); in cam_send_ccb()
77 union ccb *
80 union ccb *ccb; in cam_getccb() local
82 ccb = calloc(1, sizeof(*ccb)); in cam_getccb()
83 if (ccb != NULL) { in cam_getccb()
84 ccb->ccb_h.path_id = dev->path_id; in cam_getccb()
85 ccb->ccb_h.target_id = dev->target_id; in cam_getccb()
86 ccb->ccb_h.target_lun = dev->target_lun; in cam_getccb()
89 return(ccb); in cam_getccb()
96 cam_freeccb(union ccb *ccb) in cam_freeccb() argument
98 free(ccb); in cam_freeccb()
279 union ccb ccb; in cam_open_btl() local
290 bzero(&ccb, sizeof(union ccb)); in cam_open_btl()
291 ccb.ccb_h.func_code = XPT_DEV_MATCH; in cam_open_btl()
292 ccb.ccb_h.path_id = CAM_XPT_PATH_ID; in cam_open_btl()
293 ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; in cam_open_btl()
294 ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; in cam_open_btl()
298 ccb.cdm.match_buf_len = bufsize; in cam_open_btl()
299 ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize); in cam_open_btl()
300 if (ccb.cdm.matches == NULL) { in cam_open_btl()
306 ccb.cdm.num_matches = 0; in cam_open_btl()
309 ccb.cdm.num_patterns = 1; in cam_open_btl()
310 ccb.cdm.pattern_buf_len = sizeof(struct dev_match_pattern); in cam_open_btl()
311 ccb.cdm.patterns = (struct dev_match_pattern *)malloc( in cam_open_btl()
313 if (ccb.cdm.patterns == NULL) { in cam_open_btl()
316 free(ccb.cdm.matches); in cam_open_btl()
317 ccb.cdm.matches = NULL; in cam_open_btl()
321 ccb.cdm.patterns[0].type = DEV_MATCH_PERIPH; in cam_open_btl()
322 match_pat = &ccb.cdm.patterns[0].pattern.periph_pattern; in cam_open_btl()
336 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_open_btl()
346 if ((ccb.ccb_h.status != CAM_REQ_CMP) in cam_open_btl()
347 || ((ccb.cdm.status != CAM_DEV_MATCH_LAST) in cam_open_btl()
348 && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) { in cam_open_btl()
352 ccb.ccb_h.status, ccb.cdm.status); in cam_open_btl()
356 if (ccb.cdm.status == CAM_DEV_MATCH_MORE) { in cam_open_btl()
364 if (ccb.cdm.num_matches == 0) { in cam_open_btl()
372 switch(ccb.cdm.matches[0].type) { in cam_open_btl()
378 periph_result = &ccb.cdm.matches[0].result.periph_result; in cam_open_btl()
380 free(ccb.cdm.matches); in cam_open_btl()
381 ccb.cdm.matches = NULL; in cam_open_btl()
382 free(ccb.cdm.patterns); in cam_open_btl()
383 ccb.cdm.patterns = NULL; in cam_open_btl()
399 free(ccb.cdm.matches); in cam_open_btl()
400 ccb.cdm.matches = NULL; in cam_open_btl()
401 free(ccb.cdm.patterns); in cam_open_btl()
402 ccb.cdm.patterns = NULL; in cam_open_btl()
425 union ccb ccb; in cam_lookup_pass() local
441 ccb.ccb_h.func_code = XPT_GDEVLIST; in cam_lookup_pass()
444 strlcpy(ccb.cgdl.periph_name, dev_name, sizeof(ccb.cgdl.periph_name)); in cam_lookup_pass()
445 ccb.cgdl.unit_number = unit; in cam_lookup_pass()
452 if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) { in cam_lookup_pass()
484 if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { in cam_lookup_pass()
491 sprintf(dev_path, "/dev/%s%d", ccb.cgdl.periph_name, in cam_lookup_pass()
492 ccb.cgdl.unit_number); in cam_lookup_pass()
507 union ccb ccb; in cam_real_open_device() local
556 bzero(&ccb, sizeof(union ccb)); in cam_real_open_device()
562 ccb.ccb_h.func_code = XPT_GDEVLIST; in cam_real_open_device()
569 if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) { in cam_real_open_device()
587 if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { in cam_real_open_device()
593 device->dev_unit_num = ccb.cgdl.unit_number; in cam_real_open_device()
594 strlcpy(device->device_name, ccb.cgdl.periph_name, in cam_real_open_device()
596 device->path_id = ccb.ccb_h.path_id; in cam_real_open_device()
597 device->target_id = ccb.ccb_h.target_id; in cam_real_open_device()
598 device->target_lun = ccb.ccb_h.target_lun; in cam_real_open_device()
600 ccb.ccb_h.func_code = XPT_PATH_INQ; in cam_real_open_device()
601 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
607 strlcpy(device->sim_name, ccb.cpi.dev_name, sizeof(device->sim_name)); in cam_real_open_device()
608 device->sim_unit_number = ccb.cpi.unit_number; in cam_real_open_device()
609 device->bus_id = ccb.cpi.bus_id; in cam_real_open_device()
615 ccb.ccb_h.func_code = XPT_GDEV_TYPE; in cam_real_open_device()
616 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
622 device->pd_type = SID_TYPE(&ccb.cgd.inq_data); in cam_real_open_device()
623 bcopy(&ccb.cgd.inq_data, &device->inq_data, in cam_real_open_device()
625 device->serial_num_len = ccb.cgd.serial_num_len; in cam_real_open_device()
626 bcopy(&ccb.cgd.serial_num, &device->serial_num, device->serial_num_len); in cam_real_open_device()
631 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb.cts); in cam_real_open_device()
636 ccb.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; in cam_real_open_device()
638 ccb.cts.type = CTS_TYPE_CURRENT_SETTINGS; in cam_real_open_device()
640 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
646 if (ccb.cts.transport == XPORT_SPI) { in cam_real_open_device()
648 &ccb.cts.xport_specific.spi; in cam_real_open_device()