diff --git a/lib/Makefile.am b/lib/Makefile.am index 5940ac42..3bc57694 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.12 2003/09/13 06:25:37 rocky Exp $ +# $Id: Makefile.am,v 1.13 2003/09/14 09:34:17 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -44,6 +44,7 @@ libcdio_sources = \ ds.c \ ds.h \ logging.c \ + scsi_mmc.h \ sector.c \ util.c diff --git a/lib/_cdio_linux.c b/lib/_cdio_linux.c index 5cddb862..db5b729a 100644 --- a/lib/_cdio_linux.c +++ b/lib/_cdio_linux.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_linux.c,v 1.16 2003/09/01 15:11:36 rocky Exp $ + $Id: _cdio_linux.c,v 1.17 2003/09/14 09:34:17 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002,2003 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.16 2003/09/01 15:11:36 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.17 2003/09/14 09:34:17 rocky Exp $"; #include @@ -35,6 +35,7 @@ static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.16 2003/09/01 15:11:36 rock #include #include "cdio_assert.h" #include "cdio_private.h" +#include "scsi_mmc.h" #ifdef HAVE_LINUX_CDROM @@ -245,14 +246,9 @@ _read_packet_audio_sector (int fd, void *buf, lba_t lba) cgc.cmd[0] = GPCMD_READ_CD; cgc.cmd[1] = 0; /* Any type of sectors returned */ - cgc.cmd[2] = (lba >> 24) & 0xff; - cgc.cmd[3] = (lba >> 16) & 0xff; - cgc.cmd[4] = (lba >> 8) & 0xff; - cgc.cmd[5] = (lba >> 0) & 0xff; + SCSI_MMC_SET_READ_LBA(cgc.cmd, lba); + SCSI_MMC_SET_READ_LENGTH(cgc.cmd, nblocks); - cgc.cmd[6] = (nblocks >> 16) & 0xff; - cgc.cmd[7] = (nblocks >> 8) & 0xff; - cgc.cmd[8] = (nblocks >> 0) & 0xff; cgc.cmd[9] = 0x78; /* All headers */ cgc.buflen = CDIO_CD_FRAMESIZE_RAW * nblocks; @@ -280,15 +276,9 @@ __read_packet_mode2_sectors (int fd, void *buf, lba_t lba, memset (&cgc, 0, sizeof (struct cdrom_generic_command)); cgc.cmd[0] = use_read_10 ? GPCMD_READ_10 : GPCMD_READ_CD; - - cgc.cmd[2] = (lba >> 24) & 0xff; - cgc.cmd[3] = (lba >> 16) & 0xff; - cgc.cmd[4] = (lba >> 8) & 0xff; - cgc.cmd[5] = (lba >> 0) & 0xff; - cgc.cmd[6] = (nblocks >> 16) & 0xff; - cgc.cmd[7] = (nblocks >> 8) & 0xff; - cgc.cmd[8] = (nblocks >> 0) & 0xff; + SCSI_MMC_SET_READ_LBA(cgc.cmd, lba); + SCSI_MMC_SET_READ_LENGTH(cgc.cmd, nblocks); if (!use_read_10) { diff --git a/lib/_cdio_sunos.c b/lib/_cdio_sunos.c index 1698f4eb..c817a549 100644 --- a/lib/_cdio_sunos.c +++ b/lib/_cdio_sunos.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_sunos.c,v 1.15 2003/09/01 15:11:36 rocky Exp $ + $Id: _cdio_sunos.c,v 1.16 2003/09/14 09:34:17 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002,2003 Rocky Bernstein @@ -30,12 +30,13 @@ #include #include "cdio_assert.h" #include "cdio_private.h" +#include "scsi_mmc.h" #define DEFAULT_CDIO_DEVICE "/vol/dev/aliases/cdrom0" #ifdef HAVE_SOLARIS_CDROM -static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.15 2003/09/01 15:11:36 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.16 2003/09/14 09:34:17 rocky Exp $"; #include #include @@ -186,13 +187,10 @@ _cdio_read_mode2_sector (void *user_data, void *data, lsn_t lsn, memset(&sc, 0, sizeof(sc)); cdb.scc_cmd = 0xBE; cdb.cdb_opaque[1] = (sector_type) << 2; - cdb.cdb_opaque[2] = (lsn >> 24) & 0xff; - cdb.cdb_opaque[3] = (lsn >> 16) & 0xff; - cdb.cdb_opaque[4] = (lsn >> 8) & 0xff; - cdb.cdb_opaque[5] = lsn & 0xff; - cdb.cdb_opaque[6] = (blocks >> 16) & 0xff; - cdb.cdb_opaque[7] = (blocks >> 8) & 0xff; - cdb.cdb_opaque[8] = blocks & 0xff; + + SCSI_MMC_SET_READ_LBA(cdb.cdb_opaque, lsn); + SCSI_MMC_SET_READ_LENGTH(cdb.cdb_opaque, blocks); + cdb.cdb_opaque[9] = (sync << 7) | (header_code << 5) | (user_data << 4) | @@ -296,13 +294,10 @@ _cdio_read_audio_sector (void *user_data, void *data, lsn_t lsn) memset(&sc, 0, sizeof(sc)); cdb.scc_cmd = 0xBE; cdb.cdb_opaque[1] = (sector_type) << 2; - cdb.cdb_opaque[2] = (lsn >> 24) & 0xff; - cdb.cdb_opaque[3] = (lsn >> 16) & 0xff; - cdb.cdb_opaque[4] = (lsn >> 8) & 0xff; - cdb.cdb_opaque[5] = lsn & 0xff; - cdb.cdb_opaque[6] = (blocks >> 16) & 0xff; - cdb.cdb_opaque[7] = (blocks >> 8) & 0xff; - cdb.cdb_opaque[8] = blocks & 0xff; + + SCSI_MMC_SET_READ_LBA(cdb.cdb_opaque, lsn); + SCSI_MMC_SET_READ_LENGTH(cdb.cdb_opaque, blocks); + cdb.cdb_opaque[9] = (sync << 7) | (header_code << 5) | (user_data << 4) | diff --git a/lib/_cdio_win32.c b/lib/_cdio_win32.c index 0c6a9846..16b4b2d6 100644 --- a/lib/_cdio_win32.c +++ b/lib/_cdio_win32.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_win32.c,v 1.10 2003/08/11 09:19:18 rocky Exp $ + $Id: _cdio_win32.c,v 1.11 2003/09/14 09:34:18 rocky Exp $ Copyright (C) 2003 Rocky Bernstein @@ -26,13 +26,14 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_win32.c,v 1.10 2003/08/11 09:19:18 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_win32.c,v 1.11 2003/09/14 09:34:18 rocky Exp $"; #include #include #include #include "cdio_assert.h" #include "cdio_private.h" +#include "scsi_mmc.h" /* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */ #define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min)) @@ -534,15 +535,9 @@ _cdio_read_raw_sector (void *user_data, void *data, lsn_t lsn) /* Start of LSN */ ssc.CDBByte[ 1 ] = (sector_type) << 2; - ssc.CDBByte[ 2 ] = (lsn >> 24) & 0xff; - ssc.CDBByte[ 3 ] = (lsn >> 16) & 0xff; - ssc.CDBByte[ 4 ] = (lsn >> 8) & 0xff; - ssc.CDBByte[ 5 ] = (lsn ) & 0xff; - - /* Transfer length */ - ssc.CDBByte[ 6 ] = (blocks >> 16) & 0xff; - ssc.CDBByte[ 7 ] = (blocks >> 8) & 0xff; - ssc.CDBByte[ 8 ] = blocks & 0xff; + + SCSI_MMC_SET_READ_LBA(ssc.CDBByte, lsn); + SCSI_MMC_SET_READ_LENGTH(ssc.CDBByte, blocks); ssc.CDBByte[ 9 ] = (sync << 7) | (header_code << 5) | @@ -617,7 +612,7 @@ _cdio_read_mode2_sector (void *user_data, void *data, lsn_t lsn, || (_obj->gen.ioctls_debugged < (30 * 75) && _obj->gen.ioctls_debugged % 75 == 0) || _obj->gen.ioctls_debugged % (30 * 75) == 0) - cdio_debug ("reading %d", lsn); + cdio_debug ("reading %lu", (unsigned long int) lsn); _obj->gen.ioctls_debugged++; @@ -802,7 +797,8 @@ _cdio_read_toc (_img_private_t *_obj) ((int)p_fulltoc[ i_index+2 ] << 8) + (int)p_fulltoc[ i_index+3 ]; - cdio_debug( "p_sectors: %i %i", i, _obj->tocent[i].start_lsn ); + cdio_debug( "p_sectors: %i %lu", + i, (unsigned long int) _obj->tocent[i].start_lsn ); } free( p_fulltoc ); @@ -833,7 +829,8 @@ _cdio_read_toc (_img_private_t *_obj) cdrom_toc.TrackData[i].Address[1], cdrom_toc.TrackData[i].Address[2], cdrom_toc.TrackData[i].Address[3] ); - cdio_debug("p_sectors: %i, %i", i, (_obj->tocent[i].start_lsn)); + cdio_debug("p_sectors: %i, %lu", i, + (unsigned long int) (_obj->tocent[i].start_lsn)); } } return true; @@ -936,9 +933,7 @@ _cdio_get_track_format(void *user_data, track_t track_num) MCI_OPEN_PARMS op; MCI_STATUS_PARMS st; DWORD i_flags; - char psz_drive[4]; int ret; - unsigned int len = strlen(_obj->gen.source_name); memset( &op, 0, sizeof(MCI_OPEN_PARMS) ); op.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_CD_AUDIO; diff --git a/src/cd-info.c b/src/cd-info.c index 1eb85f6b..d04bd3cf 100644 --- a/src/cd-info.c +++ b/src/cd-info.c @@ -1,5 +1,5 @@ /* - $Id: cd-info.c,v 1.33 2003/09/07 18:12:30 rocky Exp $ + $Id: cd-info.c,v 1.34 2003/09/14 09:34:18 rocky Exp $ Copyright (C) 2003 Rocky Bernstein Copyright (C) 1996,1997,1998 Gerd Knorr @@ -639,20 +639,20 @@ print_iso9660_recurse (CdIo *cdio, const char pathname[], cdio_fs_anal_t fs, _cdio_list_append (dirlist, strdup (_fullname)); if (fs & CDIO_FS_ANAL_XA) { - printf ( " %c %s %d %d [fn %.2d] [LSN %6d] ", + printf ( " %c %s %d %d [fn %.2d] [LSN %6lu] ", (statbuf.type == _STAT_DIR) ? 'd' : '-', iso9660_get_xa_attr_str (statbuf.xa.attributes), uint16_from_be (statbuf.xa.user_id), uint16_from_be (statbuf.xa.group_id), statbuf.xa.filenum, - statbuf.lsn); + (long unsigned int) statbuf.lsn); if (uint16_from_be(statbuf.xa.attributes) & XA_ATTR_MODE2FORM2) { - printf ("%9d (%9d)", - statbuf.secsize * M2F2_SECTOR_SIZE, - statbuf.size); + printf ("%9u (%9u)", + (unsigned int) statbuf.secsize * M2F2_SECTOR_SIZE, + (unsigned int) statbuf.size); } else { - printf ("%9d", statbuf.size); + printf ("%9u", (unsigned int) statbuf.size); } } strftime(date_str, DATESTR_SIZE, "%b %e %Y %H:%M ", &statbuf.tm); @@ -706,7 +706,7 @@ print_iso9660_fs (CdIo *cdio, cdio_fs_anal_t fs, track_format_t track_format) const lsn_t extent = iso9660_get_root_lsn(&pvd); printf ("ISO9660 filesystem\n"); - printf (" root dir in PVD set to lsn %d\n\n", extent); + printf (" root dir in PVD set to lsn %lu\n\n", (long unsigned) extent); print_iso9660_recurse (cdio, "/", fs, is_mode2); } @@ -820,7 +820,7 @@ main(int argc, const char *argv[]) CdIo *cdio=NULL; cdio_fs_anal_t fs=0; int i; - lsn_t start_track; /* first sector of track */ + lsn_t start_track_lsn; /* lsn of first track */ lsn_t data_start =0; /* start of data area */ int ms_offset = 0; track_t num_tracks=0; @@ -947,16 +947,16 @@ main(int argc, const char *argv[]) if (i == CDIO_CDROM_LEADOUT_TRACK) { if (!opts.no_tracks) - printf("%3d: %2.2x:%2.2x:%2.2x %06d leadout\n", + printf("%3d: %2.2x:%2.2x:%2.2x %06lu leadout\n", (int) i, msf.m, msf.s, msf.f, - cdio_msf_to_lsn(&msf)); + (long unsigned int) cdio_msf_to_lsn(&msf)); break; } else if (!opts.no_tracks) { - printf("%3d: %2.2x:%2.2x:%2.2x %06d %s\n", + printf("%3d: %2.2x:%2.2x:%2.2x %06lu %s\n", (int) i, msf.m, msf.s, msf.f, - cdio_msf_to_lsn(&msf), + (long unsigned int) cdio_msf_to_lsn(&msf), track_format2str[cdio_get_track_format(cdio, i)]); } @@ -1049,18 +1049,18 @@ main(int argc, const char *argv[]) msf_t msf; cdio_get_track_msf(cdio, 1, &msf); - start_track = cdio_msf_to_lsn(&msf); + start_track_lsn = cdio_msf_to_lsn(&msf); - /* CD-I/Ready says start_track <= 30*75 then CDDA */ - if (start_track > 100 /* 100 is just a guess */) { + /* CD-I/Ready says start_track_lsn <= 30*75 then CDDA */ + if (start_track_lsn > 100 /* 100 is just a guess */) { fs = cdio_guess_cd_type(cdio, 0, 1, &cdio_analysis); if ((CDIO_FSTYPE(fs)) != CDIO_FS_UNKNOWN) fs |= CDIO_FS_ANAL_HIDDEN_TRACK; else { fs &= ~CDIO_FS_MASK; /* del filesystem info */ - printf("Oops: %i unused sectors at start, " + printf("Oops: %lu unused sectors at start, " "but hidden track check failed.\n", - start_track); + (long unsigned int) start_track_lsn); } } print_analysis(ms_offset, cdio_analysis, fs, first_data, num_audio, @@ -1087,24 +1087,25 @@ main(int argc, const char *argv[]) ; } - start_track = (i == 1) ? 0 : cdio_msf_to_lsn(&msf); + start_track_lsn = (i == 1) ? 0 : cdio_msf_to_lsn(&msf); /* save the start of the data area */ if (i == first_data) - data_start = start_track; + data_start = start_track_lsn; /* skip tracks which belong to the current walked session */ - if (start_track < data_start + cdio_analysis.isofs_size) + if (start_track_lsn < data_start + cdio_analysis.isofs_size) continue; - fs = cdio_guess_cd_type(cdio, start_track, i, &cdio_analysis); + fs = cdio_guess_cd_type(cdio, start_track_lsn, i, &cdio_analysis); if (i > 1) { /* track is beyond last session -> new session found */ - ms_offset = start_track; - printf("session #%d starts at track %2i, LSN: %6i," + ms_offset = start_track_lsn; + printf("session #%d starts at track %2i, LSN: %lu," " ISO 9660 blocks: %6i\n", - j++, i, start_track, cdio_analysis.isofs_size); + j++, i, (unsigned long int) start_track_lsn, + cdio_analysis.isofs_size); printf("ISO 9660: %i blocks, label `%.32s'\n", cdio_analysis.isofs_size, cdio_analysis.iso_label); fs |= CDIO_FS_ANAL_MULTISESSION; diff --git a/test/Makefile.am b/test/Makefile.am index 90fefc10..38f1e302 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.8 2003/09/14 07:49:12 rocky Exp $ +# $Id: Makefile.am,v 1.9 2003/09/14 09:34:18 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -45,6 +45,6 @@ EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ check_common_fn check_cue.sh.in check_nrg.sh.in TESTS = $(check_PROGRAMS) $(check_SCRIPTS) -XFAIL_TESTS = testassert${EXEEXT} +XFAIL_TESTS = testassert MOSTLYCLEANFILES = core.* *.dump