fmtopo.c revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <limits.h>
#include <strings.h>
#include <stdio.h>
#include <errno.h>
#define FMTOPO_EXIT_SUCCESS 0
#define FMTOPO_EXIT_ERROR 1
#define FMTOPO_EXIT_USAGE 2
static const char *g_pname;
static const char *opt_R = "/";
static const char *opt_s = FM_FMRI_SCHEME_HC;
static int opt_e;
static int opt_d;
static int opt_v;
static int opt_V;
static int
{
"Usage: %s [-Cdev] [-R root] [-s scheme]\n", g_pname);
"\t-C dump core after completing execution\n"
"\t-d set debug mode for libtopo\n"
"\t-R set root directory for libtopo plug-ins and other files\n"
"\t-s display topology for the specified FMRI scheme\n"
"\t-v set verbose mode (display node ASRU, FRU and label)\n"
"\t-V set verbose mode (display node properties)\n");
return (FMTOPO_EXIT_USAGE);
}
static void
{
int err;
char *name;
return;
}
return;
}
if (opt_v) {
} else {
(void) printf("\tASRU: -\n");
}
} else {
(void) printf("\tFRU: -\n");
}
} else {
(void) printf("\tLabel: -\n");
}
}
if (opt_d) {
"alternate fmri for %s=%d: %s\n", g_pname,
topo_strerror(err));
} else {
}
}
}
static void
{
int i, err;
uint_t n;
return;
}
return;
}
buf[0] = '\0';
for (i = 0; i < n; i++) {
"name-instance for %s=%d\n", g_pname,
return;
}
errno = 0;
}
}
}
/*ARGSUSED*/
static int
{
else
if (opt_V) {
} else {
}
}
return (TOPO_WALK_NEXT);
}
int
{
char *uuid;
int c, err;
switch (c) {
case 'C':
break;
case 'd':
opt_d++;
break;
case 'e':
opt_e++;
break;
case 'v':
opt_v++;
break;
case 'V':
opt_V++;
break;
case 'R':
break;
case 's':
break;
default:
}
}
return (FMTOPO_EXIT_USAGE);
}
}
return (FMTOPO_EXIT_ERROR);
}
if (opt_d)
return (FMTOPO_EXIT_ERROR);
}
== NULL) {
}
if (!opt_e)
g_pname);
return (FMTOPO_EXIT_ERROR);
}
if (opt_d)
(void) printf("--------------------\n");
return (FMTOPO_EXIT_SUCCESS);
}