Lines Matching refs:ccb

66 cam_send_ccb(struct cam_device *device, union ccb *ccb)  in cam_send_ccb()  argument
68 return(ioctl(device->fd, CAMIOCOMMAND, ccb)); in cam_send_ccb()
74 union ccb *
77 union ccb *ccb; in cam_getccb() local
79 ccb = calloc(1, sizeof(*ccb)); in cam_getccb()
80 if (ccb != NULL) { in cam_getccb()
81 ccb->ccb_h.path_id = dev->path_id; in cam_getccb()
82 ccb->ccb_h.target_id = dev->target_id; in cam_getccb()
83 ccb->ccb_h.target_lun = dev->target_lun; in cam_getccb()
86 return(ccb); in cam_getccb()
93 cam_freeccb(union ccb *ccb) in cam_freeccb() argument
95 free(ccb); in cam_freeccb()
276 union ccb ccb; in cam_open_btl() local
287 bzero(&ccb, sizeof(union ccb)); in cam_open_btl()
288 ccb.ccb_h.func_code = XPT_DEV_MATCH; in cam_open_btl()
289 ccb.ccb_h.path_id = CAM_XPT_PATH_ID; in cam_open_btl()
290 ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; in cam_open_btl()
291 ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; in cam_open_btl()
295 ccb.cdm.match_buf_len = bufsize; in cam_open_btl()
296 ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize); in cam_open_btl()
297 if (ccb.cdm.matches == NULL) { in cam_open_btl()
303 ccb.cdm.num_matches = 0; in cam_open_btl()
306 ccb.cdm.num_patterns = 1; in cam_open_btl()
307 ccb.cdm.pattern_buf_len = sizeof(struct dev_match_pattern); in cam_open_btl()
308 ccb.cdm.patterns = (struct dev_match_pattern *)malloc( in cam_open_btl()
310 if (ccb.cdm.patterns == NULL) { in cam_open_btl()
313 free(ccb.cdm.matches); in cam_open_btl()
314 ccb.cdm.matches = NULL; in cam_open_btl()
318 ccb.cdm.patterns[0].type = DEV_MATCH_PERIPH; in cam_open_btl()
319 match_pat = &ccb.cdm.patterns[0].pattern.periph_pattern; in cam_open_btl()
333 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_open_btl()
343 if ((ccb.ccb_h.status != CAM_REQ_CMP) in cam_open_btl()
344 || ((ccb.cdm.status != CAM_DEV_MATCH_LAST) in cam_open_btl()
345 && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) { in cam_open_btl()
349 ccb.ccb_h.status, ccb.cdm.status); in cam_open_btl()
353 if (ccb.cdm.status == CAM_DEV_MATCH_MORE) { in cam_open_btl()
361 if (ccb.cdm.num_matches == 0) { in cam_open_btl()
369 switch(ccb.cdm.matches[0].type) { in cam_open_btl()
375 periph_result = &ccb.cdm.matches[0].result.periph_result; in cam_open_btl()
377 free(ccb.cdm.matches); in cam_open_btl()
378 ccb.cdm.matches = NULL; in cam_open_btl()
379 free(ccb.cdm.patterns); in cam_open_btl()
380 ccb.cdm.patterns = NULL; in cam_open_btl()
396 free(ccb.cdm.matches); in cam_open_btl()
397 ccb.cdm.matches = NULL; in cam_open_btl()
398 free(ccb.cdm.patterns); in cam_open_btl()
399 ccb.cdm.patterns = NULL; in cam_open_btl()
422 union ccb ccb; in cam_lookup_pass() local
438 ccb.ccb_h.func_code = XPT_GDEVLIST; in cam_lookup_pass()
441 strlcpy(ccb.cgdl.periph_name, dev_name, sizeof(ccb.cgdl.periph_name)); in cam_lookup_pass()
442 ccb.cgdl.unit_number = unit; in cam_lookup_pass()
449 if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) { in cam_lookup_pass()
481 if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { in cam_lookup_pass()
488 sprintf(dev_path, "/dev/%s%d", ccb.cgdl.periph_name, in cam_lookup_pass()
489 ccb.cgdl.unit_number); in cam_lookup_pass()
504 union ccb ccb; in cam_real_open_device() local
553 bzero(&ccb, sizeof(union ccb)); in cam_real_open_device()
559 ccb.ccb_h.func_code = XPT_GDEVLIST; in cam_real_open_device()
566 if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) { in cam_real_open_device()
584 if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { in cam_real_open_device()
590 device->dev_unit_num = ccb.cgdl.unit_number; in cam_real_open_device()
591 strlcpy(device->device_name, ccb.cgdl.periph_name, in cam_real_open_device()
593 device->path_id = ccb.ccb_h.path_id; in cam_real_open_device()
594 device->target_id = ccb.ccb_h.target_id; in cam_real_open_device()
595 device->target_lun = ccb.ccb_h.target_lun; in cam_real_open_device()
597 ccb.ccb_h.func_code = XPT_PATH_INQ; in cam_real_open_device()
598 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
604 strlcpy(device->sim_name, ccb.cpi.dev_name, sizeof(device->sim_name)); in cam_real_open_device()
605 device->sim_unit_number = ccb.cpi.unit_number; in cam_real_open_device()
606 device->bus_id = ccb.cpi.bus_id; in cam_real_open_device()
612 ccb.ccb_h.func_code = XPT_GDEV_TYPE; in cam_real_open_device()
613 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
619 device->pd_type = SID_TYPE(&ccb.cgd.inq_data); in cam_real_open_device()
620 bcopy(&ccb.cgd.inq_data, &device->inq_data, in cam_real_open_device()
622 device->serial_num_len = ccb.cgd.serial_num_len; in cam_real_open_device()
623 bcopy(&ccb.cgd.serial_num, &device->serial_num, device->serial_num_len); in cam_real_open_device()
628 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb.cts); in cam_real_open_device()
633 ccb.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; in cam_real_open_device()
635 ccb.cts.type = CTS_TYPE_CURRENT_SETTINGS; in cam_real_open_device()
637 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { in cam_real_open_device()
643 if (ccb.cts.transport == XPORT_SPI) { in cam_real_open_device()
645 &ccb.cts.xport_specific.spi; in cam_real_open_device()