nscadm.c revision 570de38f63910201fdd77246630b7aa8f9dc5661
/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <locale.h>
#include <nsctl.h>
#define __NSC_GEN__
/*
* Private functions from libsd.
*/
extern int nsc_nvclean(int);
extern int nsc_gmem_data(char *);
extern int nsc_gmem_sizes(int *);
/*
* Local functions.
*/
static int _nsc_gmem(void);
static void show_maps(char *, int);
static void
usage(void)
{
}
static void
{
exit(255);
}
exit(255);
}
}
int
{
(void) textdomain("nscadm");
rc = 0;
opterr = 0;
switch (opt) {
case 'h':
usage();
exit(0);
break;
default:
usage();
exit(255);
break;
}
}
usage();
exit(255);
}
usage();
exit(255);
}
if (rc < 0) {
exit(255);
} else if (rc != 0) {
if (rc < 0) {
exit(255);
}
} else {
exit(255);
}
usage();
exit(255);
}
if (rc < 0) {
exit(255);
} else if (rc == 0) {
if (rc < 0) {
exit(255);
}
} else {
gettext("nscadm: device <%s> is not "
exit(255);
}
usage();
exit(255);
}
if (rc < 0) {
exit(255);
}
#ifdef DEBUG
rc = nsc_nvclean(0);
if (rc < 0) {
exit(255);
}
if (rc < 0) {
exit(255);
}
#endif /* DEBUG */
if (rc < 0) {
exit(255);
}
} else {
usage();
exit(255);
}
return (rc);
}
static int
_nsc_gmem(void)
{
char *addr;
int size;
int rc = 0;
if (rc < 0)
return (rc);
return (-1);
}
if (rc < 0) {
return (rc);
}
return (0);
}
static void
{
/* LINTED alignment of cast ok */
int i;
(void) printf(
gettext("magic 0x%x ver %d size %d dirty (nvmem systems): %d\n"),
/* LINTED alignment of cast ok */
continue;
"%d:\tname %s\toffset 0x%x size 0x%x inuse 0x%x\n"),
}
}