4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * This plugin creates the PICL nodes and properties specified in
32 * It is used to create the FRU tree for a platform.
33 * The configuration file for FRU tree is called "piclfrutree.conf".
46 #include <sys/utsname.h>
47 #include <sys/systeminfo.h>
52 #include "picld_pluginutil.h"
54 #define EM_FAIL gettext("SUNW_piclfrutree PICL plugin module failed")
56 static void piclfrutree_register(void);
57 static void piclfrutree_init(void);
58 static void piclfrutree_fini(void);
60 #define FRUTREE_CONFFILE_NAME "piclfrutree.conf"
62 #pragma init(piclfrutree_register)
64 static picld_plugin_reg_t my_reg_info
= {
65 PICLD_PLUGIN_VERSION_1
,
66 PICLD_PLUGIN_NON_CRITICAL
,
73 piclfrutree_register(void)
75 (void) picld_plugin_register(&my_reg_info
);
79 * Search for the frutree config file from the platform specific
80 * directory to the common directory.
82 * The size of outfilename must be PATH_MAX
85 get_config_file(char *outfilename
)
89 (void) snprintf(pname
, PATH_MAX
, "%s/%s", PICLD_PLAT_PLUGIN_DIR
,
90 FRUTREE_CONFFILE_NAME
);
92 if (access(pname
, R_OK
) == 0) {
93 (void) strlcpy(outfilename
, pname
, PATH_MAX
);
97 (void) snprintf(pname
, PATH_MAX
, "%s/%s", PICLD_COMMON_PLUGIN_DIR
,
98 FRUTREE_CONFFILE_NAME
);
100 if (access(pname
, R_OK
) == 0) {
101 (void) strlcpy(outfilename
, pname
, PATH_MAX
);
109 piclfrutree_init(void)
111 char fullfilename
[PATH_MAX
];
112 picl_nodehdl_t rooth
;
114 if (get_config_file(fullfilename
) < 0)
117 if (ptree_get_root(&rooth
) != PICL_SUCCESS
)
120 if (picld_pluginutil_parse_config_file(rooth
, fullfilename
) !=
122 syslog(LOG_ERR
, EM_FAIL
);
126 piclfrutree_fini(void)