7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
724365f7556fc4201fdb11766ebc6bd918523130sethg * Common Development and Distribution License (the "License").
724365f7556fc4201fdb11766ebc6bd918523130sethg * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
53f3aea0943e36e5fed2615ad5f9fd1f17de51d2Roger A. Faulkner * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Lazy unload module
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditopo_mod_start(topo_mod_t *mod, topo_version_t version)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (-1);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (-1);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (0);
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditopo_mod_lookup(topo_hdl_t *thp, const char *name, int bump)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiset_create_error(topo_hdl_t *thp, topo_mod_t *mod, const char *path, int err)
12cc75c814f0c017004a9bbc96429911e008601bcindi topo_dprintf(thp, TOPO_DBG_ERR, "unable to load module %s: "
12cc75c814f0c017004a9bbc96429911e008601bcindi topo_dprintf(thp, TOPO_DBG_ERR, "unable to load module: "
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditopo_mod_create(topo_hdl_t *thp, const char *name, const char *path,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (topo_modhash_lookup(thp->th_modhash, name) != NULL)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (set_create_error(thp, NULL, path, ETOPO_MOD_LOADED));
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if ((mod = topo_hdl_zalloc(thp, sizeof (topo_mod_t))) == NULL)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (set_create_error(thp, mod, path, ETOPO_NOMEM));
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi mod->tm_rootdir = topo_hdl_strdup(thp, thp->th_rootdir);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (set_create_error(thp, mod, path, ETOPO_NOMEM));
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Module will be held upon a successful return from topo_mod_start()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (set_create_error(thp, mod, path, mod->tm_errno));
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi topo_dprintf(thp, TOPO_DBG_MODSVC, "loaded module %s\n", mod->tm_name);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if ((mhp = topo_hdl_zalloc(thp, sizeof (topo_modhash_t))) == NULL)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi topo_hdl_free(thp, mhp->mh_hash, sizeof (void *) * mhp->mh_hashlen);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditopo_modhash_lookup(topo_modhash_t *mhp, const char *name)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi for (mod = mhp->mh_hash[h]; mod != NULL; mod = mod->tm_next) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditopo_modhash_load(topo_hdl_t *thp, const char *name, const char *path,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if ((mod = topo_mod_create(thp, name, path, ops, version)) == NULL) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi for (i = 0; i < TOPO_HASH_BUCKETS; ++i) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * At this point we are forcing all modules to
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * stop, ignore any remaining module reference counts.