Follow up on D53313 and https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290629.
Added libxo support to gpart show, as I thought that could be somewhat handy for some people. I also updated the man pages for geom and gpart to show where you can expect libxo formatted output.
I initially considered adding libxo support to all subcommands for every class, but after going through each and every one of them, I changed my mind. As most classes' subcommands doesn't print anything unless there is an error, with the exception of the dump subcommand that some of them have. But I personally never use that one and thought the output wasn't something most people ever need to look at, so I decided against putting in the time and effort.
Example output:
root@johan_test:/usr/src # gpart show
=> 40 41942960 vtbd0 GPT (20G)
40 532480 1 efi (260M)
532520 2008 - free - (1.0M)
534528 1048576 2 freebsd-swap (512M)
1583104 40357888 3 freebsd-zfs (19G)
41940992 2008 - free - (1.0M)
root@johan_test:/usr/src # gpart --libxo:JP show
{
"__version": "1",
"PART": [
{
"logical_starting_block": 40,
"size_in_blocks": 41942960,
"name": "vtbd0",
"scheme": "GPT",
"size": "20G",
"state": "",
"partitions": [
{
"logical_starting_block": 40,
"size_in_blocks": 532480,
"index": 1,
"provider_name": "vtbd0p1",
"type": "efi",
"attribute": "",
"size": "260M"
},
{
"logical_starting_block": 532520,
"size_in_blocks": 2008,
"free": "true",
"size": "1.0M"
},
{
"logical_starting_block": 534528,
"size_in_blocks": 1048576,
"index": 2,
"provider_name": "vtbd0p2",
"type": "freebsd-swap",
"attribute": "",
"size": "512M"
},
{
"logical_starting_block": 1583104,
"size_in_blocks": 40357888,
"index": 3,
"provider_name": "vtbd0p3",
"type": "freebsd-zfs",
"attribute": "",
"size": "19G"
}
],
"unallocated": {
"logical_starting_block": 41940992,
"size_in_blocks": 2008,
"size": "1.0M"
}
}
]
}kyua tests:
root@johan_test:/usr/tests/sys/geom/class/part # kyua report ===> Summary Results read from /root/.kyua/store/results.usr_tests_sys_geom_class_part.20251127-163431-514005.db Test cases: 5 total, 0 skipped, 0 expected failures, 0 broken, 0 failed Total time: 0.350s
Just like everyone else, I think naming things are hard. So if you have name suggestions for the fields, please let me know.