Page MenuHomeFreeBSD

gpart: More nuance for GPT support
AcceptedPublic

Authored by imp on Oct 17 2023, 2:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 2, 7:00 PM
Unknown Object (File)
Mon, Sep 2, 7:00 PM
Unknown Object (File)
Mon, Sep 2, 6:52 PM
Unknown Object (File)
Aug 6 2024, 1:53 PM
Unknown Object (File)
Jul 26 2024, 9:49 PM
Unknown Object (File)
May 14 2024, 9:30 AM
Unknown Object (File)
Apr 30 2024, 5:50 AM
Unknown Object (File)
Apr 30 2024, 5:50 AM

Details

Reviewers
emaste
marcel
zlei
Summary

A careful reading of the GPT standard shows that one may have fewer than
128 entries in your GPT table. While the standard requires that we
reserve enough space (32 512-byte-LBAs or 4 4096-byte-LBAs), it also
explicitly allows one to specify fewer actual partitions (since that
controls what is in the CRC). It requires that the first LBA to be 32
(512 sectors) or 6 (4k sectors) or larger. That requirement is not
enforced (it's not listed as one of validation criteria for the GPT).
We should likely do so in the future.

To that end, allow a default number of entries to use (defent) on
creation to be different (larger) than the minimum number of legal
entries. For gpt, these numbers work out to 128 and 1 respectively. For
all the others, make minent == defent so this is a nop for those
partitioning schemes.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 54023
Build 50913: arc lint + arc unit

Event Timeline

imp requested review of this revision.Oct 17 2023, 2:28 AM
imp created this revision.
sys/geom/part/g_part.h
120–121

strange indentation, but I assume is just Phabricator rendering bug

sys/geom/part/g_part_gpt.c
157

is it possible for this to introduce any new breakage? e.g. do we start violating the start LBA with something like gpart create -s gpt -n 1?

jrtc27 added inline comments.
sys/geom/part/g_part.h
120–121

Show Raw File (Right) confirms the indentation looks sensible in reality

zlei added a subscriber: zlei.

Looks good to me.

sys/geom/part/g_part.h
120

One tab before comment should be sufficient.

This revision is now accepted and ready to land.Oct 21 2023, 4:12 PM

I'm unsure about this

sys/geom/part/g_part_gpt.c
157

I don't think so

I'm unsure about this

sys/geom/part/g_part_gpt.c
157

But I'll experiment