public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH: cdrecord: avoiding scsi device numbering for ide devices
@ 2004-08-04 12:33 H.Rosmanith (Kernel Mailing List)
  2004-08-04 12:43 ` Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 103+ messages in thread
From: H.Rosmanith (Kernel Mailing List) @ 2004-08-04 12:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: schilling


hi,

I've written a patch for cdrecord/cdrtools. I've sent it to Joerg Schilling
already, but got no answer so far. Probably he's on vaccation.

I'm sending this to LKML too, because I've read about some ... nebulosity
with respect to scsi device numbering as used by cdrtools.

To cut a long story short: the patch avoids cdrecord having to use the
"virtual" scsi device numbering in the form of "ATAPI:x.y.z" and allows
you to use the name of the device, e.g. /dev/hdc instead.

By removing the IDE to virtual scsi bus/host/lun mapping, a lot of confusion
can be avoided especially if you have a lot devices of this kind in one
system.

with kind regards,
Herbert "herp" Rosmanith

Version: cdrtools-2.01a34

Solution: when the device specified in dev= starts with "/dev/hd" and
          this device can be found in /proc/ide, then cdrecord (and all
          it's components, such as e.g. cdrdao) is forced to use the
          ATAPI driver.

The patch is really very short and works at least on our system.

with kind regards,
Herbert Rosmanith

--- snip ---
diff -ru cdrtools-2.01.orig/libscg/scsi-linux-ata.c cdrtools-2.01/libscg/scsi-linux-ata.c
--- cdrtools-2.01.orig/libscg/scsi-linux-ata.c	Sat Jun 12 12:48:12 2004
+++ cdrtools-2.01/libscg/scsi-linux-ata.c	Wed Aug  4 14:19:31 2004
@@ -42,6 +42,11 @@
  * You should have received a copy of the GNU General Public License along with
  * this program; see the file COPYING.  If not, write to the Free Software
  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Sat Jun 12 12:48:12 CEST 2004 herp - Herbert Rosmanith
+ *     Force ATAPI driver if dev= starts with /dev/hd and device
+ *     is present in /proc/ide/hdX
+ *
  */
 
 #ifdef	USE_ATA
@@ -60,7 +65,7 @@
 LOCAL	int	scgo_areset	__PR((SCSI *scgp, int what));
 LOCAL	int	scgo_asend	__PR((SCSI *scgp));
 
-LOCAL scg_ops_t ata_ops = {
+EXPORT scg_ops_t scg_ata_ops = {
 	scgo_asend,
 	scgo_aversion,
 	scgo_ahelp,
diff -ru cdrtools-2.01.orig/libscg/scsi-linux-sg.c cdrtools-2.01/libscg/scsi-linux-sg.c
--- cdrtools-2.01.orig/libscg/scsi-linux-sg.c	Thu May 20 15:42:12 2004
+++ cdrtools-2.01/libscg/scsi-linux-sg.c	Wed Aug  4 14:20:56 2004
@@ -40,6 +40,11 @@
  *	string is related to a modified source.
  *
  *	Copyright (c) 1997 J. Schilling
+ *
+ * Sat Jun 12 12:48:12 CEST 2004 herp - Herbert Rosmanith
+ *     Force ATAPI driver if dev= starts with /dev/hd and device
+ *     is present in /proc/ide/hdX
+ *
  */
 /*
  * This program is free software; you can redistribute it and/or modify
@@ -315,7 +320,7 @@
 	if (device != NULL && *device != '\0') {
 #ifdef	USE_ATA
 		if (strncmp(device, "ATAPI", 5) == 0) {
-			scgp->ops = &ata_ops;
+			scgp->ops = &scg_ata_ops;
 			return (SCGO_OPEN(scgp, device));
 		}
 #endif
diff -ru cdrtools-2.01.orig/libscg/scsitransp.c cdrtools-2.01/libscg/scsitransp.c
--- cdrtools-2.01.orig/libscg/scsitransp.c	Thu Jun 17 22:20:27 2004
+++ cdrtools-2.01/libscg/scsitransp.c	Wed Aug  4 14:26:07 2004
@@ -13,6 +13,11 @@
  *	string is related to a modified source.
  *
  *	Copyright (c) 1988,1995,2000-2004 J. Schilling
+ *
+ * Sat Jun 12 12:48:12 CEST 2004 herp - Herbert Rosmanith
+ *     Force ATAPI driver if dev= starts with /dev/hd and device
+ *     is present in /proc/ide/hdX
+ *
  */
 /*
  * This program is free software; you can redistribute it and/or modify
@@ -34,6 +39,7 @@
 #include <stdio.h>
 #include <standard.h>
 #include <stdxlib.h>
+#include <sys/stat.h>
 #include <unixstd.h>
 #include <errno.h>
 #include <timedefs.h>
@@ -157,7 +163,7 @@
 {
 	int	ret;
 	scg_ops_t *ops;
-extern	scg_ops_t scg_std_ops;
+extern	scg_ops_t scg_std_ops,scg_ata_ops;
 
 	/*
 	 * Begin restricted code for quality assurance.
@@ -185,6 +191,16 @@
 			scgp->ops = ops;
 	}
 
+	// XXX herp - check if atapi driver neccessary
+	//            and load if ide device found
+
+	if (device && strncmp(device,"/dev/hd",7)==0) {
+	char pdev[]="/proc/ide/XXXX";
+	struct stat st;
+		strncpy(pdev+10,device+5,4);    /* hdXY should be enough, eh? */
+		if (stat(pdev,&st)==0)
+			scgp->ops=&scg_ata_ops;
+	}
 	ret = SCGO_OPEN(scgp, device);
 	if (ret < 0)
 		return (ret);
--- snip ---


^ permalink raw reply	[flat|nested] 103+ messages in thread

end of thread, other threads:[~2004-08-23 21:28 UTC | newest]

Thread overview: 103+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-04 12:33 PATCH: cdrecord: avoiding scsi device numbering for ide devices H.Rosmanith (Kernel Mailing List)
2004-08-04 12:43 ` Jens Axboe
2004-08-04 12:58   ` Jens Axboe
2004-08-05  0:56     ` H.Rosmanith (Kernel Mailing List)
2004-08-05  5:47       ` Jens Axboe
2004-08-05  0:25   ` H.Rosmanith (Kernel Mailing List)
2004-08-05  5:43     ` Jens Axboe
2004-08-19  7:04 ` Patrick McFarland
2004-08-19 11:12   ` Wakko Warner
2004-08-19 11:32   ` Lee Revell
2004-08-19 11:43     ` Marc Ballarin
2004-08-19 12:06     ` Diego Calleja
2004-08-19 13:04       ` Joerg Schilling
2004-08-20 15:10         ` Stephan von Krawczynski
2004-08-23  9:09           ` Joerg Schilling
2004-08-23 21:25         ` Adrian Bunk
2004-08-19 12:42   ` Joerg Schilling
2004-08-19 12:41     ` Alan Cox
2004-08-19 14:34       ` Frank Steiner
2004-08-20  8:02         ` Patrick McFarland
2004-08-20 14:05           ` Joerg Schilling
2004-08-20 16:43             ` Christer Weinigel
2004-08-19 14:35       ` Christer Weinigel
2004-08-19 13:10     ` Martin Mares
2004-08-19 13:38       ` Joerg Schilling
2004-08-19 13:56         ` Martin Mares
2004-08-19 14:03           ` Joerg Schilling
2004-08-19 14:14             ` Martin Mares
2004-08-19 14:45               ` Frank Steiner
2004-08-19 15:00                 ` Martin Mares
2004-08-19 15:04                   ` Joerg Schilling
2004-08-19 15:14                     ` Martin Mares
2004-08-19 15:18                       ` Joerg Schilling
2004-08-19 17:32                         ` Martin Mares
2004-08-20 18:25                   ` Martin Schlemmer
2004-08-19 15:07               ` Matthias Andree
2004-08-19 15:16                 ` Joerg Schilling
2004-08-19 17:30                   ` Martin Mares
2004-08-20 15:28                   ` Andreas Jaeger
2004-08-20 16:37                     ` Julien Oster
2004-08-19 15:36                 ` Gene Heskett
2004-08-19 16:00                   ` Paul Rolland
2004-08-19 17:41                     ` Gene Heskett
2004-08-19 19:47                       ` GNU make alleged of "bug" (was: PATCH: cdrecord: avoiding scsi device numbering for ide devices) Matthias Andree
2004-08-19 22:05                         ` Sam Ravnborg
2004-08-19 20:53                           ` Matthias Andree
2004-08-19 22:31                             ` Joerg Schilling
2004-08-20  6:41                               ` Sam Ravnborg
2004-08-19 22:58                             ` Andreas Schwab
2004-08-20 16:15                             ` Tonnerre
2004-08-20 21:00                               ` Lee Revell
2004-08-23  9:18                               ` Joerg Schilling
2004-08-20  1:08                         ` Gene Heskett
2004-08-20  8:31                           ` Please no personal insults on this list (was: GNU make alleged of "bug") Matthias Andree
2004-08-19 14:29             ` PATCH: cdrecord: avoiding scsi device numbering for ide devices Christoph Hellwig
2004-08-19 15:29           ` Andreas Jaeger
     [not found]       ` <Pine.LNX.4.60.0408191909570.23309@hermes-1.csi.cam.ac.uk>
2004-08-20 13:40         ` Joerg Schilling
2004-08-19 14:14     ` Gerd Knorr
2004-08-19 14:32     ` Frank Steiner
2004-08-19 14:32       ` Alan Cox
2004-08-19 16:00         ` Bartlomiej Zolnierkiewicz
2004-08-19 16:07           ` Joerg Schilling
2004-08-19 17:32             ` Horst von Brand
2004-08-19 23:02               ` Bartlomiej Zolnierkiewicz
2004-08-20 13:37               ` Joerg Schilling
2004-08-20 13:49                 ` Patrick McFarland
2004-08-20 14:13                   ` Joerg Schilling
2004-08-19 17:59             ` Alan Cox
2004-08-20 13:41               ` Joerg Schilling
2004-08-20 13:09                 ` Alan Cox
2004-08-20 13:55                 ` Patrick McFarland
2004-08-20 14:24                 ` H.Rosmanith (Kernel Mailing List)
2004-08-20 14:37                   ` Joerg Schilling
2004-08-20 15:05                     ` Richard B. Johnson
2004-08-20 19:28                 ` Martin Schlemmer
2004-08-20 20:30                   ` Valdis.Kletnieks
2004-08-20 22:05                 ` Kyle Moffett
2004-08-20 23:30                   ` Andreas Steinmetz
2004-08-21  6:58                   ` David Greaves
2004-08-21  7:49                     ` Marc Ballarin
2004-08-21  9:04                       ` David Greaves
2004-08-21 11:19                         ` Marc Ballarin
2004-08-22 10:44                         ` Alan Cox
2004-08-22 17:09                           ` Adam Sampson
2004-08-21 11:06                     ` Xavier Bestel
2004-08-21 12:17                       ` David Greaves
2004-08-19 17:24           ` Horst von Brand
2004-08-19 18:06           ` Alan Cox
2004-08-19 19:19             ` Mark Lord
2004-08-19 22:57               ` Bartlomiej Zolnierkiewicz
2004-08-20 11:22                 ` Alan Cox
2004-08-20 11:18               ` Alan Cox
2004-08-20  7:46         ` Frank Steiner
2004-08-20 11:23           ` Alan Cox
2004-08-20 12:45             ` Frank Steiner
2004-08-20 11:51         ` Joerg Schilling
2004-08-20 11:25           ` Alan Cox
2004-08-20 14:11             ` Joerg Schilling
2004-08-20 13:46               ` Alan Cox
2004-08-21 12:43                 ` Joerg Schilling
     [not found]                   ` <1093171538.24341.24.camel@localhost.localdomain>
2004-08-22 12:00                     ` Joerg Schilling
2004-08-19 16:22   ` V13
2004-08-21  3:31 ` Patrick McFarland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox