Page MenuHomeFreeBSD

Move all the separate copies of the same strings into paths.h. There's nothing machine specific about these.
ClosedPublic

Authored by imp on Jan 23 2016, 12:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 6 2024, 11:16 AM
Unknown Object (File)
Mar 1 2024, 1:53 PM
Unknown Object (File)
Jan 23 2024, 3:01 AM
Unknown Object (File)
Jan 11 2024, 10:54 AM
Unknown Object (File)
Dec 25 2023, 1:38 AM
Unknown Object (File)
Nov 20 2023, 1:52 PM
Unknown Object (File)
Nov 2 2023, 1:43 PM
Unknown Object (File)
Oct 15 2023, 8:41 PM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp retitled this revision from to Move all the separate copies of the same strings into paths.h. There's nothing machine specific about these..
imp updated this object.
imp edited the test plan for this revision. (Show Details)
jhb edited edge metadata.
This revision is now accepted and ready to land.Jan 23 2016, 12:37 AM
brooks added a reviewer: brooks.

Why are efi/boot1/boot1.c and zfsboot.c including libs.h rather than paths.h? For that matter, where is libs.h? I don't see it in the source tree, or referenced anywhere (so it's not generated either).

Why are efi/boot1/boot1.c and zfsboot.c including libs.h rather than paths.h? For that matter, where is libs.h? I don't see it in the source tree, or referenced anywhere (so it's not generated either).

I did them wrong...

imp edited edge metadata.

libs.h -> paths.h

Updating D5038: Move all the separate copies of the same strings into paths.h. There's

nothing machine specific about these.

This revision now requires review to proceed.Jan 23 2016, 1:54 AM
rpokala added a reviewer: rpokala.

It always bothered me that those were dup'ed everywhere. Thanks for cleaning this up.

This revision is now accepted and ready to land.Jan 23 2016, 1:58 AM
emaste edited edge metadata.
imp edited edge metadata.

Add RBX_ defines to the mix, they will be separate commits.

Updating D5038: Move all the separate copies of the same strings into paths.h. There's

nothing machine specific about these.

This revision now requires review to proceed.Jan 23 2016, 4:15 AM

Is it alright to use the RBX_MASK from rbx.h for everything? The various "boot2.c"s currently have different values for that.

