Hi tech@,
The subject says it all. I find myself doing this in my head as I hit
^T when fsck'ing. FreeBSD has this, NetBSD does not, FWIW...
Feedback, comments most welcome. Patch attached. Tested lightly on
i386 (after a hilarious few minutes trying to set up a scenario
screwed up enough that fsck took long enough to sneak a ^T in there).
Pax, -A
--
http://haqistan.net/~attila | att...@stalphonsos.com | 0x62A729CF
Index: pass1.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass1.c,v
retrieving revision 1.43
diff -u -p -r1.43 pass1.c
--- pass1.c 22 Aug 2015 06:00:27 - 1.43
+++ pass1.c 25 May 2016 17:19:47 -
@@ -55,8 +55,10 @@ static ino_t info_inumber;
static int
pass1_info(char *buf, size_t buflen)
{
- return (snprintf(buf, buflen, "phase 1, inode %llu/%llu",
+ return (snprintf(buf, buflen, "phase 1, inode %llu/%llu (%llu%%)",
(unsigned long long)info_inumber,
+ (unsigned long long)sblock.fs_ipg * sblock.fs_ncg,
+ (unsigned long long)info_inumber * 100 /
(unsigned long long)sblock.fs_ipg * sblock.fs_ncg) > 0);
}
Index: pass1b.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass1b.c,v
retrieving revision 1.21
diff -u -p -r1.21 pass1b.c
--- pass1b.c 20 Jan 2015 18:22:21 - 1.21
+++ pass1b.c 25 May 2016 17:19:47 -
@@ -47,8 +47,10 @@ static ino_t info_inumber;
static int
pass1b_info(char *buf, size_t buflen)
{
- return (snprintf(buf, buflen, "phase 1b, inode %llu/%llu",
+ return (snprintf(buf, buflen, "phase 1b, inode %llu/%llu (%llu%%)",
(unsigned long long)info_inumber,
+ (unsigned long long)sblock.fs_ipg * sblock.fs_ncg,
+ (unsigned long long)info_inumber * 100 /
(unsigned long long)sblock.fs_ipg * sblock.fs_ncg) > 0);
}
Index: pass2.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass2.c,v
retrieving revision 1.37
diff -u -p -r1.37 pass2.c
--- pass2.c 20 Jan 2015 18:22:21 - 1.37
+++ pass2.c 25 May 2016 17:19:47 -
@@ -56,8 +56,8 @@ static int info_pos;
static int
pass2_info1(char *buf, size_t buflen)
{
- return (snprintf(buf, buflen, "phase 2, directory %d/%d",
- info_pos, info_max) > 0);
+ return (snprintf(buf, buflen, "phase 2, directory %d/%d (%d%%)",
+ info_pos, info_max, info_pos * 100 / info_max) > 0);
}
static int
Index: pass3.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass3.c,v
retrieving revision 1.18
diff -u -p -r1.18 pass3.c
--- pass3.c 20 Jan 2015 18:22:21 - 1.18
+++ pass3.c 25 May 2016 17:19:47 -
@@ -42,8 +42,8 @@ static int info_pos;
static int
pass3_info(char *buf, size_t buflen)
{
- return (snprintf(buf, buflen, "phase 3, directory %d/%ld",
- info_pos, inplast) > 0);
+ return (snprintf(buf, buflen, "phase 3, directory %d/%ld (%ld%%)",
+ info_pos, inplast, info_pos * 100 / inplast) > 0);
}
void
Index: pass4.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass4.c,v
retrieving revision 1.24
diff -u -p -r1.24 pass4.c
--- pass4.c 20 Jan 2015 18:22:21 - 1.24
+++ pass4.c 25 May 2016 17:19:48 -
@@ -47,8 +47,10 @@ static ino_t info_inumber;
static int
pass4_info(char *buf, size_t buflen)
{
- return (snprintf(buf, buflen, "phase 4, inode %llu/%llu",
+ return (snprintf(buf, buflen, "phase 4, inode %llu/%llu (%llu%%)",
(unsigned long long)info_inumber,
+ (unsigned long long)lastino,
+ (unsigned long long)info_inumber * 100 /
(unsigned long long)lastino) > 0);
}
Index: pass5.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass5.c,v
retrieving revision 1.48
diff -u -p -r1.48 pass5.c
--- pass5.c 20 Jan 2015 18:22:21 - 1.48
+++ pass5.c 25 May 2016 17:19:48 -
@@ -54,8 +54,8 @@ static int info_maxcg;
static int
pass5_info(char *buf, size_t buflen)
{
- return (snprintf(buf, buflen, "phase 5, cg %d/%d",
- info_cg, info_maxcg) > 0);
+ return (snprintf(buf, buflen, "phase 5, cg %d/%d (%d%%)",
+ info_cg, info_maxcg, info_cg * 100 / info_maxcg) > 0);
}
void