示例#1
0
/********************************************************************************
 * Find a peripheral attahed at (bus),(target)
 */
static struct cam_periph *
mly_find_periph(struct mly_softc *sc, int bus, int target)
{
    struct cam_periph	*periph;
    struct cam_path	*path;
    int			status;

    status = xpt_create_path(&path, NULL, cam_sim_path(sc->mly_cam_sim[bus]), target, 0);
    if (status == CAM_REQ_CMP) {
	periph = cam_periph_find(path, NULL);
	xpt_free_path(path);
    } else {
	periph = NULL;
    }
    return(periph);
}
示例#2
0
int os_query_remove_device(void *osext, int id)
{
	PVBUS_EXT				vbus_ext = (PVBUS_EXT)osext;
	struct cam_periph		*periph = NULL;
    struct cam_path			*path;
    int						status,retval = 0;

    status = xpt_create_path(&path, NULL, vbus_ext->sim->path_id, id, 0);
    if (status == CAM_REQ_CMP) {
		if((periph = cam_periph_find(path, "da")) != NULL){
			if(periph->refcount >= 1)	
				retval = -1;
		}
		xpt_free_path(path);
    }

    return retval;
}