561 Strange characters when executing "format"
Reviewed by: Gordon Ross <
[email protected]>
Reviewed by: Garrett D'Amore <
[email protected]>
Reviewed by: Jason King <
[email protected]>
Approved by: Eric Schrock <
[email protected]>
--- a/usr/src/cmd/format/auto_sense.c Wed Jul 27 07:13:44 2011 -0700
+++ b/usr/src/cmd/format/auto_sense.c Fri Jul 29 14:40:45 2011 -0700
@@ -19,6 +19,8 @@
* CDDL HEADER END
*/
/*
+ * Copyright (c) 2011 Gary Mills
+ *
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -220,9 +222,6 @@
static char *get_sun_disk_name(
char *disk_name,
struct scsi_inquiry *inquiry);
-static char *get_generic_disk_name(
- char *disk_name,
- struct scsi_inquiry *inquiry);
static char *strcopy(
char *dst,
char *src,
@@ -2081,7 +2080,7 @@
}
-static char *
+char *
get_generic_disk_name(
char *disk_name,
struct scsi_inquiry *inquiry)
--- a/usr/src/cmd/format/auto_sense.h Wed Jul 27 07:13:44 2011 -0700
+++ b/usr/src/cmd/format/auto_sense.h Fri Jul 29 14:40:45 2011 -0700
@@ -19,6 +19,8 @@
* CDDL HEADER END
*/
/*
+ * Copyright (c) 2011 Gary Mills
+ *
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -26,12 +28,11 @@
#ifndef _AUTO_SENSE_H
#define _AUTO_SENSE_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
+struct scsi_inquiry; /* anonymous struct */
#ifdef __STDC__
/*
@@ -53,12 +54,16 @@
struct disk_type *disk_type);
struct disk_type *auto_direct_get_geom_label(int fd, struct dk_label *label);
+char *get_generic_disk_name(
+ char *disk_name,
+ struct scsi_inquiry *inquiry);
#else
struct disk_type *auto_sense();
struct disk_type *auto_efi_sense();
int build_default_partition();
struct disk_type *auto_direct_get_geom_label();
+char *get_generic_disk_name();
#endif /* __STDC__ */
--- a/usr/src/cmd/format/startup.c Wed Jul 27 07:13:44 2011 -0700
+++ b/usr/src/cmd/format/startup.c Fri Jul 29 14:40:45 2011 -0700
@@ -19,6 +19,8 @@
* CDDL HEADER END
*/
/*
+ * Copyright (c) 2011 Gary Mills
+ *
* Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
*/
@@ -1545,23 +1547,15 @@
get_disk_name(int fd, char *disk_name)
{
struct scsi_inquiry inquiry;
- char *p;
if (uscsi_inquiry(fd, (char *)&inquiry, sizeof (inquiry))) {
- err_print("Failed to inquiry this logical disk");
+ if (option_msg)
+ err_print("\nInquiry failed - %s\n", strerror(errno));
+ (void) strcpy(disk_name, "Unknown-Unknown-0001");
return;
}
- p = disk_name;
- (void) memset(p, 0, MAXNAMELEN);
-
- (void) strncpy(p, inquiry.inq_vid, sizeof (inquiry.inq_vid));
- p += sizeof (inquiry.inq_vid) - 1;
- *p++ = '-';
- p = strncpy(p, inquiry.inq_pid, sizeof (inquiry.inq_pid));
- p += sizeof (inquiry.inq_pid) - 1;
- *p++ = '-';
- p = strncpy(p, inquiry.inq_revision, sizeof (inquiry.inq_revision));
+ (void) get_generic_disk_name(disk_name, &inquiry);
}
/*