mount.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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <locale.h>
#include <fslib.h>
#include <stdlib.h>
enum {
#ifdef DEBUG
#endif
};
static char *myopts[] = {
"size", /* required */
"vb",
"largebsize",
#ifdef DEBUG
"nolargebsize", /* default */
"bsize", /* internal use only */
"reservemem", /* default */
"noreservemem",
#endif
};
static offset_t
{
char *endptr;
switch (*endptr) {
case 't': case 'T':
off *= 1024;
/* FALLTHROUGH */
case 'g': case 'G':
off *= 1024;
/* FALLTHROUGH */
case 'm': case 'M':
off *= 1024;
/* FALLTHROUGH */
case 'k': case 'K':
off *= 1024;
/* FALLTHROUGH */
default:
break;
}
return (off);
}
int
{
int c;
char *myname;
char optbuf[MAX_MNTOPT_STR];
char typename[64];
int error = 0;
int verbose = 0;
int nmflg = 0;
int optsize = sizeof (struct xmemfs_args);
int mflg = 0;
int optcnt = 0;
int qflg = 0;
char *saveopt;
struct xmemfs_args xargs = {
0, /* xa_fssize - file system sz */
0, /* xa_bsize - blk sz */
XARGS_RESERVEMEM /* xa_flags */
};
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
myname);
/* RO xmemfs not supported... */
switch (c) {
case 'q':
qflg++;
break;
case 'V':
verbose++;
break;
case 'm':
nmflg++;
mflg |= MS_NOMNTTAB;
break;
case 'O':
mflg |= MS_OVERLAY;
break;
case 'o':
while (*options != '\0') {
case LARGEBSIZE:
break;
case FSSIZE:
if (value) {
if (!fssize) {
gettext("%s: value %s for option \"%s\" is invalid\n"),
error++;
break;
}
optcnt++;
if (verbose)
} else {
error++;
}
break;
#ifdef DEBUG
case RESERVEMEM:
break;
case NORESERVEMEM:
break;
case NOLARGEBSIZE:
break;
case BSIZE: /* file system block size */
if (value) {
if (!bsize) {
gettext("%s: value %s for option \"%s\" is invalid\n"),
error++;
break;
}
optcnt++;
if (verbose)
} else {
error++;
}
break;
#endif
case VERBOSE:
verbose++;
break;
default:
if (fsisstdopt(saveopt)) {
sizeof (optbuf));
break;
}
if (!qflg) {
"%s: WARNING: ignoring "
"option \"%s\"\n"),
}
break;
}
}
if (bsize) {
if (--optcnt)
sizeof (optbuf));
if (verbose)
optbuf);
}
if (fssize) {
if (--optcnt)
sizeof (optbuf));
if (verbose)
optbuf);
} else {
error++;
}
sizeof (optbuf));
if (verbose)
optbuf);
}
if (verbose)
break;
default:
error++;
break;
}
}
char *optptr;
if (optptr)
}
}
gettext("Usage: %s -o[largebsize,]size=sz"
" xmem mount_point\n"), typename);
exit(1);
}
if (verbose) {
if (optsize)
else
}
gettext("mount: %s already mounted\n"),
else
perror("mount");
exit(1);
}
return (0);
}