Deleted Added
full compact
45c45
< "$FreeBSD: head/sbin/fsck_ffs/main.c 75557 2001-04-16 22:22:21Z mckusick $";
---
> "$FreeBSD: head/sbin/fsck_ffs/main.c 75927 2001-04-24 22:38:08Z mckusick $";
66,67d65
< int returntosingle;
<
87c85
< while ((ch = getopt(argc, argv, "b:Bc:dfm:npy")) != -1) {
---
> while ((ch = getopt(argc, argv, "b:Bc:dfFm:npy")) != -1) {
111a110,113
> case 'F':
> bkgrdcheck = 1;
> break;
>
157c159
< (void)checkfilesys(blockcheck(*argv++), 0, 0L, 0);
---
> (void)checkfilesys(*argv++, 0, 0L, 0);
196c198
< int cylno;
---
> int cylno, size;
202a205,220
> /*
> * Make best effort to get the disk name. Check first to see
> * if it is listed among the mounted filesystems. Failing that
> * check to see if it is listed in /etc/fstab.
> */
> mntp = getmntpt(filesys);
> if (mntp != NULL)
> filesys = mntp->f_mntfromname;
> else
> filesys = blockcheck(filesys);
> /*
> * If -F flag specified, check to see whether a background check
> * is possible and needed. If possible and needed, exit with
> * status zero. Otherwise exit with status non-zero. A non-zero
> * exit status will cause a foreground check to be run.
> */
204c222,237
<
---
> if (bkgrdcheck) {
> if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0)
> exit(3); /* Cannot read superblock */
> close(fsreadfd);
> if (sblock.fs_flags & FS_NEEDSFSCK)
> exit(4); /* Earlier background failed */
> if ((sblock.fs_flags & FS_DOSOFTDEP) == 0)
> exit(5); /* Not running soft updates */
> size = MIBSIZE;
> if (sysctlnametomib("vfs.ffs.adjrefcnt", adjrefcnt, &size) < 0)
> exit(6); /* Lacks kernel support */
> if ((mntp == NULL && sblock.fs_clean == 1) ||
> (mntp != NULL && (sblock.fs_flags & FS_UNCLEAN) == 0))
> exit(7); /* Filesystem clean, report it now */
> exit(0);
> }
212d244
< mntp = getmntpt(filesys);
435c467
< * Get the directory that the device is mounted on.
---
> * Get the mount point information for name.
444,445c476,477
< struct statfs *mntbuf;
< int i, mntsize;
---
> struct statfs *mntbuf, *statfsp;
> int i, mntsize, isdev;
447,448c479
< if (stat(name, &devstat) != 0 ||
< !(S_ISCHR(devstat.st_mode) || S_ISBLK(devstat.st_mode)))
---
> if (stat(name, &devstat) != 0)
449a481,484
> if (S_ISCHR(devstat.st_mode) || S_ISBLK(devstat.st_mode))
> isdev = 1;
> else
> isdev = 0;
452,454c487,488
< if (strcmp(mntbuf[i].f_fstypename, "ufs") != 0)
< continue;
< devname = mntbuf[i].f_mntfromname;
---
> statfsp = &mntbuf[i];
> devname = statfsp->f_mntfromname;
458c492
< devname = device;
---
> strcpy(statfsp->f_mntfromname, device);
459a494,498
> if (isdev == 0) {
> if (strcmp(name, statfsp->f_mntonname))
> continue;
> return (statfsp);
> }
462c501
< return (&mntbuf[i]);
---
> return (statfsp);
464c503,504
< return (NULL);
---
> statfsp = NULL;
> return (statfsp);