Start to break out routines into a device-callable routine as well

as a publically callable routine. The device-callable routine will
be able to change the passthrough routine as M$ has two distinct
routines for aspi and ioctl.
This commit is contained in:
rocky
2004-07-26 03:39:55 +00:00
parent 20e8974df8
commit 1b15e56374
3 changed files with 23 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32.c,v 1.30 2004/07/25 23:32:15 rocky Exp $ $Id: win32.c,v 1.31 2004/07/26 03:39:55 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: win32.c,v 1.30 2004/07/25 23:32:15 rocky Exp $"; static const char _rcsid[] = "$Id: win32.c,v 1.31 2004/07/26 03:39:55 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -828,7 +828,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
} }
} }
ret = cdio_new (_data, &_funcs); ret = cdio_new ((void *)_data, &_funcs);
if (ret == NULL) return NULL; if (ret == NULL) return NULL;
if (_cdio_init_win32(_data)) if (_cdio_init_win32(_data))

View File

@@ -1,6 +1,6 @@
/* Common SCSI Multimedia Command (MMC) routines. /* Common SCSI Multimedia Command (MMC) routines.
$Id: scsi_mmc.c,v 1.8 2004/07/26 02:54:37 rocky Exp $ $Id: scsi_mmc.c,v 1.9 2004/07/26 03:39:55 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -179,8 +179,10 @@ scsi_mmc_read_sectors ( const CdIo *cdio, void *p_buf, lba_t lba,
p_buf); p_buf);
} }
int int
scsi_mmc_set_bsize ( const CdIo *cdio, unsigned int bsize) set_bsize_mmc ( const void *p_env,
const scsi_mmc_run_cmd_fn_t *run_scsi_mmc_cmd,
unsigned int bsize)
{ {
scsi_mmc_cdb_t cdb = {{0, }}; scsi_mmc_cdb_t cdb = {{0, }};
@@ -200,13 +202,9 @@ scsi_mmc_set_bsize ( const CdIo *cdio, unsigned int bsize)
uint8_t block_length_lo; uint8_t block_length_lo;
} mh; } mh;
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd; if ( ! p_env || ! run_scsi_mmc_cmd )
if ( ! cdio || ! cdio->op.run_scsi_mmc_cmd )
return -2; return -2;
run_scsi_mmc_cmd = cdio->op.run_scsi_mmc_cmd;
memset (&mh, 0, sizeof (mh)); memset (&mh, 0, sizeof (mh));
mh.block_desc_length = 0x08; mh.block_desc_length = 0x08;
mh.block_length_hi = (bsize >> 16) & 0xff; mh.block_length_hi = (bsize >> 16) & 0xff;
@@ -218,7 +216,14 @@ scsi_mmc_set_bsize ( const CdIo *cdio, unsigned int bsize)
cdb.field[1] = 1 << 4; cdb.field[1] = 1 << 4;
cdb.field[4] = 12; cdb.field[4] = 12;
return run_scsi_mmc_cmd (cdio->env, DEFAULT_TIMEOUT_MS, return (*run_scsi_mmc_cmd) (p_env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb, scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, sizeof(mh), &mh); SCSI_MMC_DATA_WRITE, sizeof(mh), &mh);
}
int
scsi_mmc_set_bsize ( const CdIo *cdio, unsigned int bsize)
{
if ( ! cdio ) return -2;
return set_bsize_mmc (cdio->env, (&cdio->op.run_scsi_mmc_cmd), bsize);
} }

View File

@@ -1,6 +1,6 @@
/* private MMC helper routines. /* private MMC helper routines.
$Id: scsi_mmc_private.h,v 1.1 2004/07/26 02:54:37 rocky Exp $ $Id: scsi_mmc_private.h,v 1.2 2004/07/26 03:39:55 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -28,3 +28,6 @@ int (*scsi_mmc_run_cmd_fn_t) ( const void *p_user_data, int i_timeout,
scsi_mmc_direction_t e_direction, scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf ); unsigned int i_buf, /*in/out*/ void *p_buf );
int set_bsize_mmc ( const void *p_env,
const scsi_mmc_run_cmd_fn_t *run_scsi_mmc_cmd,
unsigned int bsize);