[xiph-commits] r15181 - in trunk/cdparanoia: . interface paranoia

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Aug 14 06:56:21 PDT 2008


Author: xiphmont
Date: 2008-08-14 06:56:20 -0700 (Thu, 14 Aug 2008)
New Revision: 15181

Modified:
   trunk/cdparanoia/cdparanoia.1
   trunk/cdparanoia/interface/scsi_interface.c
   trunk/cdparanoia/interface/utils.h
   trunk/cdparanoia/main.c
   trunk/cdparanoia/paranoia/gap.c
Log:
Add updated functionality equivalent to several patches RedHat 
deployed in previous cdparanoia versions.



Modified: trunk/cdparanoia/cdparanoia.1
===================================================================
--- trunk/cdparanoia/cdparanoia.1	2008-08-13 19:34:18 UTC (rev 15180)
+++ trunk/cdparanoia/cdparanoia.1	2008-08-14 13:56:20 UTC (rev 15181)
@@ -125,15 +125,31 @@
 proprietary).
 
 .TP
+.BI "\-k --force-cooked-device " device
+This option forces use of the old 'cooked ioctl' kernel 
+interface with the specified cdrom device.  The cooked ioctl interface
+is obsolete in Linux 2.6 if it is present at all.  
+.B \-k 
+cannot be used 
+with
+.B \-d 
+or 
+.BR \-g .
+
+
+.TP
 .BI "\-g --force-generic-device " device
 This option forces use of the old 'generic scsi' (sg) kernel 
-interface with the specified generic scsi device.
+interface with the specified generic scsi device. 
+.B \-g 
+cannot be used with
+.BR \-k .
 .B \-g
 may be used with
 .B \-d
 to explicitly set both the SCSI cdrom and
 generic (sg) devices seperately. This option is only useful on
-non-standard SCSI setups and when using the generic scsi (sg) driver. 
+obsolete SCSI setups and when using the generic scsi (sg) driver. 
 
 .TP
 .BI "\-S --force-read-speed " number

Modified: trunk/cdparanoia/interface/scsi_interface.c
===================================================================
--- trunk/cdparanoia/interface/scsi_interface.c	2008-08-13 19:34:18 UTC (rev 15180)
+++ trunk/cdparanoia/interface/scsi_interface.c	2008-08-14 13:56:20 UTC (rev 15181)
@@ -14,12 +14,6 @@
 
 /* hook */
 static int Dummy (cdrom_drive *d,int s){
-  if(d->opened){
-    fprintf(stderr,"Disabling cache\n");
-    set_read_ahead(d,
-		   cdda_track_firstsector(d,1),
-		   cdda_track_lastsector(d,d->tracks));
-  }
   return(0);
 }
 
@@ -58,7 +52,7 @@
   /* so since we never go above q->max_sectors, we should never get -EIO.
    * we might still get -ENOMEM, but we back off for that later.  Monty
    * had an old comment: "not too much; new kernels have trouble with DMA
-   * "allocation, so be more conservative: 32kB max until I test more 
+   * allocation, so be more conservative: 32kB max until I test more 
    * thoroughly".  We're not currently honoring that, because we should
    * always get -ENOMEM.
    *
@@ -617,7 +611,7 @@
   return(0);
 }
 
-int set_read_ahead (cdrom_drive *d, int start, int end){
+static int set_read_ahead (cdrom_drive *d, int start, int end){
   int err;
   unsigned char sense[SG_MAX_SENSE];
   unsigned char cmd[12]={0xA7, /* SET READ AHEAD */

Modified: trunk/cdparanoia/interface/utils.h
===================================================================
--- trunk/cdparanoia/interface/utils.h	2008-08-13 19:34:18 UTC (rev 15180)
+++ trunk/cdparanoia/interface/utils.h	2008-08-14 13:56:20 UTC (rev 15181)
@@ -111,9 +111,8 @@
       d->errorbuf=catstring(d->errorbuf,s);
       break;
     case CDDA_MESSAGE_FORGETIT:
-      ;
     default:
-      ;
+      break;
     }
   }
 }
@@ -128,9 +127,8 @@
       d->messagebuf=catstring(d->messagebuf,s);
       break;
     case CDDA_MESSAGE_FORGETIT:
-      ;
     default:
-      ;
+      break;
     }
   }
 }
@@ -172,9 +170,8 @@
       }
       break;
     case CDDA_MESSAGE_FORGETIT:
-      ;
     default:
-      ;
+      break;
     }
   }
   if(malloced)free(buffer);
@@ -210,9 +207,8 @@
 	}
       break;
     case CDDA_MESSAGE_FORGETIT:
-      ;
     default:
-      ;
+      break;
     }
   }
   if(malloced)free(buffer);

