summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2000-12-15 14:23:55 +0000
committeriedowse <iedowse@FreeBSD.org>2000-12-15 14:23:55 +0000
commit3e3c84c80c9f9500c397dc4b174259d631441b7f (patch)
tree8b803dfd960b8552dd62173dfdcbbabec2ada0d4 /sbin
parentf15d921e9eff691ff94f40f1490b10cd0ab78d65 (diff)
downloadFreeBSD-src-3e3c84c80c9f9500c397dc4b174259d631441b7f.zip
FreeBSD-src-3e3c84c80c9f9500c397dc4b174259d631441b7f.tar.gz
Add a simple SIGINFO handler to fsck_ffs. Shortly after receipt of
a SIGINFO (normally via Ctrl-T), a line will be output indicating the current phase number and progress information relevant to the current phase. Approved by: mckusick
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck_ffs/fsck.h3
-rw-r--r--sbin/fsck_ffs/main.c1
-rw-r--r--sbin/fsck_ffs/pass1.c6
-rw-r--r--sbin/fsck_ffs/pass1b.c6
-rw-r--r--sbin/fsck_ffs/pass2.c6
-rw-r--r--sbin/fsck_ffs/pass3.c6
-rw-r--r--sbin/fsck_ffs/pass4.c6
-rw-r--r--sbin/fsck_ffs/pass5.c6
-rw-r--r--sbin/fsck_ffs/utilities.c7
9 files changed, 47 insertions, 0 deletions
diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h
index a0be2a4..7365767 100644
--- a/sbin/fsck_ffs/fsck.h
+++ b/sbin/fsck_ffs/fsck.h
@@ -223,6 +223,8 @@ int lfmode; /* lost & found directory creation mode */
ufs_daddr_t n_blks; /* number of blocks in use */
ufs_daddr_t n_files; /* number of files in use */
+int got_siginfo; /* received a SIGINFO */
+
#define clearinode(dp) (*(dp) = zino)
struct dinode zino;
@@ -280,6 +282,7 @@ struct inoinfo *getinoinfo __P((ino_t inumber));
struct dinode *getnextinode __P((ino_t inumber));
void getpathname __P((char *namebuf, ino_t curdir, ino_t ino));
struct dinode *ginode __P((ino_t inumber));
+void infohandler __P((int sig));
void inocleanup __P((void));
void inodirty __P((void));
struct inostat *inoinfo __P((ino_t inum));
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 1e8a5b4..7ee4ef0b 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -140,6 +140,7 @@ main(argc, argv)
(void)signal(SIGINT, catch);
if (preen)
(void)signal(SIGQUIT, catchquit);
+ signal(SIGINFO, infohandler);
/*
* Push up our allowed memory limit so we can cope
* with huge filesystems.
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c
index 1045a5f..e6bd215 100644
--- a/sbin/fsck_ffs/pass1.c
+++ b/sbin/fsck_ffs/pass1.c
@@ -93,6 +93,12 @@ pass1()
inumber = c * sblock.fs_ipg;
setinodebuf(inumber);
inosused = sblock.fs_ipg;
+ if (got_siginfo) {
+ printf("%s: phase 1: cyl group %d of %d (%d%%)\n",
+ cdevname, c, sblock.fs_ncg,
+ c * 100 / sblock.fs_ncg);
+ got_siginfo = 0;
+ }
/*
* If we are using soft updates, then we can trust the
* cylinder group inode allocation maps to tell us which
diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c
index 7ef662f..9a37c1d 100644
--- a/sbin/fsck_ffs/pass1b.c
+++ b/sbin/fsck_ffs/pass1b.c
@@ -65,6 +65,12 @@ pass1b()
duphead = duplist;
inumber = 0;
for (c = 0; c < sblock.fs_ncg; c++) {
+ if (got_siginfo) {
+ printf("%s: phase 1b: cyl group %d of %d (%d%%)\n",
+ cdevname, c, sblock.fs_ncg,
+ c * 100 / sblock.fs_ncg);
+ got_siginfo = 0;
+ }
for (i = 0; i < sblock.fs_ipg; i++, inumber++) {
if (inumber < ROOTINO)
continue;
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c
index 088ecff..cbd5d9f 100644
--- a/sbin/fsck_ffs/pass2.c
+++ b/sbin/fsck_ffs/pass2.c
@@ -134,6 +134,12 @@ pass2()
dp = &dino;
inpend = &inpsort[inplast];
for (inpp = inpsort; inpp < inpend; inpp++) {
+ if (got_siginfo) {
+ printf("%s: phase 2: dir %d of %d (%d%%)\n", cdevname,
+ inpp - inpsort, inplast, (inpp - inpsort) * 100 /
+ inplast);
+ got_siginfo = 0;
+ }
inp = *inpp;
if (inp->i_isize == 0)
continue;
diff --git a/sbin/fsck_ffs/pass3.c b/sbin/fsck_ffs/pass3.c
index 80e38e9..730af5f 100644
--- a/sbin/fsck_ffs/pass3.c
+++ b/sbin/fsck_ffs/pass3.c
@@ -59,6 +59,12 @@ pass3()
char namebuf[MAXNAMLEN+1];
for (inpindex = inplast - 1; inpindex >= 0; inpindex--) {
+ if (got_siginfo) {
+ printf("%s: phase 3: dir %d of %d (%d%%)\n", cdevname,
+ inplast - inpindex - 1, inplast,
+ (inplast - inpindex - 1) * 100 / inplast);
+ got_siginfo = 0;
+ }
inp = inpsort[inpindex];
state = inoinfo(inp->i_number)->ino_state;
if (inp->i_number == ROOTINO ||
diff --git a/sbin/fsck_ffs/pass4.c b/sbin/fsck_ffs/pass4.c
index 0012c50..9e9cea5 100644
--- a/sbin/fsck_ffs/pass4.c
+++ b/sbin/fsck_ffs/pass4.c
@@ -62,6 +62,12 @@ pass4()
idesc.id_type = ADDR;
idesc.id_func = pass4check;
for (cg = 0; cg < sblock.fs_ncg; cg++) {
+ if (got_siginfo) {
+ printf("%s: phase 4: cyl group %d of %d (%d%%)\n",
+ cdevname, cg, sblock.fs_ncg,
+ cg * 100 / sblock.fs_ncg);
+ got_siginfo = 0;
+ }
inumber = cg * sblock.fs_ipg;
for (i = 0; i < inostathead[cg].il_numalloced; i++, inumber++) {
if (inumber < ROOTINO)
diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c
index e395625..5da84b8 100644
--- a/sbin/fsck_ffs/pass5.c
+++ b/sbin/fsck_ffs/pass5.c
@@ -169,6 +169,12 @@ pass5()
for (i = fs->fs_size; i < j; i++)
setbmap(i);
for (c = 0; c < fs->fs_ncg; c++) {
+ if (got_siginfo) {
+ printf("%s: phase 5: cyl group %d of %d (%d%%)\n",
+ cdevname, c, sblock.fs_ncg,
+ c * 100 / sblock.fs_ncg);
+ got_siginfo = 0;
+ }
getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize);
if (!cg_chkmagic(cg))
pfatal("CG %d: BAD MAGIC NUMBER\n", c);
diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c
index c77f410..aee31f0 100644
--- a/sbin/fsck_ffs/utilities.c
+++ b/sbin/fsck_ffs/utilities.c
@@ -101,3 +101,10 @@ retry:
*/
return (origname);
}
+
+void
+infohandler(sig)
+ int sig;
+{
+ got_siginfo = 1;
+}
OpenPOWER on IntegriCloud