Page MenuHomeFreeBSD

kern: osd: abstract away the math for locating a slot method
ClosedPublic

Authored by kevans on Dec 14 2024, 4:21 AM.
Tags
None
Referenced Files
F162922154: D48074.id153969.diff
Sat, Jul 18, 8:12 AM
Unknown Object (File)
Wed, Jul 15, 6:36 AM
Unknown Object (File)
Wed, Jul 15, 6:36 AM
Unknown Object (File)
Wed, Jul 1, 10:16 AM
Unknown Object (File)
Tue, Jun 30, 12:17 AM
Unknown Object (File)
Mon, Jun 29, 3:20 AM
Unknown Object (File)
Sun, Jun 28, 3:35 PM
Unknown Object (File)
Sat, Jun 27, 10:25 AM
Subscribers

Details

Summary

It's relatively simple, but we'll do it a couple of times; pull it
out into a macro.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Dec 14 2024, 4:42 AM

I'd prefer it to take the slot number, and do the "slot - 1" translation in the macro. That came to mind looking at D48075 which passes in slot - 1.

That prompted a quick scan of kern_osd.c, which has a lot of "i" starting at zero, and "i + 1" to refer to the slot number. But then osd_exit has 1 one-based "i", with "i - 1" referring to the slot index. and osd_init has "i" being the type and hiding its zero-based-ness with OSD_FIRST. This all seems to be an off-by-one waiting to happen.

This revision now requires changes to proceed.Dec 14 2024, 4:47 AM

Update based on jamie's feedback, take a slot number instead of index

Future work will see if we can cleanup some other bits to mitigate some
potential fragility.

This revision is now accepted and ready to land.Apr 21 2025, 4:29 PM