[patches] Add dmi kernel class support into HAL

Richard Hughes hughsient at gmail.com
Tue May 22 07:32:16 PDT 2007


On Tue, 2007-05-22 at 16:21 +0200, Lennart Poettering wrote:
> On Tue, 22.05.07 15:06, Richard Hughes (hughsient at gmail.com) wrote:
> 
> > +	static const char *chassis_map[] = {
> > +		"Other",                 "unknown",
> > +		"Unknown",               "unknown",
> > +		"Desktop",               "desktop",
> > +		"Low Profile Desktop",   "desktop",
> 
> [...]
> 
> > +		"Peripheral Chassis",    "unknown",
> > +		"RAID Chassis",          "unknown",
> > +		"Rack Mount Chassis",    "unknown",
> > +		"Sealed-case PC",        "unknown",
> > +		"Multi-system",          "unknown",
> > +		NULL
> > +	};
> 
> You really want to use "static const char * const chassis_map[] = {"
> here. Both the strings and the array itself should be const!

Ahh yes, good catch.

> Also: Please consider using GNU gperf for this. Constant lookup tables
> are very good candidates for gperf. 

I thought about this, but it's a tiny lookup table only used once in
coldplug. It didn't seem worth the added complexity.

> Humm. the "chassis_type" field contains a numeric id. To get a human
> readable string you need to convert that first using some lookup
> table. Unless I am mistaken you don't do that ranslation right now?

Ahh. No. That must be done with dmidecode internally.

> See the DMI/SMBIOS spec for the numeric ids:
> 
> http://www.dmtf.org/standards/published_documents/DSP0134.pdf
> 
> Section 3.3.4.1. on page 22.

Cheers, let me update the patch.

Richard.




More information about the hal mailing list