diff mbox series

[v2,4/9] target: don't depend on SCSI

Message ID 20180731195155.46664-5-keescook@chromium.org (mailing list archive)
State New, archived
Headers show
Series block: Consolidate scsi sense buffer usage | expand

Commit Message

Kees Cook July 31, 2018, 7:51 p.m. UTC
From: Christoph Hellwig <hch@lst.de>

The core target code only needs code from scsi_common.c, which is now
separately selectable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/target/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Randy Dunlap Aug. 6, 2018, 11:38 p.m. UTC | #1
On 07/31/2018 12:51 PM, Kees Cook wrote:
> From: Christoph Hellwig <hch@lst.de>
> 
> The core target code only needs code from scsi_common.c, which is now
> separately selectable.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/target/Kconfig | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
> index 4c44d7bed01a..cb6f32ce7de8 100644
> --- a/drivers/target/Kconfig
> +++ b/drivers/target/Kconfig
> @@ -1,10 +1,10 @@
>  
>  menuconfig TARGET_CORE
>  	tristate "Generic Target Core Mod (TCM) and ConfigFS Infrastructure"
> -	depends on SCSI && BLOCK
> +	depends on BLOCK
>  	select CONFIGFS_FS
>  	select CRC_T10DIF
> -	select BLK_SCSI_REQUEST # only for scsi_command_size_tbl..
> +	select BLK_SCSI_REQUEST
>  	select SGL_ALLOC
>  	default n
>  	help
> @@ -29,6 +29,7 @@ config TCM_FILEIO
>  
>  config TCM_PSCSI
>  	tristate "TCM/pSCSI Subsystem Plugin for Linux/SCSI"
> +	depends on SCSI
>  	help
>  	Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
>  	passthrough access to Linux/SCSI device
> 

Hi,

This patch causes build errors in linux-next-20180806 when SCSI=m and
LOOPBACK_TARGET=y.

