cfgadm.c revision 924c13106950186f75f1ee9d0bc5e24a2d404d8c
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This is the main program file for the configuration administration
* command as set out in manual page cfgadm(1M). It uses the configuration
* administration library interface, libcfgadm, as set out in manual
* page config_admin(3X).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <langinfo.h>
#include <time.h>
#include <assert.h>
#include <sys/openpromio.h>
#include <sys/ddi_impldefs.h>
#include <sys/systeminfo.h>
#include <ctype.h>
#include <zone.h>
#include <config_admin.h>
#include "cfgadm.h"
/*
* forward declarations
*/
static char *basename(char *);
static void cfgadm_error(int, char *);
static int confirm_interactive(void *, const char *);
static int confirm_no(void *, const char *);
static int confirm_yes(void *, const char *);
static void usage(void);
static void usage_field(void);
static int extract_list_suboptions(char *, char **, char **, char **,
int *, char **, char **, char **);
static cfga_ap_types_t find_arg_type(const char *);
static int yesno(char *, char *);
static void print_log_id(cfga_list_data_t *, int, char *);
static void print_r_state(cfga_list_data_t *, int, char *);
static void print_o_state(cfga_list_data_t *, int, char *);
static void print_cond(cfga_list_data_t *, int, char *);
static void print_time(cfga_list_data_t *, int, char *);
static void print_time_p(cfga_list_data_t *, int, char *);
static void print_info(cfga_list_data_t *, int, char *);
static void print_type(cfga_list_data_t *, int, char *);
static void print_busy(cfga_list_data_t *, int, char *);
static void print_phys_id(cfga_list_data_t *, int, char *);
static void print_class(cfga_list_data_t *, int, char *);
static void print_null(cfga_list_data_t *, int, char *);
static int count_fields(char *, char);
static int process_sort_fields(int, struct sort_el *, char *);
static int process_fields(int, struct print_col *, int, char *);
cfga_list_data_t *, FILE *);
static int ldata_compare(const void *, const void *);
int dyn_exp);
int no_dyn);
static void remove_dyn(char *ap_id);
/*
* global data
*/
/* command name for messages */
static char *cmdname;
/*
* control for comparing, printing and filtering cfga_list_data
* NOTE:Field names (i.e. member 0 of field_info struct) may not contain '('.
* The post filtering code depends on it.
* NOTE:A NULL value for the set_filter member indicates that filtering based
* on that field is currently not supported.
*/
static struct field_info all_fields[] = {
};
#define PREFILT_CLASS_STR "class="
typedef struct {
static struct field_info null_field =
static int nsort_list;
static char unk_field[] = "%s: field \"%s\" unknown\n";
static char aptype_no_dyn[] = "%s: Invalid ap_id: %s\n";
/* strings that make up the usage message */
static char *usage_tab[] = {
" %s [-f] [-y|-n] [-v] [-o hardware_opts ] -c function ap_id [ap_id...]\n",
" %s [-f] [-y|-n] [-v] [-o hardware_opts ] -x function ap_id [ap_id...]\n",
" %s [-v] [-s listing_options ] [-o hardware_opts ] [-a]\n"
"\t[-l [ap_id|ap_type...]]\n",
" %s [-v] [-o hardware_opts ] -t ap_id [ap_id...]\n",
" %s [-v] [-o hardware_opts ] -h [ap_id|ap_type...]\n",
};
/* Type of matches currently supported by the select sub-option */
static match_cvt_t match_type_array[] = {
{"partial", CFGA_MATCH_PARTIAL},
{"exact", CFGA_MATCH_EXACT}
};
static int do_config_list(int, char *[], cfga_list_data_t *, int, char *,
char *, char *, int, char *, post_filter_t *, int);
/*
* main - the main routine of cfgadm, processes the command line
* and dispatches functions off to libraries.
*/
int
main(
int argc,
char *argv[])
{
extern char *optarg;
extern int optind;
int c;
char *subopts;
char *subvalue;
struct cfga_confirm confirm;
int ret = CFGA_ERROR;
int i;
cfga_flags_t flags = 0;
int arg_error = 0;
int dyn_exp = 0;
if (argc > 0)
else
cmdname = "cfgadm";
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
static char dup_action[] =
"%s: more than one action specified (-c,-l,-t,-x)\n";
static char dup_option[] =
"%s: more than one -%c option specified\n";
switch (c) {
case 'a':
if (dyn_exp) {
arg_error = 1;
cmdname, c);
}
dyn_exp = 1;
break;
case 'c':
if (action != CFGA_OP_NONE) {
arg_error = 1;
cmdname);
}
/*
* Reject -c suboption if they are unrecognized
* or more than one or have a associated value.
*/
arg_error = 1;
break;
}
break;
case 'f':
if ((flags & CFGA_FLAG_FORCE) != 0) {
arg_error = 1;
cmdname, c);
}
flags |= CFGA_FLAG_FORCE;
break;
case 'h':
if (action != CFGA_OP_NONE) {
arg_error = 1;
cmdname);
}
break;
case 'l':
if (action != CFGA_OP_NONE) {
arg_error = 1;
cmdname);
}
break;
case 'n':
if (confarg != CONFIRM_DEFAULT) {
arg_error = 1;
cmdname, c);
}
break;
case 'o':
arg_error = 1;
cmdname, c);
}
break;
case 's':
arg_error = 1;
cmdname, c);
}
break;
case 't':
if (action != CFGA_OP_NONE) {
arg_error = 1;
cmdname);
}
break;
case 'x':
if (action != CFGA_OP_NONE) {
arg_error = 1;
cmdname);
}
break;
case 'v':
if ((flags & CFGA_FLAG_VERBOSE) != 0) {
arg_error = 1;
cmdname, c);
}
break;
case 'y':
if (confarg != CONFIRM_DEFAULT) {
arg_error = 1;
cmdname, c);
}
break;
case '?': /* getopts issues message is this case */
default: /* catch programming errors */
arg_error = 1;
break;
}
}
/* default action is list */
if (action == CFGA_OP_NONE)
/* -s and -a option only for list */
arg_error = 1;
}
if (arg_error) {
usage();
/*NOTREACHED*/
}
if (getzoneid() != GLOBAL_ZONEID) {
gettext("cfgadm can only be run from the global zone"));
}
/*
* If neither -n of -y was specified, interactive confirmation
* is used. Check if the program has terminal I/O and
* enforce -n if not.
*/
if (confarg == CONFIRM_DEFAULT &&
switch (confarg) {
case CONFIRM_DEFAULT:
break;
case CONFIRM_NO:
break;
case CONFIRM_YES:
break;
default: /* paranoia */
abort();
/*NOTREACHED*/
}
}
/*
* set up message output routine
*/
switch (action) {
case CFGA_OP_CHANGE_STATE:
/* Sanity check - requires an argument */
usage();
break;
}
/* Sanity check - args cannot be ap_types */
usage();
/*NOTREACHED*/
}
}
break;
case CFGA_OP_PRIVATE:
/* Sanity check - requires an argument */
usage();
break;
}
/* Sanity check - args cannot be ap_types */
usage();
/*NOTREACHED*/
}
}
break;
case CFGA_OP_TEST:
/* Sanity check - requires an argument */
usage();
break;
}
if ((flags & ~CFGA_FLAG_VERBOSE) != 0) {
usage();
/*NOTREACHED*/
}
/* Sanity check - args cannot be ap_types */
usage();
/*NOTREACHED*/
}
}
break;
case CFGA_OP_HELP:
if ((flags & ~CFGA_FLAG_VERBOSE) != 0) {
usage();
/*NOTREACHED*/
}
/* always do usage? */
usage();
flags);
break;
case CFGA_OP_LIST: {
/*
* Note that we leak the strdup strings below (we never free
* them). This is ok in this context since cfgadm is
* a short lived process that will exit shortly freeing
* the memory.
*/
int nlist = 0;
int noheadings = 0;
int i;
int type = 0;
if ((flags & ~CFGA_FLAG_VERBOSE) != 0) {
usage();
/*NOTREACHED*/
}
if (flags & CFGA_FLAG_VERBOSE) {
}
usage_field();
/*NOTREACHED*/
}
/*
* Scan any args and see if there are any ap_types.
* If there are we get all attachment point stats and
* then filter what gets printed.
*/
type = 0;
type = 1;
/* ap_types cannot have dynamic components */
/*NOTREACHED*/
}
break;
}
}
/* Setup filter */
if (post_filtp == NULL) {
/*NOTREACHED*/
}
!= CFGA_OK) {
/*NOTREACHED*/
}
list_array = NULL;
/*
* Check for args. No args means find all libs
* and call the cfga_list_ext routine with no ap_ids specified.
* With args, if any one of the args are ap_types we
* again find all attachment points as in the
* no-args case above and then select which attachment points
* are actually displayed.
*/
/*
* No args, or atleast 1 ap_type arg
*/
dyn_exp ? CFGA_FLAG_LIST_ALL : 0);
} else {
/*
* If the args are all ap_ids (no ap_types) we call the
* cfga_list_ext routine with those specific ap_ids.
*/
}
if (do_config_list(
} else {
}
/*NOTREACHED*/
}
} else {
}
break;
}
default: /* paranoia */
abort();
/*NOTREACHED*/
}
if (ret == CFGA_NOTSUPP) {
return (EXIT_NOTSUPP);
return (EXIT_OPFAILED);
} else {
return (EXIT_OK);
}
/*NOTREACHED*/
}
/*
* usage - outputs the usage help message.
*/
static void
void)
{
int i;
}
}
/*
* Emit an error message.
* As a side-effect the hardware specific error message is deallocated
* as described in config_admin(3X).
*/
static void
{
const char *ep;
} else {
}
if (errnum == CFGA_INVAL)
usage();
}
/*
* confirm_interactive - prompt user for confirmation
*/
static int
void *appdata_ptr,
const char *message)
{
static int inited = 0;
int isyes;
#ifdef lint
#endif /* lint */
/*
* First time through initialisation. In the original
* version of this command this function is only called once,
* but this function is generalized for the future.
*/
if (!inited) {
inited = 1;
}
do {
} while (isyes == -1);
return (isyes);
}
/*
* If any text is input it must sub-string match either yes or no.
* Failure of this match is indicated by return of -1.
* If an empty line is input, this is taken as no.
*/
static int
char *yesp,
char *nop)
{
int i, b;
i = 0;
/*CONSTCOND*/
while (1) {
if (i < YESNO_STR_MAX) /* bug fix to rm.c version */
ans[i] = 0;
break;
}
if (i < YESNO_STR_MAX)
ans[i] = b;
i++;
}
if (i >= YESNO_STR_MAX) {
i = YESNO_STR_MAX;
ans[YESNO_STR_MAX] = 0;
}
/* changes to rm.c version follow */
if (i == 0)
return (0);
return (0);
return (1);
return (-1);
}
/*ARGSUSED*/
static int
void *appdata_ptr,
const char *message)
{
return (0);
}
/*ARGSUSED*/
static int
void *appdata_ptr,
const char *message)
{
return (1);
}
/*
* Find base name of filename.
*/
static char *
char *cp)
{
char *sp;
return (sp + 1);
return (cp);
}
/*ARGSUSED*/
static int
void *appdata_ptr,
const char *message)
{
return (CFGA_OK);
}
/*
* extract_list_suboptions - process list option string
*/
static int
char *arg,
char **sortpp,
char **colspp,
char **cols2pp,
int *noheadingsp,
char **delimpp,
char **selectpp,
char **matchpp)
{
int subopt = 0;
int err = 0;
while (*arg != '\0') {
static char need_value[] =
"%s: sub-option \"%s\" requires a value\n";
static char no_value[] =
"%s: sub-option \"%s\" does not take a value\n";
static char unk_subopt[] =
"%s: sub-option \"%s\" unknown\n";
char **pptr;
switch (subopt) {
case LIST_SORT:
goto valcom;
case LIST_COLS:
goto valcom;
case LIST_COLS2:
goto valcom;
case LIST_SELECT:
goto valcom;
case LIST_MATCH:
goto valcom;
case LIST_DELIM:
err = 1;
} else
break;
case LIST_NOHEADINGS:
err = 1;
} else
*noheadingsp = 1;
break;
default:
err = 1;
break;
}
}
return (err == 0);
}
static cfga_err_t
{
const char *clopt = PREFILT_CLASS_STR;
int idx;
*prefilt_optpp = NULL;
/* Get the index for the "class" field */
break;
}
/*
* Currently pre-filter available only for class fld w/ EXACT match
*/
return (CFGA_OK);
}
return (CFGA_LIB_ERROR);
}
/*
* Since it is being pre-filtered, this attribute does not need
* post-filtering.
*/
}
return (CFGA_OK);
}
static cfga_err_t
const char *attr,
const char *val,
{
int fld = 0;
break;
}
/* Valid field or is the select option supported for this field */
return (CFGA_ATTR_INVAL);
}
== CFGA_OK) {
}
return (ret);
}
static char inval_optarg[] =
"%s: invalid value \"%s\" for %s suboption.\n";
/*
* Parses the "select" string and fills in the post_filter structure
*/
static cfga_err_t
const char *selectp,
{
int bal = 0; /* Tracks balancing */
char chr;
return (CFGA_ERROR);
}
return (CFGA_LIB_ERROR);
}
/* Init */
bal = 0;
switch (state) {
case CFGA_PSTATE_INIT:
if (*cp != LEFT_PAREN)
break;
*cp = '\0';
bal = 1;
break;
case CFGA_PSTATE_ATTR_DONE:
switch (chr) {
case LEFT_PAREN:
bal++;
break;
case RIGHT_PAREN:
bal--;
if (bal == 0) {
*cp = '\0';
}
break;
}
break;
case CFGA_PSTATE_VAL_DONE:
if (*cp != ':') {
goto out;
}
*cp = '\0';
match_type) != CFGA_OK) {
goto out;
}
break;
default:
/* FALLTHROUGH */
case CFGA_PSTATE_ERR:
goto out;
}
}
/*FALLTHRU*/
out:
if (state == CFGA_PSTATE_VAL_DONE) {
} else {
}
}
return (ret);
}
static cfga_err_t
const char *selectp,
const char *matchp,
char **prefilt_optpp)
{
int i;
static char match_needs_select[] =
"%s: %s suboption can only be used with %s suboption.\n";
*prefilt_optpp = NULL;
/*
* Initial: no filtering.
* CFGA_MATCH_NOFILTER is NOT a valid user input
*/
for (i = 0; i < N_FIELDS; i++) {
}
/* Determine type of match */
/* No filtering */
return (CFGA_OK);
/* If only match specified, select criteria also needed */
return (CFGA_ERROR);
} else {
for (i = 0; i < N_MATCH_TYPES; i++) {
break;
}
}
if (i >= N_MATCH_TYPES) {
return (CFGA_ERROR);
}
}
!= CFGA_OK) {
return (ret);
}
/* Handle pre-filtering. */
/* Cleanup */
for (i = 0; i < N_FIELDS; i++) {
}
return (ret);
}
return (CFGA_OK);
}
/*
* compare_ap_id - compare two ap_id's
*
* For partial matches, argument order is significant. The filtering criterion
* should be the first argument.
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER:
return (0); /* No filtering. all pass */
case CFGA_MATCH_PARTIAL:
case CFGA_MATCH_EXACT:
case CFGA_MATCH_ORDER:
default:
}
}
/*
* print_log_id - print logical ap_id
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
p->ap_log_id);
}
/*
* set_log_flt - Setup filter for logical ap_id
*/
static cfga_err_t
cfga_list_data_t *p,
const char *val)
{
return (CFGA_ATTR_INVAL);
return (CFGA_OK);
}
/*
* set_type_flt - Setup filter for type field
*/
static cfga_err_t
cfga_list_data_t *p,
const char *val)
{
return (CFGA_ATTR_INVAL);
return (CFGA_OK);
}
/*
* set_class_flt - Setup filter for class field
*/
static cfga_err_t
cfga_list_data_t *p,
const char *val)
{
return (CFGA_ATTR_INVAL);
return (CFGA_OK);
}
/*
* compare_r_state - compare receptacle state of two ap_id's
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER: /* no filtering. pass all */
return (0);
case CFGA_MATCH_ORDER:
default:
}
}
/*
* compare_o_state - compare occupant state of two ap_id's
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER: /* no filtering. all pass */
return (0);
case CFGA_MATCH_ORDER:
default:
}
}
/*
* compare_busy - compare busy field of two ap_id's
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER: /* no filtering. all pass */
return (0);
case CFGA_MATCH_ORDER:
default:
}
}
/*
* print_r_state - print receptacle state
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
char *cp;
switch (p->ap_r_state) {
case CFGA_STAT_EMPTY:
cp = "empty";
break;
case CFGA_STAT_CONNECTED:
cp = "connected";
break;
case CFGA_STAT_DISCONNECTED:
cp = "disconnected";
break;
default:
cp = "???";
break;
}
}
/*
* print_o_state - print occupant state
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
char *cp;
switch (p->ap_o_state) {
case CFGA_STAT_UNCONFIGURED:
cp = "unconfigured";
break;
case CFGA_STAT_CONFIGURED:
cp = "configured";
break;
default:
cp = "???";
break;
}
}
/*
* compare_cond - compare condition field of two ap_id's
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER:
return (0);
case CFGA_MATCH_ORDER:
default:
}
}
/*
* print_cond - print attachment point condition
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
char *cp;
switch (p->ap_cond) {
case CFGA_COND_UNKNOWN:
cp = "unknown";
break;
case CFGA_COND_UNUSABLE:
cp = "unusable";
break;
case CFGA_COND_FAILING:
cp = "failing";
break;
case CFGA_COND_FAILED:
cp = "failed";
break;
case CFGA_COND_OK:
cp = "ok";
break;
default:
cp = "???";
break;
}
}
/*
* compare_time - compare time field of two ap_id's
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER:
return (0);
case CFGA_MATCH_ORDER:
default:
}
}
/*
* print_time - print time from cfga_list_data.
* Time print based on ls(1).
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
if (year == 0) {
}
stime = p->ap_status_time;
return;
}
} else {
}
}
/*
* print_time_p - print time from cfga_list_data.
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
}
/*
* compare_info - compare info from two cfga_list_data structs
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER:
return (0);
case CFGA_MATCH_ORDER:
default:
}
}
/*
* print_info - print info from cfga_list_data struct
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
}
/*
* compare_type - compare type from two cfga_list_data structs
*
* For partial matches, argument order is significant. The filtering criterion
* should be the first argument.
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER:
return (0);
case CFGA_MATCH_PARTIAL:
case CFGA_MATCH_EXACT:
case CFGA_MATCH_ORDER:
default:
}
}
/*
* print_type - print type from cfga_list_data struct
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
}
/*
* compare_class - compare class from two cfga_list_data structs
*
* For partial matches, argument order is significant. The filtering criterion
* should be the first argument.
*/
static int
{
switch (match_type) {
case CFGA_MATCH_NOFILTER:
return (0);
case CFGA_MATCH_PARTIAL:
case CFGA_MATCH_EXACT:
case CFGA_MATCH_ORDER:
default:
}
}
/*
* print_class - print class from cfga_list_data struct
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
}
/*
* print_busy - print busy from cfga_list_data struct
*/
/* ARGSUSED */
static void
cfga_list_data_t *p,
int width,
char *lp)
{
if (p->ap_busy)
else
}
/*
* print_phys_id - print physical ap_id
*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
p->ap_phys_id);
}
/*
* find_field - find the named field
*/
static struct field_info *
find_field(char *fname)
{
struct field_info *fldp;
return (fldp);
return (NULL);
}
/*
* usage_field - print field usage
*/
static void
{
const char *sep;
static char field_list[] = "%s: print or sort fields must be one of:";
sep = "";
sep = ",";
}
}
/*
* compare_null - null comparison routine
*/
/*ARGSUSED*/
static int
{
return (0);
}
/*
* print_null - print out a field of spaces
*/
/*ARGSUSED*/
static void
cfga_list_data_t *p,
int width,
char *lp)
{
}
/*
* do_config_list - directs the output of the listing functions
*/
static int
int l_argc,
char *l_argv[],
int nlist,
char *sortp,
char *colsp,
char *cols2p,
int noheadings,
char *delimp,
int dyn_exp)
{
int napids_to_list = 0;
int f_err;
int nsel = 0;
int i, j;
f_err = 0;
if (nsort_list != 0) {
sizeof (*sort_list));
goto out;
}
} else
if (nprcols != 0) {
goto out;
}
if (ncols2 != 0)
} else
if (f_err) {
usage_field();
ret = CFGA_ERROR;
goto out;
}
/* Create an array of all user args (if any) */
if (l_argc != 0) {
int i, j;
napids_to_list = 0;
for (i = 0; i < l_argc; i++) {
}
sizeof (*arg_array));
goto out;
}
for (i = 0, j = 0; i < l_argc; i++) {
int n;
if (n == 0) {
continue;
} else if (n == 1) {
j++;
} else {
for (;;) {
j++;
break;
*ncp = '\0';
}
}
}
assert(j == napids_to_list);
} else {
napids_to_list = 0;
}
goto out;
}
/* create a list of output stat data */
for (i = 0; i < nlist; i++) {
}
/*
* Mark all user input which got atleast 1 stat data in response
*/
for (i = 0; i < napids_to_list; i++) {
}
/*
* Process output data
*/
nsel = 0;
for (i = 0; i < nlist; i++) {
/*
* Mark all the stats which were actually requested by user
*/
/*
* Try again without the dynamic component for the
* if dynamic expansion was requested.
*/
napids_to_list, 1);
}
/*
* post filter data which was actually requested
*/
}
}
if (sel_boards == NULL) {
goto out;
}
for (i = 0, j = 0; i < nlist; i++) {
j++;
}
}
/*
* Print headings even if no list entries - Bug or feature ?
*/
goto out;
}
if (ncols2 != 0) {
goto out;
}
}
}
if (nsel != 0) {
}
for (i = 0; i < nsel; i++) {
!= CFGA_OK)
goto out;
if (ncols2 != 0) {
if ((ret = print_fields(
goto out;
}
}
}
}
/*
* Go thru the argument list and notify user about args
* which did not have a match
*/
/*FALLTHRU*/
out:
return (ret);
}
/*
* Mark all user inputs which got a response
*/
static void
{
int i;
if (nouts == 0) {
return;
}
/*
* Go through list of output stats and check if argument
* produced that output
*/
for (i = 0; i < nouts; i++) {
if (type == PHYSICAL_AP_ID) {
break;
}
} else if (type == LOGICAL_AP_ID) {
break;
}
/*
* An AP_TYPE argument cannot generate dynamic
* attachment point stats unless dynamic expansion was
* requested by user.
*/
!= NULL) {
continue;
}
break;
}
} else {
return;
}
}
if (i < nouts) {
}
}
/* Mark all stat data which were requested by user */
static void
{
int i;
/* If no user args, all output is acceptable */
if (nargs == 0) {
return;
}
/*
* Do comparison with or without dynamic component as requested by
* user.
*/
if (no_dyn) {
/* Remove the dynamic component */
}
for (i = 0; i < nargs; i++) {
if (type == PHYSICAL_AP_ID) {
break;
}
} else if (type == LOGICAL_AP_ID) {
break;
}
/*
* Aptypes cannot generate dynamic attachment
* points unless dynamic expansion is specified.
* in which case this routine would be called a
* 2nd time with the no_dyn flag set and there
* would be no dynamic ap_ids.
*/
continue;
}
break;
}
} else {
continue;
}
}
if (i < nargs) {
/* Ok, this output was requested */
}
}
static void
{
int i;
return;
}
/*
* For fields without filtering (CFGA_MATCH_NOFILTER),
* compare always returns 0 (success)
*/
for (i = 0; i < N_FIELDS; i++) {
/*
* Note: Order is important for partial match (via strncmp).
* The first argument for compare must be the filter.
*/
post_filtp->match_type_p[i])) {
return;
}
}
/*
* Passed through filter
*/
(*nselp)++;
}
static void
{
int i;
if (nargs == 0) {
return;
}
/*
* nop if no user arguments
*/
for (i = 0; i < nargs; i++) {
gettext("%s: No matching library found\n"),
}
}
}
/*
* ldata_compare - compare two attachment point list data structures.
*/
static int
const void *vb1,
const void *vb2)
{
int i;
int res = -1;
for (i = 0; i < nsort_list; i++) {
if (res != 0) {
break;
}
}
return (res);
}
/*
* count_fields - Count the number of fields, using supplied delimiter.
*/
static int
{
int n;
return (0);
n = 1;
n++;
return (n);
}
/*
* get_field
* This function is not a re-implementation of strtok().
* There can be null fields - strtok() eats spans of delimiters.
*/
static char *
{
} else {
*cp = '\0';
if (*fld == '\0')
}
}
return (fld);
}
/*
* process_fields -
*/
static int
int ncol,
int line2,
char *fmt)
{
char *fmtx;
char *fldn;
int err;
err = 0;
fldp = &null_field;
struct field_info *tfldp;
} else {
err = 1;
}
}
if (line2) {
} else {
}
}
return (err);
}
/*
* process_sort_fields -
*/
static int
int nsort,
char *fmt)
{
int i;
int rev;
char *fmtx;
char *fldn;
int err;
err = 0;
for (i = 0; i < nsort; i++) {
fldp = &null_field;
rev = 0;
if (*fldn == '-') {
rev = 1;
fldn++;
}
} else {
err = 1;
}
}
}
return (err);
}
/*
* print_fields -
*/
static cfga_err_t
int ncol,
int heading,
int line2,
char *delim,
{
char *lp;
out_len = 0;
}
return (CFGA_LIB_ERROR);
}
}
del = "";
if (heading) {
} else {
}
}
/*
* Trim trailing spaces
*/
*lp = '\0';
return (CFGA_OK);
}
/*
* config_calloc_check - perform allocation, check result and
* set error indicator
*/
static void *
{
void *p;
static char alloc_fail[] =
"%s: memory allocation failed (%d*%d bytes)\n";
if (p == NULL) {
}
return (p);
}
/*
* find_arg_type - determine if an argument is an ap_id or an ap_type.
*/
static cfga_ap_types_t
find_arg_type(const char *ap_id)
{
char path[MAXPATHLEN];
char apbuf[MAXPATHLEN];
/*
* sanity checks
*/
return (UNKNOWN_AP);
}
/*
* Mask the dynamic component if any
*/
} else {
}
return (UNKNOWN_AP);
}
/*
* If it starts with a slash and is stat-able
* its a physical.
*/
return (PHYSICAL_AP_ID);
}
/*
* Is this a symlink in CFGA_DEV_DIR ?
*/
return (LOGICAL_AP_ID);
}
/*
* Check for ":" which is always present in an ap_id but not maybe
* present or absent in an ap_type.
* We need to check that the characters right before the : are digits
* since an ap_id is of the form <name><instance>:<specific ap name>
*/
} else {
digit = 0;
digit++;
break;
}
}
if (digit == 0) {
} else {
}
}
return (type);
}
static char *
{
return (NULL);
}
}
/*
* removes the dynamic component
*/
static void
remove_dyn(char *ap_id)
{
char *cp;
return;
}
*cp = '\0';
}
}
static char *
{
char *dup;
/*
* sometimes NULL strings may be passed in (see DEF_COLS2). This
* is not an error.
*/
return (NULL);
}
return (NULL);
}
return (dup);
}