compat/linprocfs: Update /proc/partitions output

Linux /proc/partitions reports the major/minor pair, the device size in
1K blocks, and the device name.  linprocfs still printed obsolete
statistics columns and reported the size in bytes.

Update linprocfs_dopartitions() to emit the Linux-style header and
report provider sizes in 1K blocks.

Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
Reviewed by:    des
MFC after:      2 weeks
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2126
Closes:         https://github.com/freebsd/freebsd-src/pull/2126
This commit is contained in:
Shunchao Hu
2026-04-07 13:07:31 +00:00
committed by ShengYi Hung
parent 4e3fdced7f
commit 5f5cc3c67a
+5 -9
View File
@@ -659,8 +659,7 @@ linprocfs_dopartitions(PFS_FILL_ARGS)
int major, minor;
g_topology_lock();
sbuf_printf(sb, "major minor #blocks name rio rmerge rsect "
"ruse wio wmerge wsect wuse running use aveq\n");
sbuf_printf(sb, "major minor #blocks name\n\n");
LIST_FOREACH(cp, &g_classes, class) {
if (strcmp(cp->name, "DISK") == 0 ||
@@ -672,13 +671,10 @@ linprocfs_dopartitions(PFS_FILL_ARGS)
major = 0;
minor = 0;
}
sbuf_printf(sb, "%d %d %lld %s "
"%d %d %d %d %d "
"%d %d %d %d %d %d\n",
major, minor,
(long long)pp->mediasize, pp->name,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0);
sbuf_printf(sb, "%4d %7d %10lld %s\n",
major, minor,
B2K((long long)pp->mediasize),
pp->name);
}
}
}