Page MenuHomeFreeBSD

D53950.id167534.diff
No OneTemporary

D53950.id167534.diff

diff --git a/lib/geom/part/geom_part.c b/lib/geom/part/geom_part.c
--- a/lib/geom/part/geom_part.c
+++ b/lib/geom/part/geom_part.c
@@ -78,7 +78,6 @@
static const char *find_geomcfg(struct ggeom *, const char *);
static const char *find_provcfg(struct gprovider *, const char *);
static struct gprovider *find_provider(struct ggeom *, off_t);
-static const char *fmtsize(int64_t);
static int gpart_autofill(struct gctl_req *);
static int gpart_autofill_resize(struct gctl_req *);
static void gpart_bootcode(struct gctl_req *, unsigned int);
@@ -284,16 +283,6 @@
return (bestpp);
}
-static const char *
-fmtsize(int64_t rawsz)
-{
- static char buf[5];
-
- humanize_number(buf, sizeof(buf), rawsz, "", HN_AUTOSCALE,
- HN_B | HN_NOSPACE | HN_DECIMAL);
- return (buf);
-}
-
static const char *
fmtattrib(struct gprovider *pp)
{
@@ -623,6 +612,7 @@
gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
{
struct gprovider *pp;
+ struct gconfig *gc;
const char *s, *scheme;
off_t first, last, sector, end;
off_t length, secsz;
@@ -661,10 +651,10 @@
pp = LIST_FIRST(&gp->lg_consumer)->lg_provider;
secsz = pp->lg_sectorsize;
xo_open_instance("part");
- xo_emit("=>{t:logical_starting_block/%*jd} {t:size_in_blocks/%*jd} {t:name/%*s} {:scheme} ({:size}){t:state}\n",
+ xo_emit("=>{t:start/%*jd} {t:sectors/%*jd} {t:name/%*s} {:scheme} ({h:size/%ld}){t:state}\n",
wblocks, (intmax_t)first, wblocks, (intmax_t)(last - first + 1),
wname, gp->lg_name,
- scheme, fmtsize(pp->lg_mediasize),
+ scheme, pp->lg_mediasize,
s ? " [CORRUPT]": "");
xo_open_list("partitions");
@@ -680,38 +670,63 @@
idx = atoi(s);
if (first < sector) {
xo_open_instance(s);
- xo_emit(" {t:logical_starting_block/%*jd} {t:size_in_blocks/%*jd} {P:/%*s} {e:free}- free - ({:size})\n",
+ xo_emit(" {t:start/%*jd} {t:sectors/%*jd} {P:/%*s} {ne:free}- free - ({h:size/%ld})\n",
wblocks, (intmax_t)first, wblocks,
(intmax_t)(sector - first), wname, "",
- "true", fmtsize((sector - first) * secsz));
+ "true", (sector - first) * secsz);
xo_close_instance(s);
}
xo_open_instance(s);
+ xo_emit(" {t:start/%*jd} {t:sectors/%*jd}",
+ wblocks, (intmax_t)sector, wblocks, (intmax_t)length);
if (show_providers) {
- xo_emit(" {t:logical_starting_block/%*jd} {t:size_in_blocks/%*jd} {t:provider_name/%*s}{e:index/%d} {:type} {:attribute} ({:size})\n",
- wblocks, (intmax_t)sector, wblocks,
- (intmax_t)length, wname, pp->lg_name,
- idx, find_provcfg(pp, element),
- fmtattrib(pp), fmtsize(pp->lg_mediasize));
+ xo_emit(" {t:name/%*s}{e:index/%d}", wname, pp->lg_name, idx);
} else
- xo_emit(" {t:logical_starting_block/%*jd} {t:size_in_blocks/%*jd} {t:index/%*d}{e:provider_name} {:type} {:attribute} ({:size})\n",
- wblocks, (intmax_t)sector, wblocks,
- (intmax_t)length, wname, idx, pp->lg_name,
- find_provcfg(pp, element), fmtattrib(pp),
- fmtsize(pp->lg_mediasize));
+ xo_emit(" {t:index/%*d}{e:name}", wname, idx, pp->lg_name);
+
+ if (strcmp(element, "label") == 0)
+ xo_emit(" {:label}{e:type}{e:rawtype}",
+ find_provcfg(pp, element),
+ find_provcfg(pp, "type"),
+ find_provcfg(pp, "rawtype"));
+ else if (strcmp(element, "type") == 0)
+ xo_emit(" {:type}{e:label}{e:rawtype}",
+ find_provcfg(pp, element),
+ find_provcfg(pp, "label"),
+ find_provcfg(pp, "rawtype"));
+ else
+ xo_emit(" {:rawtype}{e:type}{e:label}",
+ find_provcfg(pp, element),
+ find_provcfg(pp, "type"),
+ find_provcfg(pp, "label"));
+
+ idx = 0;
+ LIST_FOREACH(gc, &pp->lg_config, lg_config) {
+ if (strcmp(gc->lg_name, "attrib") != 0)
+ continue;
+ idx++;
+ if (idx == 1)
+ xo_emit(" [");
+ else
+ xo_emit(",");
+ xo_emit("{l:attribute}", gc->lg_val);
+ }
+ if (idx)
+ xo_emit("]");
+ xo_emit(" ({h:size/%ld})\n", pp->lg_mediasize);
xo_close_instance(s);
first = end + 1;
}
- xo_close_list("partitions");
if (first <= last) {
- xo_open_container("unallocated");
+ xo_open_instance("unallocated");
length = last - first + 1;
- xo_emit(" {t:logical_starting_block/%*jd} {t:size_in_blocks/%*jd} {P:/%*s} - free - ({:size})\n",
+ xo_emit(" {t:start/%*jd} {t:sectors/%*jd} {P:/%*s} {ne:free}- free - ({h:size/%ld})\n",
wblocks, (intmax_t)first, wblocks, (intmax_t)length,
- wname, "", fmtsize(length * secsz));
- xo_close_container("unallocated");
+ wname, "", "true", length * secsz);
+ xo_close_instance("unallocated");
}
+ xo_close_list("partitions");
xo_close_instance("part");
xo_emit("\n");
}
diff --git a/lib/geom/part/gpart.8 b/lib/geom/part/gpart.8
--- a/lib/geom/part/gpart.8
+++ b/lib/geom/part/gpart.8
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd October 24, 2025
+.Dd December 4, 2025
.Dt GPART 8
.Os
.Sh NAME
diff --git a/sbin/geom/core/geom.8 b/sbin/geom/core/geom.8
--- a/sbin/geom/core/geom.8
+++ b/sbin/geom/core/geom.8
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd May 9, 2023
+.Dd December 4, 2025
.Dt GEOM 8
.Os
.Sh NAME
@@ -214,6 +214,7 @@
.Sh SEE ALSO
.Xr libgeom 3 ,
.Xr geom 4 ,
+.Xr xo_options 7 ,
.Xr gcache 8 ,
.Xr gconcat 8 ,
.Xr geli 8 ,
@@ -229,8 +230,6 @@
.Xr gstripe 8 ,
.Xr gunion 8 ,
.Xr gvirstor 8
-.Xr libxo 3 ,
-.Xr xo_options 7 ,
.Sh HISTORY
The
.Nm

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 13, 1:56 AM (22 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31387555
Default Alt Text
D53950.id167534.diff (5 KB)

Event Timeline