Page MenuHomeFreeBSD

Move disk scheme definitions under <sys/disk/$scheme.h>
ClosedPublic

Authored by marcel on Oct 2 2016, 3:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 2 2024, 7:13 PM
Unknown Object (File)
Dec 29 2023, 9:36 PM
Unknown Object (File)
Dec 28 2023, 11:36 PM
Unknown Object (File)
Nov 8 2023, 12:53 AM
Unknown Object (File)
Nov 7 2023, 3:39 PM
Unknown Object (File)
Nov 5 2023, 10:57 AM
Unknown Object (File)
Oct 6 2023, 11:50 PM
Unknown Object (File)
Oct 6 2023, 2:24 PM
Subscribers

Details

Reviewers
jhb
adrian
Summary

In order to allow mkimg(1) (and other tools) to become a build tool that can be compiled on various OSes (including on older versions of FreeBSD), make it possible to have them include the scheme definitions without pulling in FreeBSD specific definitions. In particular this means:

  • moving the portable scheme definitions to header files under sys/disk
  • not including other system headers
  • replacing u_int*_t with uint*_t throughout.

Since UUID/GUID type definitions are non-portable, make it possible to use any (valid) type by setting GPT_UUID_TYPE to the type used on the build machine. When GPT_UUID_TYPE hasn't been defined, use "union gpt_uuid" as a generic substitute.

More consistently have the BSD scheme use the BSD_ prefix for defines. There should be no conflict between the headers, making it possible to include them all in the same file

note: consumers of the old headers have not been changed yet. Such will be done in followup commits

Test Plan

No functional change
make universe passes

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 5416
Build 5618: CI src buildJenkins

Event Timeline

marcel retitled this revision from to Move disk scheme definitions under <sys/disk/$scheme.h>.
marcel updated this object.
marcel edited the test plan for this revision. (Show Details)
marcel added reviewers: jhb, adrian.
marcel set the repository for this revision to rS FreeBSD src repository - subversion.

Fixes to the previous diff:
o Have the generic GPT uuid definition match the UUID constants so that the header is self-consistent and usable without "external" definition for UUIDs.
o Typedef gpt_uuid_t from GPT_UUID_TYPE to make it more palatable for applications to use the GPT type for UUIDs themselves.
o Fix a comment in sys/sys/disklabel.h

generally I like it, though it fills me with fear and dread since it's the oldest part of the system and has been the most fragile. That risk is mitigated by a 'universe' run as well as a exp-ports run.

sys/sys/disklabel.h
53

Historically the transport has been a problem. These constants existed to co-exist with the host's native labels. Alpha was the last one FreeBSD had where it mattered. OpenBSD's labels are also a different size because it doesn't have GEOM and had to do all manner of ugly kludges.

jhb edited edge metadata.

Definitely a fan of the approach generally. I have a minor preference for <disk/foo.h> vs <sys/disk/foo.h> as there is nothing kernel-specific about these at all. I think it would be fine in that case to have a new top-level directory in sys for just these headers if it came to it. However, that isn't a show stopper. I think the GPT_UUID_TYPE thing is ok.

This revision is now accepted and ready to land.Oct 5 2016, 6:30 PM