Skip to contentSkip to conversation

drivers/block/ub.c #6

PATCH Pete Zaitcev 2 participants 4 messages Jul 30, 2004 – Aug 28, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Same as before, but it's at least semi-useful now. I actually would consider it mergeable as EXPERIMENTAL, but for one thing: I did not ask LANANA for a major. Instead I would like to try some sort of fully dynamic allocation using udev. It looks like a good opportunity to learn about udev.

The next step is to add ioctls to burn CDs, and to clone ub.c into ufi.c with corresponding refactoring of common pieces into a library like libata. It would be neat if someone othen than I did that, to validate the readability, but I'm not holding my breath.

I wish this could be somehow limited to flash keys, but I don't see a way. Without such limit or ioctls, ub cannot be used by distributions at present.

-- Pete

Same as #5, plus added support for removable storage (flash cards). For the moment, the removable flag is hardwired to 1.

drivers/block/Kconfig +9 -0
diff -urpN -X dontdiff linux-2.6.7/drivers/block/Kconfig linux-2.6.7-ub/drivers/block/Kconfig
@@ -301,6 +301,15 @@ config BLK_DEV_CARMEL
 
 	  Use devices /dev/carmel/$N and /dev/carmel/$Np$M.
 
+config BLK_DEV_UB
+	tristate "Low Performance USB Block driver"
+	depends on USB
+	help
+	  This driver supports certain USB attached storage devices
+	  such as flash keys.
+
+	  If unsure, say N.
+
 config BLK_DEV_RAM
 	tristate "RAM disk support"
 	---help---
drivers/block/Makefile +1 -0
diff -urpN -X dontdiff linux-2.6.7/drivers/block/Makefile linux-2.6.7-ub/drivers/block/Makefile
@@ -42,4 +42,5 @@ obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryp
 
 obj-$(CONFIG_VIODASD)		+= viodasd.o
 obj-$(CONFIG_BLK_DEV_CARMEL)	+= carmel.o
+obj-$(CONFIG_BLK_DEV_UB)	+= ub.o
 
drivers/block/ub.c +1919 -0

1,919 lines not on this page · raw message

drivers/usb/storage/unusual_devs.h +2 -0
diff -urpN -X dontdiff linux-2.6.7/drivers/usb/storage/unusual_devs.h linux-2.6.7-ub/drivers/usb/storage/unusual_devs.h
@@ -486,11 +486,13 @@ UNUSUAL_DEV(  0x0781, 0x0001, 0x0200, 0x
 		US_SC_SCSI, US_PR_CB, NULL,
 		US_FL_SINGLE_LUN ),
 
+#if !defined(CONFIG_BLK_DEV_UB) && !defined(CONFIG_BLK_DEV_UB_MODULE)
 UNUSUAL_DEV(  0x0781, 0x0002, 0x0009, 0x0009, 
 		"Sandisk",
 		"ImageMate SDDR-31",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_IGNORE_SER ),
+#endif
 
 UNUSUAL_DEV(  0x0781, 0x0100, 0x0100, 0x0100,
 		"Sandisk",
drivers/usb/storage/usb.c +4 -0
diff -urpN -X dontdiff linux-2.6.7/drivers/usb/storage/usb.c linux-2.6.7-ub/drivers/usb/storage/usb.c
@@ -133,7 +133,9 @@ static struct usb_device_id storage_usb_
 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_QIC, US_PR_BULK) },
 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_UFI, US_PR_BULK) },
 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8070, US_PR_BULK) },
+#if !defined(CONFIG_BLK_DEV_UB) && !defined(CONFIG_BLK_DEV_UB_MODULE)
 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) },
+#endif
 
 	/* Terminating entry */
 	{ }
@@ -207,8 +209,10 @@ static struct us_unusual_dev us_unusual_
 	  .useTransport = US_PR_BULK},
 	{ .useProtocol = US_SC_8070,
 	  .useTransport = US_PR_BULK},
+#if !defined(CONFIG_BLK_DEV_UB) && !defined(CONFIG_BLK_DEV_UB_MODULE)
 	{ .useProtocol = US_SC_SCSI,
 	  .useTransport = US_PR_BULK},
+#endif
 
 	/* Terminating entry */
 	{ 0 }
include/linux/major.h +2 -0
diff -urpN -X dontdiff linux-2.6.7/include/linux/major.h linux-2.6.7-ub/include/linux/major.h
@@ -165,4 +165,6 @@
 
 #define VIOTAPE_MAJOR		230
 
