Mercurial > illumos > illumos-gate
changeset 3955:cc0746871731
6480198 Unable to retrieve fma data from snmp traps via snmpget
6541833 fma snmp plugin fails to provide ASRU/FRU data
6541834 dead code in libfmd_snmp's problem.c
author | wesolows |
---|---|
date | Mon, 02 Apr 2007 19:12:42 -0700 |
parents | 01e658eeea5a |
children | ea75466401e7 |
files | usr/src/lib/fm/libfmd_snmp/Makefile.com usr/src/lib/fm/libfmd_snmp/common/mapfile-vers usr/src/lib/fm/libfmd_snmp/common/module.c usr/src/lib/fm/libfmd_snmp/common/problem.c usr/src/lib/fm/libfmd_snmp/common/resource.c usr/src/lib/fm/libfmd_snmp/common/scheme.c |
diffstat | 6 files changed, 35 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/fm/libfmd_snmp/Makefile.com Mon Apr 02 18:53:24 2007 -0700 +++ b/usr/src/lib/fm/libfmd_snmp/Makefile.com Mon Apr 02 19:12:42 2007 -0700 @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -56,7 +56,7 @@ lint := SNMPLIBS= LDLIBS += $(MACH_LDLIBS) -LDLIBS += -lfmd_adm -luutil -lnvpair +LDLIBS += -lfmd_adm -luutil -lnvpair -ltopo LDLIBS += $(SNMPLIBS) LDLIBS += -lc DYNFLAGS += -R$(SFWLIBDIR)
--- a/usr/src/lib/fm/libfmd_snmp/common/mapfile-vers Mon Apr 02 18:53:24 2007 -0700 +++ b/usr/src/lib/fm/libfmd_snmp/common/mapfile-vers Mon Apr 02 19:12:42 2007 -0700 @@ -18,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -37,6 +38,7 @@ fmd_fmri_strdup; fmd_fmri_strescape; fmd_fmri_strfree; + fmd_fmri_topology; fmd_fmri_warn; fmd_fmri_zalloc; init_sunFM;
--- a/usr/src/lib/fm/libfmd_snmp/common/module.c Mon Apr 02 18:53:24 2007 -0700 +++ b/usr/src/lib/fm/libfmd_snmp/common/module.c Mon Apr 02 19:12:42 2007 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -154,10 +154,8 @@ data = uu_avl_nearest_next(mod_index_avl, idx); - while (data != NULL && !MODULE_DATA_VALID(data)) { - (void) uu_avl_find(mod_index_avl, data, NULL, &idx); - data = uu_avl_nearest_next(mod_index_avl, idx); - } + while (data != NULL && !MODULE_DATA_VALID(data)) + data = uu_avl_next(mod_index_avl, data); return (data); } @@ -528,7 +526,7 @@ return (NULL); } - *var->val.integer = index; + *var->val.integer = data->d_index; table_info->indexes = var; table_info->number_indexes = 1;
--- a/usr/src/lib/fm/libfmd_snmp/common/problem.c Mon Apr 02 18:53:24 2007 -0700 +++ b/usr/src/lib/fm/libfmd_snmp/common/problem.c Mon Apr 02 19:12:42 2007 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -63,8 +63,6 @@ #define UCT_ALL 0x2 #define UCT_FLAGS 0x3 -#define MODULE_DATA_VALID(d) ((d)->d_valid == valid_stamp) - /* * Locking strategy is described in module.c. */
--- a/usr/src/lib/fm/libfmd_snmp/common/resource.c Mon Apr 02 18:53:24 2007 -0700 +++ b/usr/src/lib/fm/libfmd_snmp/common/resource.c Mon Apr 02 19:12:42 2007 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -134,14 +134,12 @@ if ((data = uu_avl_find(rsrc_index_avl, key, NULL, &idx)) != NULL && RESOURCE_DATA_VALID(data)) - return (data); + return (data); data = uu_avl_nearest_next(rsrc_index_avl, idx); - while (data != NULL && !RESOURCE_DATA_VALID(data)) { - (void) uu_avl_find(rsrc_index_avl, data, NULL, &idx); - data = uu_avl_nearest_next(rsrc_index_avl, idx); - } + while (data != NULL && !RESOURCE_DATA_VALID(data)) + data = uu_avl_next(rsrc_index_avl, data); return (data); } @@ -541,7 +539,7 @@ return (NULL); } - *var->val.integer = index; + *var->val.integer = data->d_index; table_info->indexes = var; table_info->number_indexes = 1;
--- a/usr/src/lib/fm/libfmd_snmp/common/scheme.c Mon Apr 02 18:53:24 2007 -0700 +++ b/usr/src/lib/fm/libfmd_snmp/common/scheme.c Mon Apr 02 19:12:42 2007 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,6 +30,7 @@ #include <sys/types.h> #include <sys/systeminfo.h> #include <fm/fmd_snmp.h> +#include <fm/libtopo.h> #include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-includes.h> #include <net-snmp/agent/net-snmp-agent-includes.h> @@ -72,6 +73,7 @@ static fmd_scheme_t *sch_list; /* list of cached schemes */ static char *g_root; /* fmd root dir */ +static struct topo_hdl *g_thp; static long fmd_scheme_notsup(void) @@ -296,3 +298,20 @@ fmd_fmri_warn(const char *format, ...) { } + +/*ARGSUSED*/ +struct topo_hdl * +fmd_fmri_topology(int version) +{ + int err; + + if (g_thp == NULL) { + if ((g_thp = topo_open(TOPO_VERSION, "/", &err)) == NULL) { + DEBUGMSGTL((MODNAME_STR, "topo_open failed: %s\n", + topo_strerror(err))); + return (NULL); + } + } + + return (g_thp); +}