Skip to contentSkip to conversation

Matching semantics for version numbers....

DISCUSSION Matthew Dharm 2 participants 5 messages Mar 20, 2001 – Mar 22, 2001

lore
Share & tools
lore
#0 lore raw

I recently discovered a small problem in the code that matches devices to drivers in the way version numbers are handled.

The tests used against version numbers are < and > -- while this doesn't seem like a problem at first, consider usb-storage where we need to have one entry for a device up to rev 3.00, and a different entry for devices rev 3.00 and higher. The current mechanism means that the first entry must test against less than 3.00 and the second against greater than 2.99, which is counter-intuitive at best.

I'd like to change these to <= and >= -- and yes, I understand what a major change that is. The drivers which use the version numbers would have to be changed, and so would the hotplug scripts. But I wanted to throw this idea out there for consideration. It's certainly much easier to maintain the code with the <= and >= semantics, since I can give a definate termination point to my entries. With these semantics, the above example uses <= 2.99 and >= 3.00 as the test values respectively, which is much clearer.

Matt

Signature · 6 lines
Matthew Dharm                              Home: [email protected] 
Maintainer, Linux USB Mass Storage Driver

THEY CASTRATED MY QUAKE BITS! I WANT THEM BACK!!!!
					-- Greg
User Friendly, 3/27/1998
#1 lore raw

Hi Matt,

Two comments come to mind:

(1) Is it correct that changing this would involve no more than:

* Linux 2.4.? kernel updates:
- drivers/usb/usb.c ... usb_match_id()
- drivers/usb/ibmcam.c ... uses range matching
- drivers/usb/storage/unusual_devs.h ... lots of ranges
* Hotplug scripts
* "usbmodules"
* No spec/documentation (yet)

Distributions would need to get all those updates at once; I don't know how much of a problem that'd be, except that if there's no coordination then it'll be painful. If it happens, this should all be ready at the same time. (Not like the original match_flags patch ... though goofing this up would break less, since "modutils" will still work.)

(2) For some reason my preference in this area would be to use "low <= value < high" range specs rather the current "low < value < high" or "low <= value <= high".

That's just a better match to how I normally think about such ranges -- not a huge deal, but it seems like Jeff Ozvold had a similar thought. So maybe I'm not alone in thinking about those bcd version codes that way.

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Matthew Dharm
Quoted 9 lines · David Brownell

Hi Matt,

Two comments come to mind:

(1) Is it correct that changing this would involve no more than:

* Linux 2.4.? kernel updates:
- drivers/usb/usb.c ... usb_match_id()
- drivers/usb/ibmcam.c ... uses range matching

I'm not certain if this range-matching is done correctly for < > or if it thinks <= and >=, but assuming it's "working" now, yes, it would need changing.

Quoted 1 line

- drivers/usb/storage/unusual_devs.h ... lots of ranges

This wouldn't need updating -- it's actually improperly coded right now with the assumption of <= and >= (which was how my custom matching code worked).

Quoted 2 lines

* Hotplug scripts
* "usbmodules"

I'm not sure what you mean by this item.

Quoted 1 line

* No spec/documentation (yet)

Other than my comments above, yes, that should be all the changes.

Quoted 6 lines

Distributions would need to get all those updates at once; I don't know how much of a problem that'd be, except that if there's no coordination then it'll be painful. If it happens, this should all be ready at the same time. (Not like the original match_flags patch ... though goofing this up would break less, since "modutils" will still work.)

AFAICT, yes. Having one part of the patch (assuming the 2 kernel files count as one "part") doesn't break anything.

Quoted 8 lines

(2) For some reason my preference in this area would be to use "low <= value < high" range specs rather the current "low < value < high" or "low <= value <= high".

That's just a better match to how I normally think about such ranges -- not a huge deal, but it seems like Jeff Ozvold had a similar thought. So maybe I'm not alone in thinking about those bcd version codes that way.

Someone mentioned this to me in a private e-mail... it seems reasonable, as then range checks can be 0.00 -- 3.00, and 3.00 -- 9.99 with no overlap. Tho, it _must_ be well documented that the low and high parameters are matched slightly differently.

Matt

Signature · 6 lines
Matthew Dharm                              Home: [email protected] 
Maintainer, Linux USB Mass Storage Driver

Ye gods! I have feet??!
					-- Dust Puppy
User Friendly, 12/4/1997
#3 lore raw
In reply to Matthew Dharm
Quoted 4 lines
Quoted 2 lines

* Hotplug scripts
* "usbmodules"

I'm not sure what you mean by this item.

The "usbmodules" addition to "usbutils", from Adam Richter. It's needed for some kinds of "cold plug" (handling devices present at boot) and for multiple-interface devices. It's been posted to both these lists ... should probably put it into one of the patch areas at SourceForge, I don't think Thomas' latest "usbutils" has the current version.

Overall this proposed change falls into the category of stuff that seems better done than not.

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Matthew Dharm

Well, I'm not hearing any complaints... so who is going to do it? I can't... I can barely send e-mail right now (little 'net access)...

Matt

Quoted 24 lines · David Brownell
Quoted 4 lines
Quoted 2 lines

* Hotplug scripts
* "usbmodules"

I'm not sure what you mean by this item.

The "usbmodules" addition to "usbutils", from Adam Richter. It's needed for some kinds of "cold plug" (handling devices present at boot) and for multiple-interface devices. It's been posted to both these lists ... should probably put it into one of the patch areas at SourceForge, I don't think Thomas' latest "usbutils" has the current version.

Overall this proposed change falls into the category of stuff that seems better done than not.

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

Signature · 6 lines
Matthew Dharm                              Home: [email protected] 
Maintainer, Linux USB Mass Storage Driver

Why am I talking to a toilet brush?
					-- CEO
User Friendly, 4/30/1998