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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include <fm/fmd_api.h>
28 #include <fm/fmd_agent.h>
29 #include <fm/fmd_fmri.h>
33 cma_fmri_page_service_state(fmd_hdl_t
*hdl
, nvlist_t
*nvl
)
35 fmd_agent_hdl_t
*fa_hdl
;
38 if ((fa_hdl
= fmd_agent_open(FMD_AGENT_VERSION
)) != NULL
) {
39 rc
= fmd_agent_page_isretired(fa_hdl
, nvl
);
40 if (rc
== FMD_AGENT_RETIRE_DONE
)
41 rc
= FMD_SERVICE_STATE_UNUSABLE
;
42 else if (rc
== FMD_AGENT_RETIRE_FAIL
)
43 rc
= FMD_SERVICE_STATE_OK
;
44 else if (rc
== FMD_AGENT_RETIRE_ASYNC
)
45 rc
= FMD_SERVICE_STATE_ISOLATE_PENDING
;
46 fmd_agent_close(fa_hdl
);
50 return (FMD_SERVICE_STATE_UNKNOWN
);
55 cma_fmri_page_retire(fmd_hdl_t
*hdl
, nvlist_t
*nvl
)
57 fmd_agent_hdl_t
*fa_hdl
;
60 if ((fa_hdl
= fmd_agent_open(FMD_AGENT_VERSION
)) != NULL
) {
61 rc
= fmd_agent_page_retire(fa_hdl
, nvl
);
62 fmd_agent_close(fa_hdl
);
66 return (FMD_AGENT_RETIRE_FAIL
);
71 cma_fmri_page_unretire(fmd_hdl_t
*hdl
, nvlist_t
*nvl
)
73 fmd_agent_hdl_t
*fa_hdl
;
76 if ((fa_hdl
= fmd_agent_open(FMD_AGENT_VERSION
)) != NULL
) {
77 rc
= fmd_agent_page_unretire(fa_hdl
, nvl
);
78 fmd_agent_close(fa_hdl
);
82 return (FMD_AGENT_RETIRE_FAIL
);