sys/boot/efi/boot1/boot1.c
34 ↗(On Diff #12613)

You're including paths.h for PATH_LOADER then overriding it and no other PATH_XXX entries are used, which seems wasteful, Is there a reason for this?

sys/boot/efi/boot1/boot1.c
34 ↗(On Diff #12613)

That does seem odd. Perhaps we should have both PATH_LOADER and PATH_LOADER_EFI defines, etc.

imp edited edge metadata.
  • Move all the separate copies of the same strings into paths.h. There's
  • RBX_ defines are in rbx.h, move it there.
  • Parse the command line arguments, and do it before we initialize the
  • Read in /boot/config and /boot.config, like all the other boot

Updating D5038: Move all the separate copies of the same strings into paths.h. There's

nothing machine specific about these.

sys/boot/efi/boot1/boot1.c
34 ↗(On Diff #12613)

All paths come from paths.h, but perhaps ed is right. I'll think about that aspect.

Is it alright to use the RBX_MASK from rbx.h for everything? The various "boot2.c"s currently have different values for that.

They do? Which ones are different? All the x86 ones should be the same (and it is a bug if they aren't). The arm ones should likely be the same, but I haven't tested that stuff since the gear they were written for is a bit old. They all look the same to me, and were all originally copied from the x86 stuff. Is there a difference my eyeballs missed?

ian edited edge metadata.
This revision is now accepted and ready to land.Jan 24 2016, 6:15 PM

Ideally the path / rbx cleanup and the addition of new features such as the boot config support for EFI should be committed separately.

sys/boot/efi/boot1/boot1.c
113 ↗(On Diff #12644)

Check and report other other unexpected errors?

116 ↗(On Diff #12644)

We shouldn't use Malloc directly IMO, is there for wiring up malloc. IMO AllocatePool FreePool should be use in the EFI code.

122 ↗(On Diff #12644)

Would be nice to print this in the FreeBSD EFI boot block below, so it keeps all the useful info in one place and well formatted.

125 ↗(On Diff #12644)

If you have a config above then buf won't be NULL and bufsize will set. IIRC this means that call could fail with EFI_BUFFER_TOO_SMALL.

Easiest fix is to free the buffer used to load the config, resets buf to NULL and let load allocate the correct size buffer.

In D5038#107326, @imp wrote:

Is it alright to use the RBX_MASK from rbx.h for everything? The various "boot2.c"s currently have different values for that.

They do? Which ones are different? All the x86 ones should be the same (and it is a bug if they aren't). The arm ones should likely be the same, but I haven't tested that stuff since the gear they were written for is a bit old. They all look the same to me, and were all originally copied from the x86 stuff. Is there a difference my eyeballs missed?

sys/boot/arm/at91/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | VERBOSE | GDB

sys/boot/arm/ixp425/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | VERBOSE | GDB

sys/boot/i386/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | KDB | CONFIG | VERBOSE | SERIAL | CDROM | GDB | MUTE | PAUSE | DUAL

sys/boot/mips/beri/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | KDB | CONFIG | VERBOSE | SERIAL | CDROM | GDB | MUTE | PAUSE | DUAL

sys/boot/pc98/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | KDB | CONFIG | VERBOSE | SERIAL | CDROM | GDB | MUTE | PAUSE | DUAL
sys/boot/efi/boot1/boot1.c
34 ↗(On Diff #12644)

FWIW, I agree with @emaste - just add PATH_LOADER_EFI to paths.h

In D5038#107326, @imp wrote:

Is it alright to use the RBX_MASK from rbx.h for everything? The various "boot2.c"s currently have different values for that.

They do? Which ones are different? All the x86 ones should be the same (and it is a bug if they aren't). The arm ones should likely be the same, but I haven't tested that stuff since the gear they were written for is a bit old. They all look the same to me, and were all originally copied from the x86 stuff. Is there a difference my eyeballs missed?

sys/boot/arm/at91/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | VERBOSE | GDB

sys/boot/arm/ixp425/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | VERBOSE | GDB

sys/boot/i386/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | KDB | CONFIG | VERBOSE | SERIAL | CDROM | GDB | MUTE | PAUSE | DUAL

sys/boot/mips/beri/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | KDB | CONFIG | VERBOSE | SERIAL | CDROM | GDB | MUTE | PAUSE | DUAL

sys/boot/pc98/boot2/boot2.c
    ASKNAME | SINGLE | DFLTROOT | KDB | CONFIG | VERBOSE | SERIAL | CDROM | GDB | MUTE | PAUSE | DUAL

Ah, those differences don't matter.

sys/boot/efi/boot1/boot1.c
113 ↗(On Diff #12644)

Nope. Those don't matter. We only get EFI_NOT_FOUND when DOTCONFIG doesn't exist, but there was a filesystem. All the other errors don't matter. We'll catch them later when we go to load the kernel.

116 ↗(On Diff #12644)

Those APIs are a pain in the ass to use. There's no reason to make our life harder than it needs to be, and using those APIs when we have easier ones is just cutting our nose off to spite our face.

122 ↗(On Diff #12644)

Good point. I'll move it.

125 ↗(On Diff #12644)

No. We always pass NULL the first time to the read that's buried inside of load, and then we always allocate buf. It was uninitialized before, and so its value doesn't matter. But you are right we should free the buffer. that was an oversight on my part. freeing buf won't reset it to NULL, and there's no requirement for that in the load() code.

sys/boot/arm/at91/boot2/boot2.c
37 ↗(On Diff #12644)

Like PATH_KERNEL_EFI, maybe this should also be in paths.h?

sys/boot/efi/loader/main.c
121 ↗(On Diff #12644)

This comment says only DhS are parsed, but the code below has cases for adDmhprsSv.

sys/boot/efi/boot1/boot1.c
34 ↗(On Diff #12644)

Will fix it.

122 ↗(On Diff #12644)

Turns out, I can't move it. The other printfs are done way before this is discovered.

imp edited edge metadata.

Updating based on reviews.

  • Move all the separate copies of the same strings into paths.h. There's
    • RBX_ defines are in rbx.h, move it there.
    • Parse the command line arguments, and do it before we initialize the
    • Read in /boot/config and /boot.config, like all the other boot

Updating D5038: Move all the separate copies of the same strings into paths.h. There's

nothing machine specific about these.

This revision now requires review to proceed.Jan 25 2016, 5:13 AM
sys/boot/efi/boot1/boot1.c
111 ↗(On Diff #12670)

I was thinking about the errors from allocate etc, which are fatal, I guess they should be replicated below, so we'll catch them there.

It should also be noted that this may load PATH_DOTCONFIG / PATH_CONFIG, from a different device than that used for PATH_LOADER_EFI, not sure this is the desired behaviour or if it could cause unexpected issues?

If so we may need to use try_load, which will need exporting, as its device specific.

120 ↗(On Diff #12670)

Should we then move it to just before the StartImage call so if we fail in between we don't output it?

sys/boot/efi/boot1/boot1.c
111 ↗(On Diff #12670)

Well, yes and no. I don't think it is a big deal. It's only going to be an issue if we load /boot/loader, and it exits before calling exit boot services. Fairly theoretical. Fortunately, it is easy to fix.

120 ↗(On Diff #12670)

Yea. Another highly theoretical case. If there's a UFS filesystem, that has a and /boot.config or /boot/config and no loader.efi and the system also has a ZPOOL, then we'll print the wrong boot args to the EFI console before it boots off ZPOOL, possibly with a second set of arguments that it prints that might be confusing... Again, fairly easy to fix.

imp edited edge metadata.

More updates from the code review.

  • Move all the separate copies of the same strings into paths.h. There's
  • RBX_ defines are in rbx.h, move it there.
  • Parse the command line arguments, and do it before we initialize the
  • Read in /boot/config and /boot.config, like all the other boot
  • Allow new lines as white space for arguments that are parsed to allow

Updating D5038: Move all the separate copies of the same strings into paths.h. There's

nothing machine specific about these.

This revision was automatically updated to reflect the committed changes.

Note, I've pushed this change, but if there's other issues, I'll start a new review for them.