[Debburn-changes] r395 - in nonameyet/trunk: . cdrecord debian libscg

Eduard Bloch blade at alioth.debian.org
Wed Nov 15 12:38:02 CET 2006


Author: blade
Date: 2006-11-15 12:38:01 +0100 (Wed, 15 Nov 2006)
New Revision: 395

Modified:
   nonameyet/trunk/Changelog
   nonameyet/trunk/cdrecord/cdrecord.c
   nonameyet/trunk/debian/changelog
   nonameyet/trunk/libscg/scsi-linux-ata.c
   nonameyet/trunk/libscg/scsiopen.c
Log:
mapping of ATAPI: -> ATA: method on linux-2.6 and some code beautification

Modified: nonameyet/trunk/Changelog
===================================================================
--- nonameyet/trunk/Changelog	2006-11-07 21:27:12 UTC (rev 394)
+++ nonameyet/trunk/Changelog	2006-11-15 11:38:01 UTC (rev 395)
@@ -1,3 +1,10 @@
+cdrkit (1.0pre6) UNRELEASED; urgency=low
+
+  [ Eduard Bloch ]
+  * mapping of ATAPI: -> ATA: method on linux-2.6 and some code beautification
+
+ -- Eduard Bloch <blade at debian.org>  Wed, 15 Nov 2006 12:30:01 +0100
+
 cdrkit (1.0pre5) UNRELEASED; urgency=low
 
   [ Eduard Bloch ]

Modified: nonameyet/trunk/cdrecord/cdrecord.c
===================================================================
--- nonameyet/trunk/cdrecord/cdrecord.c	2006-11-07 21:27:12 UTC (rev 394)
+++ nonameyet/trunk/cdrecord/cdrecord.c	2006-11-15 11:38:01 UTC (rev 395)
@@ -563,36 +563,25 @@
 		exit(0);
 	}
 
-	/*
-	 * XXX scg_open() needs root privilleges (According to Joerg Schilling, but let's try anyway)
-	 */
-	if (
-        (scgp = scg_open(dev, errstr, sizeof (errstr),
-                         debug, 
-                  /* disabled unless one can explain my what is so special about the F_MSINFO option that the absense of it requires printing of the uber-verbose scg messages  (flags & F_MSINFO) == 0 || */
-                         lverbose)) == (SCSI *)0
-        ) 
+  scgp = scg_open(dev, errstr, sizeof (errstr),
+        debug, lverbose);
+  if(!scgp && dev) {
+     char *dalt;
+     int len=5+strlen(dev);
+     dalt=calloc(len, sizeof(char));
+     strcat(dalt, "ATA:");
+     strcat(dalt+4, dev);
+     scgp = scg_open(dalt, errstr, sizeof (errstr),
+           debug, lverbose);
+  }
+  if(!scgp)
   {
-      if (dev != NULL 
-            || (flags & F_SCANBUS) == 0 
-            || (scgp = scg_open("ATA", errstr, sizeof (errstr),
-                  debug, 
-                  /* disabled unless one can explain my what is so special about the F_MSINFO option that the absense of it requires printing of the uber-verbose scg messages  (flags & F_MSINFO) == 0 || */
-                            lverbose)) == (SCSI *)0
-            )
-      {
-         errmsg("%s%sCannot open SCSI driver.\n", errstr, errstr[0]?". ":"");
-         errmsgno(EX_BAD, "For possible targets try 'wodim -scanbus'.%s\n",
-               geteuid() ? " Make sure you are root.":"");
-         errmsgno(EX_BAD, "For possible transport specifiers try 'wodim dev=help'.\n");
-         errmsgno(EX_BAD, "\n");
-         errmsgno(EX_BAD, "For more information, install the cdrkit-doc\n");
-         errmsgno(EX_BAD, "package and read /usr/share/doc/wodim/README.ATAPI.setup .\n");
-         exit(EX_BAD);
-      }
-      else {
-         dev = "ATA";
-      }
+     errmsg("\nCannot open SCSI driver!\n"
+           "For possible targets try 'wodim -scanbus'.\n"
+           "For possible transport specifiers try 'wodim dev=help'.\n"
+           "For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from\n"
+           "the wodim documentation.\n");
+     exit(EX_BAD);
   }
 #ifdef	HAVE_PRIV_SET
 #ifdef	PRIV_DEBUG