drivers/target/loopback/tcm_loop.o: In function `tcm_loop_port_link':
tcm_loop.c:(.text+0x445): undefined reference to `scsi_add_device'
drivers/target/loopback/tcm_loop.o: In function `tcm_loop_driver_remove':
tcm_loop.c:(.text+0x55c): undefined reference to `scsi_remove_host'
tcm_loop.c:(.text+0x564): undefined reference to `scsi_host_put'
drivers/target/loopback/tcm_loop.o: In function `tcm_loop_submission_work':
tcm_loop.c:(.text+0x7c4): undefined reference to `scmd_printk'
drivers/target/loopback/tcm_loop.o: In function `tcm_loop_driver_probe':
tcm_loop.c:(.text+0x7fb): undefined reference to `scsi_host_alloc'
tcm_loop.c:(.text+0x85b): undefined reference to `scsi_add_host_with_dma'
tcm_loop.c:(.text+0x896): undefined reference to `scsi_host_put'
drivers/target/loopback/tcm_loop.o: In function `tcm_loop_port_unlink':
tcm_loop.c:(.text+0x962): undefined reference to `scsi_device_lookup'
tcm_loop.c:(.text+0x972): undefined reference to `scsi_remove_device'
tcm_loop.c:(.text+0x97a): undefined reference to `scsi_device_put'
drivers/target/loopback/tcm_loop.o:(.data+0x210): undefined reference to `scsi_change_queue_depth'
Kees Cook Aug. 6, 2018, 11:59 p.m. UTC | #2
On Mon, Aug 6, 2018 at 4:38 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
> On 07/31/2018 12:51 PM, Kees Cook wrote:
>> From: Christoph Hellwig <hch@lst.de>
>>
>> The core target code only needs code from scsi_common.c, which is now
>> separately selectable.
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>>  drivers/target/Kconfig | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
>> index 4c44d7bed01a..cb6f32ce7de8 100644
>> --- a/drivers/target/Kconfig
>> +++ b/drivers/target/Kconfig
>> @@ -1,10 +1,10 @@
>>
>>  menuconfig TARGET_CORE
>>       tristate "Generic Target Core Mod (TCM) and ConfigFS Infrastructure"
>> -     depends on SCSI && BLOCK
>> +     depends on BLOCK
>>       select CONFIGFS_FS
>>       select CRC_T10DIF
>> -     select BLK_SCSI_REQUEST # only for scsi_command_size_tbl..
>> +     select BLK_SCSI_REQUEST
>>       select SGL_ALLOC
>>       default n
>>       help
>> @@ -29,6 +29,7 @@ config TCM_FILEIO
>>
>>  config TCM_PSCSI
>>       tristate "TCM/pSCSI Subsystem Plugin for Linux/SCSI"
>> +     depends on SCSI
>>       help
>>       Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
>>       passthrough access to Linux/SCSI device
>>
>
> Hi,
>
> This patch causes build errors in linux-next-20180806 when SCSI=m and
> LOOPBACK_TARGET=y.
>
> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_port_link':
> tcm_loop.c:(.text+0x445): undefined reference to `scsi_add_device'
> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_driver_remove':
> tcm_loop.c:(.text+0x55c): undefined reference to `scsi_remove_host'
> tcm_loop.c:(.text+0x564): undefined reference to `scsi_host_put'
> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_submission_work':
> tcm_loop.c:(.text+0x7c4): undefined reference to `scmd_printk'
> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_driver_probe':
> tcm_loop.c:(.text+0x7fb): undefined reference to `scsi_host_alloc'
> tcm_loop.c:(.text+0x85b): undefined reference to `scsi_add_host_with_dma'
> tcm_loop.c:(.text+0x896): undefined reference to `scsi_host_put'
> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_port_unlink':
> tcm_loop.c:(.text+0x962): undefined reference to `scsi_device_lookup'
> tcm_loop.c:(.text+0x972): undefined reference to `scsi_remove_device'
> tcm_loop.c:(.text+0x97a): undefined reference to `scsi_device_put'
> drivers/target/loopback/tcm_loop.o:(.data+0x210): undefined reference to `scsi_change_queue_depth'

Can you send your .config? I'm struggling to get a build with SCSI=m. :P

I wonder if LOOPBACK_TARGET is just missing a "depends on SCSI" as was
added for TCM_PSCSI?

-Kees
Randy Dunlap Aug. 7, 2018, 12:52 a.m. UTC | #3
On 08/06/2018 04:59 PM, Kees Cook wrote:
> On Mon, Aug 6, 2018 at 4:38 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
>> On 07/31/2018 12:51 PM, Kees Cook wrote:
>>> From: Christoph Hellwig <hch@lst.de>
>>>
>>> The core target code only needs code from scsi_common.c, which is now
>>> separately selectable.
>>>
>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>> Signed-off-by: Kees Cook <keescook@chromium.org>
>>> ---
>>>  drivers/target/Kconfig | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
>>> index 4c44d7bed01a..cb6f32ce7de8 100644
>>> --- a/drivers/target/Kconfig
>>> +++ b/drivers/target/Kconfig
>>> @@ -1,10 +1,10 @@
>>>
>>>  menuconfig TARGET_CORE
>>>       tristate "Generic Target Core Mod (TCM) and ConfigFS Infrastructure"
>>> -     depends on SCSI && BLOCK
>>> +     depends on BLOCK
>>>       select CONFIGFS_FS
>>>       select CRC_T10DIF
>>> -     select BLK_SCSI_REQUEST # only for scsi_command_size_tbl..
>>> +     select BLK_SCSI_REQUEST
>>>       select SGL_ALLOC
>>>       default n
>>>       help
>>> @@ -29,6 +29,7 @@ config TCM_FILEIO
>>>
>>>  config TCM_PSCSI
>>>       tristate "TCM/pSCSI Subsystem Plugin for Linux/SCSI"
>>> +     depends on SCSI
>>>       help
>>>       Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
>>>       passthrough access to Linux/SCSI device
>>>
>>
>> Hi,
>>
>> This patch causes build errors in linux-next-20180806 when SCSI=m and
>> LOOPBACK_TARGET=y.
>>
>> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_port_link':
>> tcm_loop.c:(.text+0x445): undefined reference to `scsi_add_device'
>> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_driver_remove':
>> tcm_loop.c:(.text+0x55c): undefined reference to `scsi_remove_host'
>> tcm_loop.c:(.text+0x564): undefined reference to `scsi_host_put'
>> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_submission_work':
>> tcm_loop.c:(.text+0x7c4): undefined reference to `scmd_printk'
>> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_driver_probe':
>> tcm_loop.c:(.text+0x7fb): undefined reference to `scsi_host_alloc'
>> tcm_loop.c:(.text+0x85b): undefined reference to `scsi_add_host_with_dma'
>> tcm_loop.c:(.text+0x896): undefined reference to `scsi_host_put'
>> drivers/target/loopback/tcm_loop.o: In function `tcm_loop_port_unlink':
>> tcm_loop.c:(.text+0x962): undefined reference to `scsi_device_lookup'
>> tcm_loop.c:(.text+0x972): undefined reference to `scsi_remove_device'
>> tcm_loop.c:(.text+0x97a): undefined reference to `scsi_device_put'
>> drivers/target/loopback/tcm_loop.o:(.data+0x210): undefined reference to `scsi_change_queue_depth'
> 
> Can you send your .config? I'm struggling to get a build with SCSI=m. :P

Sure, it's attached.


> I wonder if LOOPBACK_TARGET is just missing a "depends on SCSI" as was
> added for TCM_PSCSI?

possibly.
Christoph Hellwig Aug. 7, 2018, 5:44 a.m. UTC | #4
On Mon, Aug 06, 2018 at 04:59:04PM -0700, Kees Cook wrote:
> I wonder if LOOPBACK_TARGET is just missing a "depends on SCSI" as was
> added for TCM_PSCSI?

That is eactly the case.  LOOPBACK_TARGET is a scsi driver that
feeds commands into the target layer, so it needs a depends on SCSI.

Sorry for missing that earlier.
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
index 4c44d7bed01a..cb6f32ce7de8 100644
--- a/drivers/target/Kconfig
+++ b/drivers/target/Kconfig
@@ -1,10 +1,10 @@ 
 
 menuconfig TARGET_CORE
 	tristate "Generic Target Core Mod (TCM) and ConfigFS Infrastructure"
-	depends on SCSI && BLOCK
+	depends on BLOCK
 	select CONFIGFS_FS
 	select CRC_T10DIF
-	select BLK_SCSI_REQUEST # only for scsi_command_size_tbl..
+	select BLK_SCSI_REQUEST
 	select SGL_ALLOC
 	default n
 	help
@@ -29,6 +29,7 @@  config TCM_FILEIO
 
 config TCM_PSCSI
 	tristate "TCM/pSCSI Subsystem Plugin for Linux/SCSI"
+	depends on SCSI
 	help
 	Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
 	passthrough access to Linux/SCSI device