switchout.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <limits.h>
#include <locale.h>
#include <libintl.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#define FSTYPE_MAX 8
#define ARGV_MAX 1024
extern char *default_fstype();
void stat_snap(char *, char *, char *);
char *cbasename; /* name of command */
int newargc = 2;
/*
* TRANSLATION_NOTE - the usage strings in the c_usgstr[] of the
* following structures should be given a translation; the call to gettext
* is in the usage() function. The strings are the ones containing
* "[-F FSType]".
*/
struct commands {
char *c_basename;
char *c_optstr;
} cmd_data[] = {
"clri", "F:o:?V",
{
"[-F FSType] [-V] special inumber ...",
},
"mkfs", "F:o:mb:?V",
{
"[-F FSType] [-V] [-m] [-o specific_options] special ",
"[operands]", NULL
},
"dcopy", "F:o:?V",
{
"[-F FSType] [-V] special inumber ...",
},
"fsdb", "F:o:z:?V",
{
"[-F FSType] [-V] [-o specific_options] special",
},
"fssnap", "F:dio:?V",
{
},
"labelit", "F:o:?nV",
{
"[-F FSType] [-V] [-o specific_options] special [operands]",
},
NULL, "F:o:?V",
{
"[-F FSType] [-V] [-o specific_options] special [operands]",
}
};
int argc;
char *argv[];
{
register char *ptr;
int i;
int verbose = 0; /* set if -V is specified */
int F_flg = 0;
int mflag = 0;
int iflag = 0;
int usgflag = 0;
int arg; /* argument from getopt() */
extern char *optarg; /* getopt specific */
extern int optind;
extern int opterr;
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
while (*ptr) {
if (*ptr++ == '/')
}
if (argc == 1) {
;
exit(2);
}
;
switch (arg) {
case 'V': /* echo complete command line */
verbose = 1;
break;
case 'F': /* FSType specified */
F_flg++;
break;
case 'o': /* FSType specific arguments */
break;
case '?': /* print usage message */
usgflag = 1;
break;
case 'm': /* FSType specific arguments */
mflag = 1;
if (optarg)
break;
case 'i': /* fssnap only */
iflag = 1;
/*FALLTHROUGH*/
default:
if (optarg)
break;
}
}
if (F_flg > 1) {
exit(2);
}
gettext("%s: FSType %s exceeds %d characters\n"),
exit(2);
}
}
/* perform a lookup if fstype is not specified */
optind++;
/* handle -i (fssnap command only) */
if (iflag) {
/*
* There is no reason to ever call a file system specific
* version since its all in kstats.
*/
if (diff > 0) /* gave more than one mountpoint or device */
exit(0);
}
exit(2);
}
lookup();
exit(2);
}
/* build the full pathname of the fstype dependent command */
if (verbose) {
for (i = 2; newargv[i]; i++)
printf("\n");
exit(0);
}
/*
* Execute the FSType specific command.
*/
/* build the alternate pathname */
if (verbose) {
for (i = 2; newargv[i]; i++)
printf("\n");
exit(0);
}
}
newargv[0] = "sh";
}
exit(2);
}
gettext("%s: FSType %s not installed in the kernel\n"),
exit(2);
}
gettext("%s: Operation not applicable for FSType %s \n"),
exit(2);
}
char *cmd;
char **usg;
{
int i;
exit(2);
}
/*
* It is called when the fstype is not specified on the command line.
*
* The following global variables are used:
* special, fstype
*/
lookup()
{
int ret;
exit(1);
}
if (ret == -1) {
}
switch (ret) {
case -1:
break;
case 0:
break;
case VFS_TOOLONG:
gettext("%s: line in vfstab exceeds %d characters\n"),
exit(1);
break;
case VFS_TOOFEW:
gettext("%s: line in vfstab has too few entries\n"),
exit(1);
break;
}
}
void
char *cmd;
char *mountpoint;
char *opts;
{
int fd; /* check mount point if given */
int en;
char *errstr;
if (mountpoint) {
exit(2);
}
}
}