git: 5f5cc3c67ae8 - main - compat/linprocfs: Update /proc/partitions output

From: ShengYi Hung <aokblast_at_FreeBSD.org>
Date: Sat, 11 Apr 2026 14:10:49 UTC
The branch main has been updated by aokblast:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f5cc3c67ae8a4d9a27e750bef98a9ce1a6b2cf5

commit 5f5cc3c67ae8a4d9a27e750bef98a9ce1a6b2cf5
Author:     Shunchao Hu <ankohuu@gmail.com>
AuthorDate: 2026-04-07 13:07:31 +0000
Commit:     ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-04-11 14:10:05 +0000

    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
---
 sys/compat/linprocfs/linprocfs.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index 941b76788dc1..786a486b9143 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -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);
 				}
 			}
 	}