libsmp.h revision ac88567a7a5bb7f01cf22cf366bc9d6203e24d7a
/*
* 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
*/
/*
*/
#ifndef _LIBSMP_H
#define _LIBSMP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/sysmacros.h>
#include <libnvpair.h>
#include <stdarg.h>
#define LIBSMP_VERSION 1
typedef enum smp_errno {
ESMP_NONE, /* no error */
ESMP_NOMEM, /* no memory */
ESMP_ZERO_LENGTH, /* zero-length allocation requested */
ESMP_VERSION, /* library version mismatch */
ESMP_BADTARGET, /* invalid target specification */
ESMP_BADFUNC, /* invalid SMP function */
ESMP_BADENGINE, /* engine library corrupt */
ESMP_NOENGINE, /* engine library not found */
ESMP_ENGINE_INIT, /* engine initialization failed */
ESMP_ENGINE_VER, /* engine version mismatch */
ESMP_ENGINE_BADPATH, /* engine path contains no usable components */
ESMP_BADLENGTH, /* buffer length overflow or size error */
ESMP_NEEDBUF, /* missing required buffer */
ESMP_PLUGIN, /* no plugins found */
ESMP_IO, /* I/O operation failed */
ESMP_SYS, /* system call failed */
ESMP_PERM, /* insufficient permissions */
ESMP_RANGE, /* parameter outside valid range */
ESMP_NOTSUP, /* operation not supported */
ESMP_UNKNOWN, /* error of unknown type */
ESMP_REPGEN_FAILED, /* initial report general command failed */
ESMP_MAX /* maximum libsmp errno value */
} smp_errno_t;
typedef struct smp_target_def {
const char *std_engine;
const void *std_def;
struct smp_target;
typedef struct smp_target smp_target_t;
struct smp_action;
typedef struct smp_action smp_action_t;
extern int smp_init(int);
extern void smp_fini(void);
extern const char *smp_target_vendor(const smp_target_t *);
extern const char *smp_target_product(const smp_target_t *);
extern const char *smp_target_revision(const smp_target_t *);
extern const char *smp_target_component_vendor(const smp_target_t *);
extern void smp_close(smp_target_t *);
extern smp_errno_t smp_errno(void);
extern smp_errno_t smp_errcode(const char *);
extern const char *smp_errmsg(void);
extern const char *smp_strerror(smp_errno_t);
extern const char *smp_errname(smp_errno_t);
extern char *smp_trim_strdup(const char *, size_t);
extern void smp_action_get_response(const smp_action_t *,
smp_result_t *, void **, size_t *);
extern void smp_action_free(smp_action_t *);
#ifdef __cplusplus
}
#endif
#endif /* _LIBSMP_H */