From 945338288f7f0c5e4a2b5fd6701d3d25bd3fbfe8 Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 27 Aug 2004 11:23:40 +0000 Subject: [PATCH] Add constant variable to indicate which OS driver we've got in build. --- include/cdio/cdio.h | 10 +++++++++- lib/cdio.c | 21 ++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/include/cdio/cdio.h b/include/cdio/cdio.h index 47f4bb8e..20009129 100644 --- a/include/cdio/cdio.h +++ b/include/cdio/cdio.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: cdio.h,v 1.62 2004/08/27 04:17:08 rocky Exp $ + $Id: cdio.h,v 1.63 2004/08/27 11:23:40 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2003, 2004 Rocky Bernstein @@ -105,6 +105,14 @@ extern "C" { DRIVER_DEVICE /**< Is really a set of the above; should come last */ } driver_id_t; + /** There will generally be only one hardware for a given + build/platform from the list above. You can use the variable + below to determine which you've got. If the build doesn't make an + hardware driver, then the value will be DRIVER_UNKNOWN. + */ + extern const driver_id_t cdio_os_driver; + + /** Make sure what's listed for CDIO_MIN_DRIVER is the last enumeration in driver_id_t. Since we have a bogus (but useful) 0th entry above we don't have to add one. diff --git a/lib/cdio.c b/lib/cdio.c index 5451776a..3bacaed0 100644 --- a/lib/cdio.c +++ b/lib/cdio.c @@ -1,5 +1,5 @@ /* - $Id: cdio.c,v 1.69 2004/08/27 04:17:08 rocky Exp $ + $Id: cdio.c,v 1.70 2004/08/27 11:23:40 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein Copyright (C) 2001 Herbert Valerio Riedel @@ -39,7 +39,7 @@ #include #include "cdio_private.h" -static const char _rcsid[] = "$Id: cdio.c,v 1.69 2004/08/27 04:17:08 rocky Exp $"; +static const char _rcsid[] = "$Id: cdio.c,v 1.70 2004/08/27 11:23:40 rocky Exp $"; const char *track_format2str[6] = @@ -71,13 +71,28 @@ CdIo_driver_t CdIo_driver[CDIO_MAX_DRIVER] = { {0} }; #define CDIO_DRIVER_UNINIT -1 int CdIo_last_driver = CDIO_DRIVER_UNINIT; +#ifdef HAVE_BSDI_CDROM +const driver_id_t cdio_os_driver = DRIVER_BSDI; +#elif HAVE_FREEBSD_CDROM +const driver_id_t cdio_os_driver = DRIVER_FREEBSD; +#elif HAVE_LINUX_CDROM +const driver_id_t cdio_os_driver = DRIVER_LINUX; +#elif HAVE_DARWIN_CDROM +const driver_id_t cdio_os_driver = DRIVER_OSX; +#elif HAVE_DARWIN_SOLARIS +const driver_id_t cdio_os_driver = DRIVER_SOLARIS; +#elif HAVE_DARWIN_WIN32 +const driver_id_t cdio_os_driver = DRIVER_WIN32; +#else +const driver_id_t cdio_os_driver = DRIVER_UNKNOWN; +#endif + static bool cdio_have_false(void) { return false; } - /* The below array gives all drivers that can possibly appear. on a particular host. */