[libdvdcss-devel] [PATCH 47/47] Drop support for Solaris.

Diego Biurrun diego at biurrun.de
Wed Oct 29 21:33:47 CET 2014


---
 NEWS              |   2 +-
 configure.ac      |   9 --
 libdvdcss.spec.in |   4 +-
 msvc/config.h     |   1 -
 src/device.c      |   1 -
 src/ioctl.c       | 280 +-----------------------------------------------------
 src/ioctl.h       |  11 +--
 src/libdvdcss.c   |   3 +-
 test/dvd_region.c |  15 ---
 9 files changed, 6 insertions(+), 320 deletions(-)

diff --git a/NEWS b/NEWS
index 2f37902..d3fdaed 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Changes between 1.2.13 and 1.3.0:
     - the type dvdcss_handle
     - the variable dvdcss_interface_2
   * Support for Android
-  * Drop support for HP-UX, BeOS, QNX, OS/2, and Windows 9x.
+  * Drop support for HP-UX, Solaris, BeOS, QNX, OS/2, and Windows 9x.
   * Miscellaneous cleanups to code, documentation, build system.
 
 
diff --git a/configure.ac b/configure.ac
index 868333b..cda5443 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,15 +169,6 @@ AC_CHECK_HEADERS(sys/ioctl.h,[
     LINUX_DVD_STRUCT=1
   ])
   dnl
-  dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
-  dnl
-  solaris_uscsi=yes
-  AC_CHECK_HEADERS([sys/scsi/scsi_types.h sys/scsi/impl/uscsi.h], [],
-    [solaris_uscsi=no; break;])
-  AS_IF([test "$solaris_uscsi" = "yes"], [
-    AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
-  ])
-  dnl
   dnl Darwin
   dnl
   AC_CHECK_HEADER(IOKit/storage/IODVDMediaBSDClient.h,[
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index c58d9d3..f3b3224 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,7 +32,7 @@ Conflicts:      libdvdcss0.0.1, libdvdcss0.0.2
 libdvdcss is a simple library designed for accessing DVDs like a block device
 without having to bother about the decryption. The important features are:
  * Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
-   OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) or later.
+   OpenBSD, Mac OS X, and Windows NT 4.0 (with IE 5.0) or later.
  * Adaptability: Unlike most similar projects, libdvdcss does not require the
    region of your drive to be set and will try its best to read from the disc
    even in the case of a region mismatch.
@@ -48,7 +48,7 @@ Provides:       %name = %version-%release
 libdvdcss is a simple library designed for accessing DVDs like a block device
 without having to bother about the decryption. The important features are:
  * Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
-   OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) or later.
+   OpenBSD, Mac OS X, and Windows NT 4.0 (with IE 5.0) or later.
  * Adaptability: Unlike most similar projects, libdvdcss does not require the
    region of your drive to be set and will try its best to read from the disc
    even in the case of a region mismatch.
diff --git a/msvc/config.h b/msvc/config.h
index dc7fb62..b0fadb5 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -33,7 +33,6 @@
 #define PACKAGE_STRING "libdvdcss 1.3.0"
 #define PACKAGE_TARNAME "libdvdcss"
 #define PACKAGE_VERSION "1.3.0"
-/* #undef SOLARIS_USCSI */
 #define STDC_HEADERS 1
 #define VERSION "1.3.0"
 #define _WIN32_IE 0x0500
diff --git a/src/device.c b/src/device.c
index 2c73e02..ed2b710 100644
--- a/src/device.c
+++ b/src/device.c
@@ -106,7 +106,6 @@ int dvdcss_use_ioctls( dvdcss_t dvdcss )
      *  and those that don't contain/use an 'r' in the name are block devices)
      *
      * Linux    needs a block device
-     * Solaris  needs a char device
      * Darwin   needs a char device
      * OpenBSD  needs a char device
      * NetBSD   needs a char device
