summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-04-11 10:20:34 +0300
committerToomas Soome <tsoome@me.com>2020-05-10 10:04:10 +0300
commitada2da53edc6b7d3afbdff4975c5c32c01a7c72d (patch)
tree5d3b2c83a9e653003049cb041fea4138fe7ea968
parent9ddb26a06d595789532ca2be60f2625a035e5baa (diff)
downloadillumos-joyent-ada2da53edc6b7d3afbdff4975c5c32c01a7c72d.tar.gz
12536 picl: NULL pointer errors
Reviewed by: Gary Mills <gary_mills@fastmail.fm> Approved by: Gordon Ross <gordon.w.ross@gmail.com>
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c16
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c76
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c16
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c561
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c113
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c46
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c20
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c40
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c10
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c96
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c12
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c60
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c40
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c54
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c38
-rw-r--r--usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c8
-rw-r--r--usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c14
-rw-r--r--usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c6
-rw-r--r--usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c110
-rw-r--r--usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h2
20 files changed, 663 insertions, 675 deletions
diff --git a/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c b/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c
index bc565320be..286567a046 100644
--- a/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c
+++ b/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* PICL plug-in that creates the FRU Hierarchy for the
* SUNW,Sun-Fire-480R (Cherrystone) platform
@@ -267,8 +265,8 @@ picl_frutree_fini(void)
*
* It processes the following events:
*
- * PICLEVENT_SYSEVENT_DEVICE_ADDED
- * PICLEVENT_SYSEVENT_DEVICE_REMOVED
+ * PICLEVENT_SYSEVENT_DEVICE_ADDED
+ * PICLEVENT_SYSEVENT_DEVICE_REMOVED
*/
/* ARGSUSED */
static void
@@ -1024,10 +1022,10 @@ frudr_completion_handler(char *ename, void *earg, size_t size)
* now frudata has been notified that the node is to be
* removed, we can actually remove it
*/
- fruh = NULL;
+ fruh = 0;
(void) nvlist_lookup_uint64(earg,
PICLEVENTARG_FRUHANDLE, &fruh);
- if (fruh != NULL) {
+ if (fruh != 0) {
(void) remove_picl_node(fruh);
}
}
@@ -1048,7 +1046,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh)
ev_name = strdup(ename);
if (ev_name == NULL)
return;
- if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) {
+ if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) {
free(ev_name);
return;
}
@@ -1111,7 +1109,7 @@ add_power_supply(int slotnum)
return (err);
/* Post picl-fru-added event */
- post_frudr_event(PICL_FRU_ADDED, NULL, powermodh);
+ post_frudr_event(PICL_FRU_ADDED, 0, powermodh);
}
}
return (PICL_SUCCESS);
@@ -1141,7 +1139,7 @@ remove_power_supply(int slotnum)
}
(void) ptree_destroy_node(powermodh);
/* Post picl-fru-removed event */
- post_frudr_event(PICL_FRU_REMOVED, NULL, powermodh);
+ post_frudr_event(PICL_FRU_REMOVED, 0, powermodh);
}
return (PICL_SUCCESS);
}
diff --git a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c
index 0d4578e9eb..5b3cbf2bdd 100644
--- a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c
+++ b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file contains code for setting up environmental related nodes
* and properties in the PICL tree.
@@ -83,23 +81,23 @@ typedef struct {
*/
static sensor_node_t sensor_nodes[] = {
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_CPU0,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_CPU1,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_MB,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_ADT7462,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_LM95221,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_FIRE,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_LSI1064,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_FRONT_PANEL,
- NULL, NULL, NULL, NULL},
+ NULL, 0, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_PSU,
- NULL, NULL, NULL, NULL}
+ NULL, 0, 0, 0}
};
#define N_SENSOR_NODES (sizeof (sensor_nodes)/sizeof (sensor_nodes[0]))
@@ -109,7 +107,7 @@ static sensor_node_t sensor_nodes[] = {
typedef struct {
char *parent_path; /* parent node path */
char *fan_name; /* fan name */
- env_fan_t *fanp; /* fan information */
+ env_fan_t *fanp; /* fan information */
char *speed_unit; /* speed unit string */
picl_nodehdl_t nodeh; /* "fan" node handle */
picl_prophdl_t proph; /* "Speed" property handle */
@@ -120,15 +118,15 @@ typedef struct {
*/
static fan_node_t fan_nodes[] = {
{"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN0,
- NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN1,
- NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN2,
- NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN3,
- NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN4,
- NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}
+ NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}
};
#define N_FAN_NODES (sizeof (fan_nodes)/sizeof (fan_nodes[0]))
@@ -138,7 +136,7 @@ static fan_node_t fan_nodes[] = {
typedef struct {
char *parent_path; /* parent node path */
char *disk_name; /* disk name */
- env_disk_t *diskp; /* disk information */
+ env_disk_t *diskp; /* disk information */
picl_nodehdl_t nodeh; /* "disk" node handle */
picl_prophdl_t proph; /* "Temperature" property handle */
} disk_node_t;
@@ -147,10 +145,10 @@ typedef struct {
* Disk node array
*/
static disk_node_t disk_nodes[] = {
- {DISK0_NODE_PATH, ENV_DISK0, NULL, NULL, NULL},
- {DISK1_NODE_PATH, ENV_DISK1, NULL, NULL, NULL},
- {DISK2_NODE_PATH, ENV_DISK2, NULL, NULL, NULL},
- {DISK3_NODE_PATH, ENV_DISK3, NULL, NULL, NULL}
+ {DISK0_NODE_PATH, ENV_DISK0, NULL, 0, 0},
+ {DISK1_NODE_PATH, ENV_DISK1, NULL, 0, 0},
+ {DISK2_NODE_PATH, ENV_DISK2, NULL, 0, 0},
+ {DISK3_NODE_PATH, ENV_DISK3, NULL, 0, 0}
};
#define N_DISK_NODES (sizeof (disk_nodes)/sizeof (disk_nodes[0]))
@@ -168,7 +166,7 @@ static void delete_fan_nodes_and_props(void);
static int
get_current_temp(ptree_rarg_t *parg, void *buf)
{
- tempr_t temp;
+ tempr_t temp;
picl_prophdl_t proph;
sensor_node_t *snodep;
int i;
@@ -197,7 +195,7 @@ get_current_temp(ptree_rarg_t *parg, void *buf)
static int
get_disk_temp(ptree_rarg_t *parg, void *buf)
{
- tempr_t temp;
+ tempr_t temp;
picl_prophdl_t proph;
disk_node_t *dnodep;
int i;
@@ -492,12 +490,12 @@ delete_sensor_nodes_and_props(void)
for (i = 0; i < N_SENSOR_NODES; i++) {
snodep = &sensor_nodes[i];
- if (snodep->nodeh != NULL) {
+ if (snodep->nodeh != 0) {
/* delete node and all properties under it */
(void) ptree_delete_node(snodep->nodeh);
(void) ptree_destroy_node(snodep->nodeh);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
}
}
}
@@ -634,11 +632,11 @@ delete_disk_nodes_and_props(void)
for (i = 0; i < N_DISK_NODES; i++) {
dnodep = &disk_nodes[i];
- if (dnodep->nodeh != NULL) {
+ if (dnodep->nodeh != 0) {
(void) ptree_delete_node(dnodep->nodeh);
(void) ptree_destroy_node(dnodep->nodeh);
- dnodep->nodeh = NULL;
- dnodep->proph = NULL;
+ dnodep->nodeh = 0;
+ dnodep->proph = 0;
}
}
}
@@ -772,10 +770,10 @@ delete_fan_nodes_and_props(void)
for (i = 0; i < N_FAN_NODES; i++) {
fnodep = &fan_nodes[i];
- if (fnodep->nodeh != NULL) {
+ if (fnodep->nodeh != 0) {
(void) ptree_delete_node(fnodep->nodeh);
(void) ptree_destroy_node(fnodep->nodeh);
- fnodep->nodeh = NULL;
+ fnodep->nodeh = 0;
}
}
}
@@ -947,9 +945,9 @@ env_picl_setup(void)
for (i = 0; i < N_SENSOR_NODES; i++) {
snodep = &sensor_nodes[i];
snodep->sensorp = sensor_lookup(snodep->sensor_name);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
- snodep->target_proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
+ snodep->target_proph = 0;
}
/*
@@ -958,8 +956,8 @@ env_picl_setup(void)
for (i = 0; i < N_FAN_NODES; i++) {
fnodep = &fan_nodes[i];
fnodep->fanp = fan_lookup(fnodep->fan_name);
- fnodep->nodeh = NULL;
- fnodep->proph = NULL;
+ fnodep->nodeh = 0;
+ fnodep->proph = 0;
}
/*
@@ -968,8 +966,8 @@ env_picl_setup(void)
for (i = 0; i < N_DISK_NODES; i++) {
dnodep = &disk_nodes[i];
dnodep->diskp = disk_lookup(dnodep->disk_name);
- dnodep->nodeh = NULL;
- dnodep->proph = NULL;
+ dnodep->nodeh = 0;
+ dnodep->proph = 0;
}
/*
diff --git a/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c b/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c
index d9a2264f39..0c2849b678 100644
--- a/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c
+++ b/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* PICL plug-in that creates the FRU Hierarchy for the
* SUNW,Sun-Fire-880 (Daktari) platform
@@ -328,8 +326,8 @@ picl_frutree_fini(void)
*
* It processes the following events:
*
- * PICLEVENT_SYSEVENT_DEVICE_ADDED
- * PICLEVENT_SYSEVENT_DEVICE_REMOVED
+ * PICLEVENT_SYSEVENT_DEVICE_ADDED
+ * PICLEVENT_SYSEVENT_DEVICE_REMOVED
*/
/* ARGSUSED */
static void
@@ -1149,10 +1147,10 @@ frudr_completion_handler(char *ename, void *earg, size_t size)
* now frudata has been notified that the node is to be
* removed, we can actually remove it
*/
- fruh = NULL;
+ fruh = 0;
(void) nvlist_lookup_uint64(earg,
PICLEVENTARG_FRUHANDLE, &fruh);
- if (fruh != NULL) {
+ if (fruh != 0) {
(void) remove_picl_node(fruh);
}
}
@@ -1173,7 +1171,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh)
ev_name = strdup(ename);
if (ev_name == NULL)
return;
- if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) {
+ if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) {
free(ev_name);
return;
}
@@ -1236,7 +1234,7 @@ add_power_supply(int slotnum)
return (err);
/* Post picl-fru-added event */
- post_frudr_event(PICL_FRU_ADDED, NULL, powermodh);
+ post_frudr_event(PICL_FRU_ADDED, 0, powermodh);
}
}
return (PICL_SUCCESS);
@@ -1268,7 +1266,7 @@ remove_power_supply(int slotnum)
}
/* Post picl-fru-removed event */
- post_frudr_event(PICL_FRU_REMOVED, NULL, powermodh);
+ post_frudr_event(PICL_FRU_REMOVED, 0, powermodh);
}
return (PICL_SUCCESS);
diff --git a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c
index 8bcbef376e..144c9bb3f7 100644
--- a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c
+++ b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file contains the environmental PICL plug-in module.
*/
@@ -319,21 +317,21 @@ static int set_cpu_tach(ptree_warg_t *parg, const void *buf);
static int get_sys_tach(ptree_rarg_t *parg, void *buf);
static int set_sys_tach(ptree_warg_t *parg, const void *buf);
-static int shutdown_override = 0;
-static int sensor_poll_interval = SENSORPOLL_INTERVAL;
+static int shutdown_override = 0;
+static int sensor_poll_interval = SENSORPOLL_INTERVAL;
static int warning_interval = WARNING_INTERVAL;
static int disk_warning_interval = DISK_WARNING_INTERVAL;
static int disk_warning_duration = DISK_WARNING_DURATION;
-static int shutdown_interval = SHUTDOWN_INTERVAL;
-static int disk_shutdown_interval = DISK_SHUTDOWN_INTERVAL;
+static int shutdown_interval = SHUTDOWN_INTERVAL;
+static int disk_shutdown_interval = DISK_SHUTDOWN_INTERVAL;
static int ovtemp_monitor = 1; /* enabled */
static int pm_monitor = 1; /* enabled */
static int mon_fanstat = 1; /* enabled */
-static int cpu_mode;
-static int sys_mode;
-static int cpu_tach;
-static int sys_tach;
+static int cpu_mode;
+static int sys_mode;
+static int cpu_tach;
+static int sys_tach;
static char shutdown_cmd[] = SHUTDOWN_CMD;
env_tuneable_t tuneables[] = {
@@ -1034,26 +1032,27 @@ envd_setup_fans(void)
/* make sure cpu0/1 present for validating cpu fans */
if (fanp->id == CPU0_FAN_ID) {
if (ptree_get_node_by_path(CPU0_PATH, &tnodeh) !=
- PICL_SUCCESS) {
- fanp->present = B_FALSE;
- continue;
+ PICL_SUCCESS) {
+ fanp->present = B_FALSE;
+ continue;
}
}
if (fanp->id == CPU1_FAN_ID) {
if (ptree_get_node_by_path(CPU1_PATH, &tnodeh) !=
- PICL_SUCCESS) {
- fanp->present = B_FALSE;
- continue;
+ PICL_SUCCESS) {
+ fanp->present = B_FALSE;
+ continue;
}
}
if (fanp->id == DIMM_FAN_ID) {
if (ptree_get_node_by_path(DIMM_FAN_CONTROLLER_PATH,
- &tnodeh) != PICL_SUCCESS) {
- if (env_debug)
- envd_log(LOG_ERR,
- "dimm Fan not found in the system.\n");
- fanp->present = B_FALSE;
- continue;
+ &tnodeh) != PICL_SUCCESS) {
+ if (env_debug)
+ envd_log(LOG_ERR,
+ "dimm Fan not found in the "
+ "system.\n");
+ fanp->present = B_FALSE;
+ continue;
}
}
(void) strcpy(path, "/devices");
@@ -1074,11 +1073,12 @@ envd_setup_fans(void)
*/
i2c_reg.reg_num = PIC16F819_COMMAND_REGISTER;
i2c_reg.reg_value = (PIC16F819_SW_AWARE_MODE |
- PIC16F819_FAN_FAULT_CLEAR);
+ PIC16F819_FAN_FAULT_CLEAR);
if (ioctl(fd, I2C_SET_REG, &i2c_reg) == -1) {
if (env_debug)
envd_log(LOG_ERR,
- "Error in writing to COMMAND reg. of DIMM FAN controller\n");
+ "Error in writing to COMMAND reg. "
+ "of DIMM FAN controller\n");
}
} else {
/* Get speed range value */
@@ -1114,39 +1114,39 @@ envd_setup_disks(void)
*/
if (ptree_get_node_by_path(SCSI_CONTROLLER_NODE_PATH,
- &tnodeh) != PICL_SUCCESS) {
+ &tnodeh) != PICL_SUCCESS) {
if (env_debug)
envd_log(LOG_ERR,
- "On-Board SCSI controller not found in the system.\n");
+ "On-Board SCSI controller not found "
+ "in the system.\n");
monitor_disk_temp = 0;
return (-1);
}
if ((ret = ptree_get_propval_by_name(tnodeh, VENDOR_ID,
- &vendor_id,
- sizeof (vendor_id))) != 0) {
+ &vendor_id, sizeof (vendor_id))) != 0) {
if (env_debug)
envd_log(LOG_ERR,
-"Error in getting vendor-id for SCSI controller. ret = %d errno = 0x%d\n",
- ret, errno);
+ "Error in getting vendor-id for SCSI controller. "
+ "ret = %d errno = 0x%d\n",
+ ret, errno);
monitor_disk_temp = 0;
return (-1);
}
if ((ret = ptree_get_propval_by_name(tnodeh, DEVICE_ID,
- &device_id,
- sizeof (device_id))) != 0) {
+ &device_id, sizeof (device_id))) != 0) {
if (env_debug)
envd_log(LOG_ERR,
-"Error in getting device-id for SCSI controller. ret = %d errno = 0x%d\n",
- ret, errno);
+ "Error in getting device-id for SCSI controller. "
+ "ret = %d errno = 0x%d\n", ret, errno);
monitor_disk_temp = 0;
return (-1);
}
if (env_debug)
envd_log(LOG_ERR, "vendor-id=0x%x device-id=0x%x\n",
- vendor_id, device_id);
+ vendor_id, device_id);
if ((vendor_id != LSI1030_VENDOR_ID) ||
- (device_id != LSI1030_DEVICE_ID)) {
+ (device_id != LSI1030_DEVICE_ID)) {
monitor_disk_temp = 0;
return (-1);
}
@@ -1157,20 +1157,20 @@ envd_setup_disks(void)
for (i = 0; (diskp = envd_disks[i]) != NULL; i++) {
if (ptree_get_node_by_path(diskp->nodepath,
- &tnodeh) != PICL_SUCCESS) {
+ &tnodeh) != PICL_SUCCESS) {
diskp->present = B_FALSE;
if (env_debug)
envd_log(LOG_ERR,
- "DISK %d not found in the system.\n",
- diskp->id);
+ "DISK %d not found in the system.\n",
+ diskp->id);
continue;
}
diskp->fd = open(diskp->devfs_path, O_RDONLY);
if (diskp->fd == -1) {
diskp->present = B_FALSE;
envd_log(LOG_ERR,
- "Error in opening %s errno = 0x%x\n",
- diskp->devfs_path, errno);
+ "Error in opening %s errno = 0x%x\n",
+ diskp->devfs_path, errno);
continue;
}
diskp->present = B_TRUE;
@@ -1179,23 +1179,23 @@ envd_setup_disks(void)
* Find out if the Temperature page is supported by the disk.
*/
ret = scsi_log_sense(diskp->fd, SUPPORTED_LPAGES,
- log_page, sizeof (log_page));
+ log_page, sizeof (log_page));
if (ret != 0) {
continue;
}
page_len = ((log_page[2] << 8) & 0xFF00) | log_page[3];
for (page_index = LOGPAGEHDRSIZE;
- page_index < page_len + LOGPAGEHDRSIZE; page_index++) {
+ page_index < page_len + LOGPAGEHDRSIZE; page_index++) {
switch (log_page[page_index]) {
- case TEMPERATURE_PAGE:
- diskp->tpage_supported = B_TRUE;
+ case TEMPERATURE_PAGE:
+ diskp->tpage_supported = B_TRUE;
if (env_debug)
envd_log(LOG_ERR,
- "tpage supported for %s\n",
- diskp->nodepath);
- default:
- break;
+ "tpage supported for %s\n",
+ diskp->nodepath);
+ default:
+ break;
}
}
diskp->warning_tstamp = 0;
@@ -1236,14 +1236,14 @@ envd_setup_sensors(void)
/* make sure cpu0/1 sensors are present */
if (sensorp->id == CPU0_SENSOR_ID) {
if (ptree_get_node_by_path(CPU0_PATH, &tnodeh) !=
- PICL_SUCCESS) {
+ PICL_SUCCESS) {
sensorp->present = B_FALSE;
continue;
}
}
if (sensorp->id == CPU1_SENSOR_ID) {
if (ptree_get_node_by_path(CPU1_PATH, &tnodeh) !=
- PICL_SUCCESS) {
+ PICL_SUCCESS) {
sensorp->present = B_FALSE;
continue;
}
@@ -1267,7 +1267,7 @@ envd_setup_sensors(void)
*/
if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE,
- &tmin) != -1) {
+ &tmin) != -1) {
sensorp->tmin = TMIN(tmin);
} else {
sensorp->tmin = -1;
@@ -1383,7 +1383,7 @@ updateadm_ranges(char *name, uchar_t cur_lpstate)
/* Read ADM default value only for the first time */
if (tsave[tindex] == 0) {
if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE,
- &tsave[tindex]) == -1) {
+ &tsave[tindex]) == -1) {
if (env_debug)
envd_log(LOG_ERR,
"read tminrange ioctl failed");
@@ -1408,27 +1408,27 @@ updateadm_ranges(char *name, uchar_t cur_lpstate)
* ADM 1031 Tmin/Trange register need to be reprogrammed.
*/
tdata = ((fanctl->fan_ctl_pairs[cur_lpstate].tMin / TMIN_UNITS)
- << TMIN_SHIFT);
+ << TMIN_SHIFT);
/* Need to pack tRange in ADM bits 2:0 */
switch (fanctl->fan_ctl_pairs[cur_lpstate].tRange) {
- case 5:
- break;
+ case 5:
+ break;
- case 10:
- tdata |= 1;
- break;
+ case 10:
+ tdata |= 1;
+ break;
- case 20:
- tdata |= 2;
- break;
+ case 20:
+ tdata |= 2;
+ break;
- case 40:
- tdata |= 3;
- break;
+ case 40:
+ tdata |= 3;
+ break;
- case 80:
- tdata |= 4;
- break;
+ case 80:
+ tdata |= 4;
+ break;
}
} else
tdata = tsave[tindex];
@@ -1480,13 +1480,13 @@ pmthr(void *args)
do {
if (env_debug) {
envd_log(LOG_INFO,
- "pmstate event:0x%x flags:%x"
- "comp:%d oldval:%d newval:%d path:%s\n",
- pmstate.event, pmstate.flags,
- pmstate.component,
- pmstate.old_level,
- pmstate.new_level,
- pmstate.physpath);
+ "pmstate event:0x%x flags:%x"
+ "comp:%d oldval:%d newval:%d path:%s\n",
+ pmstate.event, pmstate.flags,
+ pmstate.component,
+ pmstate.old_level,
+ pmstate.new_level,
+ pmstate.physpath);
}
cur_lpstate =
(pmstate.flags & PSC_ALL_LOWEST) ? 1 : 0;
@@ -1518,11 +1518,11 @@ pmthr(void *args)
*
* FAN ON
* Tmin
- * -------------------------------------------
+ * -------------------------------------------
*
- * FAN ON/OFF
+ * FAN ON/OFF
*
- * --------------------------------------------
+ * --------------------------------------------
* Tmin - Hysterisis
* FAN OFF
*
@@ -1674,13 +1674,13 @@ handle_overtemp_interrupt(int hwm_id)
if (env_debug)
envd_log(LOG_ERR,
- "sensor name %s, cur temp %d, "
- "HW %d LW %d SD %d LS %d\n",
- sensorp->name, temp,
- sensorp->es_ptr->high_warning,
- (int)sensorp->es_ptr->low_warning,
- sensorp->es_ptr->high_shutdown,
- (int)sensorp->es_ptr->low_shutdown);
+ "sensor name %s, cur temp %d, "
+ "HW %d LW %d SD %d LS %d\n",
+ sensorp->name, temp,
+ sensorp->es_ptr->high_warning,
+ (int)sensorp->es_ptr->low_warning,
+ sensorp->es_ptr->high_shutdown,
+ (int)sensorp->es_ptr->low_shutdown);
if (TEMP_IN_WARNING_RANGE(sensorp->cur_temp, sensorp)) {
/*
@@ -1759,7 +1759,7 @@ wait_till_timeout:
*/
(void) pthread_mutex_lock(&env_monitor_mutex);
ret = pthread_cond_reltimedwait_np(&env_monitor_cv,
- &env_monitor_mutex, &to);
+ &env_monitor_mutex, &to);
to.tv_sec = SENSORPOLL_INTERVAL;
to.tv_nsec = 0;
if (ret != ETIMEDOUT) {
@@ -1798,7 +1798,7 @@ ovtemp_thr(void *args)
}
if (env_debug)
envd_log(LOG_ERR, "ovtemp thread for %s running...\n",
- hwm_devs[hwm_id]);
+ hwm_devs[hwm_id]);
for (;;) {
/*
@@ -1816,7 +1816,7 @@ ovtemp_thr(void *args)
*/
(void) pthread_mutex_lock(&env_monitor_mutex);
ret = pthread_cond_reltimedwait_np(&env_monitor_cv,
- &env_monitor_mutex, &to);
+ &env_monitor_mutex, &to);
to.tv_sec = INTERRUPTPOLL_INTERVAL;
to.tv_nsec = 0;
if (ret != ETIMEDOUT) {
@@ -1841,27 +1841,27 @@ ovtemp_thr(void *args)
if (err == -1) {
if (env_debug)
envd_log(LOG_ERR,
- "OverTemp: Status Error");
+ "OverTemp: Status Error");
continue;
}
if (env_debug)
envd_log(LOG_ERR, "INTR %s, Stat1 %x, Stat2 %x",
- hwm_devs[hwm_id], stat[0], stat[1]);
+ hwm_devs[hwm_id], stat[0], stat[1]);
if (stat[0] & FANFAULT) {
fanp = fan_lookup(hwm_fans[hwm_id][HWM_FAN1]);
if (fanp && fanp->present)
envd_log(LOG_ERR, ENV_FAN_FAULT,
- hwm_devs[hwm_id],
- hwm_fans[hwm_id][HWM_FAN1]);
+ hwm_devs[hwm_id],
+ hwm_fans[hwm_id][HWM_FAN1]);
}
if (stat[1] & FANFAULT) {
fanp = fan_lookup(hwm_fans[hwm_id][HWM_FAN2]);
if (fanp && fanp->present)
envd_log(LOG_ERR, ENV_FAN_FAULT,
- hwm_devs[hwm_id],
- hwm_fans[hwm_id][HWM_FAN2]);
+ hwm_devs[hwm_id],
+ hwm_fans[hwm_id][HWM_FAN2]);
}
/*
* Check respective Remote/Local High, Low before start
@@ -1886,10 +1886,6 @@ dimm_fan_thr(void *args)
pthread_mutex_t env_monitor_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t env_monitor_cv = PTHREAD_COND_INITIALIZER;
-#ifdef __lint
- args = args;
-#endif
-
for (;;) {
/*
* Sleep for specified seconds before issuing IOCTL
@@ -1897,7 +1893,7 @@ dimm_fan_thr(void *args)
*/
(void) pthread_mutex_lock(&env_monitor_mutex);
ret = pthread_cond_reltimedwait_np(&env_monitor_cv,
- &env_monitor_mutex, &to);
+ &env_monitor_mutex, &to);
to.tv_sec = INTERRUPTPOLL_INTERVAL;
to.tv_nsec = 0;
if (ret != ETIMEDOUT) {
@@ -1913,10 +1909,11 @@ dimm_fan_thr(void *args)
i2c_reg.reg_num = PIC16F819_COMMAND_REGISTER;
i2c_reg.reg_value = PIC16F819_SW_AWARE_MODE;
if (ioctl(envd_dimm_fan.fd,
- I2C_SET_REG, &i2c_reg) == -1) {
+ I2C_SET_REG, &i2c_reg) == -1) {
if (env_debug)
envd_log(LOG_ERR,
- "Error in writing to COMMAND reg. of DIMM FAN controller\n");
+ "Error in writing to COMMAND reg. "
+ "of DIMM FAN controller\n");
}
/*
* We initiate shutdown if fan status indicates
@@ -1930,19 +1927,19 @@ dimm_fan_thr(void *args)
*/
envd_dimm_fan.present = B_FALSE;
(void) snprintf(msgbuf, sizeof (msgbuf),
- ENV_DIMM_FAN_FAILURE_SHUTDOWN_MSG,
- ENV_DIMM_FAN,
- dimm_fan_rpm_string, dimm_fan_status_string,
- dimm_fan_command_string,
- dimm_fan_debug_string);
+ ENV_DIMM_FAN_FAILURE_SHUTDOWN_MSG,
+ ENV_DIMM_FAN,
+ dimm_fan_rpm_string, dimm_fan_status_string,
+ dimm_fan_command_string,
+ dimm_fan_debug_string);
envd_log(LOG_ALERT, msgbuf);
if (system_shutdown_started == B_FALSE) {
system_shutdown_started = B_TRUE;
(void) snprintf(syscmd, sizeof (syscmd),
- "%s \"%s\"",
- SHUTDOWN_CMD,
- msgbuf);
+ "%s \"%s\"",
+ SHUTDOWN_CMD,
+ msgbuf);
envd_log(LOG_ALERT, syscmd);
(void) system(syscmd);
}
@@ -1981,13 +1978,15 @@ scsi_log_sense(int fd, uchar_t page_code, uchar_t *pagebuf, uint16_t pagelen)
if (ret_val == 0 && ucmd_buf.uscsi_status == 0) {
if (env_debug)
envd_log(LOG_ERR,
- "log sense command for page_code 0x%x succeeded\n", page_code);
+ "log sense command for page_code 0x%x succeeded\n",
+ page_code);
return (ret_val);
}
if (env_debug)
envd_log(LOG_ERR,
- "log sense command failed.ret_val = 0x%x status = 0x%x errno = 0x%x\n",
- ret_val, ucmd_buf.uscsi_status, errno);
+ "log sense command failed.ret_val = 0x%x status = 0x%x "
+ "errno = 0x%x\n",
+ ret_val, ucmd_buf.uscsi_status, errno);
return (1);
}
@@ -1998,8 +1997,8 @@ get_disk_temp(env_disk_t *diskp)
uchar_t tpage[256];
ret = scsi_log_sense(diskp->fd,
- TEMPERATURE_PAGE,
- tpage, sizeof (tpage));
+ TEMPERATURE_PAGE,
+ tpage, sizeof (tpage));
if (ret != 0) {
diskp->current_temp = DISK_INVALID_TEMP;
diskp->ref_temp = DISK_INVALID_TEMP;
@@ -2011,7 +2010,7 @@ get_disk_temp(env_disk_t *diskp)
* Temperature value of 255(0xFF) is considered INVALID.
*/
if ((tpage[7] == 0x02) && (tpage[4] == 0x00) &&
- (tpage[5] == 0x00)) {
+ (tpage[5] == 0x00)) {
if (tpage[9] == 0xFF) {
diskp->current_temp = DISK_INVALID_TEMP;
return (-1);
@@ -2026,7 +2025,7 @@ get_disk_temp(env_disk_t *diskp)
* Temperature value of 255(0xFF) is considered INVALID.
*/
if ((tpage[13] == 0x02) && (tpage[10] == 0x00) &&
- (tpage[11] == 0x01)) {
+ (tpage[11] == 0x01)) {
if (tpage[15] == 0xFF) {
diskp->ref_temp = DISK_INVALID_TEMP;
} else {
@@ -2055,148 +2054,163 @@ disk_temp_thr(void *args)
disk_pm_fd = open(PM_DEVICE, O_RDWR);
if (disk_pm_fd == -1) {
envd_log(LOG_ERR,
- DISK_TEMP_THREAD_EXITING,
- errno, strerror(errno));
+ DISK_TEMP_THREAD_EXITING,
+ errno, strerror(errno));
return (NULL);
}
for (;;) {
- /*
- * Sleep for specified seconds before issuing IOCTL
- * again.
- */
- (void) pthread_mutex_lock(&env_monitor_mutex);
- ret = pthread_cond_reltimedwait_np(&env_monitor_cv,
- &env_monitor_mutex, &to);
- to.tv_sec = disk_scan_interval;
- to.tv_nsec = 0;
- if (ret != ETIMEDOUT) {
- (void) pthread_mutex_unlock(&env_monitor_mutex);
- continue;
- }
- (void) pthread_mutex_unlock(&env_monitor_mutex);
- for (i = 0; (diskp = envd_disks[i]) != NULL; i++) {
- if (diskp->present == B_FALSE)
- continue;
- if (diskp->tpage_supported == B_FALSE)
- continue;
/*
- * If the disk temperature is above the warning threshold
- * continue monitoring until the temperature drops below
- * warning threshold.
- * if the temperature is in the NORMAL range monitor only
- * when the disk is BUSY.
- * We do not want to read the disk temperature if the disk is
- * is idling. The reason for this is disk will never get into
- * lowest power mode if we scan the disk temperature
- * peridoically. To avoid this situation we first determine
- * the idle_time of the disk. If the disk has been IDLE since
- * we scanned the temperature last time we will not read the
- * temperature.
+ * Sleep for specified seconds before issuing IOCTL
+ * again.
*/
- if (!DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp, diskp)) {
- pmstate.physpath = diskp->physpath;
- pmstate.size = strlen(diskp->physpath);
- pmstate.component = 0;
- if ((idle_time =
- ioctl(disk_pm_fd,
- PM_GET_TIME_IDLE, &pmstate)) == -1) {
- if (errno != EINTR) {
- if (env_debug)
+ (void) pthread_mutex_lock(&env_monitor_mutex);
+ ret = pthread_cond_reltimedwait_np(&env_monitor_cv,
+ &env_monitor_mutex, &to);
+ to.tv_sec = disk_scan_interval;
+ to.tv_nsec = 0;
+ if (ret != ETIMEDOUT) {
+ (void) pthread_mutex_unlock(&env_monitor_mutex);
+ continue;
+ }
+ (void) pthread_mutex_unlock(&env_monitor_mutex);
+ for (i = 0; (diskp = envd_disks[i]) != NULL; i++) {
+ if (diskp->present == B_FALSE)
+ continue;
+ if (diskp->tpage_supported == B_FALSE)
+ continue;
+ /*
+ * If the disk temperature is above the warning
+ * threshold continue monitoring until the temperature
+ * drops below warning threshold.
+ * If the temperature is in the NORMAL range monitor
+ * only when the disk is BUSY.
+ * We do not want to read the disk temperature if the
+ * disk is is idling. The reason for this is disk will
+ * never get into lowest power mode if we scan the disk
+ * temperature peridoically.
+ * To avoid this situation we first determine
+ * the idle_time of the disk. If the disk has been
+ * IDLE since we scanned the temperature last time
+ * we will not read the temperature.
+ */
+ if (!DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp,
+ diskp)) {
+ pmstate.physpath = diskp->physpath;
+ pmstate.size = strlen(diskp->physpath);
+ pmstate.component = 0;
+ if ((idle_time =
+ ioctl(disk_pm_fd,
+ PM_GET_TIME_IDLE, &pmstate)) == -1) {
+ if (errno != EINTR) {
+ if (env_debug) {
+ envd_log(LOG_ERR,
+ "ioctl "
+ "PM_GET_TIME_IDLE "
+ "failed for DISK0."
+ " errno=0x%x\n",
+ errno);
+ }
+ continue;
+ }
+ continue;
+ }
+ if (idle_time >= (disk_scan_interval/2)) {
+ if (env_debug) {
envd_log(LOG_ERR,
- "ioctl PM_GET_TIME_IDLE failed for DISK0. errno=0x%x\n",
- errno);
+ "%s idle time = %d\n",
+ diskp->name, idle_time);
+ }
continue;
}
- continue;
}
- if (idle_time >= (disk_scan_interval/2)) {
- if (env_debug) {
- envd_log(LOG_ERR,
- "%s idle time = %d\n",
- diskp->name, idle_time);
- }
- continue;
+ ret = get_disk_temp(diskp);
+ if (ret != 0)
+ continue;
+ if (env_debug) {
+ envd_log(LOG_ERR,
+ "%s temp = %d ref. temp = %d\n",
+ diskp->name, diskp->current_temp,
+ diskp->ref_temp);
}
- }
- ret = get_disk_temp(diskp);
- if (ret != 0)
- continue;
- if (env_debug) {
- envd_log(LOG_ERR,
- "%s temp = %d ref. temp = %d\n",
- diskp->name, diskp->current_temp, diskp->ref_temp);
- }
- /*
- * If this disk already triggered system shutdown, don't
- * log any more shutdown/warning messages for it.
- */
- if (diskp->shutdown_initiated)
- continue;
-
- /*
- * Check for the temperature in warning and shutdown range
- * and take appropriate action.
- */
- if (DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp, diskp)) {
/*
- * Check if the temperature has been in warning
- * range during last disk_warning_duration interval.
- * If so, the temperature is truly in warning
- * range and we need to log a warning message,
- * but no more than once every disk_warning_interval
- * seconds.
+ * If this disk already triggered system shutdown, don't
+ * log any more shutdown/warning messages for it.
*/
- time_t wtstamp = diskp->warning_tstamp;
-
- ct = (time_t)(gethrtime() / NANOSEC);
- if (diskp->warning_start == 0)
- diskp->warning_start = ct;
- if (((ct - diskp->warning_start) >=
- disk_warning_duration) && (wtstamp == 0 ||
- (ct - wtstamp) >= disk_warning_interval)) {
- envd_log(LOG_CRIT, ENV_WARNING_MSG,
- diskp->name, diskp->current_temp,
- diskp->low_warning,
- diskp->high_warning);
- diskp->warning_tstamp = ct;
- }
- } else if (diskp->warning_start != 0)
- diskp->warning_start = 0;
-
- if (!shutdown_override &&
- DISK_TEMP_IN_SHUTDOWN_RANGE(diskp->current_temp, diskp)) {
- ct = (time_t)(gethrtime() / NANOSEC);
- if (diskp->shutdown_tstamp == 0)
- diskp->shutdown_tstamp = ct;
+ if (diskp->shutdown_initiated)
+ continue;
/*
- * Shutdown the system if the temperature remains
- * in the shutdown range for over disk_shutdown_interval
- * seconds.
+ * Check for the temperature in warning and shutdown
+ * range and take appropriate action.
*/
- if ((ct - diskp->shutdown_tstamp) >=
- disk_shutdown_interval) {
- /* log error */
- diskp->shutdown_initiated = B_TRUE;
- (void) snprintf(msgbuf, sizeof (msgbuf),
- ENV_SHUTDOWN_MSG, diskp->name,
- diskp->current_temp, diskp->low_shutdown,
- diskp->high_shutdown);
- envd_log(LOG_ALERT, msgbuf);
-
- /* shutdown the system (only once) */
- if (system_shutdown_started == B_FALSE) {
- (void) snprintf(syscmd, sizeof (syscmd),
- "%s \"%s\"", shutdown_cmd, msgbuf);
- envd_log(LOG_ALERT, syscmd);
- system_shutdown_started = B_TRUE;
- (void) system(syscmd);
+ if (DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp,
+ diskp)) {
+ /*
+ * Check if the temperature has been in warning
+ * range during last disk_warning_duration
+ * interval.
+ * If so, the temperature is truly in warning
+ * range and we need to log a warning message,
+ * but no more than once every
+ * disk_warning_interval seconds.
+ */
+ time_t wtstamp = diskp->warning_tstamp;
+
+ ct = (time_t)(gethrtime() / NANOSEC);
+ if (diskp->warning_start == 0)
+ diskp->warning_start = ct;
+ if (((ct - diskp->warning_start) >=
+ disk_warning_duration) && (wtstamp == 0 ||
+ (ct - wtstamp) >= disk_warning_interval)) {
+ envd_log(LOG_CRIT, ENV_WARNING_MSG,
+ diskp->name, diskp->current_temp,
+ diskp->low_warning,
+ diskp->high_warning);
+ diskp->warning_tstamp = ct;
}
- }
- } else if (diskp->shutdown_tstamp != 0)
- diskp->shutdown_tstamp = 0;
+ } else if (diskp->warning_start != 0)
+ diskp->warning_start = 0;
+
+ if (!shutdown_override &&
+ DISK_TEMP_IN_SHUTDOWN_RANGE(diskp->current_temp,
+ diskp)) {
+ ct = (time_t)(gethrtime() / NANOSEC);
+ if (diskp->shutdown_tstamp == 0)
+ diskp->shutdown_tstamp = ct;
+
+ /*
+ * Shutdown the system if the temperature
+ * remains in the shutdown range for over
+ * disk_shutdown_interval seconds.
+ */
+ if ((ct - diskp->shutdown_tstamp) >=
+ disk_shutdown_interval) {
+ /* log error */
+ diskp->shutdown_initiated = B_TRUE;
+ (void) snprintf(msgbuf, sizeof (msgbuf),
+ ENV_SHUTDOWN_MSG, diskp->name,
+ diskp->current_temp,
+ diskp->low_shutdown,
+ diskp->high_shutdown);
+ envd_log(LOG_ALERT, msgbuf);
+
+ /* shutdown the system (only once) */
+ if (system_shutdown_started ==
+ B_FALSE) {
+ (void) snprintf(syscmd,
+ sizeof (syscmd),
+ "%s \"%s\"", shutdown_cmd,
+ msgbuf);
+ envd_log(LOG_ALERT, syscmd);
+ system_shutdown_started =
+ B_TRUE;
+ (void) system(syscmd);
+ }
+ }
+ } else if (diskp->shutdown_tstamp != 0)
+ diskp->shutdown_tstamp = 0;
- }
+ }
} /* end of forever loop */
}
@@ -2208,7 +2222,7 @@ disk_temp_thr(void *args)
static int
envd_setup(void)
{
- int ret;
+ int ret;
if (getenv("SUNW_piclenvd_debug") != NULL)
env_debug = 1;
@@ -2229,7 +2243,7 @@ envd_setup(void)
* at least one sensor.
*/
if (envd_setup_sensors() <= 0) {
- return (NULL);
+ return (0);
}
/*
@@ -2259,13 +2273,13 @@ envd_setup(void)
}
if (envd_dimm_fan.present) {
- if (dimm_fan_thr_created == B_FALSE) {
- if (pthread_create(&dimm_fan_thr_id, &thr_attr, dimm_fan_thr,
- NULL) != 0)
- envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED);
- else
- dimm_fan_thr_created = B_TRUE;
- }
+ if (dimm_fan_thr_created == B_FALSE) {
+ if (pthread_create(&dimm_fan_thr_id, &thr_attr,
+ dimm_fan_thr, NULL) != 0)
+ envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED);
+ else
+ dimm_fan_thr_created = B_TRUE;
+ }
}
/*
@@ -2279,13 +2293,13 @@ envd_setup(void)
pmthr_created = B_TRUE;
}
if (monitor_disk_temp) {
- if (disk_temp_thr_created == B_FALSE) {
- if (pthread_create(&disk_temp_thr_id, &thr_attr, disk_temp_thr,
- NULL) != 0)
- envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED);
- else
- disk_temp_thr_created = B_TRUE;
- }
+ if (disk_temp_thr_created == B_FALSE) {
+ if (pthread_create(&disk_temp_thr_id, &thr_attr,
+ disk_temp_thr, NULL) != 0)
+ envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED);
+ else
+ disk_temp_thr_created = B_TRUE;
+ }
}
return (0);
}
@@ -2830,18 +2844,19 @@ is_dimm_fan_failed(void)
if (retry_count != MAX_RETRIES_FOR_PIC16F819_REG_READ) {
if (env_debug)
envd_log(LOG_ERR,
- "%d retries attempted in reading STATUS register.\n",
+ "%d retries attempted in reading STATUS "
+ "register.\n",
(MAX_RETRIES_FOR_PIC16F819_REG_READ - retry_count));
}
if (retry_count == 0) {
(void) strncpy(dimm_fan_status_string, NOT_AVAILABLE,
- sizeof (dimm_fan_status_string));
+ sizeof (dimm_fan_status_string));
(void) strncpy(dimm_fan_command_string, NOT_AVAILABLE,
- sizeof (dimm_fan_command_string));
+ sizeof (dimm_fan_command_string));
(void) strncpy(dimm_fan_debug_string, NOT_AVAILABLE,
- sizeof (dimm_fan_debug_string));
+ sizeof (dimm_fan_debug_string));
(void) strncpy(dimm_fan_rpm_string, NOT_AVAILABLE,
- sizeof (dimm_fan_rpm_string));
+ sizeof (dimm_fan_rpm_string));
return (-1);
}
if (env_debug)
@@ -2849,33 +2864,33 @@ is_dimm_fan_failed(void)
"DIMM FAN STATUS reg = 0x%x\n", i2c_reg.reg_value);
if (i2c_reg.reg_value & PIC16F819_FAN_FAILED) {
(void) snprintf(dimm_fan_status_string,
- sizeof (dimm_fan_status_string), "0x%x",
- i2c_reg.reg_value);
+ sizeof (dimm_fan_status_string), "0x%x",
+ i2c_reg.reg_value);
i2c_reg.reg_num = PIC16F819_DEBUG_REGISTER;
if (ioctl(envd_dimm_fan.fd, I2C_GET_REG, &i2c_reg) == -1) {
(void) strncpy(dimm_fan_debug_string, NOT_AVAILABLE,
- sizeof (dimm_fan_debug_string));
+ sizeof (dimm_fan_debug_string));
} else {
(void) snprintf(dimm_fan_debug_string,
- sizeof (dimm_fan_debug_string),
- "0x%x", i2c_reg.reg_value);
+ sizeof (dimm_fan_debug_string),
+ "0x%x", i2c_reg.reg_value);
}
i2c_reg.reg_num = PIC16F819_COMMAND_REGISTER;
if (ioctl(envd_dimm_fan.fd, I2C_GET_REG, &i2c_reg) == -1) {
(void) strncpy(dimm_fan_command_string, NOT_AVAILABLE,
- sizeof (dimm_fan_command_string));
+ sizeof (dimm_fan_command_string));
} else {
(void) snprintf(dimm_fan_command_string,
- sizeof (dimm_fan_command_string),
- "0x%x", i2c_reg.reg_value);
+ sizeof (dimm_fan_command_string),
+ "0x%x", i2c_reg.reg_value);
}
if (get_dimm_fan_speed(envd_dimm_fan.fd, &fan_speed) == -1) {
(void) strncpy(dimm_fan_rpm_string, NOT_AVAILABLE,
- sizeof (dimm_fan_rpm_string));
+ sizeof (dimm_fan_rpm_string));
} else {
(void) snprintf(dimm_fan_rpm_string,
- sizeof (dimm_fan_rpm_string),
- "%d", fan_speed);
+ sizeof (dimm_fan_rpm_string),
+ "%d", fan_speed);
}
return (1);
} else return (0);
diff --git a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c
index 56dcf64224..ca9ebe3ac6 100644
--- a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c
+++ b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file contains code for setting up environmental related nodes
* and properties in the PICL tree.
@@ -88,22 +86,22 @@ typedef struct {
*/
static sensor_node_t sensor_nodes[] = {
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58",
- SENSOR_CPU0_DIE, NULL, NULL, NULL, NULL},
+ SENSOR_CPU0_DIE, NULL, 0, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58",
- SENSOR_CPU1_DIE, NULL, NULL, NULL, NULL},
+ SENSOR_CPU1_DIE, NULL, 0, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58",
- SENSOR_INT_AMB_0, NULL, NULL, NULL, NULL},
+ SENSOR_INT_AMB_0, NULL, 0, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- SENSOR_SYS_OUT, NULL, NULL, NULL, NULL},
+ SENSOR_SYS_OUT, NULL, 0, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- SENSOR_SYS_IN, NULL, NULL, NULL, NULL},
+ SENSOR_SYS_IN, NULL, 0, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- SENSOR_INT_AMB_1, NULL, NULL, NULL, NULL},
+ SENSOR_INT_AMB_1, NULL, 0, 0, 0},
};
#define N_SENSOR_NODES (sizeof (sensor_nodes)/sizeof (sensor_nodes[0]))
@@ -115,7 +113,7 @@ static sensor_node_t sensor_nodes[] = {
typedef struct {
char *parent_path; /* parent node path */
char *fan_name; /* fan name */
- env_fan_t *fanp; /* fan information */
+ env_fan_t *fanp; /* fan information */
char *speed_unit; /* speed unit string */
picl_nodehdl_t nodeh; /* "fan" node handle */
picl_prophdl_t proph; /* "Speed" property handle */
@@ -127,19 +125,19 @@ typedef struct {
*/
static fan_node_t fan_nodes[] = {
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58",
- ENV_CPU0_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ ENV_CPU0_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58",
- ENV_CPU1_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ ENV_CPU1_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,52",
- ENV_DIMM_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ ENV_DIMM_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
};
#define N_FAN_NODES (sizeof (fan_nodes)/sizeof (fan_nodes[0]))
@@ -150,7 +148,7 @@ static fan_node_t fan_nodes[] = {
typedef struct {
char *parent_path; /* parent node path */
char *disk_name; /* disk name */
- env_disk_t *diskp; /* disk information */
+ env_disk_t *diskp; /* disk information */
picl_nodehdl_t nodeh; /* "disk" node handle */
picl_prophdl_t proph; /* "Temperature" property handle */
} disk_node_t;
@@ -159,8 +157,8 @@ typedef struct {
* Disk node array
*/
static disk_node_t disk_nodes[] = {
- {DISK0_NODE_PATH, ENV_DISK0, NULL, NULL, NULL},
- {DISK1_NODE_PATH, ENV_DISK1, NULL, NULL, NULL},
+ {DISK0_NODE_PATH, ENV_DISK0, NULL, 0, 0},
+ {DISK1_NODE_PATH, ENV_DISK1, NULL, 0, 0},
};
#define N_DISK_NODES (sizeof (disk_nodes)/sizeof (disk_nodes[0]))
@@ -178,7 +176,7 @@ static void delete_fan_nodes_and_props(void);
static int
get_current_temp(ptree_rarg_t *parg, void *buf)
{
- tempr_t temp;
+ tempr_t temp;
picl_prophdl_t proph;
sensor_node_t *snodep;
int i;
@@ -207,7 +205,7 @@ get_current_temp(ptree_rarg_t *parg, void *buf)
static int
get_disk_temp(ptree_rarg_t *parg, void *buf)
{
- tempr_t temp;
+ tempr_t temp;
picl_prophdl_t proph;
disk_node_t *dnodep;
int i;
@@ -497,12 +495,12 @@ delete_sensor_nodes_and_props(void)
for (i = 0; i < N_SENSOR_NODES; ++i) {
snodep = &sensor_nodes[i];
- if (snodep->nodeh != NULL) {
+ if (snodep->nodeh != 0) {
/* delete node and all properties under it */
(void) ptree_delete_node(snodep->nodeh);
(void) ptree_destroy_node(snodep->nodeh);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
}
}
}
@@ -529,11 +527,12 @@ add_disk_nodes_and_props()
*/
err = ptree_get_node_by_path(dnodep->parent_path, &nodeh);
if (err != PICL_SUCCESS) {
- if (env_debug)
- envd_log(LOG_ERR, "failed to get node for path %s\n",
- dnodep->parent_path);
- err = PICL_SUCCESS;
- continue;
+ if (env_debug)
+ envd_log(LOG_ERR,
+ "failed to get node for path %s\n",
+ dnodep->parent_path);
+ err = PICL_SUCCESS;
+ continue;
}
diskp = dnodep->diskp;
if (diskp->present == B_FALSE)
@@ -584,24 +583,24 @@ add_disk_nodes_and_props()
*/
(void) add_regular_prop(cnodeh, PICL_PROP_LOW_SHUTDOWN,
- PICL_PTYPE_INT, PICL_READ,
- sizeof (diskp->low_shutdown),
- (void *)&(diskp->low_shutdown), &proph);
+ PICL_PTYPE_INT, PICL_READ,
+ sizeof (diskp->low_shutdown),
+ (void *)&(diskp->low_shutdown), &proph);
(void) add_regular_prop(cnodeh, PICL_PROP_LOW_WARNING,
- PICL_PTYPE_INT, PICL_READ,
- sizeof (diskp->low_warning),
- (void *)&(diskp->low_warning), &proph);
+ PICL_PTYPE_INT, PICL_READ,
+ sizeof (diskp->low_warning),
+ (void *)&(diskp->low_warning), &proph);
(void) add_regular_prop(cnodeh, PICL_PROP_HIGH_WARNING,
- PICL_PTYPE_INT, PICL_READ,
- sizeof (diskp->high_warning),
- (void *)&(diskp->high_warning), &proph);
+ PICL_PTYPE_INT, PICL_READ,
+ sizeof (diskp->high_warning),
+ (void *)&(diskp->high_warning), &proph);
(void) add_regular_prop(cnodeh, PICL_PROP_HIGH_SHUTDOWN,
- PICL_PTYPE_INT, PICL_READ,
- sizeof (diskp->high_shutdown),
- (void *)&(diskp->high_shutdown), &proph);
+ PICL_PTYPE_INT, PICL_READ,
+ sizeof (diskp->high_shutdown),
+ (void *)&(diskp->high_shutdown), &proph);
}
if (err != PICL_SUCCESS) {
@@ -633,11 +632,11 @@ delete_disk_nodes_and_props(void)
for (i = 0; i < N_DISK_NODES; ++i) {
dnodep = &disk_nodes[i];
- if (dnodep->nodeh != NULL) {
+ if (dnodep->nodeh != 0) {
(void) ptree_delete_node(dnodep->nodeh);
(void) ptree_destroy_node(dnodep->nodeh);
- dnodep->nodeh = NULL;
- dnodep->proph = NULL;
+ dnodep->nodeh = 0;
+ dnodep->proph = 0;
}
}
}
@@ -716,14 +715,14 @@ add_fan_nodes_and_props()
* We do not permit setting of DIMM FAN speeds.
*/
err = add_volatile_prop(cnodeh, pname, PICL_PTYPE_INT,
- PICL_READ, sizeof (fanspeed_t),
- get_current_speed,
- NULL, &proph);
+ PICL_READ, sizeof (fanspeed_t),
+ get_current_speed,
+ NULL, &proph);
} else {
err = add_volatile_prop(cnodeh, pname, PICL_PTYPE_INT,
- PICL_READ|PICL_WRITE, sizeof (fanspeed_t),
- get_current_speed,
- set_current_speed, &proph);
+ PICL_READ|PICL_WRITE, sizeof (fanspeed_t),
+ get_current_speed,
+ set_current_speed, &proph);
}
if (err != PICL_SUCCESS)
@@ -772,10 +771,10 @@ delete_fan_nodes_and_props(void)
for (i = 0; i < N_FAN_NODES; ++i) {
fnodep = &fan_nodes[i];
- if (fnodep->nodeh != NULL) {
+ if (fnodep->nodeh != 0) {
(void) ptree_delete_node(fnodep->nodeh);
(void) ptree_destroy_node(fnodep->nodeh);
- fnodep->nodeh = NULL;
+ fnodep->nodeh = 0;
}
}
}
@@ -943,9 +942,9 @@ env_picl_setup(void)
for (i = 0; i < N_SENSOR_NODES; ++i) {
snodep = &sensor_nodes[i];
snodep->sensorp = sensor_lookup(snodep->sensor_name);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
- snodep->target_proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
+ snodep->target_proph = 0;
}
/*
@@ -954,8 +953,8 @@ env_picl_setup(void)
for (i = 0; i < N_FAN_NODES; ++i) {
fnodep = &fan_nodes[i];
fnodep->fanp = fan_lookup(fnodep->fan_name);
- fnodep->nodeh = NULL;
- fnodep->proph = NULL;
+ fnodep->nodeh = 0;
+ fnodep->proph = 0;
}
/*
@@ -964,8 +963,8 @@ env_picl_setup(void)
for (i = 0; i < N_DISK_NODES; ++i) {
dnodep = &disk_nodes[i];
dnodep->diskp = disk_lookup(dnodep->disk_name);
- dnodep->nodeh = NULL;
- dnodep->proph = NULL;
+ dnodep->nodeh = 0;
+ dnodep->proph = 0;
}
/*
diff --git a/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c
index c33b7ab029..64420e7306 100644
--- a/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c
+++ b/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file contains code for setting up environmental related nodes
* and properties in the PICL tree.
@@ -133,7 +131,7 @@ static sensor_node_t sensor_nodes[] = {
*/
typedef struct {
char *fan_name; /* fan name */
- env_fan_t *fanp; /* fan information */
+ env_fan_t *fanp; /* fan information */
char *speed_unit; /* speed unit string */
picl_nodehdl_t nodeh; /* "fan" node handle */
picl_prophdl_t proph; /* "Speed" property handle */
@@ -203,7 +201,7 @@ get_current_target_temp(ptree_rarg_t *parg, void *buf)
static int
get_current_temp(ptree_rarg_t *parg, void *buf)
{
- tempr_t temp;
+ tempr_t temp;
picl_prophdl_t proph;
sensor_node_t *snodep;
@@ -298,7 +296,7 @@ add_node_to_list(picl_nodehdl_t nodeh, node_list_t *listp)
*/
static node_list_t *
get_node_list_by_class(picl_nodehdl_t nodeh, const char *classname,
- node_list_t *listp)
+ node_list_t *listp)
{
int err;
char clname[PICL_CLASSNAMELEN_MAX+1];
@@ -507,7 +505,7 @@ add_sensor_nodes_and_props(picl_nodehdl_t plath)
* Skip if already initialized or no sensor info
*/
sensorp = snodep->sensorp;
- if (snodep->nodeh != NULL || sensorp == NULL)
+ if (snodep->nodeh != 0 || sensorp == NULL)
continue;
/*
@@ -628,18 +626,18 @@ delete_sensor_nodes_and_props(void)
*/
for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) {
- if (snodep->sdev_proph != NULL) {
+ if (snodep->sdev_proph != 0) {
(void) ptree_delete_prop(snodep->sdev_proph);
(void) ptree_destroy_prop(snodep->sdev_proph);
- snodep->sdev_proph = NULL;
+ snodep->sdev_proph = 0;
}
- if (snodep->nodeh != NULL) {
+ if (snodep->nodeh != 0) {
/* delete node and all properties under it */
(void) ptree_delete_node(snodep->nodeh);
(void) ptree_destroy_node(snodep->nodeh);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
}
}
}
@@ -682,7 +680,7 @@ add_fan_nodes_and_props(picl_nodehdl_t plath)
for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) {
/* Skip if already initialized or no fan info */
- if (fnodep->nodeh != NULL || fnodep->fanp == NULL)
+ if (fnodep->nodeh != 0 || fnodep->fanp == NULL)
continue;
/*
@@ -731,9 +729,9 @@ add_fan_nodes_and_props(picl_nodehdl_t plath)
*/
pname = PICL_PROP_FAN_SPEED_UNIT;
err = add_regular_prop(cnodeh, pname,
- PICL_PTYPE_CHARSTRING, PICL_READ,
- strlen(fnodep->speed_unit)+1,
- (void *)fnodep->speed_unit, &proph);
+ PICL_PTYPE_CHARSTRING, PICL_READ,
+ strlen(fnodep->speed_unit)+1,
+ (void *)fnodep->speed_unit, &proph);
if (err != PICL_SUCCESS)
break;
@@ -770,10 +768,10 @@ delete_fan_nodes_and_props(void)
*/
for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) {
- if (fnodep->nodeh != NULL) {
+ if (fnodep->nodeh != 0) {
(void) ptree_delete_node(fnodep->nodeh);
(void) ptree_destroy_node(fnodep->nodeh);
- fnodep->nodeh = NULL;
+ fnodep->nodeh = 0;
}
}
}
@@ -806,7 +804,7 @@ get_envmodel_conf_file(char *outfilename)
}
(void) snprintf(pname, PATH_MAX, "%s/%s", PICLD_COMMON_PLUGIN_DIR,
- ENVMODEL_CONF_FILE);
+ ENVMODEL_CONF_FILE);
if (access(pname, R_OK) == 0) {
(void) strlcpy(outfilename, pname, PATH_MAX);
@@ -842,10 +840,10 @@ env_picl_setup(void)
*/
for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) {
snodep->sensorp = sensor_lookup(snodep->sensor_name);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
- snodep->target_proph = NULL;
- snodep->sdev_proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
+ snodep->target_proph = 0;
+ snodep->sdev_proph = 0;
}
/*
@@ -853,8 +851,8 @@ env_picl_setup(void)
*/
for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) {
fnodep->fanp = fan_lookup(fnodep->fan_name);
- fnodep->nodeh = NULL;
- fnodep->proph = NULL;
+ fnodep->nodeh = 0;
+ fnodep->proph = 0;
}
/*
diff --git a/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c b/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c
index e0849ebc47..f73c2585c5 100644
--- a/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c
+++ b/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c
@@ -210,7 +210,7 @@ lock_container_lock(picl_nodehdl_t nodehdl, int object_type, int operation)
static hash_obj_t *
lookup_node_object(picl_nodehdl_t nodehdl, int object_type,
- container_tbl_t *cont_tbl)
+ container_tbl_t *cont_tbl)
{
int index_to_hash;
hash_obj_t *first_hash;
@@ -561,7 +561,7 @@ free_packet_list(hash_obj_t *hash_obj, container_tbl_t *cont_tbl)
static void
free_segment_node(hash_obj_t *hash_obj, picl_nodehdl_t nodehdl,
- container_tbl_t *cont_tbl)
+ container_tbl_t *cont_tbl)
{
hash_obj_t *prev_hash_obj;
hash_obj_t *next_obj;
@@ -1107,7 +1107,7 @@ frudata_delete_packet(ptree_warg_t *warg, const void *buf)
static int
add_row_to_table(hash_obj_t *seg_obj, picl_nodehdl_t tblhdl, packet_t *pkt,
- container_tbl_t *cont_tbl)
+ container_tbl_t *cont_tbl)
{
int retval;
int paylen;
@@ -1195,7 +1195,7 @@ add_row_to_table(hash_obj_t *seg_obj, picl_nodehdl_t tblhdl, packet_t *pkt,
static int
frudata_read_packet(picl_nodehdl_t nodeh, picl_prophdl_t *tblhdl,
- container_tbl_t *cont_tbl, door_cred_t *cred)
+ container_tbl_t *cont_tbl, door_cred_t *cred)
{
int cnt;
int retval;
@@ -1388,7 +1388,7 @@ freeup(picl_nodehdl_t nodeh)
static int
create_segment_node(hash_obj_t *sec_obj, picl_nodehdl_t sec_node,
- segment_t *segment, container_tbl_t *cont_tbl, door_cred_t *cred)
+ segment_t *segment, container_tbl_t *cont_tbl, door_cred_t *cred)
{
int retval;
@@ -1745,7 +1745,7 @@ frudata_add_segment(ptree_warg_t *warg, const void *buf)
static int
create_section_node(picl_nodehdl_t nodehdl, int section_count,
- section_t *section, container_tbl_t *cont_tbl)
+ section_t *section, container_tbl_t *cont_tbl)
{
char sec_name[SECNAMESIZE];
hash_obj_t *hash_obj;
@@ -2167,7 +2167,7 @@ delete_frudata_props(picl_nodehdl_t fru_hdl)
/* ARGSUSED */
static void
frudata_state_change_evhandler(const char *event_name, const void *event_arg,
- size_t size, void *cookie)
+ size_t size, void *cookie)
{
int rc;
nvlist_t *nvlp;
@@ -2180,7 +2180,7 @@ frudata_state_change_evhandler(const char *event_name, const void *event_arg,
if (strcmp(event_name, PICLEVENT_STATE_CHANGE) != 0)
return;
- if (nvlist_unpack((char *)event_arg, size, &nvlp, NULL)) {
+ if (nvlist_unpack((char *)event_arg, size, &nvlp, 0)) {
return;
}
@@ -2271,7 +2271,7 @@ frudata_state_change_evhandler(const char *event_name, const void *event_arg,
/* ARGSUSED */
static void
frudata_event_handler(const char *event_name, const void *event_arg,
- size_t size, void *cookie)
+ size_t size, void *cookie)
{
int retval;
char fullfilename[PATH_MAX];
@@ -2316,7 +2316,7 @@ frudata_event_handler(const char *event_name, const void *event_arg,
/*
* Function : plugin_init() is called by daemon. this routine is specified
- * while registering with daemon. it performs the initialization
+ * while registering with daemon. it performs the initialization
* of plugin module.
*/
diff --git a/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c
index 6431df8bde..f456eb0fb2 100644
--- a/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c
+++ b/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file contains code for setting up environmental related nodes
* and properties in the PICL tree.
@@ -154,7 +152,7 @@ static sensor_node_t sensor_nodes[] = {
*/
typedef struct {
char *fan_name; /* fan name */
- env_fan_t *fanp; /* fan information */
+ env_fan_t *fanp; /* fan information */
char *speed_unit; /* speed unit string */
picl_nodehdl_t nodeh; /* "fan" node handle */
picl_prophdl_t proph; /* "Speed" property handle */
@@ -188,7 +186,7 @@ static void delete_fan_nodes_and_props(void);
static int
get_current_temp(ptree_rarg_t *parg, void *buf)
{
- tempr_t temp;
+ tempr_t temp;
picl_prophdl_t proph;
sensor_node_t *snodep;
@@ -275,7 +273,7 @@ add_node_to_list(picl_nodehdl_t nodeh, node_list_t *listp)
*/
static node_list_t *
get_node_list_by_class(picl_nodehdl_t nodeh, const char *classname,
- node_list_t *listp)
+ node_list_t *listp)
{
int err;
char clname[PICL_CLASSNAMELEN_MAX+1];
@@ -484,7 +482,7 @@ add_sensor_nodes_and_props(picl_nodehdl_t plath)
* Skip if already initialized or no sensor info
*/
sensorp = snodep->sensorp;
- if (snodep->nodeh != NULL || sensorp == NULL)
+ if (snodep->nodeh != 0 || sensorp == NULL)
continue;
/*
@@ -590,18 +588,18 @@ delete_sensor_nodes_and_props(void)
*/
for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) {
- if (snodep->sdev_proph != NULL) {
+ if (snodep->sdev_proph != 0) {
(void) ptree_delete_prop(snodep->sdev_proph);
(void) ptree_destroy_prop(snodep->sdev_proph);
- snodep->sdev_proph = NULL;
+ snodep->sdev_proph = 0;
}
- if (snodep->nodeh != NULL) {
+ if (snodep->nodeh != 0) {
/* delete node and all properties under it */
(void) ptree_delete_node(snodep->nodeh);
(void) ptree_destroy_node(snodep->nodeh);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
}
}
}
@@ -644,7 +642,7 @@ add_fan_nodes_and_props(picl_nodehdl_t plath)
for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) {
/* Skip if already initialized or no fan info */
- if (fnodep->nodeh != NULL || fnodep->fanp == NULL)
+ if (fnodep->nodeh != 0 || fnodep->fanp == NULL)
continue;
/*
@@ -691,7 +689,7 @@ add_fan_nodes_and_props(picl_nodehdl_t plath)
/*
* Add other "fan" class properties
*/
- pname = PROP_FAN_SPEED_UNIT,
+ pname = PROP_FAN_SPEED_UNIT;
err = add_regular_prop(cnodeh, pname,
PICL_PTYPE_CHARSTRING, PICL_READ,
strlen(fnodep->speed_unit)+1,
@@ -732,10 +730,10 @@ delete_fan_nodes_and_props(void)
*/
for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) {
- if (fnodep->nodeh != NULL) {
+ if (fnodep->nodeh != 0) {
(void) ptree_delete_node(fnodep->nodeh);
(void) ptree_destroy_node(fnodep->nodeh);
- fnodep->nodeh = NULL;
+ fnodep->nodeh = 0;
}
}
}
@@ -768,7 +766,7 @@ get_envmodel_conf_file(char *outfilename)
}
(void) snprintf(pname, PATH_MAX, "%s/%s", PICLD_COMMON_PLUGIN_DIR,
- ENVMODEL_CONF_FILE);
+ ENVMODEL_CONF_FILE);
if (access(pname, R_OK) == 0) {
(void) strlcpy(outfilename, pname, PATH_MAX);
@@ -793,9 +791,9 @@ env_picl_setup(void)
*/
for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) {
snodep->sensorp = sensor_lookup(snodep->sensor_name);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
- snodep->sdev_proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
+ snodep->sdev_proph = 0;
}
/*
@@ -803,8 +801,8 @@ env_picl_setup(void)
*/
for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) {
fnodep->fanp = fan_lookup(fnodep->fan_name);
- fnodep->nodeh = NULL;
- fnodep->proph = NULL;
+ fnodep->nodeh = 0;
+ fnodep->proph = 0;
}
/*
diff --git a/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c b/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c
index 30505cc151..0277cb3c4a 100644
--- a/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c
+++ b/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This plugin creates memory configuration nodes and properties in the
* PICL tree for Grover/Grover+ platform.
@@ -101,7 +99,7 @@ create_logical_tree(picl_nodehdl_t memh, mmodinfo_t *mmodinfo)
* It means no segment for the slot if size is zero
*/
if (mmodinfo[i].size == 0) {
- memsegh[i] = NULL;
+ memsegh[i] = 0;
continue;
}
@@ -165,7 +163,7 @@ create_logical_tree(picl_nodehdl_t memh, mmodinfo_t *mmodinfo)
* Add reference property to the memory module if memory
* module node handle is not NULL.
*/
- if (mmodinfo[i].memmodh == NULL)
+ if (mmodinfo[i].memmodh == 0)
continue;
err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION,
@@ -185,7 +183,7 @@ create_logical_tree(picl_nodehdl_t memh, mmodinfo_t *mmodinfo)
* Undo in the logical memory tree
*/
for (i = 0; i < TOTAL_MEM_SLOTS; i++) {
- if (memsegh[i] == NULL)
+ if (memsegh[i] == 0)
continue;
(void) ptree_delete_node(memsegh[i]);
@@ -274,7 +272,7 @@ create_physical_tree(picl_nodehdl_t plfh, mmodinfo_t *mmodinfo)
* logical memory tree won't link to memory module.
*/
for (i = 0; i < TOTAL_MEM_SLOTS; i++)
- mmodinfo[i].memmodh = NULL;
+ mmodinfo[i].memmodh = 0;
/*
* Undo in the physical memory tree
diff --git a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c
index aaa9e843f7..1bb24230cd 100644
--- a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c
+++ b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <limits.h>
#include <alloca.h>
#include "fru_access_impl.h"
@@ -777,41 +775,41 @@ fru_open_container(picl_nodehdl_t fruhdl)
retval = ptree_get_propval_by_name(fruhdl, PICL_REFPROP_SEEPROM_SRC,
&tmphdl, sizeof (tmphdl));
if (retval != PICL_SUCCESS) {
- return (NULL);
+ return (0);
}
/* Get the device path of the fru */
retval = ptree_get_propval_by_name(tmphdl, PICL_PROP_DEVICEPATH,
devpath, PATH_MAX);
if (retval != PICL_SUCCESS) {
- return (NULL);
+ return (0);
}
retval = ptree_get_prop_by_name(tmphdl, PICL_PROP_BINDING_NAME,
&prophdl);
if (retval != PICL_SUCCESS) {
- return (NULL);
+ return (0);
}
retval = ptree_get_propinfo(prophdl, &propinfo);
if (retval != PICL_SUCCESS) {
- return (NULL);
+ return (0);
}
bname = alloca(propinfo.piclinfo.size);
if (bname == NULL) {
- return (NULL);
+ return (0);
}
/* get the driver binding name */
retval = ptree_get_propval(prophdl, bname, propinfo.piclinfo.size);
if (retval != PICL_SUCCESS) {
- return (NULL);
+ return (0);
}
cont_hash_obj = create_container_hash_object();
if (cont_hash_obj == NULL) {
- return (NULL);
+ return (0);
}
add_hashobject_to_hashtable(cont_hash_obj);
@@ -823,7 +821,7 @@ fru_open_container(picl_nodehdl_t fruhdl)
if (strcmp(bname, "i2c-at34c02") == 0) {
device_fd = open(devpath, O_RDONLY);
if (device_fd < 0) {
- return (NULL);
+ return (0);
}
first_byte = 0x00;
@@ -861,7 +859,7 @@ fru_open_container(picl_nodehdl_t fruhdl)
retval = get_container_info(devpath, bname, &cont_info);
}
if (retval < 0) {
- return (NULL);
+ return (0);
}
cont_hash_obj->u.cont_obj->num_of_section = cont_info.num_sections;
@@ -870,7 +868,7 @@ fru_open_container(picl_nodehdl_t fruhdl)
for (count = 0; count < cont_info.num_sections; count++) {
sec_hash_obj = create_section_hash_object();
if (sec_hash_obj == NULL) {
- return (NULL);
+ return (0);
}
add_hashobject_to_hashtable(sec_hash_obj);
@@ -1101,7 +1099,7 @@ call_devfsadm(void)
/*
* Description :
- * fru_get_sections() fills an array of section structures passed
+ * fru_get_sections() fills an array of section structures passed
* as an argument.
*
* Arguments :
@@ -1110,16 +1108,16 @@ call_devfsadm(void)
* int : maximum number of section in a container.
*
* Returns :
- * int
- * On success,the number of section structures written is returned;
- * on error, -1 is returned and "errno" is set appropriately.
+ * int
+ * On success,the number of section structures written is returned;
+ * on error, -1 is returned and "errno" is set appropriately.
*
*/
/* ARGSUSED */
int
fru_get_sections(container_hdl_t container, section_t *section, int maxsec,
- door_cred_t *cred)
+ door_cred_t *cred)
{
int device_fd;
int retrys = 1;
@@ -1168,16 +1166,16 @@ fru_get_sections(container_hdl_t container, section_t *section, int maxsec,
/*
* Description :
- * fru_get_num_segments() returns the current number of segments
+ * fru_get_num_segments() returns the current number of segments
* in a section.
*
* Arguments :
* section_hdl_t : section header holding section information.
*
* Return :
- * int
- * On success, the number of segments in the argument section is
- * returned; on error -1 is returned.
+ * int
+ * On success, the number of segments in the argument section is
+ * returned; on error -1 is returned.
*/
/* ARGSUSED */
@@ -1284,7 +1282,7 @@ fru_get_segments(section_hdl_t section, segment_t *segment, int maxseg,
int
fru_add_segment(section_hdl_t section, segment_t *segment,
- section_hdl_t *newsection, door_cred_t *cred)
+ section_hdl_t *newsection, door_cred_t *cred)
{
int fd;
int retval;
@@ -1300,7 +1298,7 @@ fru_add_segment(section_hdl_t section, segment_t *segment,
hash_obj_t *sec_hash;
hash_obj_t *seg_hash;
fru_segdesc_t *new_seg_desc;
- unsigned char *crcbuf;
+ unsigned char *crcbuf;
section_layout_t sec_layout;
segment_layout_t *seg_layout;
segment_layout_t *segment_buf;
@@ -1560,7 +1558,7 @@ free_segment_hash(handle_t handle, hash_obj_t *sec_hash)
int
fru_delete_segment(segment_hdl_t segment, section_hdl_t *newsection,
- door_cred_t *cred)
+ door_cred_t *cred)
{
int num_of_seg;
int bufsize;
@@ -1712,14 +1710,14 @@ fru_delete_segment(segment_hdl_t segment, section_hdl_t *newsection,
/*
* Description :
- * fru_read_segment() reads the raw contents of a segment.
+ * fru_read_segment() reads the raw contents of a segment.
*
* Arguments : segment_hdl_t : segment handle.
* void * : buffer containing segment data when function returns.
* size_t :number of bytes.
*
* Return :
- * int
+ * int
* On success, the number of bytes read is returned;
*
* Notes :
@@ -2223,8 +2221,8 @@ fru_get_packets(segment_hdl_t segment, packet_t *packet, int maxpackets,
* size_t : sizeof the buffer.
*
* Return :
- * int
- * On success, the number of bytes copied is returned; On error
+ * int
+ * On success, the number of bytes copied is returned; On error
* -1 returned.
*/
@@ -2252,7 +2250,7 @@ fru_get_payload(packet_hdl_t packet, void *buffer, size_t nbytes,
/*
* Description :
- * fru_update_payload() writes the contents of a packet's payload.
+ * fru_update_payload() writes the contents of a packet's payload.
*
* Arguments : packet_hdl_t : packet handle.
* const void * : data buffer.
@@ -2260,7 +2258,7 @@ fru_get_payload(packet_hdl_t packet, void *buffer, size_t nbytes,
* packet_hdl_t : new packet handle.
*
* Return :
- * int
+ * int
* On success, 0 is returned; on failure
* -1 is returned.
*/
@@ -2360,22 +2358,22 @@ fru_update_payload(packet_hdl_t packet, const void *data, size_t nbytes,
* segment_hdl_t segment
* A handle for the segment to which the packet will be appended.
*
- * packet_t *packet
- * On entry, the "tag" component of "packet" specifies the tag
- * value for the added packet; the "handle" component is ignored.
- * On return, the "handle" component is set to the handle of the
- * appended packet.
+ * packet_t *packet
+ * On entry, the "tag" component of "packet" specifies the tag
+ * value for the added packet; the "handle" component is ignored.
+ * On return, the "handle" component is set to the handle of the
+ * appended packet.
*
- * const void *payload
- * A pointer to the caller's buffer containing the payload data for
- * the appended packet.
+ * const void *payload
+ * A pointer to the caller's buffer containing the payload data for
+ * the appended packet.
*
- * size_t nbytes
- * The size of the caller buffer.
+ * size_t nbytes
+ * The size of the caller buffer.
*
* Return :
- * int
- * On success, 0 is returned; on error -1 is returned;
+ * int
+ * On success, 0 is returned; on error -1 is returned;
*/
int
@@ -2522,7 +2520,7 @@ fru_append_packet(segment_hdl_t segment, packet_t *packet, const void *payload,
seg_hash->u.seg_obj->trailer_offset = trailer_offset;
seg_hash->u.seg_obj->num_of_packets += 1;
- *newsegment = segment; /* return new segment handle */
+ *newsegment = segment; /* return new segment handle */
return (0);
} else {
errno = EAGAIN;
@@ -2601,18 +2599,18 @@ free_packet_object(handle_t handle, hash_obj_t *seg_hash)
/*
* Description :
- * fru_delete_packet() deletes a packet from a segment.
+ * fru_delete_packet() deletes a packet from a segment.
*
* Arguments : packet_hdl_t : packet number to be deleted.
* segment_hdl_t : new segment handler.
*
* Return :
- * int
- * On success, 0 is returned; on error, -1.
+ * int
+ * On success, 0 is returned; on error, -1.
*
* NOTES
- * Packets are adjacent; thus, deleting a packet requires moving
- * succeeding packets to compact the resulting hole.
+ * Packets are adjacent; thus, deleting a packet requires moving
+ * succeeding packets to compact the resulting hole.
*/
int
@@ -2666,7 +2664,7 @@ fru_delete_packet(packet_hdl_t packet, segment_hdl_t *newsegment,
if (sec_hash->u.sec_obj->section.protection == READ_ONLY_SECTION) {
errno = EPERM;
- return (-1); /* read-only section */
+ return (-1); /* read-only section */
}
prev_obj = seg_hash->u.seg_obj->pkt_obj_list;
diff --git a/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c b/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c
index a4fea2bd61..0a2cf07c0c 100644
--- a/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c
+++ b/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
@@ -78,7 +76,7 @@ int fru_append_packet(segment_hdl_t segment, packet_t *packet,
segment_hdl_t *newsegment, door_cred_t *cred);
int fru_delete_packet(packet_hdl_t packet,
segment_hdl_t *newsegment, door_cred_t *cred);
-int fru_is_data_available(picl_nodehdl_t fru);
+int fru_is_data_available(picl_nodehdl_t fru);
#define PICL_PROP_SC_HANDLE "SC_handle"
#define PICL_PROP_DATA_AVAIL "FRUDataAvailable"
@@ -114,19 +112,19 @@ fru_open_container(picl_nodehdl_t fruh)
container_hdl_t container_hdl;
if (fru_open_dev() == -1) {
- return (NULL);
+ return (0);
}
- err = ptree_get_propval_by_name(fruh, PICL_PROP_DATA_AVAIL, NULL, NULL);
+ err = ptree_get_propval_by_name(fruh, PICL_PROP_DATA_AVAIL, NULL, 0);
if (err != PICL_SUCCESS) {
syslog(LOG_ERR, GETPV, PICL_PROP_DATA_AVAIL, err);
- return (NULL);
+ return (0);
}
err = ptree_get_propval_by_name(fruh, PICL_PROP_SC_HANDLE,
&container_hdl, sizeof (container_hdl_t));
if (err != PICL_SUCCESS) {
syslog(LOG_ERR, GETPV, PICL_PROP_SC_HANDLE, err);
- return (NULL);
+ return (0);
}
return (container_hdl);
}
diff --git a/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c b/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c
index f4e14aa564..bb0c4d5567 100644
--- a/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c
+++ b/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This plugin-in creates the FRU Hierarchy for the
* SUNW,Netra-T12 platform and manages the environmental sensors
@@ -126,7 +124,7 @@ static picld_plugin_reg_t my_reg_info = {
#define PICL_PROPVAL_DISABLED "disabled"
#define PICL_PROPVAL_UNKNOWN "unknown"
#define PICL_PROPVAL_SELF_REGULATING "self-regulating"
-#define PICL_PROPVAL_PER_CENT "%"
+#define PICL_PROPVAL_PER_CENT "%"
#define PICL_PROP_BANK_STATUS "bank-status"
/*
@@ -297,7 +295,7 @@ static char *hpu_condition_table[] = {"unknown", "okay", "failing",
* variables set up in init
*/
static picl_nodehdl_t frutreeh;
-static picl_nodehdl_t sch = NULL;
+static picl_nodehdl_t sch = 0;
static int init_complete;
static int pcix_io = 0;
@@ -746,7 +744,7 @@ add_fru_node(picl_nodehdl_t parh, sgfrunode_t *sgfrunode,
* if sgfrunode already there, then just carry on own the tree
*/
childh = find_child_by_name(parh, nodename);
- if (childh != NULL) {
+ if (childh != 0) {
/*
* for frus other than dimms and ecaches, update environmental
* sensors and board status if necessary
@@ -807,7 +805,7 @@ add_fru_node(picl_nodehdl_t parh, sgfrunode_t *sgfrunode,
* a dr event - ie post-initialisation
*/
if (init_complete)
- post_frudr_event(PICL_FRU_ADDED, parh, NULL);
+ post_frudr_event(PICL_FRU_ADDED, parh, 0);
/*
* Create empty Devices table - we'll add lines to it as we go along
@@ -941,7 +939,7 @@ add_location_node(picl_nodehdl_t parh, sgfrunode_t *sgfrunode,
* if node already there, then just carry on down the tree
*/
childh = find_child_by_name(parh, labelp);
- if (childh != NULL) {
+ if (childh != 0) {
*childp = childh;
return (PICL_SUCCESS);
}
@@ -1330,7 +1328,7 @@ add_intermediate_nodes(picl_nodehdl_t *nodep, char *labelp,
* created)
*/
intermediate = find_child_by_name(*nodep, labelp);
- if (intermediate == NULL) {
+ if (intermediate == 0) {
intermediate = *nodep;
err = add_intermediate_location(&intermediate, labelp,
slot_name);
@@ -1344,7 +1342,7 @@ add_intermediate_nodes(picl_nodehdl_t *nodep, char *labelp,
* created)
*/
intermediate2 = find_child_by_name(intermediate, labelp);
- if (intermediate2 == NULL) {
+ if (intermediate2 == 0) {
/*
* need to create intermediate fru node node
*/
@@ -1436,19 +1434,19 @@ find_child_by_name(picl_nodehdl_t parh, char *name)
err = ptree_get_propval_by_name(parh, PICL_PROP_CHILD,
&nodeh, sizeof (picl_nodehdl_t));
if (err != PICL_SUCCESS)
- return (NULL);
+ return (0);
for (;;) {
err = ptree_get_propval_by_name(nodeh, PICL_PROP_NAME, nodename,
sizeof (nodename));
if (err != PICL_SUCCESS)
- return (NULL);
+ return (0);
if (strcmp(name, nodename) == 0) {
return (nodeh);
}
err = ptree_get_propval_by_name(nodeh, PICL_PROP_PEER,
&nodeh, sizeof (picl_nodehdl_t));
if (err != PICL_SUCCESS)
- return (NULL);
+ return (0);
}
}
@@ -1457,7 +1455,7 @@ create_dimm_references(picl_nodehdl_t parh, int dimm_id,
picl_nodehdl_t nodeh, picl_prophdl_t tblhdl)
{
int err;
- picl_nodehdl_t memctlhdl = NULL;
+ picl_nodehdl_t memctlhdl = 0;
picl_nodehdl_t memgrphdl;
picl_nodehdl_t memhdl;
char name[MAXPATHLEN];
@@ -1662,8 +1660,8 @@ create_cpu_references(char *pname, picl_nodehdl_t nodeh, picl_prophdl_t tblhdl)
err = ptree_get_prop_by_name(cpuhdl1,
PICL_REFPROP_FRU_PARENT, &prophdl);
if (err != PICL_SUCCESS) {
- err = add_prop_ref(cpuhdl1, nodeh,
- PICL_REFPROP_FRU_PARENT);
+ err = add_prop_ref(cpuhdl1, nodeh,
+ PICL_REFPROP_FRU_PARENT);
if (err != PICL_SUCCESS)
return (err);
err = create_table_entry(tblhdl, cpuhdl1,
@@ -2024,19 +2022,19 @@ frudr_completion_handler(char *ename, void *earg, size_t size)
* now frudata has been notified that the node is to be
* removed, we can actually remove it
*/
- fruh = NULL;
+ fruh = 0;
(void) nvlist_lookup_uint64(earg,
PICLEVENTARG_FRUHANDLE, &fruh);
- if (fruh != NULL) {
+ if (fruh != 0) {
(void) remove_subtree(fruh);
/*
* Now repopulate the frutree with current data.
*/
- parh = NULL;
+ parh = 0;
(void) nvlist_lookup_uint64(earg,
PICLEVENTARG_PARENTHANDLE, &parh);
- if (parh != NULL) {
+ if (parh != 0) {
frudr_add_subtree(parh);
}
}
@@ -2058,7 +2056,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh)
ev_name = strdup(ename);
if (ev_name == NULL)
return;
- if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) {
+ if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) {
free(ev_name);
return;
}
@@ -2164,7 +2162,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie)
if (strcmp(ename, PICLEVENT_DR_AP_STATE_CHANGE) != 0)
return;
- if (nvlist_unpack((char *)earg, size, &nvlp, NULL))
+ if (nvlist_unpack((char *)earg, size, &nvlp, 0))
return;
if (nvlist_lookup_string(nvlp, PICLEVENTARG_DATA_TYPE, &dtype)) {
@@ -2366,7 +2364,7 @@ frumemcfg_evhandler(const char *ename, const void *earg, size_t size,
/*
* find corresponding frutree dimm nodes
*/
- if (nvlist_unpack((char *)earg, size, &nvlp, NULL))
+ if (nvlist_unpack((char *)earg, size, &nvlp, 0))
return;
if (nvlist_lookup_uint64(nvlp, PICLEVENTARG_NODEHANDLE, &nodeh)) {
nvlist_free(nvlp);
@@ -2574,8 +2572,8 @@ next_bank:
*/
static int
add_sensor_node(picl_nodehdl_t fruhdl, picl_nodehdl_t lochdl, char *nodename,
- char *class, char *prop_class, picl_prophdl_t tblhdl,
- picl_nodehdl_t *sensorhdlp)
+ char *class, char *prop_class, picl_prophdl_t tblhdl,
+ picl_nodehdl_t *sensorhdlp)
{
int err;
@@ -2597,7 +2595,7 @@ add_sensor_node(picl_nodehdl_t fruhdl, picl_nodehdl_t lochdl, char *nodename,
if (err != PICL_SUCCESS)
return (err);
- if (fruhdl != NULL) {
+ if (fruhdl != 0) {
err = add_prop_ref(*sensorhdlp, fruhdl,
PICL_REFPROP_FRU_PARENT);
} else {
@@ -3226,7 +3224,7 @@ add_env_nodes(picl_nodehdl_t nodeh, char *nodename, picl_prophdl_t tblhdl)
* check if sensor node has already been created
*/
sprintf_buf3(buf, "%s_%s", nodename, id);
- if (find_child_by_name(sch, buf) != NULL)
+ if (find_child_by_name(sch, buf) != 0)
continue;
if (env->sd_id.id.sensor_type == SG_SENSOR_TYPE_COOLING) {
@@ -3267,7 +3265,7 @@ add_env_nodes(picl_nodehdl_t nodeh, char *nodename, picl_prophdl_t tblhdl)
childh = nodeh;
tblhdl2 = tblhdl;
}
- err = add_sensor_node(childh, NULL, buf,
+ err = add_sensor_node(childh, 0, buf,
hpu_sensor_class_table[env->sd_id.id.sensor_type],
hpu_sensor_prop_table[env->sd_id.id.sensor_type],
tblhdl2, &sensorhdl);
@@ -3627,10 +3625,10 @@ add_led_nodes(picl_nodehdl_t nodeh, char *name, int position,
if (position != lom_get_led.position)
continue;
if (position == LOM_LED_POSITION_LOCATION) {
- err = add_sensor_node(NULL, nodeh, buf, PICL_CLASS_LED,
+ err = add_sensor_node(0, nodeh, buf, PICL_CLASS_LED,
PICL_PROP_STATE, tblhdl, &sensorhdl);
} else {
- err = add_sensor_node(nodeh, NULL, buf, PICL_CLASS_LED,
+ err = add_sensor_node(nodeh, 0, buf, PICL_CLASS_LED,
PICL_PROP_STATE, tblhdl, &sensorhdl);
}
if (err != PICL_SUCCESS) {
@@ -3863,7 +3861,7 @@ update_disk_node(struct lw8_disk *diskp)
diskndh = find_child_by_name(slotndh, fruname);
err = ptree_get_node_by_path(diskp->d_plat_path, &devhdl);
if (err == PICL_SUCCESS) {
- if (diskndh != NULL)
+ if (diskndh != 0)
return;
err = ptree_create_and_add_node(slotndh, fruname,
PICL_CLASS_FRU, &diskndh);
@@ -3881,7 +3879,7 @@ update_disk_node(struct lw8_disk *diskp)
if (err != PICL_SUCCESS)
return;
} else {
- if (diskndh == NULL)
+ if (diskndh == 0)
return;
err = ptree_delete_node(diskndh);
if (err != PICL_SUCCESS)
diff --git a/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c b/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c
index 28adb31207..513f3d4ad4 100644
--- a/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c
+++ b/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c
@@ -894,19 +894,19 @@ find_child_by_name(picl_nodehdl_t parh, char *name)
err = ptree_get_propval_by_name(parh, PICL_PROP_CHILD,
&nodeh, sizeof (picl_nodehdl_t));
if (err != PICL_SUCCESS)
- return (NULL);
+ return (0);
for (;;) {
err = ptree_get_propval_by_name(nodeh, PICL_PROP_NAME, nodename,
sizeof (nodename));
if (err != PICL_SUCCESS)
- return (NULL);
+ return (0);
if (strcmp(name, nodename) == 0) {
return (nodeh);
}
err = ptree_get_propval_by_name(nodeh, PICL_PROP_PEER,
&nodeh, sizeof (picl_nodehdl_t));
if (err != PICL_SUCCESS)
- return (NULL);
+ return (0);
}
}
@@ -1241,7 +1241,7 @@ frudr_completion_handler(char *ename, void *earg, size_t size)
{
picl_nodehdl_t fruh;
picl_nodehdl_t parh;
- picl_nodehdl_t peerh = NULL;
+ picl_nodehdl_t peerh = 0;
char nodename[PICL_PROPNAMELEN_MAX] = { '\0' };
int err;
@@ -1250,10 +1250,10 @@ frudr_completion_handler(char *ename, void *earg, size_t size)
* now frudata has been notified that the node is to be
* removed, we can actually remove it
*/
- fruh = NULL;
+ fruh = 0;
(void) nvlist_lookup_uint64(earg,
PICLEVENTARG_FRUHANDLE, &fruh);
- if (fruh != NULL) {
+ if (fruh != 0) {
(void) ptree_get_propval_by_name(fruh, PICL_PROP_PEER,
&peerh, sizeof (peerh));
@@ -1301,7 +1301,7 @@ frudr_completion_handler(char *ename, void *earg, size_t size)
if ((sys_platform == PLAT_CHALUPA19) &&
(strncmp(nodename, FT_NAME, FT_NAME_LEN) == 0) &&
- (peerh != NULL)) {
+ (peerh != 0)) {
/*
* On Netra-440 platforms, a fan tray
* may contain 2 fans (F0 and F1) but
@@ -1337,7 +1337,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh)
ev_name = strdup(ename);
if (ev_name == NULL)
return;
- if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) {
+ if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) {
free(ev_name);
return;
}
@@ -1488,7 +1488,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie)
return;
}
- if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) {
+ if (nvlist_unpack((char *)earg, size, &nvlp, 0)) {
return;
}
@@ -1579,7 +1579,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie)
/*
* fru was there - but has gone away
*/
- post_frudr_event(PICL_FRU_REMOVED, NULL, fruh);
+ post_frudr_event(PICL_FRU_REMOVED, 0, fruh);
}
} else if (rmc_flag) {
/*
@@ -1589,7 +1589,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie)
*/
if (ptree_get_propval_by_name(locnodeh, PICL_PROP_CHILD,
&fruh, sizeof (picl_nodehdl_t)) != PICL_SUCCESS) {
- fruh = NULL;
+ fruh = 0;
}
post_frudr_event(PICL_FRU_ADDED, locnodeh, fruh);
} else {
@@ -1598,7 +1598,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie)
* if node already there, then just return
*/
childh = find_child_by_name(locnodeh, fru_name);
- if (childh != NULL) {
+ if (childh != 0) {
nvlist_free(nvlp);
return;
}
@@ -1641,7 +1641,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie)
/*
* now post event
*/
- post_frudr_event(PICL_FRU_ADDED, locnodeh, NULL);
+ post_frudr_event(PICL_FRU_ADDED, locnodeh, 0);
}
nvlist_free(nvlp);
}
@@ -1752,7 +1752,7 @@ frutree_evhandler(const char *ename, const void *earg, size_t size,
if (strcmp(ename, PICLEVENT_SYSEVENT_DEVICE_ADDED) != 0)
return;
- if (nvlist_unpack((char *)earg, size, &nvlp, NULL))
+ if (nvlist_unpack((char *)earg, size, &nvlp, 0))
return;
if (nvlist_lookup_string(nvlp, PICLEVENTARG_DATA_TYPE, &dtype)) {
@@ -1894,7 +1894,7 @@ set_led(char *name, char *ptr, char *value)
/*
* if no fru node, then turn led off
*/
- if (find_child_by_name(locnodeh, DISK_FRU_NAME) != NULL)
+ if (find_child_by_name(locnodeh, DISK_FRU_NAME) != 0)
value_ptr = value;
else
value_ptr = PICL_PROPVAL_OFF;
@@ -2344,7 +2344,7 @@ update_disk_node(char *fruname, char *devpath)
return;
}
diskndh = find_child_by_name(slotndh, DISK_FRU_NAME);
- if (diskndh == NULL) {
+ if (diskndh == 0) {
return;
}
err = ptree_get_node_by_path(devpath, &devhdl);
@@ -2491,16 +2491,14 @@ check_raid(int target)
static void *
disk_leds_thread(void *args)
{
- int c;
- int i;
+ int c;
+ int i;
char **disk_dev;
int fd;
devctl_hdl_t dhdl;
- int n_disks = 0,
- do_raid = 0,
- err = 0;
+ int n_disks = 0, do_raid = 0, err = 0;
uint_t statep = 0;
static char *mpxu_devs[] = {
diff --git a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c
index 538e156510..8ca5de7a7e 100644
--- a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c
+++ b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file contains the environmental PICL plug-in module.
*/
@@ -233,15 +231,15 @@ static int get_tach(ptree_rarg_t *parg, void *buf);
static int set_tach(ptree_warg_t *parg, const void *buf);
static int shutdown_override = 0;
-static int sensor_poll_interval = SENSORPOLL_INTERVAL;
+static int sensor_poll_interval = SENSORPOLL_INTERVAL;
static int warning_interval = WARNING_INTERVAL;
-static int shutdown_interval = SHUTDOWN_INTERVAL;
+static int shutdown_interval = SHUTDOWN_INTERVAL;
static int ovtemp_monitor = 1; /* enabled */
static int pm_monitor = 1; /* enabled */
static int mon_fanstat = 1; /* enabled */
-static int hwm_mode;
-static int hwm_tach_enable;
+static int hwm_mode;
+static int hwm_tach_enable;
static char shutdown_cmd[] = SHUTDOWN_CMD;
env_tuneable_t tuneables[] = {
@@ -901,7 +899,7 @@ envd_setup_sensors(void)
*/
if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE,
- &tmin) != -1) {
+ &tmin) != -1) {
sensorp->tmin = TMIN(tmin);
} else {
sensorp->tmin = -1;
@@ -1006,13 +1004,13 @@ updateadm_ranges(char *name, uchar_t cur_lpstate)
if (sysfd == -1) {
if (env_debug)
envd_log(LOG_ERR, ENV_ADM_OPEN_FAIL, hwm_devs[sys_id],
- errno, strerror(errno));
+ errno, strerror(errno));
return;
}
/* Read ADM default value only for the first time */
if (tsave == 0) {
if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE,
- &tsave) == -1) {
+ &tsave) == -1) {
if (env_debug)
envd_log(LOG_ERR,
"read tminrange ioctl failed");
@@ -1038,7 +1036,7 @@ updateadm_ranges(char *name, uchar_t cur_lpstate)
* ADM 1031 Tmin/Trange register need to be reprogrammed.
*/
tdata = ((fanctl->fan_ctl_pairs[cur_lpstate].tMin / TMIN_UNITS)
- << TMIN_SHIFT);
+ << TMIN_SHIFT);
/* Need to pack tRange in ADM bits 2:0 */
switch (fanctl->fan_ctl_pairs[cur_lpstate].tRange) {
case 5:
@@ -1112,13 +1110,13 @@ pmthr(void *args)
do {
if (env_debug) {
envd_log(LOG_INFO,
- "pmstate event:0x%x flags:%x comp:%d "
- "oldval:%d newval:%d path:%s\n",
- pmstate.event, pmstate.flags,
- pmstate.component,
- pmstate.old_level,
- pmstate.new_level,
- pmstate.physpath);
+ "pmstate event:0x%x flags:%x comp:%d "
+ "oldval:%d newval:%d path:%s\n",
+ pmstate.event, pmstate.flags,
+ pmstate.component,
+ pmstate.old_level,
+ pmstate.new_level,
+ pmstate.physpath);
}
cur_lpstate =
(pmstate.flags & PSC_ALL_LOWEST) ? 1 : 0;
@@ -1149,11 +1147,11 @@ pmthr(void *args)
*
* FAN ON
* Tmin
- * -------------------------------------------
+ * -------------------------------------------
*
- * FAN ON/OFF
+ * FAN ON/OFF
*
- * --------------------------------------------
+ * --------------------------------------------
* Tmin - Hysterisis
* FAN OFF
*
@@ -1303,13 +1301,13 @@ handle_overtemp_interrupt(int hwm_id)
if (env_debug)
envd_log(LOG_ERR,
- "sensor name %s, cur temp %d, "
- "HW %d LW %d SD %d LS %d\n",
- sensorp->name, temp,
- sensorp->es_ptr->high_warning,
- (int)sensorp->es_ptr->low_warning,
- sensorp->es_ptr->high_shutdown,
- (int)sensorp->es_ptr->low_shutdown);
+ "sensor name %s, cur temp %d, "
+ "HW %d LW %d SD %d LS %d\n",
+ sensorp->name, temp,
+ sensorp->es_ptr->high_warning,
+ (int)sensorp->es_ptr->low_warning,
+ sensorp->es_ptr->high_shutdown,
+ (int)sensorp->es_ptr->low_shutdown);
if (TEMP_IN_WARNING_RANGE(sensorp->cur_temp, sensorp)) {
/*
@@ -1484,7 +1482,7 @@ envd_setup(void)
* at least one sensor.
*/
if (envd_setup_sensors() <= 0) {
- return (NULL);
+ return (0);
}
/*
diff --git a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c
index 5310b2440b..df9bf69684 100644
--- a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c
+++ b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file contains code for setting up environmental related nodes
* and properties in the PICL tree.
@@ -87,15 +85,15 @@ typedef struct {
static sensor_node_t sensor_nodes[] = {
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
SENSOR_CPU_DIE, NULL,
- NULL, NULL, NULL},
+ 0, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
SENSOR_INT_AMB, NULL,
- NULL, NULL, NULL},
+ 0, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
SENSOR_SYS_IN, NULL,
- NULL, NULL, NULL}
+ 0, 0, 0}
};
#define NSENSORS (sizeof (sensor_nodes)/sizeof (sensor_nodes[0]))
@@ -106,7 +104,7 @@ static sensor_node_t sensor_nodes[] = {
typedef struct {
char *parent_path; /* parent node path */
char *fan_name; /* fan name */
- env_fan_t *fanp; /* fan information */
+ env_fan_t *fanp; /* fan information */
char *speed_unit; /* speed unit string */
picl_nodehdl_t nodeh; /* "fan" node handle */
picl_prophdl_t proph; /* "Speed" property handle */
@@ -118,13 +116,13 @@ typedef struct {
*/
static fan_node_t fan_nodes[] = {
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- ENV_CPU_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ ENV_CPU_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL},
+ ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0},
{"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c",
- ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}
+ ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}
};
#define NFANS (sizeof (fan_nodes)/sizeof (fan_nodes[0]))
@@ -141,7 +139,7 @@ static void delete_fan_nodes_and_props(void);
static int
get_current_temp(ptree_rarg_t *parg, void *buf)
{
- tempr_t temp;
+ tempr_t temp;
picl_prophdl_t proph;
sensor_node_t *snodep;
int i;
@@ -427,12 +425,12 @@ delete_sensor_nodes_and_props(void)
for (i = 0; i < NSENSORS; ++i) {
snodep = &sensor_nodes[i];
- if (snodep->nodeh != NULL) {
+ if (snodep->nodeh != 0) {
/* delete node and all properties under it */
(void) ptree_delete_node(snodep->nodeh);
(void) ptree_destroy_node(snodep->nodeh);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
}
}
}
@@ -553,10 +551,10 @@ delete_fan_nodes_and_props(void)
for (i = 0; i < NFANS; ++i) {
fnodep = &fan_nodes[i];
- if (fnodep->nodeh != NULL) {
+ if (fnodep->nodeh != 0) {
(void) ptree_delete_node(fnodep->nodeh);
(void) ptree_destroy_node(fnodep->nodeh);
- fnodep->nodeh = NULL;
+ fnodep->nodeh = 0;
}
}
}
@@ -723,9 +721,9 @@ env_picl_setup(void)
for (i = 0; i < NSENSORS; ++i) {
snodep = &sensor_nodes[i];
snodep->sensorp = sensor_lookup(snodep->sensor_name);
- snodep->nodeh = NULL;
- snodep->proph = NULL;
- snodep->target_proph = NULL;
+ snodep->nodeh = 0;
+ snodep->proph = 0;
+ snodep->target_proph = 0;
}
/*
@@ -734,8 +732,8 @@ env_picl_setup(void)
for (i = 0; i < NFANS; ++i) {
fnodep = &fan_nodes[i];
fnodep->fanp = fan_lookup(fnodep->fan_name);
- fnodep->nodeh = NULL;
- fnodep->proph = NULL;
+ fnodep->nodeh = 0;
+ fnodep->proph = 0;
}
/*
diff --git a/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c b/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c
index f02c7af356..08c203a7f7 100644
--- a/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c
+++ b/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c
@@ -112,7 +112,7 @@ dr_handler(const char *ename, const void *earg, size_t size, void *cookie)
return;
}
- if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) {
+ if (nvlist_unpack((char *)earg, size, &nvlp, 0)) {
return;
}
@@ -176,13 +176,13 @@ dsc_handler(const char *ename, const void *earg, size_t size, void *cookie)
* retrieve the device's physical path from the event arg
* and determine which disk (if any) we are working with
*/
- if (nvlist_unpack((char *)earg, size, &nvlp, NULL))
+ if (nvlist_unpack((char *)earg, size, &nvlp, 0))
return;
if (nvlist_lookup_string(nvlp, "devfs-path", &path))
return;
lookup.path = strdup(path);
- lookup.disk = NULL;
+ lookup.disk = 0;
lookup.result = DISK_NOT_FOUND;
status = ptree_walk_tree_by_class(root_node, "disk", (void *)&lookup,
@@ -218,7 +218,7 @@ signal_devtree(void)
size_t nvl_size;
int status;
- if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL) != 0)
+ if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0) != 0)
return;
/*
diff --git a/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c b/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c
index e70ea55d54..4d4e3233f4 100644
--- a/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c
+++ b/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c
@@ -192,12 +192,12 @@ check_raid(int target)
/*
* Ontario SBL event handler, subscribed to:
- * PICLEVENT_SYSEVENT_DEVICE_ADDED
- * PICLEVENT_SYSEVENT_DEVICE_REMOVED
+ * PICLEVENT_SYSEVENT_DEVICE_ADDED
+ * PICLEVENT_SYSEVENT_DEVICE_REMOVED
*/
static void
piclsbl_handler(const char *ename, const void *earg, size_t size,
- void *cookie)
+ void *cookie)
{
char *devfs_path;
char hdd_location[PICL_PROPNAMELEN_MAX];
@@ -236,7 +236,7 @@ piclsbl_handler(const char *ename, const void *earg, size_t size,
/*
* retrieve the device's physical path from the event payload
*/
- if (nvlist_unpack((char *)earg, size, &nvlp, NULL))
+ if (nvlist_unpack((char *)earg, size, &nvlp, 0))
goto sbl_return;
if (nvlist_lookup_string(nvlp, "devfs-path", &devfs_path))
goto sbl_return;
@@ -248,7 +248,7 @@ piclsbl_handler(const char *ename, const void *earg, size_t size,
* otherwise, return as it is not one of our disks.
*/
lookup.path = strdup(devfs_path);
- lookup.disk = NULL;
+ lookup.disk = 0;
lookup.result = DISK_NOT_FOUND;
/* first, find the disk */
@@ -315,7 +315,7 @@ piclsbl_handler(const char *ename, const void *earg, size_t size,
* populate the message for libpcp
*/
send_msg.msg_type = PCP_SBL_CONTROL;
- send_msg.sub_type = NULL;
+ send_msg.sub_type = 0;
send_msg.msg_len = sizeof (pcp_sbl_req_t);
send_msg.msg_data = (uint8_t *)req_ptr;
@@ -387,7 +387,7 @@ piclsbl_init(void)
return;
/* retrieve the root node for lookups in the event handler */
- if ((ptree_get_root(&root_node)) != NULL)
+ if ((ptree_get_root(&root_node)) != 0)
return;
/* load libpcp */
diff --git a/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c b/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c
index 7ef1bad438..13bf878af8 100644
--- a/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c
+++ b/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <pri.h>
#include "priplugin.h"
@@ -126,14 +124,14 @@ priplugin_init(void)
(void) mutex_init(&rebuild_lock, USYNC_THREAD, NULL);
(void) cond_init(&rebuild_cv, USYNC_THREAD, NULL);
- if ((status = thr_create(NULL, NULL, pri_worker_thread, NULL, THR_BOUND,
+ if ((status = thr_create(NULL, 0, pri_worker_thread, NULL, THR_BOUND,
&pri_worker_thread_id)) < 0) {
pri_debug(LOG_NOTICE, "priplugin: can't create worker thread: "
"%d\n", status);
all_thr_exit = B_TRUE;
(void) mutex_destroy(&rebuild_lock);
(void) cond_destroy(&rebuild_cv);
- } else if ((status = thr_create(NULL, NULL, pri_reader_thread, NULL,
+ } else if ((status = thr_create(NULL, 0, pri_reader_thread, NULL,
THR_BOUND, &pri_reader_thread_id)) < 0) {
pri_debug(LOG_NOTICE, "priplugin: can't create reader thread: "
"%d\n", status);
diff --git a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c
index 62e97e1a00..767c7f7514 100644
--- a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c
+++ b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c
@@ -332,7 +332,7 @@ snmpplugin_init(void)
* Create the tree-builder thread and let it take over
*/
LOGPRINTF("Tree-builder thread being created.\n");
- if ((ret = thr_create(NULL, NULL, tree_builder, NULL,
+ if ((ret = thr_create(NULL, 0, tree_builder, NULL,
THR_BOUND, &tree_builder_thr_id)) < 0) {
log_msg(LOG_ERR, SNMPP_CANT_CREATE_TREE_BUILDER, ret);
snmp_fini(hdl);
@@ -356,7 +356,7 @@ snmpplugin_init(void)
cache_refresh_thr_exit = B_FALSE;
LOGPRINTF("Cache refresher thread being created.\n");
- if (thr_create(NULL, NULL, cache_refresher, NULL, THR_BOUND,
+ if (thr_create(NULL, 0, cache_refresher, NULL, THR_BOUND,
&cache_refresh_thr_id) < 0) {
(void) cond_destroy(&cache_refresh_cv);
(void) mutex_destroy(&cache_refresh_lock);
@@ -489,8 +489,8 @@ tree_builder(void *arg)
return (NULL);
}
- old_physplat_root = NULL;
- physplat_root = NULL;
+ old_physplat_root = 0;
+ physplat_root = 0;
LOGPRINTF("tree_builder: getting root node\n");
if ((ret = ptree_get_root(&root_node)) != PICL_SUCCESS) {
@@ -514,7 +514,7 @@ tree_builder(void *arg)
return ((void *)-3);
}
- if (rv == PICL_SUCCESS && old_physplat_root != NULL) {
+ if (rv == PICL_SUCCESS && old_physplat_root != 0) {
LOGPRINTF("tree_builder: destroying existing nodes\n");
ptree_delete_node(old_physplat_root);
ptree_destroy_node(old_physplat_root);
@@ -705,7 +705,7 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
/*
* If we've already created this picl node, just return it
*/
- if ((nodeh = lookup_nodeh(row)) != NULL)
+ if ((nodeh = lookup_nodeh(row)) != 0)
return (nodeh);
/*
@@ -715,13 +715,13 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
*/
ret = snmp_get_int(hdl, OID_entPhysicalContainedIn, row,
&parent_row, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0 || parent_row <= 0)
parenth = subtree_root;
else {
parenth = make_node(subtree_root, parent_row, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
- if (parenth == NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
+ if (parenth == 0)
parenth = subtree_root;
}
@@ -732,49 +732,49 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
*/
ret = snmp_get_str(hdl, OID_entPhysicalName, row,
&phys_name, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0 || phys_name == NULL) {
log_msg(LOG_WARNING, SNMPP_NO_ENTPHYSNAME, row);
- return (NULL);
+ return (0);
}
node_name = basename(phys_name);
ret = snmp_get_int(hdl, OID_entPhysicalClass, row,
&ent_physclass, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0) {
log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL,
*snmp_syserr_p ? *snmp_syserr_p : ret,
OID_entPhysicalClass, row);
free(phys_name);
- return (NULL);
+ return (0);
}
switch (ent_physclass) {
case SPC_OTHER:
ret = snmp_get_int(hdl, OID_sunPlatPhysicalClass, row,
&sunplat_physclass, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0) {
log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL,
*snmp_syserr_p ? *snmp_syserr_p : ret,
OID_sunPlatPhysicalClass, row);
free(phys_name);
- return (NULL);
+ return (0);
}
if (sunplat_physclass == SSPC_ALARM) {
ret = snmp_get_int(hdl, OID_sunPlatAlarmType,
row, &alarm_type, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0) {
log_msg(LOG_WARNING,
SNMPP_CANT_FETCH_OBJECT_VAL,
*snmp_syserr_p ? *snmp_syserr_p : ret,
OID_sunPlatAlarmType, row);
free(phys_name);
- return (NULL);
+ return (0);
}
if (alarm_type == SSAT_VISIBLE) {
@@ -785,14 +785,14 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
add_prop(nodeh, &proph, node_name, row, PP_STATE,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
} else {
ADD_NODE(PICL_CLASS_OTHER)
}
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
break;
case SPC_UNKNOWN:
@@ -803,14 +803,14 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
ADD_NODE(PICL_CLASS_CHASSIS)
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
break;
case SPC_BACKPLANE:
ADD_NODE(PICL_CLASS_BACKPLANE)
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
break;
case SPC_CONTAINER:
@@ -818,66 +818,66 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_SLOT_TYPE,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
break;
case SPC_POWERSUPPLY:
ret = snmp_get_int(hdl, OID_sunPlatPowerSupplyClass,
row, &ps_class, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0) {
log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL,
*snmp_syserr_p ? *snmp_syserr_p : ret,
OID_sunPlatPowerSupplyClass, row);
free(phys_name);
- return (NULL);
+ return (0);
}
if (ps_class == SSPSC_BATTERY) {
ADD_NODE(PICL_CLASS_BATTERY)
add_prop(nodeh, &proph, node_name, row,
PP_BATT_STATUS, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
} else {
ADD_NODE(PICL_CLASS_POWERSUPPLY)
}
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
break;
case SPC_FAN:
ADD_NODE(PICL_CLASS_FAN)
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
break;
case SPC_SENSOR:
ret = snmp_get_int(hdl, OID_sunPlatSensorClass,
row, &sensor_class, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0) {
log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL,
*snmp_syserr_p ? *snmp_syserr_p : ret,
OID_sunPlatSensorClass, row);
free(phys_name);
- return (NULL);
+ return (0);
}
ret = snmp_get_int(hdl, OID_sunPlatSensorType,
row, &sensor_type, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
if (ret < 0) {
log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL,
*snmp_syserr_p ? *snmp_syserr_p : ret,
OID_sunPlatSensorType, row);
free(phys_name);
- return (NULL);
+ return (0);
}
if (sensor_class == SSSC_NUMERIC) {
@@ -902,26 +902,26 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
add_prop(nodeh, &proph, node_name, row,
PP_SENSOR_VALUE, snmp_syserr_p);
}
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row,
PP_OPSTATUS, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row,
PP_BASE_UNITS, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row,
PP_EXPONENT, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row,
PP_RATE_UNITS, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_thresholds(nodeh, row, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
} else if (sensor_class == SSSC_BINARY) {
if (sensor_type == SSST_TEMPERATURE) {
@@ -940,19 +940,19 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_CONDITION,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_EXPECTED,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
} else {
log_msg(LOG_ERR,
SNMPP_UNSUPP_SENSOR_CLASS, sensor_class, row);
- return (NULL);
+ return (0);
}
break;
@@ -961,15 +961,15 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_REPLACEABLE,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_HOTSWAPPABLE,
snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
break;
case SPC_PORT:
@@ -984,32 +984,32 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p)
log_msg(LOG_WARNING,
SNMPP_UNKNOWN_ENTPHYSCLASS, ent_physclass, row);
free(phys_name);
- return (NULL);
+ return (0);
}
add_prop(nodeh, &proph, node_name, row, PP_DESCRIPTION, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_LABEL, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_HW_REVISION, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_FW_REVISION, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_SERIAL_NUM, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_MFG_NAME, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_MODEL_NAME, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
add_prop(nodeh, &proph, node_name, row, PP_IS_FRU, snmp_syserr_p);
- CHECK_LINKRESET(snmp_syserr_p, NULL)
+ CHECK_LINKRESET(snmp_syserr_p, 0)
free(phys_name);
save_nodeh(nodeh, row);
@@ -1057,7 +1057,7 @@ static picl_nodehdl_t
lookup_nodeh(int row)
{
if (row >= n_physplat_nodes)
- return (NULL);
+ return (0);
return (physplat_nodes[row]);
}
diff --git a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h
index 8bd7d87db1..6454552b7a 100644
--- a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h
+++ b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h
@@ -71,7 +71,7 @@ typedef struct {
if (ptree_create_and_add_node(parenth, node_name, cl, \
&nodeh) != PICL_SUCCESS) { \
log_msg(LOG_ERR, SNMPP_ADD_NODE_FAIL, node_name, cl); \
- return (NULL); \
+ return (0); \
} \
}