linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix: BK-Current doesn't compile w/o SCSI enabled
@ 2002-10-29 14:30 tytso
  2002-10-29 14:32 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: tytso @ 2002-10-29 14:30 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel, linux-scsi


BK current doesn't compile without SCSI being enabled, since
sg_scsi_ioctl() in drivers/block/scsi_ioctl.c is always being compiled,
regardless of whether or not SCSI is present (since some non-SCSI
devices now use this infrastructure).  Unfortunately, it makes reference
to the COMMAND_SIZE() macro, which is defined in drivers/scsi/scsi.c,
and that is NOT defined on non-SCSI build kernels.

The simplest solution to this problem seems to be move scsi_command_size
from drivers/scsi/scsi.c to drivers/block/scsi_ioctl.c, where it is used
(and since it is always compiled in, this shouldn't break anything on
SCSI systems).

I'm a bit uneasy about the abstraction violation of moving the
scsi_command_size array outside of the drivers/scsi tree, but that
problem was introduced when the code in drivers/block/scsi_ioctl.c was
moved out of the drivers/scsi tree, since drivers/block/scsi_ioctl.c
already #includes ../scsi/scsi.h, so I haven't introduced a new layering
violation.

Jens, do you agree this is the best way of fixing this issue?  If so,
please push this change to Linus.  Thanks!!

					- Ted


diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c	Tue Oct 29 09:25:36 2002
+++ b/drivers/block/scsi_ioctl.c	Tue Oct 29 09:25:36 2002
@@ -39,6 +39,14 @@
 
 #define BLK_DEFAULT_TIMEOUT	(60 * HZ)
 
+/* Command group 3 is reserved and should never be used.  */
+const unsigned char scsi_command_size[8] =
+{
+	6, 10, 10, 12,
+	16, 12, 10, 10
+};
+EXPORT_SYMBOL(scsi_command_size);
+
 int blk_do_rq(request_queue_t *q, struct block_device *bdev, struct request *rq)
 {
 	DECLARE_COMPLETION(wait);
diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c	Tue Oct 29 09:25:36 2002
+++ b/drivers/scsi/scsi.c	Tue Oct 29 09:25:36 2002
@@ -123,12 +123,6 @@
  */
 unsigned long scsi_pid;
 Scsi_Cmnd *last_cmnd;
-/* Command group 3 is reserved and should never be used.  */
-const unsigned char scsi_command_size[8] =
-{
-	6, 10, 10, 12,
-	16, 12, 10, 10
-};
 static unsigned long serial_number;
 
 struct softscsi_data {
diff -Nru a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c
--- a/drivers/scsi/scsi_syms.c	Tue Oct 29 09:25:36 2002
+++ b/drivers/scsi/scsi_syms.c	Tue Oct 29 09:25:36 2002
@@ -39,7 +39,6 @@
 EXPORT_SYMBOL(scsi_bios_ptable);
 EXPORT_SYMBOL(scsi_allocate_device);
 EXPORT_SYMBOL(scsi_do_cmd);
-EXPORT_SYMBOL(scsi_command_size);
 EXPORT_SYMBOL(scsi_ioctl);
 EXPORT_SYMBOL(print_command);
 EXPORT_SYMBOL(print_sense);

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

* Re: [PATCH] Fix: BK-Current doesn't compile w/o SCSI enabled
  2002-10-29 14:30 [PATCH] Fix: BK-Current doesn't compile w/o SCSI enabled tytso
@ 2002-10-29 14:32 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2002-10-29 14:32 UTC (permalink / raw)
  To: tytso; +Cc: linux-kernel, linux-scsi

On Tue, Oct 29 2002, tytso@mit.edu wrote:
> 
> BK current doesn't compile without SCSI being enabled, since
> sg_scsi_ioctl() in drivers/block/scsi_ioctl.c is always being compiled,
> regardless of whether or not SCSI is present (since some non-SCSI
> devices now use this infrastructure).  Unfortunately, it makes reference
> to the COMMAND_SIZE() macro, which is defined in drivers/scsi/scsi.c,
> and that is NOT defined on non-SCSI build kernels.
> 
> The simplest solution to this problem seems to be move scsi_command_size
> from drivers/scsi/scsi.c to drivers/block/scsi_ioctl.c, where it is used
> (and since it is always compiled in, this shouldn't break anything on
> SCSI systems).
> 
> I'm a bit uneasy about the abstraction violation of moving the
> scsi_command_size array outside of the drivers/scsi tree, but that
> problem was introduced when the code in drivers/block/scsi_ioctl.c was
> moved out of the drivers/scsi tree, since drivers/block/scsi_ioctl.c
> already #includes ../scsi/scsi.h, so I haven't introduced a new layering
> violation.

I think the "violation" is ok, since the commandset they reference is
the same. So no problem there.

> Jens, do you agree this is the best way of fixing this issue?  If so,
> please push this change to Linus.  Thanks!!

I've already sent the very same patch to Linus earlier today,
bit-for-bit identical :-)

-- 
Jens Axboe


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

end of thread, other threads:[~2002-10-29 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-29 14:30 [PATCH] Fix: BK-Current doesn't compile w/o SCSI enabled tytso
2002-10-29 14:32 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).