USB file mmap

Greg Kroah-Hartman greg at kroah.com
Mon Jul 7 16:29:29 EDT 2014


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



More information about the Kernelnewbies mailing list