hc.c revision ded9341448cd6e2573619c7f6fe98909bdd35ec6
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CDDL HEADER START
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The contents of this file are subject to the terms of the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Common Development and Distribution License (the "License").
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You may not use this file except in compliance with the License.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * See the License for the specific language governing permissions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * and limitations under the License.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * When distributing Covered Code, include this CDDL HEADER in each
199767f8919635c4928607450d9e0abb932109ceToomas Soome * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If applicable, add the following below this CDDL HEADER, with the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * fields enclosed by brackets "[]" replaced with your own identifying
199767f8919635c4928607450d9e0abb932109ceToomas Soome * information: Portions Copyright [yyyy] [name of copyright owner]
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CDDL HEADER END
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_enum(topo_mod_t *, tnode_t *, const char *, topo_instance_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soome topo_instance_t, void *, void *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic void hc_release(topo_mod_t *, tnode_t *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_nvl2str(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_str2nvl(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_compare(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_present(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_replaced(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_unusable(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_expand(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_retire(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_unretire(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_service_state(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_create_meth(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_prop_get(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_prop_set(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_pgrp_get(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_fmri_facility(topo_mod_t *, tnode_t *, topo_version_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic nvlist_t *hc_fmri_create(topo_mod_t *, nvlist_t *, int, const char *,
199767f8919635c4928607450d9e0abb932109ceToomas Soome topo_instance_t inst, const nvlist_t *, const char *, const char *,
199767f8919635c4928607450d9e0abb932109ceToomas Soome const char *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome { TOPO_METH_NVL2STR, TOPO_METH_NVL2STR_DESC, TOPO_METH_NVL2STR_VERSION,
199767f8919635c4928607450d9e0abb932109ceToomas Soome { TOPO_METH_STR2NVL, TOPO_METH_STR2NVL_DESC, TOPO_METH_STR2NVL_VERSION,
199767f8919635c4928607450d9e0abb932109ceToomas Soome { TOPO_METH_COMPARE, TOPO_METH_COMPARE_DESC, TOPO_METH_COMPARE_VERSION,
199767f8919635c4928607450d9e0abb932109ceToomas Soome { TOPO_METH_PRESENT, TOPO_METH_PRESENT_DESC, TOPO_METH_PRESENT_VERSION,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_REPLACED_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_UNUSABLE_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_EXPAND_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_RETIRE_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_UNRETIRE_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome { TOPO_METH_SERVICE_STATE, TOPO_METH_SERVICE_STATE_DESC,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_SERVICE_STATE_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome { TOPO_METH_FMRI, TOPO_METH_FMRI_DESC, TOPO_METH_FMRI_VERSION,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_STABILITY_INTERNAL, hc_fmri_create_meth },
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_PROP_GET_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_PROP_SET_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_PGRP_GET_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome TOPO_METH_FACILITY_VERSION, TOPO_STABILITY_INTERNAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome { HC, FM_FMRI_SCHEME_HC, HC_VERSION, &hc_ops };
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int hc_ncanon = sizeof (hc_canon) / sizeof (hcc_t);
int err;
&err);
&err);
&err);
&err);
int err;
int err, i;
if (err != 0)
for (i = 0; i < nhcp1; i++) {
int ret;
if (ret < 0)
compare) == 0)
static ssize_t
int err, i;
if (root)
for (i = 0; i < hcnprs; i++) {
hexstr);
return (size);
static nvlist_t *
int err = 0;
return (NULL);
if (err != 0) {
return (NULL);
return (fmri);
static nvlist_t **
char *find;
int nslashes = 0;
int npairs = 0;
int i, hclen;
return (NULL);
return (NULL);
npairs++;
nslashes++;
return (NULL);
return (NULL);
for (i = 0; i < npairs; i++) {
startn++;
if (i < npairs) {
for (i = 0; i < npairs; i++)
return (NULL);
return (pa);
goto hcabail;
goto hcabail;
goto hcabail;
goto hcabail;
goto hcabail;
NV_UNIQUE_NAME) == 0) {
aid);
++fac;
++fname;
char *str;
int npairs, n;
goto hcfmbail;
goto hcfmbail;
n = npairs;
char *hcid;
&hcid);
goto hcfmbail;
goto hcfmbail;
goto hcfmbail;
for (i = 0; i < npairs; i++)
goto hcfmbail;
goto hcfmbail;
for (i = 0; i < npairs; i++)
static nvlist_t *
int err;
return (NULL);
if (err != 0) {
return (NULL);
return (hc);
static nvlist_t *
int err)
return (NULL);
for (i = 0; i < hc_ncanon; i++) {
if (i >= hc_ncanon) {
name);
static nvlist_t *
EMOD_NOMEM));
for (i = 0; i < pelems; ++i)
return (fmri);
int ret;
&pfmri);
&auth);
&part);
&serial);
struct hc_walk {
void *hcw_priv;
int err;
rsrc) != 0 ||
fmri) != 0) {
&match) != 0) {
int status;
return (status);
return (TOPO_WALK_TERMINATE);
int i, err;
return (TOPO_WALK_ERR);
return (TOPO_WALK_TERMINATE);
return (TOPO_WALK_TERMINATE);
if (err != 0) {
return (TOPO_WALK_ERR);
return (TOPO_WALK_ERR);
if (!match)
if (err != 0) {
return (TOPO_WALK_ERR);
return (TOPO_WALK_ERR);
return (TOPO_WALK_TERMINATE);
if (err != 0) {
return (TOPO_WALK_ERR);
static struct hc_walk *
return (NULL);
&sz) != 0) {
return (NULL);
return (NULL);
== NULL) {
return (NULL);
return (hwp);
struct prop_lookup {
const char *pl_pgroup;
const char *pl_pname;
int pl_flag;
int err = 0;
return (err);
int err;
if (err != 0) {
err = 0;
return (err);
int err = 0;
return (err);
int err;
if (err != 0) {
err = 0;
return (err);
int err = 0;
return (err);
int err;
if (err != 0) {
err = 0;
return (err);
struct hc_args {
char *ha_method_name;
return (FMD_OBJ_STATE_UNKNOWN);
return (FMD_OBJ_STATE_REPLACED);
return (FMD_OBJ_STATE_STILL_PRESENT);
int err;
&err) < 0) {
return (err);
return (err);
return (EMOD_NOMEM);
return (EMOD_NOMEM);
int err;
err = 0;
return (err);
int err;
&err) < 0) {
return (err);
&err) < 0) {
return (err);
return (err);
NV_UNIQUE_NAME) != 0)
return (EMOD_NOMEM);
return (ETOPO_PROP_NVL);
FMD_OBJ_STATE_NOT_PRESENT) != 0) {
return (ETOPO_PROP_NVL);
int err;
err = 0;
return (err);
int err;
&err) < 0) {
TOPO_METH_UNUSABLE_RET, 0) == 0)
return (ETOPO_PROP_NVL);
int err;
err = 0;
return (err);
struct fac_lookup {
const char *fl_fac_type;
#ifdef _LP64
return (TOPO_WALK_ERR);
return (ret);
int err = 0;
#ifdef _LP64
if (err != 0) {
err = 0;
return (err);
int err;
const char **namep;
const char *names[] = {
return (ETOPO_METHOD_FAIL);
return (ETOPO_PROP_NVL);
int err;
err = 0;
return (err);
int err;
err = 0;
return (err);