Skip to contentSkip to conversation

accessing the scsi disk from a kernel module

DISCUSSION Karthik Sarangan 2 participants 6 messages Sep 30, 2005 SCSI

lore
Share & tools
lore
#0 lore raw

what do I write in a kernel module for accessing a scsi disk device?

#1 lore raw
Quoted 2 lines · Karthik Sarangan

what do I write in a kernel module for accessing a scsi disk device?

What do u mean by this ??? Are you writing a driver for SCSI Disk or Want to do read/write on it using its own driver ??? For read/write using its own driver you can use/call generic_make_request (function from block/ll_rw_blk.c) from your kernel module to send requests to any block device available on the system and kernel will do the creating and sending request to correct block device whether that will be a SCSI disk or any disk .... And if you want directly to use the SCSI device then you have to make requests using SCSI protocol .....

--
Fawad Lateef

#2 lore raw
Quoted 17 lines · Fawad Lateef
Quoted 4 lines · Karthik Sarangan

what do I write in a kernel module for accessing a scsi disk device?

What do u mean by this ??? Are you writing a driver for SCSI Disk or Want to do read/write on it using its own driver ??? For read/write using its own driver you can use/call generic_make_request (function from block/ll_rw_blk.c) from your kernel module to send requests to any block device available on the system and kernel will do the creating and sending request to correct block device whether that will be a SCSI disk or any disk .... And if you want directly to use the SCSI device then you have to make requests using SCSI protocol .....

Quoted 5 lines

--
Fawad Lateef

I dont want the buffer cache of the block device interfering.

Basically I require to read/write data (without being cached or copied into intermediate kernel buffers) to scsi disk from a kernel module.

Hope this make my meaning clearer.

Karthik Sarangan

#3 lore raw
Quoted 7 lines · Karthik Sarangan

I dont want the buffer cache of the block device interfering.

Basically I require to read/write data (without being cached or copied into intermediate kernel buffers) to scsi disk from a kernel module.

Hope this make my meaning clearer.

Ya, I havn't did thing what you want but for sending SCSI Commands to the SCSI Device directly you have to use SCSI Protocol, in Kernel-2.6.x I found generic SCSI Mid-Layer Driver
(http://lxr.linux.no/source/drivers/scsi/scsi.c) and other files with name scsi_* in drivers/scsi/ from which you can get help and also look header files defined in include/scsi/ which actually has the structures holding the SCSI cmnds etc ...... (CMIIW)

--
Fawad Lateef

#4 lore raw
In reply to Fawad Lateef
Quoted 17 lines · Fawad Lateef
Quoted 4 lines · Karthik Sarangan

what do I write in a kernel module for accessing a scsi disk device?

What do u mean by this ??? Are you writing a driver for SCSI Disk or Want to do read/write on it using its own driver ??? For read/write using its own driver you can use/call generic_make_request (function from block/ll_rw_blk.c) from your kernel module to send requests to any block device available on the system and kernel will do the creating and sending request to correct block device whether that will be a SCSI disk or any disk .... And if you want directly to use the SCSI device then you have to make requests using SCSI protocol .....

Quoted 5 lines

--
Fawad Lateef

I dont want the buffer cache of the block device interfering.

Basically I require to read/write data (without being cached or copied into intermediate kernel buffers) to scsi disk from a kernel module.

Hope this make my meaning clearer.

Karthik Sarangan

#5 lore raw
In reply to Fawad Lateef
Quoted 17 lines · Fawad Lateef
Quoted 4 lines · Karthik Sarangan

what do I write in a kernel module for accessing a scsi disk device?

What do u mean by this ??? Are you writing a driver for SCSI Disk or Want to do read/write on it using its own driver ??? For read/write using its own driver you can use/call generic_make_request (function from block/ll_rw_blk.c) from your kernel module to send requests to any block device available on the system and kernel will do the creating and sending request to correct block device whether that will be a SCSI disk or any disk .... And if you want directly to use the SCSI device then you have to make requests using SCSI protocol .....

Quoted 5 lines

--
Fawad Lateef

I dont want the buffer cache of the block device interfering.

Basically I require to read/write data (without being cached or copied into intermediate kernel buffers) to scsi disk from a kernel module.

Hope this make my meaning clearer.

Karthik Sarangan