/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <meta.h>
#include <libsysevent.h>
#include <libnvpair.h>
#include <dlfcn.h>
char *
{
char *setname;
char *uname;
int rtn = 0;
if ((setno != MD_SET_BAD) &&
}
name[0] = '\0';
switch (tag) {
case SVM_TAG_HS:
case SVM_TAG_METADEVICE:
case SVM_TAG_MIRROR:
case SVM_TAG_RAID5:
case SVM_TAG_STRIPE:
case SVM_TAG_TRANS:
return (NULL);
break;
case SVM_TAG_HSP:
return (NULL);
break;
case SVM_TAG_DRIVE:
break;
case SVM_TAG_HOST:
}
/*
* Get the host data from the node array.
*/
}
rtn = 0;
}
break;
case SVM_TAG_SET:
} else {
}
break;
default:
}
break;
}
mdclrerror(&status);
/* Check if we got any rubbish for any of the snprintf's */
return (NULL);
}
}
/* Sysevent subclass and mdnotify event type pairs */
struct node {
char *se_ev;
};
/* Table must be sorted in ascending order */
{ ESC_SVM_ADD, EV_ADD },
{ ESC_SVM_ATTACH, EV_ATTACH },
{ ESC_SVM_CHANGE, EV_CHANGE },
{ ESC_SVM_CREATE, EV_CREATE },
{ ESC_SVM_DELETE, EV_DELETE },
{ ESC_SVM_DETACH, EV_DETACH },
{ ESC_SVM_ENABLE, EV_ENABLE },
{ ESC_SVM_ERRED, EV_ERRED },
{ ESC_SVM_EXCHANGE, EV_EXCHANGE },
{ ESC_SVM_GROW, EV_GROW },
{ ESC_SVM_HS_FREED, EV_HS_FREED },
{ ESC_SVM_HOST_ADD, EV_HOST_ADD },
{ ESC_SVM_IOERR, EV_IOERR },
{ ESC_SVM_OFFLINE, EV_OFFLINE },
{ ESC_SVM_OK, EV_OK },
{ ESC_SVM_ONLINE, EV_ONLINE },
{ ESC_SVM_RELEASE, EV_RELEASE },
{ ESC_SVM_REMOVE, EV_REMOVE },
{ ESC_SVM_REPLACE, EV_REPLACE },
};
};
static int
{
}
/*
* Log mdnotify event
*/
void
{
/* Translate sysevent into mdnotify event */
} else {
}
} else {
}
}
/*
* External symbols from libsysevent and libnvpair which are not
* available in static forms
*/
static int (*_sysevent_post_event)(char *, char *, char *, char *,
/*
* Load nvpair and sysevent symbols
*/
static int
{
/* Try to load the sysevent symbol */
}
if ((_sysevent_post_event == NULL) &&
(_sysevent_post_event = (int (*)(char *, char *, char *,
char *, nvlist_t *, sysevent_id_t *))
goto out;
}
} else {
return (1);
}
/* Try to load the nvpair symbols */
}
if ((_nvlist_alloc == NULL) &&
goto out;
}
if ((_nvlist_free == NULL) &&
"nvlist_free")) == NULL) {
goto out;
}
if ((_nvlist_add_uint32 == NULL) &&
(_nvlist_add_uint32 = (int (*)(nvlist_t *, char *,
"nvlist_add_uint32")) == NULL) {
goto out;
}
if ((_nvlist_add_uint64 == NULL) &&
(_nvlist_add_uint64 = (int (*)(nvlist_t *, char *,
"nvlist_add_uint64")) == NULL) {
goto out;
}
if ((_nvlist_add_string == NULL) &&
(_nvlist_add_string = (int (*)(nvlist_t *, char *,
"nvlist_add_string")) == NULL) {
goto out;
}
return (0);
}
out:
}
}
_nvlist_free = NULL;
return (1);
}
/*
* Log SVM sys events
*/
void
char *se_class,
char *se_subclass,
)
{
int err = 0;
char *devname;
/* Raise the mdnotify event before anything else */
/* Just get out if the sysevent symbol can't be loaded */
if (load_sev_lib()) {
return;
}
if (err == 0) {
/* Add the version number */
if (err != 0) {
goto fail;
}
/* Add the tag attribute */
if (err != 0) {
goto fail;
}
/* Add the set number attribute */
if (err != 0) {
goto fail;
}
/* Add the device id attribute */
if (err != 0) {
goto fail;
}
/* Add the device name attribute */
devname);
} else {
"unspecified");
}
if (err != 0) {
goto fail;
}
/* Attempt to post event */
(*_nvlist_free)(attr_list);
}
return;
fail:
(*_nvlist_free)(attr_list);
}