diff --git a/src/ioctl.c b/src/ioctl.c
index b54c1bd..37d7ce8 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -55,13 +55,6 @@
 #ifdef DVD_STRUCT_IN_DVD_H
 #   include <dvd.h>
 #endif
-#ifdef SOLARIS_USCSI
-#   include <dlfcn.h>
-#   include <unistd.h>
-#   include <stropts.h>
-#   include <sys/scsi/scsi_types.h>
-#   include <sys/scsi/impl/uscsi.h>
-#endif
 #ifdef DARWIN_DVD_IOCTL
 #   include <IOKit/storage/IODVDMediaBSDClient.h>
 #endif
@@ -73,10 +66,7 @@
 /*****************************************************************************
  * Local prototypes, OS specific
  *****************************************************************************/
-#if defined( SOLARIS_USCSI )
-static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
-static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
-#elif defined( WIN32 )
+#if defined( WIN32 )
 static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
 #endif
 
@@ -107,21 +97,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
 
     *pi_copyright = dvd.cpst;
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, 8 );
-
-    rs_cdb.cdb_opaque[ 6 ] = i_layer;
-    rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
-    i_ret = SolarisSendUSCSI(i_fd, &sc);
-
-    if( i_ret < 0 || sc.uscsi_status ) {
-        i_ret = -1;
-    }
-
-    *pi_copyright = p_buffer[ 4 ];
-    /* s->copyright.rmi = p_buffer[ 5 ]; */
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDCopyrightInfo,
                    kDVDStructureFormatCopyrightInfo );
@@ -195,22 +170,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
 
     memcpy( p_key, dvd.data, DVD_DISCKEY_SIZE );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
-
-    rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_DISCKEY;
-    rs_cdb.cdb_opaque[ 10 ] = *pi_agid << 6;
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-        return i_ret;
-    }
-
-    memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDDiscKeyInfo,
                    kDVDStructureFormatDiscKeyInfo );
@@ -277,29 +236,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
 
     memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_REPORT_KEY, 12 );
-
-    rs_cdb.cdb_opaque[ 2 ] = ( i_pos >> 24 ) & 0xff;
-    rs_cdb.cdb_opaque[ 3 ] = ( i_pos >> 16 ) & 0xff;
-    rs_cdb.cdb_opaque[ 4 ] = ( i_pos >>  8 ) & 0xff;
-    rs_cdb.cdb_opaque[ 5 ] = ( i_pos       ) & 0xff;
-    rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
-    /* Do we want to return the cp_sec flag perhaps? */
-    /* a->lstk.cpm    = (buf[ 4 ] >> 7) & 1; */
-    /* a->lstk.cp_sec = (buf[ 4 ] >> 6) & 1; */
-    /* a->lstk.cgms   = (buf[ 4 ] >> 4) & 3; */
-
-    memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_report_key_t, DVDTitleKeyInfo,
                    kDVDKeyFormatTitleKey );
@@ -365,20 +301,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
 
     *pi_agid = auth_info.agid;
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_REPORT_KEY, 8 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
-    *pi_agid = p_buffer[ 7 ] >> 6;
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationGrantIDInfo,
                    kDVDKeyFormatAGID_CSS );
@@ -433,20 +355,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
 
     memcpy( p_challenge, auth_info.keychal, DVD_CHALLENGE_SIZE );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_REPORT_KEY, 16 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
-    memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_report_key_t, DVDChallengeKeyInfo,
                    kDVDKeyFormatChallengeKey );
@@ -511,20 +419,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
 
     *pi_asf = auth_info.asf;
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_REPORT_KEY, 8 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_ASF;
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
-    *pi_asf = p_buffer[ 7 ] & 1;
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationSuccessFlagInfo,
                    kDVDKeyFormatASF );
@@ -591,20 +485,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
 
     memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_REPORT_KEY, 12 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
-    memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_report_key_t, DVDKey1Info,
                    kDVDKeyFormatKey1 );