Modified: trunk/cdparanoia/main.c
===================================================================
--- trunk/cdparanoia/main.c	2008-08-13 19:34:18 UTC (rev 15180)
+++ trunk/cdparanoia/main.c	2008-08-14 13:56:20 UTC (rev 15181)
@@ -242,7 +242,13 @@
 "                                    verification to n sectors\n"
 "  -d --force-cdrom-device   <dev> : use specified device; disallow \n"
 "                                    autosense\n"
-"  -g --force-generic-device <dev> : use specified generic scsi device\n"
+"  -k --force-cooked-device  <dev> : use specified cdrom device and force\n"
+"                                    use of the old 'cooked ioctl' kernel\n"
+"                                    interface. -k cannot be used with -d\n"
+"                                    or -g.\n"
+"  -g --force-generic-device <dev> : use specified generic scsi device and\n"
+"                                    force use of the old SG kernel\n"
+"                                    interface. -g cannot be used with -k.\n"
 "  -S --force-read-speed <n>       : read from device at specified speed\n"
 "  -t --toc-offset <n>             : Add <n> sectors to the values reported\n"
 "                                    when addressing tracks. May be negative\n"
@@ -576,7 +582,7 @@
     memset(dispcache,' ',graph);
 }
 
-const char *optstring = "escCn:o:O:d:g:S:prRwafvqVQhZz::YXWBi:Tt:l:";
+const char *optstring = "escCn:o:O:d:g:k:S:prRwafvqVQhZz::YXWBi:Tt:l:";
 
 struct option options [] = {
 	{"stderr-progress",no_argument,NULL,'e'},
@@ -586,6 +592,7 @@
 	{"force-default-sectors",required_argument,NULL,'n'},
 	{"force-search-overlap",required_argument,NULL,'o'},
 	{"force-cdrom-device",required_argument,NULL,'d'},
+	{"force-cooked-device",required_argument,NULL,'k'},
 	{"force-generic-device",required_argument,NULL,'g'},
 	{"force-read-speed",required_argument,NULL,'S'},
 	{"sample-offset",required_argument,NULL,'O'},
@@ -646,6 +653,7 @@
   int force_cdrom_overlap=-1;
   char *force_cdrom_device=NULL;
   char *force_generic_device=NULL;
+  char *force_cooked_device=NULL;
   int force_cdrom_speed=-1;
   int max_retries=20;
   char *span=NULL;
@@ -687,9 +695,22 @@
       force_cdrom_device=copystring(optarg);
       break;
     case 'g':
+      if(force_cooked_device){
+	report3("-g option incompatable with -k\n");
+	exit(1);
+      }
+      force_cooked_device=NULL;
       if(force_generic_device)free(force_generic_device);
       force_generic_device=copystring(optarg);
       break;
+    case 'k':
+      if(force_generic_device || force_cdrom_device){
+	report3("-k option incompatable with -d and -g\n");
+	exit(1);
+      }
+      if(force_cooked_device)free(force_cooked_device);
+      force_cooked_device=copystring(optarg);
+      break;
     case 'S':
       force_cdrom_speed=atoi(optarg);
       break;
@@ -730,7 +751,7 @@
       break;
     case 'e':
       callscript=1;
-      fprintf(stderr,"Sending all callcaks to stderr for wrapper script\n");
+      fprintf(stderr,"Sending all callbacks to stderr for wrapper script\n");
       break;
     case 'V':
       fprintf(stderr,VERSION);
@@ -829,7 +850,9 @@
 
   /* Query the cdrom/disc; we may need to override some settings */
 
-  if(force_generic_device)
+  if(force_cooked_device){
+    d=cdda_identify_cooked(force_cooked_device,verbose,NULL);
+  }else if(force_generic_device)
     d=cdda_identify_scsi(force_generic_device,force_cdrom_device,verbose,NULL);
   else
     if(force_cdrom_device)
@@ -928,7 +951,8 @@
     exit(1);
   }
 
-  cdda_cache_sectors(d);
+  /* Determine drive caching behavior for cache-busting purposes */
+  /* cdda_cache_sectors(d); */
 
   /* Dump the TOC */
   if(query_only || verbose)display_toc(d);

Modified: trunk/cdparanoia/paranoia/gap.c
===================================================================
--- trunk/cdparanoia/paranoia/gap.c	2008-08-13 19:34:18 UTC (rev 15180)
+++ trunk/cdparanoia/paranoia/gap.c	2008-08-14 13:56:20 UTC (rev 15181)
@@ -9,6 +9,7 @@
 #include "p_block.h"
 #include "cdda_paranoia.h"
 #include "gap.h"
+#include <string.h>
 
 /**** Gap analysis code ***************************************************/
 



More information about the commits mailing list