Yet another attempt to get "get_drives_with_cap" working in a rational

fashion.
This commit is contained in:
rocky
2006-03-28 03:26:16 +00:00
parent 10942d5ba3
commit dbc63b695a
7 changed files with 46 additions and 52 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: drives.cpp,v 1.4 2006/03/27 02:48:41 rocky Exp $ $Id: drives.cpp,v 1.5 2006/03/28 03:26:16 rocky Exp $
Copyright (C) 2003, 2004, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2006 Rocky Bernstein <rocky@panix.com>
@@ -84,12 +84,8 @@ main(int argc, const char *argv[])
print_drive_class("All CD-ROM drives (again)", CDIO_FS_MATCH_ALL); print_drive_class("All CD-ROM drives (again)", CDIO_FS_MATCH_ALL);
print_drive_class("CD-ROM drives with a CD-DA loaded...", CDIO_FS_AUDIO); print_drive_class("CD-ROM drives with a CD-DA loaded...", CDIO_FS_AUDIO);
print_drive_class("CD-ROM drives with some sort of ISO 9660 filesystem...", print_drive_class("CD-ROM drives with some sort of ISO 9660 filesystem...",
(CDIO_FS_ISO_9660 CDIO_FS_ANAL_ISO9660_ANY, true);
|CDIO_FS_ISO_HFS print_drive_class("(S)VCD drives...", CDIO_FS_ANAL_VCD_ANY, true);
|CDIO_FS_ISO_9660_INTERACTIVE), true);
print_drive_class("(S)VCD drives...",
(CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|
CDIO_FS_ANAL_VIDEOCD|CDIO_FS_UNKNOWN), true);
return 0; return 0;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: drives.c,v 1.4 2006/03/27 02:48:41 rocky Exp $ $Id: drives.c,v 1.5 2006/03/28 03:26:16 rocky Exp $
Copyright (C) 2003, 2004, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2006 Rocky Bernstein <rocky@panix.com>
@@ -87,12 +87,8 @@ main(int argc, const char *argv[])
print_drive_class("CD-ROM drives with a CD-DA loaded...", print_drive_class("CD-ROM drives with a CD-DA loaded...",
CDIO_FS_AUDIO, false); CDIO_FS_AUDIO, false);
print_drive_class("CD-ROM drives with some sort of ISO 9660 filesystem...", print_drive_class("CD-ROM drives with some sort of ISO 9660 filesystem...",
(CDIO_FS_ISO_9660 CDIO_FS_ANAL_ISO9660_ANY, true);
|CDIO_FS_ISO_HFS print_drive_class("(S)VCD drives...", CDIO_FS_ANAL_VCD_ANY, true);
|CDIO_FS_ISO_9660_INTERACTIVE), true);
print_drive_class("(S)VCD drives...",
(CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|
CDIO_FS_ANAL_VIDEOCD|CDIO_FS_UNKNOWN), true);
return 0; return 0;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd_types.h,v 1.15 2006/03/26 20:47:55 rocky Exp $ $Id: cd_types.h,v 1.16 2006/03/28 03:26:16 rocky Exp $
Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org> Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
@@ -93,21 +93,24 @@ extern "C" {
CDIO_FS_MASK = 0x000f, /**< Note: this should be 2**n-1 and CDIO_FS_MASK = 0x000f, /**< Note: this should be 2**n-1 and
and greater than the highest and greater than the highest
CDIO_FS number above */ CDIO_FS number above */
CDIO_FS_ANAL_XA = 0x0010, /**< eXtended Architecture format */ CDIO_FS_ANAL_XA = 0x00010, /**< eXtended Architecture format */
CDIO_FS_ANAL_MULTISESSION = 0x0020, /**< CD has multisesion */ CDIO_FS_ANAL_MULTISESSION = 0x00020, /**< CD has multisesion */
CDIO_FS_ANAL_PHOTO_CD = 0x0040, /**< Is a Kodak Photo CD */ CDIO_FS_ANAL_PHOTO_CD = 0x00040, /**< Is a Kodak Photo CD */
CDIO_FS_ANAL_HIDDEN_TRACK = 0x0080, /**< Hidden track at the CDIO_FS_ANAL_HIDDEN_TRACK = 0x00080, /**< Hidden track at the
beginning of the CD */ beginning of the CD */
CDIO_FS_ANAL_CDTV = 0x0100, CDIO_FS_ANAL_CDTV = 0x00100,
CDIO_FS_ANAL_BOOTABLE = 0x0200, /**< CD is bootable */ CDIO_FS_ANAL_BOOTABLE = 0x00200, /**< CD is bootable */
CDIO_FS_ANAL_VIDEOCD = 0x0400, /**< VCD 1.1 */ CDIO_FS_ANAL_VIDEOCD = 0x00400, /**< VCD 1.1 */
CDIO_FS_ANAL_ROCKRIDGE = 0x0800, /**< Has Rock Ridge Extensions to CDIO_FS_ANAL_ROCKRIDGE = 0x00800, /**< Has Rock Ridge Extensions to
ISO 9660, */ ISO 9660, */
CDIO_FS_ANAL_JOLIET = 0x1000, /**< Microsoft Joliet extensions CDIO_FS_ANAL_JOLIET = 0x01000, /**< Microsoft Joliet extensions
to ISO 9660, */ to ISO 9660, */
CDIO_FS_ANAL_SVCD = 0x2000, /**< Super VCD or Choiji Video CD */ CDIO_FS_ANAL_SVCD = 0x02000, /**< Super VCD or Choiji Video CD */
CDIO_FS_ANAL_CVD = 0x4000, /**< Choiji Video CD */ CDIO_FS_ANAL_CVD = 0x04000, /**< Choiji Video CD */
CDIO_FS_ANAL_XISO = 0x8000, /**< XBOX CD */ CDIO_FS_ANAL_XISO = 0x08000, /**< XBOX CD */
CDIO_FS_ANAL_ISO9660_ANY = 0x10000, /**< Any sort fo ISO9660 FS */
CDIO_FS_ANAL_VCD_ANY = (CDIO_FS_ANAL_VIDEOCD|CDIO_FS_ANAL_SVCD|
CDIO_FS_ANAL_CVD),
CDIO_FS_MATCH_ALL = ~CDIO_FS_MASK /**< bitmask which can CDIO_FS_MATCH_ALL = ~CDIO_FS_MASK /**< bitmask which can
be used by be used by
cdio_get_devices to cdio_get_devices to

View File

@@ -1,5 +1,5 @@
/* -*- c -*- /* -*- c -*-
$Id: device.h,v 1.33 2006/03/27 02:48:41 rocky Exp $ $Id: device.h,v 1.34 2006/03/28 03:26:16 rocky Exp $
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
@@ -331,11 +331,9 @@ extern "C" {
If "b_any" is set true, then if any of the analysis capabilities If "b_any" is set true, then if any of the analysis capabilities
matches, we call that a success. matches, we call that a success.
In either case, you can specify in the filesystem portion In either case, in the filesystem portion different filesystem
different filesystem types and a match will succeed only if one of either specify 0 to match any filesystem or the specific
them matches. (It doesn't make sense to try to match on *all* of filesystem type.
the filesystems as a CD can only have one). Again, if no fileystem
is specified, that's a match.
To find a CD-drive of any type, use the mask CDIO_FS_MATCH_ALL. To find a CD-drive of any type, use the mask CDIO_FS_MATCH_ALL.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd_types.c,v 1.6 2006/02/27 10:29:20 flameeyes Exp $ $Id: cd_types.c,v 1.7 2006/03/28 03:26:16 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein
<rocky@panix.com> <rocky@panix.com>
@@ -261,7 +261,7 @@ cdio_guess_cd_type(const CdIo_t *p_cdio, int start_session, track_t i_track,
/* We have something that smells of a filesystem. */ /* We have something that smells of a filesystem. */
if (_cdio_is_it(INDEX_CD_I) && _cdio_is_it(INDEX_CD_RTOS) if (_cdio_is_it(INDEX_CD_I) && _cdio_is_it(INDEX_CD_RTOS)
&& !_cdio_is_it(INDEX_BRIDGE) && !_cdio_is_it(INDEX_XA)) { && !_cdio_is_it(INDEX_BRIDGE) && !_cdio_is_it(INDEX_XA)) {
return CDIO_FS_INTERACTIVE; return (CDIO_FS_INTERACTIVE | CDIO_FS_ANAL_ISO9660_ANY);
} else { } else {
/* read sector 0 ONLY, when NO greenbook CD-I !!!! */ /* read sector 0 ONLY, when NO greenbook CD-I !!!! */
@@ -272,11 +272,11 @@ cdio_guess_cd_type(const CdIo_t *p_cdio, int start_session, track_t i_track,
ret |= CDIO_FS_HIGH_SIERRA; ret |= CDIO_FS_HIGH_SIERRA;
else if (_cdio_is_it(INDEX_ISOFS)) { else if (_cdio_is_it(INDEX_ISOFS)) {
if (_cdio_is_it(INDEX_CD_RTOS) && _cdio_is_it(INDEX_BRIDGE)) if (_cdio_is_it(INDEX_CD_RTOS) && _cdio_is_it(INDEX_BRIDGE))
ret = CDIO_FS_ISO_9660_INTERACTIVE; ret = (CDIO_FS_ISO_9660_INTERACTIVE | CDIO_FS_ANAL_ISO9660_ANY);
else if (_cdio_is_hfs()) else if (_cdio_is_hfs())
ret = CDIO_FS_ISO_HFS; ret = CDIO_FS_ISO_HFS;
else else
ret = CDIO_FS_ISO_9660; ret = (CDIO_FS_ISO_9660 | CDIO_FS_ANAL_ISO9660_ANY);
iso_analysis->isofs_size = _cdio_get_iso9660_fs_sec_count(); iso_analysis->isofs_size = _cdio_get_iso9660_fs_sec_count();
strncpy(iso_analysis->iso_label, buffer[0]+40,33); strncpy(iso_analysis->iso_label, buffer[0]+40,33);
iso_analysis->iso_label[32] = '\0'; iso_analysis->iso_label[32] = '\0';
@@ -316,7 +316,7 @@ cdio_guess_cd_type(const CdIo_t *p_cdio, int start_session, track_t i_track,
if (_cdio_is_joliet()) { if (_cdio_is_joliet()) {
iso_analysis->joliet_level = _cdio_get_joliet_level(); iso_analysis->joliet_level = _cdio_get_joliet_level();
ret |= CDIO_FS_ANAL_JOLIET; ret |= (CDIO_FS_ANAL_JOLIET | CDIO_FS_ANAL_ISO9660_ANY);
} }
if (_cdio_is_it(INDEX_BOOTABLE)) if (_cdio_is_it(INDEX_BOOTABLE))
ret |= CDIO_FS_ANAL_BOOTABLE; ret |= CDIO_FS_ANAL_BOOTABLE;
@@ -329,6 +329,7 @@ cdio_guess_cd_type(const CdIo_t *p_cdio, int start_session, track_t i_track,
return ret; return ret;
if (_cdio_is_it(INDEX_BRIDGE) && _cdio_is_it(INDEX_CD_RTOS)) { if (_cdio_is_it(INDEX_BRIDGE) && _cdio_is_it(INDEX_CD_RTOS)) {
ret |= CDIO_FS_ANAL_ISO9660_ANY;
if (_cdio_is_it(INDEX_VIDEO_CD)) ret |= CDIO_FS_ANAL_VIDEOCD; if (_cdio_is_it(INDEX_VIDEO_CD)) ret |= CDIO_FS_ANAL_VIDEOCD;
else if (_cdio_is_it(INDEX_SVCD)) ret |= CDIO_FS_ANAL_SVCD; else if (_cdio_is_it(INDEX_SVCD)) ret |= CDIO_FS_ANAL_SVCD;
} else if (_cdio_is_it(INDEX_SVCD)) ret |= CDIO_FS_ANAL_CVD; } else if (_cdio_is_it(INDEX_SVCD)) ret |= CDIO_FS_ANAL_CVD;
@@ -336,7 +337,8 @@ cdio_guess_cd_type(const CdIo_t *p_cdio, int start_session, track_t i_track,
} }
} }
else if (_cdio_is_hfs()) ret |= CDIO_FS_HFS; else if (_cdio_is_hfs()) ret |= CDIO_FS_HFS;
else if (sector0_read_ok && _cdio_is_it(INDEX_EXT2)) ret |= CDIO_FS_EXT2; else if (sector0_read_ok && _cdio_is_it(INDEX_EXT2))
ret |= (CDIO_FS_EXT2 | CDIO_FS_ANAL_ISO9660_ANY);
else if (_cdio_is_3do()) ret |= CDIO_FS_3DO; else if (_cdio_is_3do()) ret |= CDIO_FS_3DO;
else { else {
if ( _cdio_read_block(p_cdio, UFS_SUPERBLOCK_SECTOR, start_session, 2, if ( _cdio_read_block(p_cdio, UFS_SUPERBLOCK_SECTOR, start_session, 2,
@@ -351,8 +353,11 @@ cdio_guess_cd_type(const CdIo_t *p_cdio, int start_session, track_t i_track,
} }
/* other checks */ /* other checks */
if (_cdio_is_it(INDEX_XA)) ret |= CDIO_FS_ANAL_XA; if (_cdio_is_it(INDEX_XA))
if (_cdio_is_it(INDEX_PHOTO_CD)) ret |= CDIO_FS_ANAL_PHOTO_CD; ret |= (CDIO_FS_ANAL_XA | CDIO_FS_ANAL_ISO9660_ANY);
if (_cdio_is_it(INDEX_CDTV)) ret |= CDIO_FS_ANAL_CDTV; if (_cdio_is_it(INDEX_PHOTO_CD))
ret |= (CDIO_FS_ANAL_PHOTO_CD | CDIO_FS_ANAL_ISO9660_ANY);
if (_cdio_is_it(INDEX_CDTV))
ret |= CDIO_FS_ANAL_CDTV;
return ret; return ret;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: device.c,v 1.37 2006/03/27 02:48:41 rocky Exp $ $Id: device.c,v 1.38 2006/03/28 03:26:16 rocky Exp $
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
@@ -622,8 +622,8 @@ cdio_get_devices_with_cap_ret (/*in*/ char* search_devices[],
filesystem is - automatic match, or we no that the file filesystem is - automatic match, or we no that the file
system is in the set of those specified. system is in the set of those specified.
We refine the logic further after this initial test. */ We refine the logic further after this initial test. */
if ( CDIO_FS_UNKNOWN == need_fs if ( CDIO_FS_UNKNOWN == need_fs || 0 == need_fs
|| (CDIO_FSTYPE(got_cap) & need_fs) ) { || (CDIO_FSTYPE(got_cap) == need_fs) ) {
/* Match on analysis type. If we haven't set any /* Match on analysis type. If we haven't set any
analysis type, then an automatic match. Otherwise analysis type, then an automatic match. Otherwise
a match is determined by whether we need all a match is determined by whether we need all

View File

@@ -1,4 +1,4 @@
/* $Id: testisocd.c,v 1.2 2006/03/26 20:47:55 rocky Exp $ /* $Id: testisocd.c,v 1.3 2006/03/28 03:26:16 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein
<rockyb@users.sourceforge.net> <rockyb@users.sourceforge.net>
@@ -65,12 +65,8 @@ main(int argc, const char *argv[])
/* See if we can find a device with a loaded CD-DA in it. If successful /* See if we can find a device with a loaded CD-DA in it. If successful
drive_id will be set. */ drive_id will be set. */
ppsz_cd_drives = ppsz_cd_drives =
cdio_get_devices_with_cap_ret(NULL, cdio_get_devices_with_cap_ret(NULL, CDIO_FS_ANAL_ISO9660_ANY,
(CDIO_FS_ISO_9660 true, &driver_id);
|CDIO_FS_ISO_HFS
|CDIO_FS_ISO_9660_INTERACTIVE),
true,
&driver_id);
if (ppsz_cd_drives && ppsz_cd_drives[0]) { if (ppsz_cd_drives && ppsz_cd_drives[0]) {
/* Found such a CD-ROM with an ISO 9660 filesystem. Use the first drive in /* Found such a CD-ROM with an ISO 9660 filesystem. Use the first drive in