topo_mod.c revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Topology Plugin Modules
*
* Topology plugin modules are shared libraries that are dlopen'd and
* used to enumerate resources in the system.
* They are loaded by our builtin scheme-specific plugins or other modules
* to enumerate and create nodes for resources that are present in the system.
* They may also export a set of resource (node) specific methods that can be
* called on node-by-node basis.
*
* Module Plugin API
*
* Enumerators must provide entry points for intialization and clean-up
* (_topo_init() and _topo_fini()). In their _topo_init() function, an
* enumerator should register (topo_mod_register()) its enumeration callback
* and allocate resources required for a subsequent call to the callback.
* Optionally, methods may also be registered with topo_method_register().
*
* In its enumeration callback routine, the module should search for resources
* within its realm of resposibility and create any node ranges,
* topo_node_range_create() or nodes, topo_node_bind(). The Enumerator
* module is handed a node to which it may begin attaching additional
* topology nodes.
*
* If additional helper modules need to be loaded to complete the enumeration
* the module may do so by calling topo_mod_load(). Enumeration may then
* continue with the module handing off enumeration to its helper module
* by calling topo_mod_enumerate().
*
* If the module registers a release callback, it will be called on a node
* by node basis during topo_snap_rele(). Any private node data may be
* deallocated or methods unregistered at that time. Global module data
* should be clean-up before or at the time that the module _topo_fini
* entry point is called.
*/
#include <pthread.h>
#include <assert.h>
#include <errno.h>
#include <dirent.h>
#include <limits.h>
#include <alloca.h>
#include <unistd.h>
#include <stdio.h>
#include <topo_module.h>
#include <topo_alloc.h>
#include <topo_string.h>
#include <topo_error.h>
#include <topo_subr.h>
{
int err = 0;
char *p;
/*
* Already loaded, bump the ref count
*/
return (mod);
}
/*
* Check for a valid path
*/
return (NULL);
}
return (NULL);
}
} else {
return (NULL);
}
return (mod);
}
void
{
}
static int
{
}
int
{
== NULL)
return (0);
}
return (0);
}
void
{
return;
return;
}
int
{
int err = 0;
if (err != 0) {
return (-1);
}
return (0);
}
char *
{
return (mod->tm_rootdir);
}
{
}
void *
{
}
void
{
}
void
{
}
/*PRINTFLIKE2*/
void
{
}
}