2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Snapshot Library Interfaces 2N/A * Consumers of topology data may use the interfaces in this file to open, 2N/A * snapshot and close a topology exported by FMRI scheme (hc, mem and cpu) 2N/A * builtin plugins and their helper modules. A topology handle is obtained 2N/A * by calling topo_open(). Upon a successful return, the caller may use this 2N/A * handle to open a new snapshot. Each snapshot is assigned a Universally 2N/A * Unique Identifier that in a future enchancement to the libtopo API will be 2N/A * used as the file locator in /var/fm/topo to persist new snapshots or lookup 2N/A * a previously captured snapshot. topo_snap_hold() will capture the current 2N/A * system topology. All consumers of the topo_hdl_t argument will be 2N/A * blocked from accessing the topology trees until the snapshot completes. 2N/A * A snapshot may be cleared by calling topo_snap_rele(). As with 2N/A * topo_snap_hold(), all topology accesses are blocked until the topology 2N/A * trees have been released and deallocated. 2N/A * Walker Library Interfaces 2N/A * Once a snapshot has been taken with topo_snap_hold(), topo_hdl_t holders 2N/A * may initiate topology tree walks on a scheme-tree basis. topo_walk_init() 2N/A * will initiate the data structures required to walk any one one of the 2N/A * FMRI scheme trees. The walker data structure, topo_walk_t, is an opaque 2N/A * handle passed to topo_walk_step to begin the walk. At each node in the 2N/A * topology tree, a callback function is called with access to the node at 2N/A * which our current walk falls. The callback function is passed in during 2N/A * calls to topo_walk_init() and used throughout the walk_step of the 2N/A * scheme tree. At any time, the callback may terminate the walk by returning 2N/A * TOPO_WALK_TERMINATE or TOPO_WALK_ERR. TOPO_WALK_NEXT will continue the walk. 2N/A * The type of walk through the tree may be sibling first or child first by 2N/A * respectively passing in TOPO_WALK_SIBLING or TOPO_WALK_CHILD to 2N/A * the topo_walk_step() function. Topology nodes 2N/A * associated with an outstanding walk are held in place and will not be 2N/A * deallocated until the walk through that node completes. 2N/A * Once the walk has terminated, the walking process should call 2N/A * topo_walk_fini() to clean-up resources created in topo_walk_init() 2N/A * and release nodes that may be still held. 2N/A /* get SMBIOS handle */ 2N/A /* determine product name */ 2N/A * Cleanup the product name we found. Note that 2N/A * topo_cleanup_auth_str imposes a MAXNAMELEN limit 2N/A * Install default allocators 2N/A * Set-up system information and search paths for modules 2N/A * and topology map files 2N/A /* setup sysinfo based authority */ 2N/A "%s: failed to load builtin modules: %s\n",
2N/A * Unload all plugins 2N/A * If we're loading a topo snapshot rather than generating 2N/A * a new one from scratch, then thp->th_snap_dir will be 2N/A * non-null and the name of a sub-directory under the top 2N/A * level topo snapshots directory. 2N/A * If we're not loading a topo snapshot then generate a uuid, 2N/A * otherwise, one will be read in from the snapshot. 2N/A * We also don't need the devinfo or prominfo handles 2N/A * when loading a snapshot since those are only used 2N/A * Use uuid_generate_time() if debug option is set. 2N/A "%s: using uuid_generate_time(), time=0x%lx(%s)\n",
2N/A * the /dev links are probed by the disk enumerator and the ses 2N/A * enumetator to find /dev public name for a device that the 2N/A * enumerator is interested in. The devlink handle used to 2N/A * for the devices that are pulled from the devinfo snapshot 2N/A * taken above so it is okay to acquire the handle here since 2N/A * the /dev link repository will include the same set of 2N/A * the devices as the devinfo snapshot. 2N/A * Until we can clean up (i.e. remove) topo dependencies 2N/A * on /dev public names, we ensure that name creation has 2N/A * completed by passing the DI_MAKE_LINK flag. Doing this 2N/A * lets us ignore EC_DEV_ADD and EC_DEV_REMOVE events 2N/A * Note that nothing returns ETOPO_ENUM_FATAL today. 2N/A "%s: failed to refresh IPMI sdr repository: %s\n",
2N/A "%s: enumeration failed, th_uuid is NULL\n",
__func__);
2N/A * Create topo handle authority if enumerator has not. 2N/A * If the facility enumeration method fails, note the failure, 2N/A * but continue on with the walk. 2N/A "%s: facility enumeration method failed on " 2N/A * Return snapshot id 2N/A /* global zone: walk and invoke facility enumeration methods. */ 2N/A * Clean-up tree nodes from the bottom-up 2N/A * Tidy-up the root node 2N/A * Clean-up our cached devinfo, devlink, prom tree, and smbios handles. 2N/A * Hold the root node and start walk at the first 2N/A "%s: TOPO_WALK_TERMINATE for %s=%d\n",
2N/A * No more nodes to walk 2N/A * Walker callback says we're done 2N/A * No more nodes in this hash, skip to next node hash by stepping 2N/A * to next sibling (child-first walk) or next child (sibling-first 2N/A * At a leaf, run the callback 2N/A * Try next child or sibling 2N/A * Load in a saved topology snapshot. 2N/A /* fmd(1M) is about to exit, call di_cromk_cleanup(). */