/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <stdio.h>
#include <errno.h>
#include <limits.h>
#include <fcntl.h>
#include <string.h>
#include <sys/sysmacros.h>
#include <locale.h>
#include <libintl.h>
usage(); \
}
options++; \
break
if (optarg) {\
}\
break
extern char *default_fstype();
int options = 0;
int mnt_passno = 0;
int exitstat = 0;
int verbose = 0;
char *malloc();
/*
* Keep an idea of the last device arg type as a hint to the
* type of the next arg. In the case of mountall, it's very likely
* to be the same type and the next entry in the file. This should
* help speed vfstab lookups.
*/
static struct devlist {
char *name;
char *fsname;
/*
* private copy vfstab functions
*/
static void usage(void);
static int
{
}
return (4); /* XXX */
}
}
return (4); /* XXX */
}
}
return (4); /* XXX */
}
}
return (4); /* XXX */
}
}
return (4); /* XXX */
}
}
return (4); /* XXX */
}
}
return (4); /* XXX */
}
return (0);
}
static int
{
int error;
return (error);
}
static int
{
int error;
return (error);
}
int
{
char *subopt;
int devfd;
int preencnt = 0;
int status;
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
if (myname)
myname++;
else
switch (cc) {
case '?':
questflg++;
if (questflg > 1)
usage();
break;
case 'F':
Fflg++;
/* check for more that one -F */
if (Fflg > 1) {
gettext("%s: more than one fstype specified\n"),
myname);
usage();
}
gettext("%s: Fstype %s exceeds %d characters\n"),
exit(1);
}
break;
case 'm':
sanity++;
OPTION("-m");
case 'n':
OPTION("-n");
case 'N':
OPTION("-N");
case 'o':
while (*subopt != '\0') {
if (*subopt == 'p') {
pflg++;
break;
}
subopt++;
}
OPTARG("-o");
case 'v':
OPTION("-v");
case 'V':
Vflg++;
if (Vflg > 1)
usage();
break;
case 'y':
OPTION("-y");
case 'Y':
OPTION("-Y");
}
}
/* copy '--' to specific */
}
if (questflg) {
if (Fflg) {
nargc = 2;
}
usage();
}
usage();
}
usage();
}
}
/*
* Try to check UFS filesystems first, then check other
* filesystems if they exist.
* Note: Parallel checking is only available in UFS for now.
*/
gettext("%s: cannot open vfstab\n"),
myname);
exit(1);
}
other_than_ufs ++;
continue;
}
else
continue;
if (mnt_passno < 1)
continue;
/* return the highest exit code */
preencnt++;
} else {
/*
* preening setup failed, so
* execute serially here...
*/
gettext("%s: preen_addev error\n"),
myname);
/* return the highest exit code */
}
}
if (ret > 0)
}
}
else
other_than_ufs = 1;
if (other_than_ufs) {
gettext("%s: cannot open vfstab\n"),
myname);
exit(1);
}
/* return the highest exit code */
}
if (ret > 0)
}
} else { /* device name is specified */
myname);
exit(1);
}
/*
* If "-F FStype" is specified, use that fs type.
* if the entry exists. Otherwise, determine the
*/
usage();
}
/* must check for both special && raw devices */
/*
* Find the vfstab entry for this device.
* arg_hint tells us what to try to match,
* based on the type of the last arg. If
* arg_hint equals UNKNOWN, then we're not
* sure of the type and need to fallthrough
* all 3 possibilities for vfstab lookup.
* Try it as a mountpt first, since that's
* what mountall gives us.
*/
switch (arg_hint) {
case UNKNOWN:
/* FALLTHROUGH */
case MOUNTPT:
&vref)) == -1 ||
goto try_again;
}
/* FALLTHROUGH */
} else {
/* Found it */
}
break;
}
case FSCKDEV:
/*
* Check the media sector size
*/
DKIOCGMEDIAINFO, &dkminfo) !=
-1)) {
DEV_BSIZE) &&
gettext("The device"
" sector size is"
" not supported by"
" fsck\n"));
exit(1);
}
}
if (devfd >= 0) {
}
&vref)) == -1 ||
goto try_again;
}
/* FALLTHROUGH */
} else {
/* Found it */
break;
}
case SPECIAL:
&vref)) == -1 ||
goto try_again;
}
/* FALLTHROUGH */
} else {
/* Found it */
break;
}
}
MNTTYPE_UFS) == 0) && (preen_addev(
vget.vfs_fsckdev) == 0)) {
preencnt++;
} else {
}
} else if (ret == -1 ||
fstype =
/* return the highest exit code */
} else
} else {
/* return the highest exit code */
}
optind++;
}
}
}
return (exitstat);
}
static void
{
int rc;
int i;
while (ndevs > 0) {
switch (rc) {
case 0:
break;
case 1:
gettext("%s: unknown dev: `%s'\n"),
exit(1);
}
ndevs--;
break;
case 2:
break;
default:
gettext("%s: bad return `%d' from preen_getdev\n"),
break;
}
}
}
}
static void
{
nrun++;
perror("fork");
exit(1);
} else if (pid == 0) {
} else {
}
}
static void
{
int status;
if (curpid == -1) {
perror("wait");
exit(1);
}
break;
}
}
return;
nrun--;
if (pbdp)
else
}
}
}
static void
{
int x, len;
gettext("\nTHE FOLLOWING FILE SYSTEM(S) HAD AN UNEXPECTED INCONSISTENCY:"));
x += len;
if (x >= 80) {
printf("\n ");
x = len + 3;
} else {
printf(" ");
}
}
}
/*
* allocate and initialize a `devlist' structure
*/
static
struct devlist *
{
extern char *strdup();
exit(1);
}
exit(1);
}
return (dp);
}
/*
* locate the devlist structure in the given list that matches `name'.
* If found, the structure is removed from the list, and a pointer to
* it is returned. If not, NULL is returned.
*/
static
struct devlist *
{
break;
}
if (p != NULL) {
else
}
return (p);
}
/* see if all numbers */
int
{
return (0);
yp++;
if (*yp)
return (0);
return (1);
}
int
{
int st;
int status = 0;
if (Vflg) {
return (0);
}
if (fd)
gettext("%s: cannot fork. Try again later\n"),
myname);
exit(1);
}
if (fk == 0) {
/* Try to exec the fstype dependent portion of the fsck. */
} else {
/* parent waits for child */
exit(1);
}
gettext("%s: warning: the following command"
" (process %d) was stopped by signal %d\n"),
} else if (st & 0xff) {
if (st & 0x80)
gettext("%s: warning: the following command"
" (process %d) was terminated by signal %d"
" and dumped core\n"),
else
gettext("%s: warning: the following command"
" (process %d) was terminated by signal %d\n"),
} else if (st & 0xff00)
}
return (status);
}
static void
{
gettext("%s: Fstype %s exceeds %d characters\n"),
exit(1);
}
/* build the full pathname of the fstype dependent command. */
/* set the new argv[0] to the filename */
/* Try to exec the fstype dependent portion of the fsck. */
gettext("%s: cannot execute %s - permission denied\n"),
}
nargv[0] = "sh";
}
/* second path to try */
/* build the full pathname of the fstype dependent command. */
/* set the new argv[0] to the filename */
/* Try to exec the second fstype dependent portion of the fsck. */
gettext("%s: cannot execute %s - permission denied\n"),
exit(1);
}
nargv[0] = "sh";
}
gettext("%s: operation not applicable to FSType %s\n"),
exit(1);
}
static void
{
char **argp;
}
static void
{
switch (flag) {
case VFS_TOOLONG:
gettext("%s: line in vfstab exceeds %d characters\n"),
break;
case VFS_TOOFEW:
gettext("%s: line in vfstab has too few entries\n"),
myname);
break;
case VFS_TOOMANY:
gettext("%s: line in vfstab has too many entries\n"),
myname);
break;
}
exit(1);
}
static void
usage(void)
{
gettext("Usage:\n%s [-F FSType] [-V] [-m] [special ...]\n"
"%s [-F FSType] [-V] [-y|Y|n|N]"
" [-o specific_options] [special ...]\n"),
exit(1);
}