Page MenuHomeFreeBSD

libsa: smbios: Parse the chassis type and export it as smbios.chassis.type
ClosedPublic

Authored by manu on Aug 12 2020, 6:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
May 24 2024, 12:55 AM
Unknown Object (File)
May 12 2024, 5:24 PM
Unknown Object (File)
Feb 13 2024, 4:52 AM
Unknown Object (File)
Feb 7 2024, 4:04 AM
Unknown Object (File)
Dec 20 2023, 8:30 AM
Unknown Object (File)
Nov 8 2023, 1:50 AM
Unknown Object (File)
Nov 1 2023, 1:04 AM
Unknown Object (File)
Oct 7 2023, 12:45 AM
Subscribers
None

Details

Reviewers
emaste
imp
kevans
Summary

It can be useful to know what type of machine we are running on for desktop
related thing.
It also allow us to support all the DMI variable that linux driver can fetch.

Sponsored-by: The FreeBSD Foundation

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

manu requested review of this revision.Aug 12 2020, 6:00 PM
manu created this revision.

Repeating setenv in each case seems a bit odd to me. Why not a variable or even a helper function that just does e.g. return ("Pizza Box") for each case?

Use a helper function and do the setenv where the others setenv are done.

That's nicer, also you can now drop the break statements.

This revision is now accepted and ready to land.Aug 13 2020, 2:05 PM

That's nicer, also you can now drop the break statements.

Yeah but doesn't some code analysis stuff warn on those ? (or maybe some cflags ...) that's the reason I've left them.

stand/libsa/smbios.c
324

I'd think an array of these and a bound check would be better

Yeah but doesn't some code analysis stuff warn on those ? (or maybe some cflags ...) that's the reason I've left them.

Nah, it's a pretty common pattern and compilers/static analysis is smart enough. There are a ton of examples in contrib/elftoolchain/readelf/readelf.c

stand/libsa/smbios.c
324

That'd work, IMO either is equally fine.