/*
* 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
*/
/*
*/
/*
* libfmd_agent contains the low-level operations that needed by the fmd
*
* heavily versioned to allow userland patching without requiring a reboot
* between userland and kernel. (see fmd_agent_nvl_ioctl()).
*/
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <strings.h>
#include <libnvpair.h>
#include <string.h>
#include <fmd_agent_impl.h>
int
{
return (hdl->agent_errno);
}
int
{
return (-1);
}
const char *
{
}
const char *
{
}
static int
int err)
{
}
/*
* name-value lists (nvlists).
*/
int
{
int err = 0;
return (err);
if (insz > FM_IOC_MAXBUFSZ)
return (ENAMETOOLONG);
return (errno);
NV_ENCODE_NATIVE, 0)) != 0) {
return (err);
}
}
}
for (;;) {
break;
}
}
outsz < FM_IOC_OUT_MAXBUFSZ) {
outsz *= 2;
} else {
break;
}
outnvlp, 0);
break;
} else {
break;
}
}
return (err);
}
/*
*/
static fmd_agent_hdl_t *
{
return (NULL); /* errno is set for us */
UMEM_DEFAULT)) == NULL) {
return (NULL);
}
/*
* Get the individual interface versions.
*/
< 0) {
return (NULL);
}
return (hdl);
}
{
if (ver > FMD_AGENT_VERSION) {
return (NULL);
}
}
void
{
}
/*
* Given a interface name, return the kernel interface version.
*/
int
{
int err;
if (err != 0) {
return (-1);
}
return (0);
}
static int
{
int err;
return (0);
}
static int
{
switch (ver) {
case 1:
default:
}
}
int
{
/*
* FM_IOC_PAGE_RETIRE ioctl returns:
* 0 - success in retiring page
* -1, errno = EIO - page is already retired
* -1, errno = EAGAIN - page is scheduled for retirement
* -1, errno = EINVAL - page fmri is invalid
* -1, errno = any else - error
*/
if (rc == 0)
(void) fmd_agent_seterrno(hdl, 0);
return (FMD_AGENT_RETIRE_DONE);
}
return (FMD_AGENT_RETIRE_ASYNC);
return (FMD_AGENT_RETIRE_FAIL);
}
int
{
/*
* FM_IOC_PAGE_UNRETIRE ioctl returns:
* 0 - success in unretiring page
* -1, errno = EIO - page is already unretired
* -1, errno = EAGAIN - page couldn't be locked, still retired
* -1, errno = EINVAL - page fmri is invalid
* -1, errno = any else - error
*/
if (rc == 0)
(void) fmd_agent_seterrno(hdl, 0);
return (FMD_AGENT_RETIRE_DONE);
}
return (FMD_AGENT_RETIRE_FAIL);
}
int
{
/*
* FM_IOC_PAGE_STATUS returns:
* 0 - page is retired
* -1, errno = EAGAIN - page is scheduled for retirement
* -1, errno = EIO - page not scheduled for retirement
* -1, errno = EINVAL - page fmri is invalid
* -1, errno = any else - error
*/
if (rc == 0)
(void) fmd_agent_seterrno(hdl, 0);
return (FMD_AGENT_RETIRE_DONE);
}
return (FMD_AGENT_RETIRE_ASYNC);
return (FMD_AGENT_RETIRE_FAIL);
}