usblog ([info]usblog) wrote,
@ 2004-12-23 09:32:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
USB subsystem 6
USB subsystem 6 - USB Mass Storage Driver for Linux

Hello,

I had some pressure in work so it had been a while since last post.
Sorry about this. I will try to post more often in the near future.


This driver is for mass storage usb devices, like USB disks and
USB DiskOnKeys, with which I will dill here.All what is below is relevant
to DiskOnKey (but I assume also USB disks behave more or less the
same).

First , for mounting diskonkey you should run (after creating a
mounting point, let's say /mnt/dok):

mount /dev/sda /mnt/dok

(Note that when we mount an IDE disk it is ususally /dev/hda1 or /dev/hda2 and so on; there are /dev/sda1 till /dev/sda15 special device files; but this is not so impotant).

The code for USB Mass Storage Driver resides, naturally, under
drivers/usb/storage .
The module name is usb-storage.ko ; it uses SCSI emulation ; we will deal
SCSI emulation in the future.

The us_data structure (from storage/usb.h)
is probably the most important struct in storage mass storage.


The protocol we use is Transparent SCSI
The transport layer is : Bulk (corresponds to US_PR_BULK in
usb/transport.h).

The use of SCSI emulation appears also in ATAPI devices
like CD-RW devices.


It is a good question why we use this emulation at all. Why not use IDE
interface ? I wonder what is the reason (It does not seems to me related
to the fact that IDE disks are not hot plugged while USB disk can be
hot plugged. )

The usb_stor_control_thread() is a daemon thread which controls the
usb device.

It adds the PF_NOFREEZE flag to the current process.

Aside from in this module, use of PF_NOFREEZE is only in 2 other places under drivers:

in block/loop.c:
loop_thread(void *data)

in scsi/scsi_error.c:
scsi_error_handler(void *data)

The use of PF_NOFREEZE flag is for Swsusp : Software Suspend for Linux
(the Linux equivalent of Windows' hibernate).
see http://softwaresuspend.berlios.de/


You can see a little on USB Mass Storage Driver for Linux in
http://www2.one-eyed-alien.net/~mdharm/linux-usb/ but take in
account that this site was last updated in July 2002.

Cheers,
USBLOG



Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…