diff options
| author | Alan Somers <asomers@FreeBSD.org> | 2025-12-05 16:16:53 +0000 |
|---|---|---|
| committer | Alan Somers <asomers@FreeBSD.org> | 2025-12-10 18:08:30 +0000 |
| commit | a0347b0f3a6088872c29eddb85154478d543dffb (patch) | |
| tree | 25229d2352e5a122b0806532be4492f5a24c9c52 | |
| parent | 4ae02d9792272fa8c43f4982cf338123d9bcaed2 (diff) | |
gpart: "gpart --libxo:JP list" duplicates attribute keys
Add leaf-list modifier to attrib as it's possible to have multiple
attributes on a gpart provider.
I purposely made it so that the normal output still says "attrib:" just
so we don't break any scripts people may be using to parse the output,
but the libxo output now says "attribute" just like `gpart show` will do
once https://reviews.freebsd.org/D53950 is merged.
PR: 291377
MFC after: 1 week
Reviewed by: asomers
Sponsored by: ConnectWise
Differential Revision: https://reviews.freebsd.org/D54080
| -rw-r--r-- | sbin/geom/core/geom.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index 51ea52a3e858..a1b1b351ebb3 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -912,8 +912,12 @@ list_one_provider(struct gprovider *pp, const char *padding) } xo_emit("{P:/%s}{Lcw:Mode}{:mode}\n", padding, pp->lg_mode); LIST_FOREACH(conf, &pp->lg_config, lg_config) { - xo_emit("{P:/%s}{Lcwa:}{a:}\n", padding, conf->lg_name, - conf->lg_name, conf->lg_val ? conf->lg_val : ""); + if (strcmp(conf->lg_name, "attrib") != 0) + xo_emit("{P:/%s}{Lcwa:}{a:}\n", padding, conf->lg_name, + conf->lg_name, conf->lg_val ? conf->lg_val : ""); + else + xo_emit("{P:/%s}{Lcw:attrib}{l:attribute}\n", padding, + conf->lg_val ? conf->lg_val : ""); } } |