+#define UB_MAJOR		125	/* USB Block - Experimental XXX */
+
 #endif
#1 lore raw

Pete Z:

Quoted 3 lines

Date: 30 Jul 2004 04:51:20 -0600
...
I wish this could be somehow limited to flash keys,

I see a 3X drop in thruput, ouch, when I substitute ub.ko for usb-storage.ko.

Specifically I get 0.5 GB/min from ub.ko, as contrasted with 1.5 GB/min from usb-storage.ko, in the outside 1 GiB of a particular disc, in three or more consistent consecutive samples from each.

I knew how to patch to allow bytes/LBA != 512 only because of your recent answers in [usb-storage]. I took my samples from linux-2.6.9-rc1-bk2, modprobe'ing .ko built with and without CONFIG_BLK_DEV_UB.

Quoted 3 lines

I did not ask LANANA for a major.
next ...
add ioctls to burn CDs, and ...

Yes please.

Even DVD-RAM need the ioctl's to pass thru SCSI, for everything vendor-specific that lies beyond generic read and write.

Quoted 2 lines

dynamic ... udev ...
ufi.c ... refactoring ...

Pat LaVarre

#2 lore raw

Pete Z:

Quoted 3 lines
Quoted 3 lines

Date: 30 Jul 2004 04:51:20 -0600
...
I wish this could be somehow limited to flash keys,

How committed are we to the "Low Performance" part of the "Low Performance USB Block driver" title for "config BLK_DEV_UB" found in drivers/block/Kconfig?

Do we instead hope for ub.ko to simplify all "generic USB Mass Storage", leaving only the vendor-specific work to usb-storage.ko?

I ask because I haven't yet learned how to reconcile two source files:

--- drivers/usb/storage/usb.c
...
static struct usb_device_id storage_usb_ids [] = {
...
#if !defined(CONFIG_BLK_DEV_UB) && !defined(CONFIG_BLK_DEV_UB_MODULE) { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, #endif
...
--- C:/Windows/inf/usbstor.inf:
...
[Generic]
%GenericBulkOnly.DeviceDesc%=USBSTOR_BULK, USB\Class_08&SubClass_02&Prot_50 %GenericBulkOnly.DeviceDesc%=USBSTOR_BULK, USB\Class_08&SubClass_05&Prot_50 %GenericBulkOnly.DeviceDesc%=USBSTOR_BULK, USB\Class_08&SubClass_06&Prot_50
...
---

Looks to me like we have ub.ko taking over just x 08 06 50, rather than all of the x 08 (06|05|02) 50 = bInterfaceClass ...SubClass ...Protocol considered generic by MSFT?

http://www.microsoft.com/whdc/device/storage/usbfaq.mspx
agrees Flash should be x 08 06 50 but gives no clear guidance to the rest of us.

I remember we invented x 08 06 50 to be the one tuple to rule them all, to move the determination of PDT (peripheral device type) etc. back into op x12 "INQUIRY" where it belongs, ...

Of course the world may yet contain advocates of connecting HDD/FDD as bInterfaceSubClass = x05 "SFF 8070" = Compaq LS-120 or connecting DVD/CD as x02 "SFF 8020" = read-only CD.

Pat LaVarre
http://linux-pel.blog-city.com/read/790489.htm

#3 lore raw
Quoted 11 lines · On 27 Aug 2004 16:32:39 -0600 Pat LaVarre <[email protected]> wrote:

Looks to me like we have ub.ko taking over just x 08 06 50, rather than all of the x 08 (06|05|02) 50 = bInterfaceClass ...SubClass ...Protocol considered generic by MSFT?

http://www.microsoft.com/whdc/device/storage/usbfaq.mspx
agrees Flash should be x 08 06 50 but gives no clear guidance to the rest of us.

I remember we invented x 08 06 50 to be the one tuple to rule them all, to move the determination of PDT (peripheral device type) etc. back into op x12 "INQUIRY" where it belongs, ...

I'll look at non-bulk once we have something useable by common folks and Fedora ships ub, but not before. All my devices use Bulk. But also, UFI has to come first. Only then, perhaps, I'll look at CB and CBI.

Quoted 3 lines

Of course the world may yet contain advocates of connecting HDD/FDD as bInterfaceSubClass = x05 "SFF 8070" = Compaq LS-120 or connecting DVD/CD as x02 "SFF 8020" = read-only CD.

I don't have any plans for 8070 and 8020i. I promise to look at patches if someone submits any. However, in my experience, 8070 devices are fickle. They may be better off left to usb-storage forever, with its richer infrastructure.

-- Pete