More common routiens and structures moved to cdio_generic.c or
cdio_private.h respectively.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_linux.c,v 1.3 2003/03/29 17:32:00 rocky Exp $
|
||||
$Id: _cdio_linux.c,v 1.4 2003/03/30 13:01:22 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.3 2003/03/29 17:32:00 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.4 2003/03/30 13:01:22 rocky Exp $";
|
||||
|
||||
#include "cdio_assert.h"
|
||||
#include "cdio_private.h"
|
||||
@@ -76,39 +76,12 @@ typedef struct {
|
||||
_AM_READ_10
|
||||
} access_mode;
|
||||
|
||||
int ioctls_debugged; /* for debugging */
|
||||
|
||||
/* Track information */
|
||||
bool toc_init; /* if true, info below is valid. */
|
||||
struct cdrom_tochdr tochdr;
|
||||
struct cdrom_tocentry tocent[100]; /* entry info for each track */
|
||||
|
||||
} _img_private_t;
|
||||
|
||||
/*!
|
||||
Initialize CD device.
|
||||
*/
|
||||
static bool
|
||||
_cdio_init (_img_private_t *_obj)
|
||||
{
|
||||
if (_obj->gen.init) {
|
||||
cdio_error ("init called more than once");
|
||||
return false;
|
||||
}
|
||||
|
||||
_obj->gen.fd = open (_obj->gen.source_name, O_RDONLY, 0);
|
||||
|
||||
if (_obj->gen.fd < 0)
|
||||
{
|
||||
cdio_error ("open (%s): %s", _obj->gen.source_name, strerror (errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
_obj->gen.init = true;
|
||||
_obj->toc_init = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
_set_bsize (int fd, unsigned int bsize)
|
||||
{
|
||||
@@ -249,20 +222,20 @@ _cdio_read_mode2_sector (void *user_data, void *data, lsn_t lsn,
|
||||
msf->cdmsf_sec0 = from_bcd8(_msf.s);
|
||||
msf->cdmsf_frame0 = from_bcd8(_msf.f);
|
||||
|
||||
if (_obj->ioctls_debugged == 75)
|
||||
if (_obj->gen.ioctls_debugged == 75)
|
||||
cdio_debug ("only displaying every 75th ioctl from now on");
|
||||
|
||||
if (_obj->ioctls_debugged == 30 * 75)
|
||||
if (_obj->gen.ioctls_debugged == 30 * 75)
|
||||
cdio_debug ("only displaying every 30*75th ioctl from now on");
|
||||
|
||||
if (_obj->ioctls_debugged < 75
|
||||
|| (_obj->ioctls_debugged < (30 * 75)
|
||||
&& _obj->ioctls_debugged % 75 == 0)
|
||||
|| _obj->ioctls_debugged % (30 * 75) == 0)
|
||||
if (_obj->gen.ioctls_debugged < 75
|
||||
|| (_obj->gen.ioctls_debugged < (30 * 75)
|
||||
&& _obj->gen.ioctls_debugged % 75 == 0)
|
||||
|| _obj->gen.ioctls_debugged % (30 * 75) == 0)
|
||||
cdio_debug ("reading %2.2d:%2.2d:%2.2d",
|
||||
msf->cdmsf_min0, msf->cdmsf_sec0, msf->cdmsf_frame0);
|
||||
|
||||
_obj->ioctls_debugged++;
|
||||
_obj->gen.ioctls_debugged++;
|
||||
|
||||
retry:
|
||||
switch (_obj->access_mode)
|
||||
@@ -539,7 +512,7 @@ _cdio_get_first_track_num(void *user_data)
|
||||
{
|
||||
_img_private_t *_obj = user_data;
|
||||
|
||||
if (!_obj->toc_init) _cdio_read_toc (_obj) ;
|
||||
if (!_obj->gen.toc_init) _cdio_read_toc (_obj) ;
|
||||
|
||||
return FIRST_TRACK_NUM;
|
||||
}
|
||||
@@ -553,7 +526,7 @@ _cdio_get_num_tracks(void *user_data)
|
||||
{
|
||||
_img_private_t *_obj = user_data;
|
||||
|
||||
if (!_obj->toc_init) _cdio_read_toc (_obj) ;
|
||||
if (!_obj->gen.toc_init) _cdio_read_toc (_obj) ;
|
||||
|
||||
return TOTAL_TRACKS;
|
||||
}
|
||||
@@ -566,7 +539,7 @@ _cdio_get_track_format(void *user_data, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = user_data;
|
||||
|
||||
if (!_obj->toc_init) _cdio_read_toc (_obj) ;
|
||||
if (!_obj->gen.toc_init) _cdio_read_toc (_obj) ;
|
||||
|
||||
if (track_num > TOTAL_TRACKS || track_num == 0)
|
||||
return TRACK_FORMAT_ERROR;
|
||||
@@ -599,7 +572,7 @@ _cdio_get_track_green(void *user_data, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = user_data;
|
||||
|
||||
if (!_obj->toc_init) _cdio_read_toc (_obj) ;
|
||||
if (!_obj->gen.toc_init) _cdio_read_toc (_obj) ;
|
||||
|
||||
if (track_num == CDIO_LEADOUT_TRACK) track_num = TOTAL_TRACKS+1;
|
||||
|
||||
@@ -626,7 +599,7 @@ _cdio_get_track_msf(void *user_data, track_t track_num, msf_t *msf)
|
||||
|
||||
if (NULL == msf) return false;
|
||||
|
||||
if (!_obj->toc_init) _cdio_read_toc (_obj) ;
|
||||
if (!_obj->gen.toc_init) _cdio_read_toc (_obj) ;
|
||||
|
||||
if (track_num == CDIO_LEADOUT_TRACK) track_num = TOTAL_TRACKS+1;
|
||||
|
||||
@@ -686,7 +659,7 @@ cdio_open_linux (const char *source_name)
|
||||
ret = cdio_new (_data, &_funcs);
|
||||
if (ret == NULL) return NULL;
|
||||
|
||||
if (_cdio_init(_data))
|
||||
if (cdio_generic_init(_data))
|
||||
return ret;
|
||||
else {
|
||||
cdio_generic_free (_data);
|
||||
|
||||
Reference in New Issue
Block a user