Modified: nonameyet/trunk/debian/changelog
===================================================================
--- nonameyet/trunk/debian/changelog	2006-11-07 21:27:12 UTC (rev 394)
+++ nonameyet/trunk/debian/changelog	2006-11-15 11:38:01 UTC (rev 395)
@@ -1,3 +1,9 @@
+cdrkit (5:1.0~pre5-1.1) unstable; urgency=low
+
+  * ATAPI -> ATA mapping and better error messages
+
+ -- Eduard Bloch <blade at debian.org>  Tue, 14 Nov 2006 15:08:16 +0100
+
 cdrkit (5:1.0~pre5-1) unstable; urgency=low
 
   * New upstream source snapshot

Modified: nonameyet/trunk/libscg/scsi-linux-ata.c
===================================================================
--- nonameyet/trunk/libscg/scsi-linux-ata.c	2006-11-07 21:27:12 UTC (rev 394)
+++ nonameyet/trunk/libscg/scsi-linux-ata.c	2006-11-15 11:38:01 UTC (rev 395)
@@ -738,7 +738,7 @@
 		!(token[ID_TOKEN_DEV]) ||
 		strcmp(token[ID_TOKEN_DEV], TOKEN_DEV)) {
 
-		errmsgno(EX_BAD, "ERROR: unknow format\n");
+		errmsgno(EX_BAD, "ERROR: unknown format\n");
 		errmsgno(EX_BAD, "EXAMPLE: /dev/scsi/host1/bus2/target3/lun4/cd\n");
 		errmsgno(EX_BAD, "EXAMPLE: /dev/ide/host0/bus0/target1/lun0/cd\n");
 		errmsgno(EX_BAD, "EXAMPLE: /dev/hda or /dev/sr0\n");

Modified: nonameyet/trunk/libscg/scsiopen.c
===================================================================
--- nonameyet/trunk/libscg/scsiopen.c	2006-11-07 21:27:12 UTC (rev 394)
+++ nonameyet/trunk/libscg/scsiopen.c	2006-11-15 11:38:01 UTC (rev 395)
@@ -67,6 +67,11 @@
 #include <scg/scsireg.h>
 #include <scg/scsitransp.h>
 
+#if    defined(linux) || defined(__linux) || defined(__linux__)
+#include <sys/utsname.h>
+#endif
+
+
 #define	strbeg(s1, s2)	(strstr((s2), (s1)) == (s2))
 
 extern	int	lverbose;
@@ -131,6 +136,22 @@
 	scgp->debug = debug;
 	scgp->overbose = be_verbose;
 
+#ifdef __linux__
+  struct utsname buf; 
+  if(scsidev) {
+     if(0==strncmp(scsidev, "ATAPI:", 6) &&
+           0==uname( &buf ) &&
+           0==strncmp(buf.release, "2.6", 3) ) {
+        scsidev+=6;
+        fprintf(stderr, "\nWarning, the ATAPI: method is considered deprecated on modern kernels!\n"
+              "Mapping device specification to dev=%s now.\n"
+              "To force the old ATAPI: method, replace ATAPI: with OLDATAPI:\n", scsidev);
+     }
+     else if(0==strncmp(scsidev, "OLDATAPI:", 9))
+        scsidev+=3;
+  }
+#endif
+
 	devname[0] = '\0';
 	if (scsidev != NULL && scsidev[0] != '\0') {
 		sdev = scsidev;




More information about the Debburn-changes mailing list