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
This commit is contained in:
Alan Somers
2025-12-05 09:16:53 -07:00
parent 4ae02d9792
commit a0347b0f3a
+6 -2
View File
@@ -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 : "");
}
}