fmd_protocol.c (9dd0f810) fmd_protocol.c (44743693)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29#include <sys/fm/protocol.h>
30#include <strings.h>
31#include <alloca.h>

--- 102 unchanged lines hidden (view full) ---

134 if (err != 0)
135 fmd_panic("failed to populate nvlist: %s\n", fmd_strerror(err));
136
137 return (nvl);
138}
139
140nvlist_t *
141fmd_protocol_list(const char *class, nvlist_t *de_fmri, const char *uuid,
24 * Use is subject to license terms.
25 */
26
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29#include <sys/fm/protocol.h>
30#include <strings.h>
31#include <alloca.h>

--- 102 unchanged lines hidden (view full) ---

134 if (err != 0)
135 fmd_panic("failed to populate nvlist: %s\n", fmd_strerror(err));
136
137 return (nvl);
138}
139
140nvlist_t *
141fmd_protocol_list(const char *class, nvlist_t *de_fmri, const char *uuid,
142 const char *code, uint_t argc, nvlist_t **argv, uint8_t *flagv, int domsg)
142 const char *code, uint_t argc, nvlist_t **argv, uint8_t *flagv, int domsg,
143 struct timeval *tvp)
143{
144{
144 struct timeval tv;
145 int64_t tod[2];
146 nvlist_t *nvl;
147 int err = 0;
148
145 int64_t tod[2];
146 nvlist_t *nvl;
147 int err = 0;
148
149 fmd_time_gettimeofday(&tv);
150 tod[0] = tv.tv_sec;
151 tod[1] = tv.tv_usec;
149 tod[0] = tvp->tv_sec;
150 tod[1] = tvp->tv_usec;
152
153 if (nvlist_xalloc(&nvl, NV_UNIQUE_NAME, &fmd.d_nva) != 0)
154 fmd_panic("failed to xalloc suspect list nvlist");
155
156 err |= nvlist_add_uint8(nvl, FM_VERSION, FM_SUSPECT_VERSION);
157 err |= nvlist_add_string(nvl, FM_CLASS, class);
158 err |= nvlist_add_string(nvl, FM_SUSPECT_UUID, uuid);
159 err |= nvlist_add_string(nvl, FM_SUSPECT_DIAG_CODE, code);

--- 17 unchanged lines hidden (view full) ---

177 fmd_panic("failed to populate nvlist: %s\n", fmd_strerror(err));
178
179 return (nvl);
180}
181
182nvlist_t *
183fmd_protocol_rsrc_asru(const char *class,
184 nvlist_t *fmri, const char *uuid, const char *code,
151
152 if (nvlist_xalloc(&nvl, NV_UNIQUE_NAME, &fmd.d_nva) != 0)
153 fmd_panic("failed to xalloc suspect list nvlist");
154
155 err |= nvlist_add_uint8(nvl, FM_VERSION, FM_SUSPECT_VERSION);
156 err |= nvlist_add_string(nvl, FM_CLASS, class);
157 err |= nvlist_add_string(nvl, FM_SUSPECT_UUID, uuid);
158 err |= nvlist_add_string(nvl, FM_SUSPECT_DIAG_CODE, code);

--- 17 unchanged lines hidden (view full) ---

176 fmd_panic("failed to populate nvlist: %s\n", fmd_strerror(err));
177
178 return (nvl);
179}
180
181nvlist_t *
182fmd_protocol_rsrc_asru(const char *class,
183 nvlist_t *fmri, const char *uuid, const char *code,
185 boolean_t faulty, boolean_t unusable, boolean_t message, nvlist_t *event)
184 boolean_t faulty, boolean_t unusable, boolean_t message, nvlist_t *event,
185 struct timeval *tvp)
186{
187 nvlist_t *nvl;
186{
187 nvlist_t *nvl;
188 int64_t tod[2];
188 int err = 0;
189
189 int err = 0;
190
191 tod[0] = tvp->tv_sec;
192 tod[1] = tvp->tv_usec;
193
190 if (nvlist_xalloc(&nvl, NV_UNIQUE_NAME, &fmd.d_nva) != 0)
191 fmd_panic("failed to xalloc resource nvlist");
192
193 err |= nvlist_add_uint8(nvl, FM_VERSION, FM_RSRC_VERSION);
194 err |= nvlist_add_string(nvl, FM_CLASS, class);
195 err |= nvlist_add_nvlist(nvl, FM_RSRC_RESOURCE, fmri);
196
197 if (uuid != NULL)
198 err |= nvlist_add_string(nvl, FM_RSRC_ASRU_UUID, uuid);
199
200 if (code != NULL)
201 err |= nvlist_add_string(nvl, FM_RSRC_ASRU_CODE, code);
202
203 err |= nvlist_add_boolean_value(nvl, FM_RSRC_ASRU_FAULTY, faulty);
204 err |= nvlist_add_boolean_value(nvl, FM_RSRC_ASRU_UNUSABLE, unusable);
205 err |= nvlist_add_boolean_value(nvl, FM_SUSPECT_MESSAGE, message);
194 if (nvlist_xalloc(&nvl, NV_UNIQUE_NAME, &fmd.d_nva) != 0)
195 fmd_panic("failed to xalloc resource nvlist");
196
197 err |= nvlist_add_uint8(nvl, FM_VERSION, FM_RSRC_VERSION);
198 err |= nvlist_add_string(nvl, FM_CLASS, class);
199 err |= nvlist_add_nvlist(nvl, FM_RSRC_RESOURCE, fmri);
200
201 if (uuid != NULL)
202 err |= nvlist_add_string(nvl, FM_RSRC_ASRU_UUID, uuid);
203
204 if (code != NULL)
205 err |= nvlist_add_string(nvl, FM_RSRC_ASRU_CODE, code);
206
207 err |= nvlist_add_boolean_value(nvl, FM_RSRC_ASRU_FAULTY, faulty);
208 err |= nvlist_add_boolean_value(nvl, FM_RSRC_ASRU_UNUSABLE, unusable);
209 err |= nvlist_add_boolean_value(nvl, FM_SUSPECT_MESSAGE, message);
210 err |= nvlist_add_int64_array(nvl, FM_SUSPECT_DIAG_TIME, tod, 2);
206
207 if (event != NULL)
208 err |= nvlist_add_nvlist(nvl, FM_RSRC_ASRU_EVENT, event);
209
210 if (err != 0)
211 fmd_panic("failed to populate nvlist: %s\n", fmd_strerror(err));
212
213 return (nvl);

--- 114 unchanged lines hidden ---
211
212 if (event != NULL)
213 err |= nvlist_add_nvlist(nvl, FM_RSRC_ASRU_EVENT, event);
214
215 if (err != 0)
216 fmd_panic("failed to populate nvlist: %s\n", fmd_strerror(err));
217
218 return (nvl);

--- 114 unchanged lines hidden ---