1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1980, 1986, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. Neither the name of the University nor the names of its contributors 16 * may be used to endorse or promote products derived from this software 17 * without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32 #if 0 33 #ifndef lint 34 static const char copyright[] = 35 "@(#) Copyright (c) 1980, 1986, 1993\n\ 36 The Regents of the University of California. All rights reserved.\n"; 37 #endif /* not lint */ 38 39 #ifndef lint 40 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; 41 #endif /* not lint */ 42 #endif 43 #include <sys/cdefs.h> 44 __FBSDID("$FreeBSD$"); 45 46 #include <sys/param.h> 47 #include <sys/file.h> 48 #include <sys/mount.h> 49 #include <sys/resource.h> 50 #include <sys/stat.h> 51 #include <sys/sysctl.h> 52 #include <sys/uio.h> 53 #include <sys/disklabel.h> 54 55 #include <ufs/ufs/dinode.h> 56 #include <ufs/ffs/fs.h> 57 58 #include <err.h> 59 #include <errno.h> 60 #include <fstab.h> 61 #include <grp.h> 62 #include <inttypes.h> 63 #include <mntopts.h> 64 #include <paths.h> 65 #include <stdint.h> 66 #include <string.h> 67 #include <time.h> 68 69 #include "fsck.h" 70 71 int restarts; 72 73 static void usage(void) __dead2; 74 static intmax_t argtoimax(int flag, const char *req, const char *str, int base); 75 static int checkfilesys(char *filesys); 76 static int chkdoreload(struct statfs *mntp); 77 static struct statfs *getmntpt(const char *); 78 79 int 80 main(int argc, char *argv[]) 81 { 82 int ch; 83 struct rlimit rlimit; 84 struct itimerval itimerval; 85 int fsret; 86 int ret = 0; 87 88 sync(); 89 skipclean = 1; 90 inoopt = 0; 91 while ((ch = getopt(argc, argv, "b:Bc:CdEfFm:npRrSyZ")) != -1) { 92 switch (ch) { 93 case 'b': 94 skipclean = 0; 95 bflag = argtoimax('b', "number", optarg, 10); 96 printf("Alternate super block location: %jd\n", bflag); 97 break; 98 99 case 'B': 100 bkgrdflag = 1; 101 break; 102 103 case 'c': 104 skipclean = 0; 105 cvtlevel = argtoimax('c', "conversion level", optarg, 106 10); 107 if (cvtlevel < 3) 108 errx(EEXIT, "cannot do level %d conversion", 109 cvtlevel); 110 break; 111 112 case 'd': 113 debug++; 114 break; 115 116 case 'E': 117 Eflag++; 118 break; 119 120 case 'f': 121 skipclean = 0; 122 break; 123 124 case 'F': 125 bkgrdcheck = 1; 126 break; 127 128 case 'm': 129 lfmode = argtoimax('m', "mode", optarg, 8); 130 if (lfmode &~ 07777) 131 errx(EEXIT, "bad mode to -m: %o", lfmode); 132 printf("** lost+found creation mode %o\n", lfmode); 133 break; 134 135 case 'n': 136 nflag++; 137 yflag = 0; 138 break; 139 140 case 'p': 141 preen++; 142 /*FALLTHROUGH*/ 143 144 case 'C': 145 ckclean++; 146 break; 147 148 case 'R': 149 wantrestart = 1; 150 break; 151 case 'r': 152 inoopt++; 153 break; 154 155 case 'S': 156 surrender = 1; 157 break; 158 159 case 'y': 160 yflag++; 161 nflag = 0; 162 break; 163 164 case 'Z': 165 Zflag++; 166 break; 167 168 default: 169 usage(); 170 } 171 } 172 argc -= optind; 173 argv += optind; 174 175 if (!argc) 176 usage(); 177 178 if (signal(SIGINT, SIG_IGN) != SIG_IGN) 179 (void)signal(SIGINT, catch); 180 if (ckclean) 181 (void)signal(SIGQUIT, catchquit); 182 signal(SIGINFO, infohandler); 183 if (bkgrdflag) { 184 signal(SIGALRM, alarmhandler); 185 itimerval.it_interval.tv_sec = 5; 186 itimerval.it_interval.tv_usec = 0; 187 itimerval.it_value.tv_sec = 5; 188 itimerval.it_value.tv_usec = 0; 189 setitimer(ITIMER_REAL, &itimerval, NULL); 190 } 191 /* 192 * Push up our allowed memory limit so we can cope 193 * with huge file systems. 194 */ 195 if (getrlimit(RLIMIT_DATA, &rlimit) == 0) { 196 rlimit.rlim_cur = rlimit.rlim_max; 197 (void)setrlimit(RLIMIT_DATA, &rlimit); 198 } 199 while (argc > 0) { 200 if ((fsret = checkfilesys(*argv)) == ERESTART) 201 continue; 202 ret |= fsret; 203 argc--; 204 argv++; 205 } 206 207 if (returntosingle) 208 ret = 2; 209 exit(ret); 210 } 211 212 static intmax_t 213 argtoimax(int flag, const char *req, const char *str, int base) 214 { 215 char *cp; 216 intmax_t ret; 217 218 ret = strtoimax(str, &cp, base); 219 if (cp == str || *cp) 220 errx(EEXIT, "-%c flag requires a %s", flag, req); 221 return (ret); 222 } 223 224 /* 225 * Check the specified file system. 226 */ 227 /* ARGSUSED */ 228 static int 229 checkfilesys(char *filesys) 230 { 231 ufs2_daddr_t n_ffree, n_bfree; 232 struct dups *dp; 233 struct statfs *mntp; 234 struct stat snapdir; 235 struct group *grp; 236 struct iovec *iov; 237 char errmsg[255]; 238 int ofsmodified; 239 int iovlen; 240 int cylno; 241 intmax_t blks, files; 242 size_t size; 243 244 iov = NULL; 245 iovlen = 0; 246 errmsg[0] = '\0'; 247 fsutilinit(); 248 fsckinit(); 249 250 cdevname = filesys; 251 if (debug && ckclean) 252 pwarn("starting\n"); 253 /* 254 * Make best effort to get the disk name. Check first to see 255 * if it is listed among the mounted file systems. Failing that 256 * check to see if it is listed in /etc/fstab. 257 */ 258 mntp = getmntpt(filesys); 259 if (mntp != NULL) 260 filesys = mntp->f_mntfromname; 261 else 262 filesys = blockcheck(filesys); 263 /* 264 * If -F flag specified, check to see whether a background check 265 * is possible and needed. If possible and needed, exit with 266 * status zero. Otherwise exit with status non-zero. A non-zero 267 * exit status will cause a foreground check to be run. 268 */ 269 sblock_init(); 270 if (bkgrdcheck) { 271 if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) 272 exit(3); /* Cannot read superblock */ 273 close(fsreadfd); 274 /* Earlier background failed or journaled */ 275 if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ)) 276 exit(4); 277 if ((sblock.fs_flags & FS_DOSOFTDEP) == 0) 278 exit(5); /* Not running soft updates */ 279 size = MIBSIZE; 280 if (sysctlnametomib("vfs.ffs.adjrefcnt", adjrefcnt, &size) < 0) 281 exit(6); /* Lacks kernel support */ 282 if ((mntp == NULL && sblock.fs_clean == 1) || 283 (mntp != NULL && (sblock.fs_flags & FS_UNCLEAN) == 0)) 284 exit(7); /* Filesystem clean, report it now */ 285 exit(0); 286 } 287 if (ckclean && skipclean) { 288 /* 289 * If file system is gjournaled, check it here. 290 */ 291 if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) 292 exit(3); /* Cannot read superblock */ 293 close(fsreadfd); 294 if ((sblock.fs_flags & FS_GJOURNAL) != 0) { 295 //printf("GJournaled file system detected on %s.\n", 296 // filesys); 297 if (sblock.fs_clean == 1) { 298 pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); 299 exit(0); 300 } 301 if ((sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0) { 302 gjournal_check(filesys); 303 if (chkdoreload(mntp) == 0) 304 exit(0); 305 exit(4); 306 } else { 307 pfatal( 308 "UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n"); 309 } 310 } 311 } 312 /* 313 * If we are to do a background check: 314 * Get the mount point information of the file system 315 * create snapshot file 316 * return created snapshot file 317 * if not found, clear bkgrdflag and proceed with normal fsck 318 */ 319 if (bkgrdflag) { 320 if (mntp == NULL) { 321 bkgrdflag = 0; 322 pfatal("NOT MOUNTED, CANNOT RUN IN BACKGROUND\n"); 323 } else if ((mntp->f_flags & MNT_SOFTDEP) == 0) { 324 bkgrdflag = 0; 325 pfatal( 326 "NOT USING SOFT UPDATES, CANNOT RUN IN BACKGROUND\n"); 327 } else if ((mntp->f_flags & MNT_RDONLY) != 0) { 328 bkgrdflag = 0; 329 pfatal("MOUNTED READ-ONLY, CANNOT RUN IN BACKGROUND\n"); 330 } else if ((fsreadfd = open(filesys, O_RDONLY)) >= 0) { 331 if (readsb(0) != 0) { 332 if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ)) { 333 bkgrdflag = 0; 334 pfatal( 335 "UNEXPECTED INCONSISTENCY, CANNOT RUN IN BACKGROUND\n"); 336 } 337 if ((sblock.fs_flags & FS_UNCLEAN) == 0 && 338 skipclean && ckclean) { 339 /* 340 * file system is clean; 341 * skip snapshot and report it clean 342 */ 343 pwarn( 344 "FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); 345 goto clean; 346 } 347 } 348 close(fsreadfd); 349 } 350 if (bkgrdflag) { 351 snprintf(snapname, sizeof snapname, "%s/.snap", 352 mntp->f_mntonname); 353 if (stat(snapname, &snapdir) < 0) { 354 if (errno != ENOENT) { 355 bkgrdflag = 0; 356 pfatal( 357 "CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n", 358 snapname, strerror(errno)); 359 } else if ((grp = getgrnam("operator")) == NULL || 360 mkdir(snapname, 0770) < 0 || 361 chown(snapname, -1, grp->gr_gid) < 0 || 362 chmod(snapname, 0770) < 0) { 363 bkgrdflag = 0; 364 pfatal( 365 "CANNOT CREATE SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n", 366 snapname, strerror(errno)); 367 } 368 } else if (!S_ISDIR(snapdir.st_mode)) { 369 bkgrdflag = 0; 370 pfatal( 371 "%s IS NOT A DIRECTORY, CANNOT RUN IN BACKGROUND\n", 372 snapname); 373 } 374 } 375 if (bkgrdflag) { 376 snprintf(snapname, sizeof snapname, 377 "%s/.snap/fsck_snapshot", mntp->f_mntonname); 378 build_iovec(&iov, &iovlen, "fstype", "ffs", 4); 379 build_iovec(&iov, &iovlen, "from", snapname, 380 (size_t)-1); 381 build_iovec(&iov, &iovlen, "fspath", mntp->f_mntonname, 382 (size_t)-1); 383 build_iovec(&iov, &iovlen, "errmsg", errmsg, 384 sizeof(errmsg)); 385 build_iovec(&iov, &iovlen, "update", NULL, 0); 386 build_iovec(&iov, &iovlen, "snapshot", NULL, 0); 387 388 while (nmount(iov, iovlen, mntp->f_flags) < 0) { 389 if (errno == EEXIST && unlink(snapname) == 0) 390 continue; 391 bkgrdflag = 0; 392 pfatal("CANNOT CREATE SNAPSHOT %s: %s %s\n", 393 snapname, strerror(errno), errmsg); 394 break; 395 } 396 if (bkgrdflag != 0) 397 filesys = snapname; 398 } 399 } 400 401 switch (setup(filesys)) { 402 case 0: 403 if (preen) 404 pfatal("CAN'T CHECK FILE SYSTEM."); 405 return (0); 406 case -1: 407 clean: 408 pwarn("clean, %ld free ", (long)(sblock.fs_cstotal.cs_nffree + 409 sblock.fs_frag * sblock.fs_cstotal.cs_nbfree)); 410 printf("(%jd frags, %jd blocks, %.1f%% fragmentation)\n", 411 (intmax_t)sblock.fs_cstotal.cs_nffree, 412 (intmax_t)sblock.fs_cstotal.cs_nbfree, 413 sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize); 414 return (0); 415 } 416 /* 417 * Determine if we can and should do journal recovery. 418 */ 419 if ((sblock.fs_flags & FS_SUJ) == FS_SUJ) { 420 if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && skipclean) { 421 if (preen || reply("USE JOURNAL")) { 422 if (suj_check(filesys) == 0) { 423 printf("\n***** FILE SYSTEM MARKED CLEAN *****\n"); 424 if (chkdoreload(mntp) == 0) 425 exit(0); 426 exit(4); 427 } 428 } 429 printf("** Skipping journal, falling through to full fsck\n\n"); 430 } 431 /* 432 * Write the superblock so we don't try to recover the 433 * journal on another pass. If this is the only change 434 * to the filesystem, we do not want it to be called 435 * out as modified. 436 */ 437 sblock.fs_mtime = time(NULL); 438 sbdirty(); 439 ofsmodified = fsmodified; 440 flush(fswritefd, &sblk); 441 fsmodified = ofsmodified; 442 } 443 444 /* 445 * Cleared if any questions answered no. Used to decide if 446 * the superblock should be marked clean. 447 */ 448 resolved = 1; 449 /* 450 * 1: scan inodes tallying blocks used 451 */ 452 if (preen == 0) { 453 printf("** Last Mounted on %s\n", sblock.fs_fsmnt); 454 if (mntp != NULL && mntp->f_flags & MNT_ROOTFS) 455 printf("** Root file system\n"); 456 printf("** Phase 1 - Check Blocks and Sizes\n"); 457 } 458 clock_gettime(CLOCK_REALTIME_PRECISE, &startprog); 459 pass1(); 460 IOstats("Pass1"); 461 462 /* 463 * 1b: locate first references to duplicates, if any 464 */ 465 if (duplist) { 466 if (preen || usedsoftdep) 467 pfatal("INTERNAL ERROR: dups with %s%s%s", 468 preen ? "-p" : "", 469 (preen && usedsoftdep) ? " and " : "", 470 usedsoftdep ? "softupdates" : ""); 471 printf("** Phase 1b - Rescan For More DUPS\n"); 472 pass1b(); 473 IOstats("Pass1b"); 474 } 475 476 /* 477 * 2: traverse directories from root to mark all connected directories 478 */ 479 if (preen == 0) 480 printf("** Phase 2 - Check Pathnames\n"); 481 pass2(); 482 IOstats("Pass2"); 483 484 /* 485 * 3: scan inodes looking for disconnected directories 486 */ 487 if (preen == 0) 488 printf("** Phase 3 - Check Connectivity\n"); 489 pass3(); 490 IOstats("Pass3"); 491 492 /* 493 * 4: scan inodes looking for disconnected files; check reference counts 494 */ 495 if (preen == 0) 496 printf("** Phase 4 - Check Reference Counts\n"); 497 pass4(); 498 IOstats("Pass4"); 499 500 /* 501 * 5: check and repair resource counts in cylinder groups 502 */ 503 if (preen == 0) 504 printf("** Phase 5 - Check Cyl groups\n"); 505 pass5(); 506 IOstats("Pass5"); 507 508 /* 509 * print out summary statistics 510 */ 511 n_ffree = sblock.fs_cstotal.cs_nffree; 512 n_bfree = sblock.fs_cstotal.cs_nbfree; 513 files = maxino - UFS_ROOTINO - sblock.fs_cstotal.cs_nifree - n_files; 514 blks = n_blks + 515 sblock.fs_ncg * (cgdmin(&sblock, 0) - cgsblock(&sblock, 0)); 516 blks += cgsblock(&sblock, 0) - cgbase(&sblock, 0); 517 blks += howmany(sblock.fs_cssize, sblock.fs_fsize); 518 blks = maxfsblock - (n_ffree + sblock.fs_frag * n_bfree) - blks; 519 if (bkgrdflag && (files > 0 || blks > 0)) { 520 countdirs = sblock.fs_cstotal.cs_ndir - countdirs; 521 pwarn("Reclaimed: %ld directories, %jd files, %jd fragments\n", 522 countdirs, files - countdirs, blks); 523 } 524 pwarn("%ld files, %jd used, %ju free ", 525 (long)n_files, (intmax_t)n_blks, 526 (uintmax_t)n_ffree + sblock.fs_frag * n_bfree); 527 printf("(%ju frags, %ju blocks, %.1f%% fragmentation)\n", 528 (uintmax_t)n_ffree, (uintmax_t)n_bfree, 529 n_ffree * 100.0 / sblock.fs_dsize); 530 if (debug) { 531 if (files < 0) 532 printf("%jd inodes missing\n", -files); 533 if (blks < 0) 534 printf("%jd blocks missing\n", -blks); 535 if (duplist != NULL) { 536 printf("The following duplicate blocks remain:"); 537 for (dp = duplist; dp; dp = dp->next) 538 printf(" %jd,", (intmax_t)dp->dup); 539 printf("\n"); 540 } 541 } 542 duplist = (struct dups *)0; 543 muldup = (struct dups *)0; 544 inocleanup(); 545 if (fsmodified) { 546 sblock.fs_time = time(NULL); 547 sbdirty(); 548 } 549 if (cvtlevel && sblk.b_dirty) { 550 /* 551 * Write out the duplicate super blocks 552 */ 553 for (cylno = 0; cylno < sblock.fs_ncg; cylno++) 554 blwrite(fswritefd, (char *)&sblock, 555 fsbtodb(&sblock, cgsblock(&sblock, cylno)), 556 SBLOCKSIZE); 557 } 558 if (rerun) 559 resolved = 0; 560 finalIOstats(); 561 562 /* 563 * Check to see if the file system is mounted read-write. 564 */ 565 if (bkgrdflag == 0 && mntp != NULL && (mntp->f_flags & MNT_RDONLY) == 0) 566 resolved = 0; 567 ckfini(resolved); 568 569 for (cylno = 0; cylno < sblock.fs_ncg; cylno++) 570 if (inostathead[cylno].il_stat != NULL) 571 free((char *)inostathead[cylno].il_stat); 572 free((char *)inostathead); 573 inostathead = NULL; 574 if (fsmodified && !preen) 575 printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); 576 if (rerun) { 577 if (wantrestart && (restarts++ < 10) && 578 (preen || reply("RESTART"))) 579 return (ERESTART); 580 printf("\n***** PLEASE RERUN FSCK *****\n"); 581 } 582 if (chkdoreload(mntp) != 0) { 583 if (!fsmodified) 584 return (0); 585 if (!preen) 586 printf("\n***** REBOOT NOW *****\n"); 587 sync(); 588 return (4); 589 } 590 return (rerun ? ERERUN : 0); 591 } 592 593 static int 594 chkdoreload(struct statfs *mntp) 595 { 596 struct iovec *iov; 597 int iovlen; 598 char errmsg[255]; 599 600 if (mntp == NULL) 601 return (0); 602 603 iov = NULL; 604 iovlen = 0; 605 errmsg[0] = '\0'; 606 /* 607 * We modified a mounted file system. Do a mount update on 608 * it unless it is read-write, so we can continue using it 609 * as safely as possible. 610 */ 611 if (mntp->f_flags & MNT_RDONLY) { 612 build_iovec(&iov, &iovlen, "fstype", "ffs", 4); 613 build_iovec(&iov, &iovlen, "from", mntp->f_mntfromname, 614 (size_t)-1); 615 build_iovec(&iov, &iovlen, "fspath", mntp->f_mntonname, 616 (size_t)-1); 617 build_iovec(&iov, &iovlen, "errmsg", errmsg, 618 sizeof(errmsg)); 619 build_iovec(&iov, &iovlen, "update", NULL, 0); 620 build_iovec(&iov, &iovlen, "reload", NULL, 0); 621 /* 622 * XX: We need the following line until we clean up 623 * nmount parsing of root mounts and NFS root mounts. 624 */ 625 build_iovec(&iov, &iovlen, "ro", NULL, 0); 626 if (nmount(iov, iovlen, mntp->f_flags) == 0) { 627 return (0); 628 } 629 pwarn("mount reload of '%s' failed: %s %s\n\n", 630 mntp->f_mntonname, strerror(errno), errmsg); 631 return (1); 632 } 633 return (0); 634 } 635 636 /* 637 * Get the mount point information for name. 638 */ 639 static struct statfs * 640 getmntpt(const char *name) 641 { 642 struct stat devstat, mntdevstat; 643 char device[sizeof(_PATH_DEV) - 1 + MNAMELEN]; 644 char *ddevname; 645 struct statfs *mntbuf, *statfsp; 646 int i, mntsize, isdev; 647 648 if (stat(name, &devstat) != 0) 649 return (NULL); 650 if (S_ISCHR(devstat.st_mode) || S_ISBLK(devstat.st_mode)) 651 isdev = 1; 652 else 653 isdev = 0; 654 mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); 655 for (i = 0; i < mntsize; i++) { 656 statfsp = &mntbuf[i]; 657 ddevname = statfsp->f_mntfromname; 658 if (*ddevname != '/') { 659 if (strlen(_PATH_DEV) + strlen(ddevname) + 1 > 660 sizeof(statfsp->f_mntfromname)) 661 continue; 662 strcpy(device, _PATH_DEV); 663 strcat(device, ddevname); 664 strcpy(statfsp->f_mntfromname, device); 665 } 666 if (isdev == 0) { 667 if (strcmp(name, statfsp->f_mntonname)) 668 continue; 669 return (statfsp); 670 } 671 if (stat(ddevname, &mntdevstat) == 0 && 672 mntdevstat.st_rdev == devstat.st_rdev) 673 return (statfsp); 674 } 675 statfsp = NULL; 676 return (statfsp); 677 } 678 679 static void 680 usage(void) 681 { 682 (void) fprintf(stderr, 683 "usage: %s [-BCdEFfnpRrSyZ] [-b block] [-c level] [-m mode] filesystem ...\n", 684 getprogname()); 685 exit(1); 686 } 687 688 void 689 infohandler(int sig __unused) 690 { 691 got_siginfo = 1; 692 } 693 694 void 695 alarmhandler(int sig __unused) 696 { 697 got_sigalarm = 1; 698 } 699