topo_file.c revision 724365f7556fc4201fdb11766ebc6bd918523130
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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"
#include <limits.h>
#include <string.h>
#include <topo_error.h>
#include <topo_tree.h>
#include <topo_subr.h>
#include <topo_file.h>
/*
*
* This file hides the details of any file manipulation to
* establish topology for a given scheme. It has two outward
* facing interfaces topo_file_load() and topo_file_unload().
*/
#define TOPO_DEFAULT_FILE "%s-topology.xml"
#define COMMON_TOPO_PATH "%susr/lib/fm/topo/%s"
static int
{
int err, e;
char _topo_path[PATH_MAX];
(void) snprintf(_topo_file,
/*
* Look for a platform-specific topology file first
*/
if (e < 0)
tfp->tf_fileinfo =
return (0);
}
/*
* No luck with the platform-specific file, how about a
* machine-specific one?
*/
if (e < 0) {
}
/*
* Don't waste time trying to open the same file twice in the
* cases where the platform name is identical to the machine
* name
*/
tfp->tf_fileinfo =
}
return (0);
} else {
"failed to load topology file %s: %s\n",
}
tfp->tf_fileinfo =
"failed to load topology file %s: %s\n",
}
return (0);
}
int
{
return (-1);
}
"Failed to enumerate topology: %s\n",
return (-1);
}
return (0);
}
void
{
return;
}