Changeset View
Changeset View
Standalone View
Standalone View
sbin/fsck/fsck.c
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#include <sys/wait.h> | #include <sys/wait.h> | ||||
#include <sys/disk.h> | #include <sys/disk.h> | ||||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||
#include <ctype.h> | #include <ctype.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <fstab.h> | #include <fstab.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <mntopts.h> | |||||
#include <paths.h> | #include <paths.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "fsutil.h" | #include "fsutil.h" | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | for (; argc--; argv++) { | ||||
mntpt = NULL; | mntpt = NULL; | ||||
spec = *argv; | spec = *argv; | ||||
cp = strrchr(spec, '/'); | cp = strrchr(spec, '/'); | ||||
if (cp == NULL) { | if (cp == NULL) { | ||||
(void)snprintf(device, sizeof(device), "%s%s", | (void)snprintf(device, sizeof(device), "%s%s", | ||||
_PATH_DEV, spec); | _PATH_DEV, spec); | ||||
spec = device; | spec = device; | ||||
} | } | ||||
mntp = getmntpt(spec); | mntp = getmntpoint(spec); | ||||
if (mntp != NULL) { | if (mntp != NULL) { | ||||
spec = mntp->f_mntfromname; | spec = mntp->f_mntfromname; | ||||
mntpt = mntp->f_mntonname; | mntpt = mntp->f_mntonname; | ||||
} | } | ||||
if ((fs = getfsfile(spec)) == NULL && | if ((fs = getfsfile(spec)) == NULL && | ||||
(fs = getfsspec(spec)) == NULL) { | (fs = getfsspec(spec)) == NULL) { | ||||
if (vfstype == NULL) | if (vfstype == NULL) | ||||
vfstype = getfstype(spec); | vfstype = getfstype(spec); | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | isok(struct fstab *fs) | ||||
* not mounted at boot time (typically those marked `noauto'). | * not mounted at boot time (typically those marked `noauto'). | ||||
* If these basic tests are passed, check with the file system | * If these basic tests are passed, check with the file system | ||||
* itself to see if it is willing to do background checking | * itself to see if it is willing to do background checking | ||||
* by invoking its check program with the -F flag. | * by invoking its check program with the -F flag. | ||||
*/ | */ | ||||
if (flags & DO_BACKGRD) { | if (flags & DO_BACKGRD) { | ||||
if (!strcmp(fs->fs_type, FSTAB_RO)) | if (!strcmp(fs->fs_type, FSTAB_RO)) | ||||
return (0); | return (0); | ||||
if (getmntpt(fs->fs_spec) == NULL) | if (getmntpoint(fs->fs_spec) == NULL) | ||||
return (0); | return (0); | ||||
if (checkfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, "-F", 0)) | if (checkfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, "-F", 0)) | ||||
return (0); | return (0); | ||||
return (1); | return (1); | ||||
} | } | ||||
/* | /* | ||||
* If the -F flag has been given, then consider deferring the | * If the -F flag has been given, then consider deferring the | ||||
* check to background. Background checks cannot be run on | * check to background. Background checks cannot be run on | ||||
▲ Show 20 Lines • Show All 305 Lines • Show Last 20 Lines |