Page MenuHomeFreeBSD

loader: lua: test that /boot exists first
ClosedPublic

Authored by manu on Dec 13 2021, 1:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 19, 8:19 PM
Unknown Object (File)
Thu, May 16, 9:36 PM
Unknown Object (File)
Thu, May 16, 9:35 PM
Unknown Object (File)
May 12 2024, 6:24 PM
Unknown Object (File)
May 12 2024, 5:24 PM
Unknown Object (File)
Mar 26 2024, 6:42 AM
Unknown Object (File)
Mar 11 2024, 7:46 AM
Unknown Object (File)
Mar 11 2024, 7:42 AM
Subscribers

Details

Summary

Otherwise on fs like tftp where no directory listing is possible we fail
on the .dir method.

MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG

Diff Detail

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

Event Timeline

manu requested review of this revision.Dec 13 2021, 1:24 PM
stand/lua/core.lua
251

Any objection to moving this up above the autodetect bailout and doing something like...

if not lfs.attributes("/boot", "mode") then
    autodetect = "no"
    loader.setenv("kernels_autodetect", "NO")
end

?

Two benefits:

  1. adds a way to detect that autodetection was skipped rather than it failed
  2. less important, avoid a second stat() on /boot if we re-enter this (e.g., drop to loader prompt and re-enter)
imp added a subscriber: imp.

I'd prefer that we had a variable for "/boot" but that's orthogonal to this change.
However, we need a comment I think for why we do this.
I approved, but that's contingent on expanding the comment to explain why we short-circuit.

stand/lua/core.lua
251

I'm surprised we don't have a variable for "/boot"
However, you should add a comment above explaining why we short-circuit here, drawn from the commit message. It's weird enough that I think explaining why here will likely avert churn in this area in the future.

This revision is now accepted and ready to land.Dec 13 2021, 4:43 PM
stand/lua/core.lua
251

hmmm, I like kyle's notion better.

stand/lua/core.lua
251

Sure, will change this.

Move check up to disable autodetect.

This revision now requires review to proceed.Dec 14 2021, 8:41 AM
manu marked an inline comment as done.Dec 14 2021, 8:42 AM
This revision is now accepted and ready to land.Dec 14 2021, 5:31 PM
This revision was automatically updated to reflect the committed changes.