@@ -660,18 +540,6 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
 
     i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_REPORT_KEY, 0 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVDCSS_INVALIDATE_AGID | (*pi_agid << 6);
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_send_key_t, DVDAuthenticationGrantIDInfo,
                    kDVDKeyFormatAGID_Invalidate );
@@ -720,21 +588,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
 
     i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_SEND_KEY, 16 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
-
-    p_buffer[ 1 ] = 0xe;
-    memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
-    if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
-    {
-        return -1;
-    }
-
-    i_ret = 0;
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_send_key_t, DVDChallengeKeyInfo,
                    kDVDKeyFormatChallengeKey );
@@ -796,21 +649,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
 
     i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_SEND_KEY, 12 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
-
-    p_buffer[ 1 ] = 0xa;
-    memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
-    if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
-    {
-        return -1;
-    }
-
-    i_ret = 0;
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_send_key_t, DVDKey2Info,
                    kDVDKeyFormatKey2 );
@@ -878,22 +716,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
     *p_mask = auth_info.region; // ??
     *p_scheme = auth_info.rpc_scheme;
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_REPORT_KEY, 8 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_RPC;
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
-    *p_type = p_buffer[ 4 ] >> 6;
-    *p_mask = p_buffer[ 5 ];
-    *p_scheme = p_buffer[ 6 ];
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_report_key_t, DVDRegionPlaybackControlInfo,
                    kDVDKeyFormatRegionState );
@@ -938,106 +760,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
 
 /* Local prototypes */
 
-#if defined( SOLARIS_USCSI )
-/*****************************************************************************
- * SolarisInitUSCSI: initialize a USCSICMD structure for the Solaris kernel
- *****************************************************************************
- * This function initializes a Solaris userspace SCSI command structure for
- * future use, either a read command or a write command.
- *****************************************************************************/
-static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type )
-{
-    union scsi_cdb *rs_cdb;
-    memset( p_sc->uscsi_cdb, 0, sizeof( union scsi_cdb ) );
-    memset( p_sc->uscsi_bufaddr, 0, p_sc->uscsi_buflen );
-
-    switch( i_type )
-    {
-        case GPCMD_SEND_KEY:
-            p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_WRITE;
-            break;
-
-        case GPCMD_READ_DVD_STRUCTURE:
-        case GPCMD_REPORT_KEY:
-            p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_READ;
-            break;
-    }
-
-    rs_cdb = (union scsi_cdb *)p_sc->uscsi_cdb;
-
-    rs_cdb->scc_cmd = i_type;
-
-    rs_cdb->cdb_opaque[ 8 ] = (p_sc->uscsi_buflen >> 8) & 0xff;
-    rs_cdb->cdb_opaque[ 9 ] =  p_sc->uscsi_buflen       & 0xff;
-    p_sc->uscsi_cdblen = 12;
-    p_sc->uscsi_timeout = 15;
-}
-
-/*****************************************************************************
- * SolarisSendUSCSI: send a USCSICMD structure to the Solaris kernel
- * for execution
- *****************************************************************************
- * When available, this function uses the function smedia_uscsi_cmd()
- * from Solaris' libsmedia library (Solaris 9 or newer) to execute the
- * USCSI command.  smedia_uscsi_cmd() allows USCSI commands for
- * non-root users on removable media devices on Solaris 9; sending the
- * USCSI command directly to the device using the USCSICMD ioctl fails
- * with an EPERM error on Solaris 9.
- *
- * The code will fall back to the USCSICMD ioctl method, when
- * libsmedia.so is not available or does not export the
- * smedia_uscsi_cmd() function (on Solaris releases up to and including
- * Solaris 8). Fortunately, on these old releases non-root users are
- * allowed to perform USCSICMD ioctls on removable media devices.
- *****************************************************************************/
-static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc )
-{
-    void *p_handle;
-
-    /* We use static variables to keep track of the libsmedia symbols, which
-     * is harmless even in a multithreaded program because the library and
-     * its symbols will always be mapped at the same address. */
-    static int b_tried = 0;
-    static int b_have_sm = 0;
-    static void * (*p_get_handle) ( int32_t );
-    static int (*p_uscsi_cmd) ( void *, struct uscsi_cmd * );
-    static int (*p_release_handle) ( void * );
-
-    if( !b_tried )
-    {
-        void *p_lib;
-
-        p_lib = dlopen( "libsmedia.so", RTLD_NOW );
-        if( p_lib )
-        {
-            p_get_handle = dlsym( p_lib, "smedia_get_handle" );
-            p_uscsi_cmd = dlsym( p_lib, "smedia_uscsi_cmd" );
-            p_release_handle = dlsym( p_lib, "smedia_release_handle" );
-
-            if( p_get_handle && p_uscsi_cmd && p_release_handle )
-            {
-                b_have_sm = 1;
-            }
-            else
-            {
-                dlclose( p_lib );
-            }
-        }
-
-        b_tried = 1;
-    }
-
-    if( b_have_sm && (p_handle = p_get_handle(i_fd)) )
-    {
-        int i_ret = p_uscsi_cmd( p_handle, p_sc );
-        p_release_handle( p_handle );
-        return i_ret;
-    }
-
-    return ioctl( i_fd, USCSICMD, p_sc );
-}
-#endif /* defined( SOLARIS_USCSI ) */
-
 #if defined( WIN32 )
 /*****************************************************************************
  * WinInitSPTD: initialize a sptd structure
diff --git a/src/ioctl.h b/src/ioctl.h
index eb8cd8d..98119b5 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -44,16 +44,7 @@ int ioctl_ReportRPC         ( int, int *, int *, int * );
 /*****************************************************************************
  * Common macros, OS specific
  *****************************************************************************/
