From 7e18d89c8a2b44289d1864e7b818c12d634f5c36 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 17 Jul 2004 15:31:00 +0000 Subject: [PATCH] Add common defines for some subchannel commands, and use them. --- include/cdio/sector.h | 10 +++++++++- lib/FreeBSD/freebsd_cam.c | 6 +++--- lib/FreeBSD/freebsd_ioctl.c | 22 +++++++++++----------- lib/MSWindows/aspi32.c | 6 +++--- lib/MSWindows/win32_ioctl.c | 6 +++--- lib/_cdio_sunos.c | 6 +++--- 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/include/cdio/sector.h b/include/cdio/sector.h index 23de392a..4f29eb3a 100644 --- a/include/cdio/sector.h +++ b/include/cdio/sector.h @@ -1,5 +1,5 @@ /* - $Id: sector.h,v 1.17 2004/07/12 03:34:14 rocky Exp $ + $Id: sector.h,v 1.18 2004/07/17 15:31:00 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003, 2004 Rocky Bernstein @@ -88,6 +88,14 @@ typedef enum { CDIO_DISC_MODE_CD_ROM_XA /* CD-ROM XA and CD-I */ } discmode_t; +/*! Information that can be obtained through a Read Subchannel + command. + */ +#define CDIO_SUBCHANNEL_SUBQ_DATA 0 +#define CDIO_SUBCHANNEL_CURRENT_POSITION 1 +#define CDIO_SUBCHANNEL_MEDIA_CATALOG 2 +#define CDIO_SUBCHANNEL_TRACK_INFO 3 + /*! track flags * Q Sub-channel Control Field (4.2.3.3) */ diff --git a/lib/FreeBSD/freebsd_cam.c b/lib/FreeBSD/freebsd_cam.c index c7d4aa90..d48cac0d 100644 --- a/lib/FreeBSD/freebsd_cam.c +++ b/lib/FreeBSD/freebsd_cam.c @@ -1,5 +1,5 @@ /* - $Id: freebsd_cam.c,v 1.16 2004/07/08 05:19:29 rocky Exp $ + $Id: freebsd_cam.c,v 1.17 2004/07/17 15:31:00 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.16 2004/07/08 05:19:29 rocky Exp $"; +static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.17 2004/07/17 15:31:00 rocky Exp $"; #ifdef HAVE_FREEBSD_CDROM @@ -141,7 +141,7 @@ get_drive_mcn_freebsd_cam (img_private_t *env) CDIO_MMC_GPCMD_READ_SUBCHANNEL); env->ccb.csio.cdb_io.cdb_bytes[1] = 0x0; env->ccb.csio.cdb_io.cdb_bytes[2] = 0x40; - env->ccb.csio.cdb_io.cdb_bytes[3] = 02; /* Get media catalog number. */ + env->ccb.csio.cdb_io.cdb_bytes[3] = CDIO_SUBCHANNEL_MEDIA_CATALOG; env->ccb.csio.cdb_io.cdb_bytes[4] = 0; /* Not used */ env->ccb.csio.cdb_io.cdb_bytes[5] = 0; /* Not used */ env->ccb.csio.cdb_io.cdb_bytes[6] = 0; /* Not used */ diff --git a/lib/FreeBSD/freebsd_ioctl.c b/lib/FreeBSD/freebsd_ioctl.c index 4e8272d1..2353a267 100644 --- a/lib/FreeBSD/freebsd_ioctl.c +++ b/lib/FreeBSD/freebsd_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: freebsd_ioctl.c,v 1.9 2004/06/26 00:39:01 rocky Exp $ + $Id: freebsd_ioctl.c,v 1.10 2004/07/17 15:31:00 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: freebsd_ioctl.c,v 1.9 2004/06/26 00:39:01 rocky Exp $"; +static const char _rcsid[] = "$Id: freebsd_ioctl.c,v 1.10 2004/07/17 15:31:00 rocky Exp $"; #ifdef HAVE_FREEBSD_CDROM @@ -83,7 +83,7 @@ read_audio_sectors_freebsd_ioctl (_img_private_t *_obj, void *data, lsn_t lsn, cdda.address.lba = lsn; cdda.buffer = buf; cdda.nframes = nblocks; - cdda.address_format = CD_LBA_FORMAT; + cdda.address_format = CDIO_CDROM_LBA; /* read a frame */ if(ioctl(_obj->gen.fd, CDIOCREADAUDIO, &cdda) < 0) { @@ -127,7 +127,7 @@ stat_size_freebsd_ioctl (_img_private_t *_obj) uint32_t size; tocent.track = CDIO_CDROM_LEADOUT_TRACK; - tocent.address_format = CD_LBA_FORMAT; + tocent.address_format = CDIO_CDROM_LBA; if (ioctl (_obj->gen.fd, CDIOREADTOCENTRY, &tocent) == -1) { perror ("ioctl(CDROMREADTOCENTRY)"); @@ -179,10 +179,10 @@ get_mcn_freebsd_ioctl (const _img_private_t *env) { struct ioc_read_subchannel subchannel; struct cd_sub_channel_info subchannel_info; - subchannel.address_format = CD_LBA_FORMAT; - subchannel.data_format = CD_MEDIA_CATALOG; + subchannel.address_format = CDIO_CDROM_LBA; + subchannel.data_format = CDIO_SUBCHANNEL_MEDIA_CATALOG; subchannel.track = 0; - subchannel.data_len = 1; + subchannel.data_len = 10; subchannel.data = &subchannel_info; if(ioctl(env->gen.fd, CDIOCREADSUBCHANNEL, &subchannel) < 0) { @@ -211,8 +211,8 @@ get_track_format_freebsd_ioctl(const _img_private_t *env, track_t i_track) struct ioc_read_subchannel subchannel; struct cd_sub_channel_info subchannel_info; - subchannel.address_format = CD_LBA_FORMAT; - subchannel.data_format = CD_CURRENT_POSITION; + subchannel.address_format = CDIO_CDROM_LBA; + subchannel.data_format = CDIO_SUBCHANNEL_CURRENT_POSITION; subchannel.track = i_track; subchannel.data_len = 1; subchannel.data = &subchannel_info; @@ -247,8 +247,8 @@ get_track_green_freebsd_ioctl(const _img_private_t *env, track_t i_track) struct ioc_read_subchannel subchannel; struct cd_sub_channel_info subchannel_info; - subchannel.address_format = CD_LBA_FORMAT; - subchannel.data_format = CD_CURRENT_POSITION; + subchannel.address_format = CDIO_CDROM_LBA; + subchannel.data_format = CDIO_SUBCHANNEL_CURRENT_POSITION; subchannel.track = i_track; subchannel.data_len = 1; subchannel.data = &subchannel_info; diff --git a/lib/MSWindows/aspi32.c b/lib/MSWindows/aspi32.c index 497c425c..fa33b302 100644 --- a/lib/MSWindows/aspi32.c +++ b/lib/MSWindows/aspi32.c @@ -1,5 +1,5 @@ /* - $Id: aspi32.c,v 1.27 2004/07/17 10:05:54 rocky Exp $ + $Id: aspi32.c,v 1.28 2004/07/17 15:31:00 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: aspi32.c,v 1.27 2004/07/17 10:05:54 rocky Exp $"; +static const char _rcsid[] = "$Id: aspi32.c,v 1.28 2004/07/17 15:31:00 rocky Exp $"; #include #include @@ -797,7 +797,7 @@ get_mcn_aspi (const _img_private_t *env) CDIO_MMC_SET_COMMAND(scsi_cdb, CDIO_MMC_GPCMD_READ_SUBCHANNEL); scsi_cdb[1] = 0x0; scsi_cdb[2] = 0x40; - scsi_cdb[3] = 02; /* Give media catalog number. */ + scsi_cdb[3] = CDIO_SUBCHANNEL_MEDIA_CATALOG; scsi_cdb[4] = 0; /* Not used */ scsi_cdb[5] = 0; /* Not used */ scsi_cdb[6] = 0; /* Not used */ diff --git a/lib/MSWindows/win32_ioctl.c b/lib/MSWindows/win32_ioctl.c index 05a276bc..fdbde04e 100644 --- a/lib/MSWindows/win32_ioctl.c +++ b/lib/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.16 2004/07/17 10:05:54 rocky Exp $ + $Id: win32_ioctl.c,v 1.17 2004/07/17 15:31:00 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.16 2004/07/17 10:05:54 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.17 2004/07/17 15:31:00 rocky Exp $"; #include #include @@ -471,7 +471,7 @@ get_mcn_win32ioctl (const _img_private_t *env) { memset( &mcn, 0, sizeof(mcn) ); - q_data_format.Format = IOCTL_CDROM_MEDIA_CATALOG; + q_data_format.Format = CDIO_SUBCHANNEL_MEDIA_CATALOG; q_data_format.Track=1; diff --git a/lib/_cdio_sunos.c b/lib/_cdio_sunos.c index d34e806c..a5cbdb98 100644 --- a/lib/_cdio_sunos.c +++ b/lib/_cdio_sunos.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_sunos.c,v 1.50 2004/07/17 09:35:00 rocky Exp $ + $Id: _cdio_sunos.c,v 1.51 2004/07/17 15:31:00 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -38,7 +38,7 @@ #ifdef HAVE_SOLARIS_CDROM -static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.50 2004/07/17 09:35:00 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.51 2004/07/17 15:31:00 rocky Exp $"; #ifdef HAVE_GLOB_H #include @@ -680,7 +680,7 @@ _cdio_get_mcn_solaris (const void *user_data) CDIO_MMC_SET_COMMAND(scsi_cdb, CDIO_MMC_GPCMD_READ_SUBCHANNEL); scsi_cdb[1] = 0x0; scsi_cdb[2] = 0x40; - scsi_cdb[3] = 02; /* Give media catalog number. */ + scsi_cdb[3] = CDIO_SUBCHANNEL_MEDIA_CATALOG; scsi_cdb[4] = 0; /* Not used */ scsi_cdb[5] = 0; /* Not used */ scsi_cdb[6] = 0; /* Not used */