summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/luxadm/fabric_conf.c70
-rw-r--r--usr/src/cmd/luxadm/lux_util.c31
2 files changed, 45 insertions, 56 deletions
diff --git a/usr/src/cmd/luxadm/fabric_conf.c b/usr/src/cmd/luxadm/fabric_conf.c
index 2a7611f319..4903979f19 100644
--- a/usr/src/cmd/luxadm/fabric_conf.c
+++ b/usr/src/cmd/luxadm/fabric_conf.c
@@ -68,12 +68,11 @@ log_error(char *msg_id, char *input_tmplt, ...)
va_end(ap);
merged_msg = (char *)malloc(strlen(msg_template) +
- strlen(input_merged_msg) +
- strlen(msg_id) + 1);
+ strlen(input_merged_msg) +
+ strlen(msg_id) + 1);
if (merged_msg == NULL) {
- syslog(LOG_ERR,
- "ID[luxadm.create_fabric_device.2317] "
- "malloc failure, %s", strerror(errno));
+ syslog(LOG_ERR, "ID[luxadm.create_fabric_device.2317] "
+ "malloc failure, %s", strerror(errno));
} else {
sprintf(merged_msg, msg_template, msg_id, input_merged_msg);
/* first insert msg_id */
@@ -101,10 +100,10 @@ read_repos_file(char *repos_filename)
unsigned int filesize;
unsigned int bytes_read;
- if (repos_filename == NULL || *repos_filename == NULL) {
+ if (repos_filename == NULL || *repos_filename == '\0') {
log_error("2310",
- "filename missing for -f option of "
- "luxadm -e create_fabric_device");
+ "filename missing for -f option of "
+ "luxadm -e create_fabric_device");
return (-1);
}
@@ -112,26 +111,24 @@ read_repos_file(char *repos_filename)
if (fd == -1) {
log_error("2311",
- "fopen failed: cannot open repository file %s. %d",
- repos_filename, strerror(errno));
+ "fopen failed: cannot open repository file %s. %d",
+ repos_filename, strerror(errno));
return (-1);
}
if (fstat(fd, &stbuf) == -1) {
close(fd);
- log_error("2312",
- "stat failed on file %s. %s",
- repos_filename, strerror(errno));
+ log_error("2312", "stat failed on file %s. %s",
+ repos_filename, strerror(errno));
return (-1);
}
filesize = stbuf.st_size;
tmp_ptr = mmap_ptr = mmap((caddr_t)0, filesize,
- (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0);
+ (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0);
if (mmap_ptr == MAP_FAILED) {
- log_error("2315",
- "Failed to mmap file %s. %s",
- repos_filename, strerror(errno));
+ log_error("2315", "Failed to mmap file %s. %s",
+ repos_filename, strerror(errno));
return (-1);
}
@@ -143,7 +140,7 @@ read_repos_file(char *repos_filename)
tmp_ptr++;
}
if (*tmp_ptr == '\n') {
- *tmp_ptr = NULL;
+ *tmp_ptr = '\0';
tmp_ptr++;
bytes_read++;
}
@@ -184,22 +181,21 @@ parse_line(char *line, char *path, char *wwn, char *filename)
line_copy = strdup(line);
if (line_copy == NULL) {
- log_error("2317",
- "malloc failure, %s", strerror(errno));
+ log_error("2317", "malloc failure, %s", strerror(errno));
}
p_path = line_copy;
p_delim = strstr(p_path, WWN_DELIM);
if (p_delim == NULL) {
log_error("2313",
- "Invalid line (%s) in file %s.", line, filename);
+ "Invalid line (%s) in file %s.", line, filename);
free(line_copy);
return (-1);
}
- *p_delim = NULL; /* NULL terminate path */
+ *p_delim = '\0'; /* NULL terminate path */
if (strlcpy(path, p_path, MAXPATHLEN) >= MAXPATHLEN) {
log_error("2318",
- "Path too long (%s) in file %s.", p_path, filename);
+ "Path too long (%s) in file %s.", p_path, filename);
free(line_copy);
return (-1);
}
@@ -215,12 +211,12 @@ parse_line(char *line, char *path, char *wwn, char *filename)
p_delim = strchr(p_wwn, ' ');
if (p_delim != NULL) {
/* now p_delim points to blank */
- *p_delim = NULL; /* terminate wwn at delim */
+ *p_delim = '\0'; /* terminate wwn at delim */
} else {
char *p_last_char;
p_last_char = p_wwn+strlen(p_wwn)-1;
if (*p_last_char == '\n') {
- *p_last_char = NULL;
+ *p_last_char = '\0';
}
}
strcpy(wwn, p_wwn);
@@ -280,7 +276,7 @@ string_to_wwn(const uchar_t *string, uchar_t *port_wwn)
static int
create_ap_instance(char *ap_id, char *wwn_string,
- char *filename, char *line)
+ char *filename, char *line)
{
devctl_hdl_t bus_handle, dev_handle;
devctl_ddef_t ddef_handle;
@@ -290,9 +286,8 @@ create_ap_instance(char *ap_id, char *wwn_string,
ddef_handle = devctl_ddef_alloc("dummy", 0);
if (ddef_handle == NULL) {
log_error("2314",
- "Internal error to process line (%s) "
- "in file: %s. %s",
- line, filename, strerror(errno));
+ "Internal error to process line (%s) in file: %s. %s",
+ line, filename, strerror(errno));
return (-1);
}
/*
@@ -301,21 +296,19 @@ create_ap_instance(char *ap_id, char *wwn_string,
*/
if (string_to_wwn((uchar_t *)wwn_string, wwn_array) != 0) {
log_error("2314",
- "Internal error to process line (%s) "
- "in file: %s. %s",
- line, filename, strerror(errno));
+ "Internal error to process line (%s) in file: %s. %s",
+ line, filename, strerror(errno));
devctl_ddef_free(ddef_handle);
return (-1);
}
(void) devctl_ddef_byte_array(ddef_handle,
- "port-wwn", FC_WWN_SIZE, wwn_array);
+ "port-wwn", FC_WWN_SIZE, wwn_array);
if ((bus_handle = devctl_bus_acquire(ap_id, 0)) == NULL) {
devctl_ddef_free(ddef_handle);
log_error("2314",
- "Internal error to process line (%s) "
- "in file: %s. %s",
- line, filename, strerror(errno));
+ "Internal error to process line (%s) in file: %s. %s",
+ line, filename, strerror(errno));
return (-1);
}
if (ret =
@@ -323,9 +316,8 @@ create_ap_instance(char *ap_id, char *wwn_string,
devctl_ddef_free(ddef_handle);
devctl_release(bus_handle);
log_error("2316",
- "configuration failed for line (%s) "
- "in file: %s. %s",
- line, filename, strerror(errno));
+ "configuration failed for line (%s) in file: %s. %s",
+ line, filename, strerror(errno));
return (-1);
}
devctl_release(dev_handle);
diff --git a/usr/src/cmd/luxadm/lux_util.c b/usr/src/cmd/luxadm/lux_util.c
index 3c731383e1..ac408704c5 100644
--- a/usr/src/cmd/luxadm/lux_util.c
+++ b/usr/src/cmd/luxadm/lux_util.c
@@ -281,7 +281,7 @@ scsi_find_command_name(int cmd)
static void
scsi_printerr(struct uscsi_cmd *ucmd, struct scsi_extended_sense *rq,
- int rqlen, char msg_string[], char *err_string)
+ int rqlen, char msg_string[], char *err_string)
{
int blkno;
@@ -608,11 +608,8 @@ retry:
* page_code = Pages to return
*/
int
-scsi_mode_sense_cmd(int fd,
- uchar_t *buf_ptr,
- int buf_len,
- uchar_t pc,
- uchar_t page_code)
+scsi_mode_sense_cmd(int fd, uchar_t *buf_ptr, int buf_len, uchar_t pc,
+ uchar_t page_code)
{
struct uscsi_cmd ucmd;
/* 10 byte Mode Select cmd */
@@ -716,7 +713,7 @@ scsi_reserve(char *path)
*/
void
print_fabric_dtype_prop(uchar_t *hba_port_wwn, uchar_t *port_wwn,
- uchar_t dtype_prop)
+ uchar_t dtype_prop)
{
if ((dtype_prop & DTYPE_MASK) < 0x10) {
(void) fprintf(stdout, " 0x%-2x (%s)\n",
@@ -914,7 +911,7 @@ print_inq_data(char *arg_path, char *path, L_inquiry inq, uchar_t *serial,
(void) fprintf(stdout, ")\n");
(void) fprintf(stdout, "%s", *p++);
- if (inq.inq_rmb != NULL) {
+ if (inq.inq_rmb != 0) {
(void) fprintf(stdout, MSGSTR(40, "yes"));
} else {
(void) fprintf(stdout, MSGSTR(45, "no"));
@@ -923,7 +920,7 @@ print_inq_data(char *arg_path, char *path, L_inquiry inq, uchar_t *serial,
if (scsi_3) {
(void) fprintf(stdout, "%s", *p++);
- if (inq.inq_mchngr != NULL) {
+ if (inq.inq_mchngr != 0) {
(void) fprintf(stdout, MSGSTR(40, "yes"));
} else {
(void) fprintf(stdout, MSGSTR(45, "no"));
@@ -950,7 +947,7 @@ print_inq_data(char *arg_path, char *path, L_inquiry inq, uchar_t *serial,
}
if (scsi_3) {
(void) fprintf(stdout, "%s", *p++);
- if (inq.inq_normaca != NULL) {
+ if (inq.inq_normaca != 0) {
(void) fprintf(stdout, MSGSTR(40, "yes"));
} else {
(void) fprintf(stdout, MSGSTR(45, "no"));
@@ -968,7 +965,7 @@ print_inq_data(char *arg_path, char *path, L_inquiry inq, uchar_t *serial,
(void) fprintf(stdout, "%s0x%x\n", *p++, inq.inq_len);
if (scsi_3) {
if (inq.inq_dual_p) {
- if (inq.inq_port != NULL) {
+ if (inq.inq_port != 0) {
(void) fprintf(stdout, MSGSTR(2187,
"%sa\n"), *p++);
} else {
@@ -1029,7 +1026,7 @@ print_inq_data(char *arg_path, char *path, L_inquiry inq, uchar_t *serial,
if (scsi_3) {
(void) fprintf(stdout, "%s", *p++);
- if (inq.ui.inq_3.inq_trandis != NULL) {
+ if (inq.ui.inq_3.inq_trandis != 0) {
(void) fprintf(stdout, MSGSTR(40, "yes"));
} else {
(void) fprintf(stdout, MSGSTR(45, "no"));
@@ -1362,19 +1359,19 @@ get_scsi_vhci_pathinfo(char *dev_path, sv_iocdata_t *ioc, int *path_count)
int fd;
int initial_path_count;
int current_path_count;
- int i;
+ int i;
char *delimiter;
int malloc_error = 0;
- int prop_buf_size;
+ int prop_buf_size;
int pathlist_retry_count = 0;
- if (strncmp(dev_path, SCSI_VHCI, strlen(SCSI_VHCI)) != NULL) {
+ if (strncmp(dev_path, SCSI_VHCI, strlen(SCSI_VHCI)) != 0) {
if ((physical_path = get_slash_devices_from_osDevName(
dev_path, STANDARD_DEVNAME_HANDLING)) == NULL) {
return (L_INVALID_PATH);
}
if (strncmp(physical_path, SCSI_VHCI,
- strlen(SCSI_VHCI)) != NULL) {
+ strlen(SCSI_VHCI)) != 0) {
free(physical_path);
return (L_INVALID_PATH);
}
@@ -1392,7 +1389,7 @@ get_scsi_vhci_pathinfo(char *dev_path, sv_iocdata_t *ioc, int *path_count)
delimiter = strrchr(physical_path, ':');
/* if we didn't find the ':' fine, else truncate */
if (delimiter != NULL) {
- *delimiter = NULL;
+ *delimiter = '\0';
}
/*