Page MenuHomeFreeBSD

kern_conf: fully initialize cloned devices with make_dev_args, too

Authored by kevans on Sat, Oct 5, 12:55 PM.



Attempting to initialize si_drv{1,2} with mda_si_drv{1,2} does not work if you are operating on cloned devices.

clone_create must be called prior to the make_dev* family to create/return the device on the clonelist as needed. This device is later returned early in newdev(), prior to si_drv{0,1,2} initialization.

This patch simply breaks out of the loop if we've found a non-(SI_CHEAPCLONE | SI_NAMED) device and finishes init. I'm not convinced SI_CHEAPCLONE needs to stick around from a brief poke around this stuff, but I've made sure we don't touch these devices if they are already initialized here.

Later check of !SI_NAMED in make_dev_sv could be removed now that newdev() should catch it earlier, but I've not done so.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kevans created this revision.Sat, Oct 5, 12:55 PM
kib accepted this revision.Sat, Oct 5, 7:08 PM
kib added inline comments.
586 ↗(On Diff #62930)

I do not believe we ever set the SI_CHEAPCLONE flag anywhere. It probably should be removed finally. Or at least new uses should not be added.

This revision is now accepted and ready to land.Sat, Oct 5, 7:08 PM
kevans added inline comments.Sat, Oct 5, 7:23 PM
586 ↗(On Diff #62930)

grep seemed to think that SI_CHEAPCLONE was effectively a read-only flag. I added it here because make_dev_sv expects that it can happen. Do you mind if I commit it with SI_CHEAPCLONE then subsequently rip out SI_CHEAPCLONE altogether?

I think it's a good idea to make sure we're honoring callers' expectations until we rip it out, in case any downstream projects use it (for what reason, I do not understand).

kib added inline comments.Sat, Oct 5, 7:26 PM
586 ↗(On Diff #62930)

Do not add it there. Remove in follow-up commit.

kevans added inline comments.Sat, Oct 5, 7:31 PM
586 ↗(On Diff #62930)

Alrighty then.