-#if defined( SOLARIS_USCSI )
-#define INIT_USCSI( TYPE, SIZE ) \
-    struct uscsi_cmd sc = { 0 }; \
-    union scsi_cdb rs_cdb; \
-    uint8_t p_buffer[ (SIZE)+1 ]; \
-    sc.uscsi_cdb = (caddr_t)&rs_cdb; \
-    sc.uscsi_bufaddr = (caddr_t)p_buffer; \
-    sc.uscsi_buflen = (SIZE); \
-    SolarisInitUSCSI( &sc, (TYPE) );
-#elif defined( DARWIN_DVD_IOCTL )
+#if defined( DARWIN_DVD_IOCTL )
 #define INIT_DVDIOCTL( DKDVD_TYPE, BUFFER_TYPE, FORMAT ) \
     DKDVD_TYPE dvd = { 0 }; \
     BUFFER_TYPE dvdbs = { 0 }; \
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 85edba5..ab5b665 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,7 @@
  * device without having to bother about the decryption. The important features
  * are:
  * \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- *     NetBSD, OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0)
- *     or later.
+ *     NetBSD, OpenBSD, Mac OS X, and Windows NT 4.0 (with IE 5.0) or later.
  * \li adaptability: Unlike most similar projects, libdvdcss does not require
  *     the region of your drive to be set and will try its best to read from
  *     the disc even in the case of a region mismatch.
diff --git a/test/dvd_region.c b/test/dvd_region.c
index d601386..e8f18e5 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -57,21 +57,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )
 
     i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
 
-#elif defined( SOLARIS_USCSI )
-    INIT_USCSI( GPCMD_SEND_KEY, 8 );
-
-    rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_RPC;
-
-    p_buffer[ 1 ] = 6;
-    p_buffer[ 4 ] = i_pdrc;
-
-    i_ret = SolarisSendUSCSI( i_fd, &sc );
-
-    if( i_ret < 0 || sc.uscsi_status )
-    {
-        i_ret = -1;
-    }
-
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_send_key_t, DVDRegionPlaybackControlInfo,
                    kDVDKeyFormatSetRegion );
-- 
1.9.1



More information about the libdvdcss-devel mailing list