Use solaris ioctl for blocksize set/get. Prototype corrections.

This commit is contained in:
rocky
2005-02-10 11:23:08 +00:00
parent 5316ed6880
commit e491ba74d6
3 changed files with 66 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: mmc.h,v 1.6 2005/02/10 01:59:06 rocky Exp $ $Id: mmc.h,v 1.7 2005/02/10 11:23:08 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -388,8 +388,8 @@ const char *mmc_feature_profile2str( int i_feature_profile );
uint8_t mmc_get_cmd_len(uint8_t scsi_cmd); uint8_t mmc_get_cmd_len(uint8_t scsi_cmd);
/*! /*!
Set the block size for subsequest read requests, via an MMC Get the block size used in read requests, via MMC.
MODE_SENSE 6 command. @return the blocksize if > 0; error if <= 0
*/ */
int mmc_get_blocksize ( CdIo_t *p_cdio ); int mmc_get_blocksize ( CdIo_t *p_cdio );
@@ -517,10 +517,10 @@ int mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
scsi_mmc_direction_t e_direction, unsigned int i_buf, scsi_mmc_direction_t e_direction, unsigned int i_buf,
/*in/out*/ void *p_buf ); /*in/out*/ void *p_buf );
/*! /*!
Set the block size for subsequest read requests, via an MMC Set the block size for subsequest read requests, via MMC.
MODE_SELECT 6 command.
*/ */
int mmc_set_blocksize ( const CdIo_t *p_cdio, unsigned int i_bsize); driver_return_code_t mmc_set_blocksize ( const CdIo_t *p_cdio,
unsigned int i_bsize);
/*! /*!
Set the drive speed. Set the drive speed.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_sunos.c,v 1.21 2005/02/07 03:36:02 rocky Exp $ $Id: _cdio_sunos.c,v 1.22 2005/02/10 11:23:08 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM #ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.21 2005/02/07 03:36:02 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.22 2005/02/10 11:23:08 rocky Exp $";
#ifdef HAVE_GLOB_H #ifdef HAVE_GLOB_H
#include <glob.h> #include <glob.h>
@@ -496,6 +496,26 @@ get_arg_solaris (void *p_user_data, const char key[])
return NULL; return NULL;
} }
/*!
Get the block size used in read requests, via ioctl.
@return the blocksize if > 0; error if <= 0
*/
static int
get_blocksize_solaris (void *p_user_data) {
_img_private_t *p_env = p_user_data;
int ret;
int i_blocksize;
if ( !p_env || p_env->gen.fd <=0 ) return DRIVER_OP_UNINIT;
if ((ret = ioctl(p_env->gen.fd, CDROMGBLKMODE, &i_blocksize)) != 0) {
cdio_warn ("CDROMGBLKMODE failed: %s\n", strerror(errno));
return DRIVER_OP_ERROR;
} else {
return i_blocksize;
}
}
/*! /*!
Return a string containing the default CD device if none is specified. Return a string containing the default CD device if none is specified.
*/ */
@@ -692,7 +712,7 @@ get_track_format_solaris(void *p_user_data, track_t i_track)
FIXME: there's gotta be a better design for this and get_track_format? FIXME: there's gotta be a better design for this and get_track_format?
*/ */
static bool static bool
_cdio_get_track_green(void *p_user_data, track_t i_track) get_track_green_solaris(void *p_user_data, track_t i_track)
{ {
_img_private_t *p_env = p_user_data; _img_private_t *p_env = p_user_data;
@@ -722,7 +742,7 @@ _cdio_get_track_green(void *p_user_data, track_t i_track)
False is returned if there is no entry. False is returned if there is no entry.
*/ */
static bool static bool
_cdio_get_track_msf(void *p_user_data, track_t i_track, msf_t *msf) get_track_msf_solaris(void *p_user_data, track_t i_track, msf_t *msf)
{ {
_img_private_t *p_env = p_user_data; _img_private_t *p_env = p_user_data;
@@ -746,6 +766,26 @@ _cdio_get_track_msf(void *p_user_data, track_t i_track, msf_t *msf)
} }
} }
/*!
Get the block size used in read requests, via ioctl.
@return the blocksize if > 0; error if <= 0
*/
static driver_return_code_t
set_blocksize_solaris (void *p_user_data) {
_img_private_t *p_env = p_user_data;
int ret;
int i_blocksize;
if ( !p_env || p_env->gen.fd <=0 ) return DRIVER_OP_UNINIT;
if ((ret = ioctl(p_env->gen.fd, CDROMSBLKMODE, i_blocksize)) != 0) {
cdio_warn ("CDROMSBLKMODE failed: %s\n", strerror(errno));
return DRIVER_OP_ERROR;
} else {
return DRIVER_OP_SUCCESS;
}
}
/* Set CD-ROM drive speed */ /* Set CD-ROM drive speed */
static driver_return_code_t static driver_return_code_t
set_speed_solaris (void *p_user_data, int i_speed) set_speed_solaris (void *p_user_data, int i_speed)
@@ -846,7 +886,11 @@ cdio_open_am_solaris (const char *psz_orig_source, const char *access_mode)
_funcs.eject_media = eject_media_solaris; _funcs.eject_media = eject_media_solaris;
_funcs.free = cdio_generic_free; _funcs.free = cdio_generic_free;
_funcs.get_arg = get_arg_solaris; _funcs.get_arg = get_arg_solaris;
#if USE_MMC
_funcs.get_blocksize = get_blocksize_mmc, _funcs.get_blocksize = get_blocksize_mmc,
#else
_funcs.get_blocksize = get_blocksize_solaris,
#endif
_funcs.get_cdtext = get_cdtext_generic; _funcs.get_cdtext = get_cdtext_generic;
_funcs.get_default_device = cdio_get_default_device_solaris; _funcs.get_default_device = cdio_get_default_device_solaris;
_funcs.get_devices = cdio_get_devices_solaris; _funcs.get_devices = cdio_get_devices_solaris;
@@ -861,10 +905,10 @@ cdio_open_am_solaris (const char *psz_orig_source, const char *access_mode)
_funcs.get_track_channels = get_track_channels_generic, _funcs.get_track_channels = get_track_channels_generic,
_funcs.get_track_copy_permit = get_track_copy_permit_generic, _funcs.get_track_copy_permit = get_track_copy_permit_generic,
_funcs.get_track_format = get_track_format_solaris; _funcs.get_track_format = get_track_format_solaris;
_funcs.get_track_green = _cdio_get_track_green; _funcs.get_track_green = get_track_green_solaris;
_funcs.get_track_lba = NULL; /* This could be done if need be. */ _funcs.get_track_lba = NULL; /* This could be done if need be. */
_funcs.get_track_preemphasis = get_track_preemphasis_generic, _funcs.get_track_preemphasis = get_track_preemphasis_generic,
_funcs.get_track_msf = _cdio_get_track_msf; _funcs.get_track_msf = get_track_msf_solaris;
_funcs.lseek = cdio_generic_lseek; _funcs.lseek = cdio_generic_lseek;
_funcs.read = cdio_generic_read; _funcs.read = cdio_generic_read;
_funcs.read_audio_sectors = _read_audio_sectors_solaris; _funcs.read_audio_sectors = _read_audio_sectors_solaris;
@@ -875,7 +919,11 @@ cdio_open_am_solaris (const char *psz_orig_source, const char *access_mode)
_funcs.read_toc = read_toc_solaris; _funcs.read_toc = read_toc_solaris;
_funcs.run_mmc_cmd = run_mmc_cmd_solaris; _funcs.run_mmc_cmd = run_mmc_cmd_solaris;
_funcs.set_arg = _set_arg_solaris; _funcs.set_arg = _set_arg_solaris;
#if USE_MMC
_funcs.set_blocksize = set_blocksize_mmc; _funcs.set_blocksize = set_blocksize_mmc;
#else
_funcs.set_blocksize = set_blocksize_solaris;
#endif
_funcs.set_speed = set_speed_solaris; _funcs.set_speed = set_speed_solaris;
_data = calloc(1, sizeof (_img_private_t)); _data = calloc(1, sizeof (_img_private_t));

View File

@@ -1,6 +1,6 @@
/* Common Multimedia Command (MMC) routines. /* Common Multimedia Command (MMC) routines.
$Id: mmc.c,v 1.8 2005/02/10 03:23:10 rocky Exp $ $Id: mmc.c,v 1.9 2005/02/10 11:23:08 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -54,8 +54,11 @@
corresponding publically-accessible routine. corresponding publically-accessible routine.
*************************************************************************/ *************************************************************************/
/* Set read blocksize (via MMC) */ /*!
driver_return_code_t Get the block size for subsequest read requests, via MMC.
@return the blocksize if > 0; error if <= 0
*/
int
get_blocksize_mmc (void *p_user_data) get_blocksize_mmc (void *p_user_data)
{ {
generic_img_private_t *p_env = p_user_data; generic_img_private_t *p_env = p_user_data;