plugin_mgr.c revision 7a0b67e3ef0ce92ca436e68c45383a76e14311a0
/*
* 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"
/*
* Block comment that describes the contents of this file.
*/
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <link.h>
#include <pthread.h>
#include "util.h"
#include "sfx4500-disk.h"
#include "plugin_mgr.h"
static boolean_t
safe_protocol_string(const char *protocol)
{
while (*protocol != 0) {
return (B_FALSE);
protocol++;
}
return (B_TRUE);
}
/*
* Initialize the plugin.
* Returns DMPE_SUCCESS if the _init entry point of the plugin
* executed successfully, otherwise returns DMPE_FAILURE.
*/
static dm_plugin_error_t
{
} else {
log_warn("_init failed for %s plugin; unloading it\n",
}
return (ec);
}
static dm_plugin_t *
new_dm_plugin(const char *protocol)
{
return (newpi);
}
static void
{
}
static void
{
if (dmpip) {
if (ec != DMPE_SUCCESS) {
log_warn("_fini failed for plugin %s.\n",
}
}
}
}
static boolean_t
{
int len;
char *buf;
/*
* Currently, plugins are baked into the module, and the name of the
* ops structure is formed by concatenating the plugin's protocol
* with a static string:
*/
log_warn("Plugin error: cannot handle "
"plugin %s with version %d.\n",
} else
} else {
log_warn("Plugin error: dlsym(%s) = NULL\n",
buf);
}
return (plugin_loaded);
}
static dm_plugin_t *
load_dm_plugin(const char *protocol)
{
/*
* Validate the protocol string -- if there are any non-alphanumeric
* characters, it's not a valid protocol string.
*/
log_warn("Invalid characters in plugin protocol `%s'.\n",
protocol);
goto fpi_out;
}
if (plugin_loaded) {
return (dmpip);
}
static char *
extract_protocol(const char *action)
{
int len;
int i = 0;
/* The protocol is the string before the separator, but in lower-case */
if (s) {
while (i < len) {
i++;
}
}
return (proto);
}
static char *
extract_action(const char *action)
{
/* The action is the string after the separator */
return (s ? (s + 1) : NULL);
}
static dm_plugin_t *
load_and_init_dm_plugin(const char *protocol)
{
if (plugin) {
/* If _init succeeded, add the plugin to the list */
} else {
/* Otherwise, free it. */
}
} else {
log_warn("Could not load `%s' plugin!\n",
protocol);
}
return (plugin);
}
static dm_plugin_t *
protocol_to_dm_plugin(const char *protocol)
{
/*
* Traversing the plugin list must be atomic with
* respect to plugin loads
*/
break;
}
}
/* Wasn't found -- load, initialize, and return it */
return (plugin);
}
static dm_plugin_action_handle_impl_t *
{
sizeof (dm_plugin_action_handle_impl_t));
/* Add the handle to the global list */
handle_list = hip;
return (hip);
}
static void
{
if (hip) {
if (hip->actionString)
!= DMPE_SUCCESS) {
log_warn("indicator_free_handle failed for %s"
" plugin\n",
}
}
}
static dm_plugin_action_handle_impl_t *
lookup_handle_by_action(const char *action)
{
break;
}
return (handle);
}
int
init_plugin_manager(void)
{
return (0);
}
void
cleanup_plugin_manager(void)
{
while (handle_list != NULL) {
}
while (plugin_list != NULL) {
}
}
static dm_plugin_error_t
{
return (DMPE_FAILURE);
}
{
log_warn("FRU update: Invalid protocol specified in action "
"`%s'\n", action);
return (DMPE_FAILURE);
}
frup));
}
return (DMPE_FAILURE);
}
dm_pm_indicator_execute(const char *action)
{
return (DMPE_FAILURE);
}
}
return (DMPE_FAILURE);
}
{
}
void
{
}
void
{
}
const char *
dm_plugin_prop_lookup(const char *propname)
{
}