All of lore.kernel.org
 help / color / mirror / Atom feed
* USB file mmap
@ 2014-07-07 14:00 Jeshwanth Kumar N K
  2014-07-07 16:34 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Jeshwanth Kumar N K @ 2014-07-07 14:00 UTC (permalink / raw)
  To: kernelnewbies

Hello List,
I am trying to understand mmap on files residing in USB flash, so can you
please give a pointer from where I can start to understand this? I mean how
it works, and which part in kernel takes care of it.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140707/858a5303/attachment.html 

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

* USB file mmap
  2014-07-07 14:00 USB file mmap Jeshwanth Kumar N K
@ 2014-07-07 16:34 ` Greg KH
  2014-07-07 19:56   ` Jeshwanth Kumar N K
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2014-07-07 16:34 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 07, 2014 at 07:30:07PM +0530, Jeshwanth Kumar N K wrote:
> Hello List,
> I am trying to understand mmap on files residing in USB flash, so can you
> please give a pointer from where I can start to understand this? I mean how it
> works, and which part in kernel takes care of it.

That's a _huge_ stack you are talking about here involving a vfs, the
memory management core, a filesystem, block layer, SCSI, and USB, at the
very least.

What _exactly_ are you looking to understand here?  And where in the
code have you looked and need help with?  What documents have you read
that were unclear?  And why do you need this information?

greg k-h

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

* USB file mmap
  2014-07-07 16:34 ` Greg KH
@ 2014-07-07 19:56   ` Jeshwanth Kumar N K
  2014-07-07 20:29     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Jeshwanth Kumar N K @ 2014-07-07 19:56 UTC (permalink / raw)
  To: kernelnewbies

Hi Greg,

Thanks for the reply.

I recently purchased an mbed board
https://mbed.org/platforms/mbed-LPC1768/ (friend recommended) to learn
USB Mass storage class. And used OpenLPC usb stack with fatfs example
to check how it works (used protocol analyser and stuff, to know whats
happening). In that they are reading each buffer, i mean copying
buffer (8k) of data to RAM and process it. And other idea I found is
using diskio function in openLPC stack to read the data in USB flash
(but this is without file system).

As a Linux user I knew in Linux we can do mmap easily for a file (with
filesystem). So thought of asking from where to start understanding
these concepts :).

Greg is it OK to ask this question here?

Thanks
On 07-Jul-2014 10:00 pm, "Greg KH" <greg@kroah.com> wrote:

> On Mon, Jul 07, 2014 at 07:30:07PM +0530, Jeshwanth Kumar N K wrote:
> > Hello List,
> > I am trying to understand mmap on files residing in USB flash, so can you
> > please give a pointer from where I can start to understand this? I mean
> how it
> > works, and which part in kernel takes care of it.
>
> That's a _huge_ stack you are talking about here involving a vfs, the
> memory management core, a filesystem, block layer, SCSI, and USB, at the
> very least.
>
> What _exactly_ are you looking to understand here?  And where in the
> code have you looked and need help with?  What documents have you read
> that were unclear?  And why do you need this information?
>
> greg k-h
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140708/06775a0d/attachment.html 

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

* USB file mmap
  2014-07-07 19:56   ` Jeshwanth Kumar N K
@ 2014-07-07 20:29     ` Greg Kroah-Hartman
  2014-07-07 20:32       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-07 20:29 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Jul 08, 2014 at 01:26:26AM +0530, Jeshwanth Kumar N K wrote:
> Hi Greg,
> 
> Thanks for the reply.
> 
> I recently purchased an mbed board
> https://mbed.org/platforms/mbed-LPC1768/?(friend recommended) to learn
> USB Mass storage class. And used OpenLPC usb stack with fatfs example
> to check how it works (used protocol analyser and stuff, to know whats
> happening). In that they are reading each buffer, i mean copying
> buffer (8k) of data to RAM and process it. And other idea I found is
> using diskio function in openLPC stack to read the data in USB flash
> (but this is without file system).

The USB storage protocol does not define a specific filesystem, so you
can send "raw" block commands to the device, but that's usually not very
interesting.

> As a Linux user I knew in Linux we can do mmap easily for a file (with
> filesystem). So thought of asking from where to start understanding
> these concepts :).

mmap on a file on disk is the same as USB flash, a USB storage device is
just a SCSI device (a quite complex little device, not a trivial one at
all.)  As I said, you have a filesystem, block layer, SCSI layer, USB
layer, and then the VFS and other stuff going on here.  So I'd recommend
focusing on one layer at a time, otherwise you will be overwhelmed.

good luck,

greg k-h

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

* USB file mmap
  2014-07-07 20:29     ` Greg Kroah-Hartman
@ 2014-07-07 20:32       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-07 20:32 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 07, 2014 at 01:29:29PM -0700, Greg Kroah-Hartman wrote:
> On Tue, Jul 08, 2014 at 01:26:26AM +0530, Jeshwanth Kumar N K wrote:
> > Hi Greg,
> > 
> > Thanks for the reply.
> > 
> > I recently purchased an mbed board
> > https://mbed.org/platforms/mbed-LPC1768/?(friend recommended) to learn
> > USB Mass storage class.

Wait, you mean the USB storage class from the device side, right?  If
so, just read the USB storage spec, and the SCSI spec that it referrs
to.  There is no need to worry about mmap, or anything other than
"normal" scsi block commands.

This device can't run Linux, it's too small, which is a shame, as Linux
works really well running as a USB "gadget".

good luck,

greg k-h

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

end of thread, other threads:[~2014-07-07 20:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-07 14:00 USB file mmap Jeshwanth Kumar N K
2014-07-07 16:34 ` Greg KH
2014-07-07 19:56   ` Jeshwanth Kumar N K
2014-07-07 20:29     ` Greg Kroah-Hartman
2014-07-07 20:32       ` Greg Kroah-Hartman

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.