Page MenuHomeFreeBSD

cam/cd: Simplify to remove invalid flag
ClosedPublic

Authored by imp on Feb 4 2025, 6:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 23, 1:23 PM
Unknown Object (File)
Wed, Apr 23, 1:07 PM
Unknown Object (File)
Wed, Apr 23, 12:31 PM
Unknown Object (File)
Wed, Apr 23, 9:01 AM
Unknown Object (File)
Wed, Apr 23, 8:10 AM
Unknown Object (File)
Wed, Apr 23, 7:36 AM
Unknown Object (File)
Mar 23 2025, 6:43 PM
Unknown Object (File)
Mar 19 2025, 1:23 AM
Subscribers
None

Details

Summary

cdoninvalidate set the CD_FLAG_INVALID flag. However, the periph's
invalid flag is set before that routine is called, so it's always set
when CD_FLAG_INVALID is set. It's therefore redundant.

The code in strategy can be simplified by checking the periph's
CAM_PERIPH_INVALID flag. Since this is a locked access, they will
always be the same.

The check in cdopen is currently redundant because both
cam_periph_acquire and cam_periph_hold will return an error when
CAM_PERIPH_INVALID is set, the former being unlocked, the latter being
locked (to catch the race, but in this case the race doesn't matter).

Since theres are the only places we use this flag, we can simplfy
the code by removing it entirely.

Diff Detail

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