FreeBSD and gcc < 3.0 fixes
Some variable name changes to match style.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: freebsd_cam.c,v 1.30 2004/08/01 11:51:20 rocky Exp $
|
||||
$Id: freebsd_cam.c,v 1.31 2004/08/07 09:42:34 rocky Exp $
|
||||
|
||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.30 2004/08/01 11:51:20 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.31 2004/08/07 09:42:34 rocky Exp $";
|
||||
|
||||
#ifdef HAVE_FREEBSD_CDROM
|
||||
|
||||
@@ -60,6 +60,7 @@ run_scsi_cmd_freebsd_cam( const void *p_user_data, unsigned int i_timeout_ms,
|
||||
{
|
||||
const _img_private_t *p_env = p_user_data;
|
||||
int i_status;
|
||||
int direction = CAM_DEV_QFRZDIS;
|
||||
union ccb ccb;
|
||||
|
||||
if (!p_env || !p_env->cam) return -2;
|
||||
@@ -71,18 +72,16 @@ run_scsi_cmd_freebsd_cam( const void *p_user_data, unsigned int i_timeout_ms,
|
||||
ccb.ccb_h.target_lun = p_env->cam->target_lun;
|
||||
ccb.ccb_h.timeout = i_timeout_ms;
|
||||
|
||||
if (!i_cdb)
|
||||
direction |= CAM_DIR_NONE;
|
||||
else
|
||||
direction |= (e_direction == SCSI_MMC_DATA_READ)?CAM_DIR_IN : CAM_DIR_OUT;
|
||||
cam_fill_csio (&(ccb.csio), 1, NULL,
|
||||
CAM_DEV_QFRZDIS, MSG_SIMPLE_Q_TAG, NULL, 0,
|
||||
direction | CAM_DEV_QFRZDIS, MSG_SIMPLE_Q_TAG, p_buf, i_buf,
|
||||
sizeof(ccb.csio.sense_data), 0, 30*1000);
|
||||
|
||||
memcpy(ccb.csio.cdb_io.cdb_bytes, p_cdb, i_cdb);
|
||||
|
||||
ccb.csio.ccb_h.flags = (SCSI_MMC_DATA_READ == e_direction)
|
||||
? CAM_DIR_OUT : CAM_DIR_IN;
|
||||
|
||||
ccb.csio.data_ptr = p_buf;
|
||||
ccb.csio.dxfer_len = i_buf;
|
||||
|
||||
ccb.csio.cdb_len =
|
||||
scsi_mmc_get_cmd_len(ccb.csio.cdb_io.cdb_bytes[0]);
|
||||
|
||||
@@ -156,75 +155,6 @@ free_freebsd_cam (void *user_data)
|
||||
free (p_env);
|
||||
}
|
||||
|
||||
/****
|
||||
The below are really rough guesses. They are here in the hope
|
||||
they can be used as a starting point for someone who knows what
|
||||
they are doing.
|
||||
*******/
|
||||
#if 1
|
||||
/*!
|
||||
Return the the kind of drive capabilities of device.
|
||||
|
||||
*/
|
||||
void
|
||||
get_drive_cap_freebsd_cam (const _img_private_t *p_env,
|
||||
cdio_drive_read_cap_t *p_read_cap,
|
||||
cdio_drive_write_cap_t *p_write_cap,
|
||||
cdio_drive_misc_cap_t *p_misc_cap)
|
||||
{
|
||||
scsi_mmc_cdb_t cdb = {{0, }};
|
||||
uint8_t buf[256] = { 0, };
|
||||
int i_status;
|
||||
|
||||
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_MODE_SENSE_10);
|
||||
cdb.field[1] = 0x0;
|
||||
cdb.field[2] = CDIO_MMC_ALL_PAGES;
|
||||
cdb.field[7] = 0x01;
|
||||
cdb.field[8] = 0x00;
|
||||
|
||||
i_status = run_scsi_cmd_freebsd_cam(p_env, DEFAULT_TIMEOUT_MSECS,
|
||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||
&cdb, SCSI_MMC_DATA_READ,
|
||||
sizeof(buf), buf);
|
||||
if (0 == i_status) {
|
||||
uint8_t *p;
|
||||
int lenData = ((unsigned int)buf[0] << 8) + buf[1];
|
||||
uint8_t *pMax = buf + 256;
|
||||
|
||||
*p_read_cap = 0;
|
||||
*p_write_cap = 0;
|
||||
*p_misc_cap = 0;
|
||||
|
||||
/* set to first sense mask, and then walk through the masks */
|
||||
p = buf + 8;
|
||||
while( (p < &(buf[2+lenData])) && (p < pMax) ) {
|
||||
uint8_t which;
|
||||
|
||||
which = p[0] & 0x3F;
|
||||
switch( which )
|
||||
{
|
||||
case CDIO_MMC_AUDIO_CTL_PAGE:
|
||||
case CDIO_MMC_R_W_ERROR_PAGE:
|
||||
case CDIO_MMC_CDR_PARMS_PAGE:
|
||||
/* Don't handle these yet. */
|
||||
break;
|
||||
case CDIO_MMC_CAPABILITIES_PAGE:
|
||||
scsi_mmc_get_drive_cap(p, p_read_cap, p_write_cap, p_misc_cap);
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
p += (p[1] + 2);
|
||||
}
|
||||
} else {
|
||||
cdio_info("error in aspi USCSICMD MODE_SELECT");
|
||||
*p_read_cap = CDIO_DRIVE_CAP_UNKNOWN;
|
||||
*p_write_cap = CDIO_DRIVE_CAP_UNKNOWN;
|
||||
*p_misc_cap = CDIO_DRIVE_CAP_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
_set_bsize (_img_private_t *p_env, unsigned int bsize)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user