On Wed, Oct 27, 2004 at 03:36:19PM +0100, Jon Masters wrote: > On Wed, 27 Oct 2004 15:02:18 +0200, Tommaso Moroni > <tommaso.m@xxxxxxxxxxxxx> wrote: > > > I'm writing a kernel module which, given a struct scsi_cmnd, processes the > > data involved in the command. If use_sg is 0, I access the data with buffer and > > bufflen. > > Is it possible to post an excerpt from your code in order to help > understand what you want to do? Sure! First of all, the aim is to produce a trace of read and write access to flash drives used via usb-storage. So in drivers/usb/storage/usb.c I've added a call to a function in the module I'm writing: [snip] /* we've got a command, let's do it! */ else { US_DEBUG(usb_stor_show_command(us->srb)); if (write_trace_entry) (* write_trace_entry) (us->srb); us->proto_handler(us->srb, us); } [snip] In my module when tracing is active write_trace_entry points to real_write_trace_entry: void real_write_trace_entry(struct scsi_cmnd *cmd) { [snip] if (cmd->use_sg == 0) data = Byte2StringHex(cmd->buffer, cmd->bufflen); else /* here's the problem */ [snip] where Byte2StringHex converts the data into a hex string. My problem is how to find the data to parse when cmd->use_sg != 0. I hope this will clarify the things! Thank you for the patience, Tommaso -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/