diff usr/src/lib/fm/topo/libtopo/common/topo_mod.c @ 12979:ab9ae749152f

PSARC/2009/617 Software Events Notification Parameters CLI PSARC/2009/618 snmp-notify: SNMP Notification Daemon for Software Events PSARC/2009/619 smtp-notify: Email Notification Daemon for Software Events PSARC/2010/225 fmd for non-global Solaris zones PSARC/2010/226 Solaris Instance UUID PSARC/2010/227 nvlist_nvflag(3NVPAIR) PSARC/2010/228 libfmevent additions PSARC/2010/257 sysevent_evc_setpropnvl and sysevent_evc_getpropnvl PSARC/2010/265 FMRI and FMA Event Stabilty, 'ireport' category 1 event class, and the 'sw' FMRI scheme PSARC/2010/278 FMA/SMF integration: instance state transitions PSARC/2010/279 Modelling panics within FMA PSARC/2010/290 logadm.conf upgrade 6392476 fmdump needs to pretty-print 6393375 userland ereport/ireport event generation interfaces 6445732 Add email notification agent for FMA and software events 6804168 RFE: Allow an efficient means to monitor SMF services status changes 6866661 scf_values_destroy(3SCF) will segfault if is passed NULL 6884709 Add snmp notification agent for FMA and software events 6884712 Add private interface to tap into libfmd_msg macro expansion capabilities 6897919 fmd to run in a non-global zone 6897937 fmd use of non-private doors is not safe 6900081 add a UUID to Solaris kernel image for use in crashdump identification 6914884 model panic events as a defect diagnosis in FMA 6944862 fmd_case_open_uuid, fmd_case_uuisresolved, fmd_nvl_create_defect 6944866 log legacy sysevents in fmd 6944867 enumerate svc scheme in topo 6944868 software-diagnosis and software-response fmd modules 6944870 model SMF maintenance state as a defect diagnosis in FMA 6944876 savecore runs in foreground for systems with zfs root and dedicated dump 6965796 Implement notification parameters for SMF state transitions and FMA events 6968287 SUN-FM-MIB.mib needs to be updated to reflect Oracle information 6972331 logadm.conf upgrade PSARC/2010/290
author Gavin Maltby <gavin.maltby@oracle.com>
date Fri, 30 Jul 2010 17:04:17 +1000
parents 3ae81edcfbf7
children
line wrap: on
line diff
--- a/usr/src/lib/fm/topo/libtopo/common/topo_mod.c	Thu Jul 29 22:45:58 2010 -0700
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_mod.c	Fri Jul 30 17:04:17 2010 +1000
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -560,6 +559,70 @@
 	return (nfp);
 }
 
+#define	_SWFMRI_ADD_STRING(nvl, name, val) \
+	((val) ? (nvlist_add_string(nvl, name, val) != 0) : 0)
+
+nvlist_t *
+topo_mod_swfmri(topo_mod_t *mod, int version,
+    char *obj_path, char *obj_root, nvlist_t *obj_pkg,
+    char *site_token, char *site_module, char *site_file, char *site_func,
+    int64_t site_line, char *ctxt_origin, char *ctxt_execname,
+    int64_t ctxt_pid, char *ctxt_zone, int64_t ctxt_ctid,
+    char **ctxt_stack, uint_t ctxt_stackdepth)
+{
+	nvlist_t *fmri, *args;
+	nvlist_t *nfp = NULL;
+	int err;
+
+	if (version != FM_SW_SCHEME_VERSION)
+		return (set_fmri_err(mod, EMOD_FMRI_VERSION));
+
+	if (topo_mod_nvalloc(mod, &args, NV_UNIQUE_NAME) != 0)
+		return (set_fmri_err(mod, EMOD_FMRI_NVL));
+
+	err = 0;
+	err |= _SWFMRI_ADD_STRING(args, "obj_path", obj_path);
+	err |= _SWFMRI_ADD_STRING(args, "obj_root", obj_root);
+	if (obj_pkg)
+		err |= nvlist_add_nvlist(args, "obj_pkg", obj_pkg);
+
+	err |= _SWFMRI_ADD_STRING(args, "site_token", site_token);
+	err |= _SWFMRI_ADD_STRING(args, "site_module", site_module);
+	err |= _SWFMRI_ADD_STRING(args, "site_file", site_file);
+	err |= _SWFMRI_ADD_STRING(args, "site_func", site_func);
+	if (site_line != -1)
+		err |= nvlist_add_int64(args, "site_line", site_line);
+
+	err |= _SWFMRI_ADD_STRING(args, "ctxt_origin", ctxt_origin);
+	err |= _SWFMRI_ADD_STRING(args, "ctxt_execname", ctxt_execname);
+	if (ctxt_pid != -1)
+		err |= nvlist_add_int64(args, "ctxt_pid", ctxt_pid);
+	err |= _SWFMRI_ADD_STRING(args, "ctxt_zone", ctxt_zone);
+	if (ctxt_ctid != -1)
+		err |= nvlist_add_int64(args, "ctxt_ctid", ctxt_ctid);
+	if (ctxt_stack != NULL && ctxt_stackdepth != 0)
+		err |= nvlist_add_string_array(args, "stack", ctxt_stack,
+		    ctxt_stackdepth);
+
+	if (err) {
+		nvlist_free(args);
+		return (set_fmri_err(mod, EMOD_FMRI_NVL));
+	}
+
+	if ((fmri = topo_fmri_create(mod->tm_hdl, FM_FMRI_SCHEME_SW,
+	    FM_FMRI_SCHEME_SW, 0, args, &err)) == NULL) {
+		nvlist_free(args);
+		return (set_fmri_err(mod, err));
+	}
+
+	nvlist_free(args);
+
+	(void) topo_mod_nvdup(mod, fmri, &nfp);
+	nvlist_free(fmri);
+
+	return (nfp);
+}
+
 int
 topo_mod_str2nvl(topo_mod_t *mod, const char *fmristr, nvlist_t **fmri)
 {