All of lore.kernel.org
 help / color / mirror / Atom feed
* extracting infos from struct scsi_cmnd
@ 2004-11-27 12:42 Tommaso Moroni
  2004-11-27 15:48 ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Tommaso Moroni @ 2004-11-27 12:42 UTC (permalink / raw)
  To: linux-scsi

Hi!

I'm writing a module for the 2.6.9 kernel which tracks accesses on a usb-storage device;
in particular I'm interested in extracting from a struct scsi_cmnd the data read/written 
and the associated sector. 


The code I'vr written till now looks like the following:


struct scsi_cmnd * cmd;
[...]
if (cmd->use_sg == 0)
{
	buf = cmd->buffer;
	buflen = cmd->bufflen;
	sector = cmd->request->sector;
} else {
	struct scatterlist * sl = (struct scatterlist *) cmd->buffer;
	for (i = 0; i < cmd->use_sg; i++)
	{
		buf = page_address(sl[i].page) + sl[i].offset;
                buflen = sl[i].length;
		/* sector? */
	}
}


Is it correct?
Where can I find the sector involved in the operation if the scatter-gather is used?


Thank you in advance
-- 
Tommaso Moroni <tommaso.m@tiscalinet.it>

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

end of thread, other threads:[~2004-11-28 14:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-27 12:42 extracting infos from struct scsi_cmnd Tommaso Moroni
2004-11-27 15:48 ` Jens Axboe
2004-11-28  2:02   ` extracting resid " Douglas Gilbert
2004-11-28  9:12     ` Jens Axboe
2004-11-28 13:01       ` [PATCH] " Douglas Gilbert
2004-11-28 14:59         ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.