scheme.c revision 1fe76c0bac8011fcb2a7d8a4a83b76700787dd5c
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/systeminfo.h>
#include <fm/fmd_snmp.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <libnvpair.h>
#include <limits.h>
#include <strings.h>
#include <stddef.h>
#include <unistd.h>
#include <dlfcn.h>
#include <errno.h>
#if defined(__sparcv9)
#else
#define DEFAULTSCHEMEDIR SCHEMEDIR_BASE
#endif
typedef struct fmd_scheme_ops {
int (*sop_init)(void);
void (*sop_fini)(void);
typedef struct fmd_scheme_opd {
const char *opd_name; /* symbol name of scheme function */
typedef struct fmd_scheme {
char *sch_name; /* name of this scheme (fmri prefix) */
void *sch_dlp; /* libdl(3DL) shared library handle */
int sch_err; /* if negative entry, errno to return */
} fmd_scheme_t;
static char *g_root; /* fmd root dir */
static long
fmd_scheme_notsup(void)
{
return (-1);
}
static int
fmd_scheme_nop(void)
{
return (0);
}
/*
* Default values for the scheme ops. If a scheme function is not defined in
* the module, then this operation is implemented using the default function.
*/
static const fmd_scheme_ops_t _fmd_scheme_default_ops = {
(int (*)())fmd_scheme_nop, /* sop_init */
(void (*)())fmd_scheme_nop, /* sop_fini */
};
/*
* Scheme ops descriptions. These names and offsets are used by the function
* fmd_scheme_rtld_init(), defined below, to load up a fmd_scheme_ops_t.
*/
static const fmd_scheme_opd_t _fmd_scheme_ops[] = {
{ NULL, 0 }
};
static fmd_scheme_t *
fmd_scheme_create(const char *name)
{
return (NULL);
}
return (sp);
}
static int
{
const fmd_scheme_opd_t *opd;
void *p;
}
}
static fmd_scheme_t *
{
return (sp);
}
return (NULL); /* errno is set for us */
return (sp);
}
NULL) {
return (sp);
}
if (fmd_scheme_rtld_init(sp) != 0) {
}
return (sp);
}
char *
{
"'%s' nvpair\n", FM_FMRI_SCHEME));
return (NULL);
}
const char *msg =
return (NULL);
}
name));
free(s);
return (NULL);
}
return (s);
}
void *
{
}
void *
{
void *data;
return (data);
}
/*ARGSUSED*/
void
{
}
int
fmd_fmri_error(int err)
{
return (-1);
}
char *
fmd_fmri_strescape(const char *s)
{
return (strdup(s));
}
char *
fmd_fmri_strdup(const char *s)
{
return (strdup(s));
}
void
fmd_fmri_strfree(char *s)
{
free(s);
}
const char *
fmd_fmri_get_rootdir(void)
{
}
const char *
fmd_fmri_get_platform(void)
{
static char platform[MAXNAMELEN];
if (platform[0] == '\0')
return (platform);
}
fmd_fmri_get_drgen(void)
{
return (0);
}
int
fmd_fmri_set_errno(int err)
{
return (-1);
}
/*ARGSUSED*/
void
fmd_fmri_warn(const char *format, ...)
{
}
/*ARGSUSED*/
struct topo_hdl *
fmd_fmri_topology(int version)
{
int err;
topo_strerror(err)));
return (NULL);
}
}
return (g_thp);
}