summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-05-22 10:19:49 +0300
committerToomas Soome <tsoome@me.com>2021-03-12 08:58:49 +0200
commita11d78d661ddb4b26a53fad39aba982d2bb5a63b (patch)
tree228b34535ccfed9d751b35589874e3c6dedf74d3
parente0dfa398a76c38cdf3380b38117ee2d1ed3249f0 (diff)
downloadillumos-joyent-a11d78d661ddb4b26a53fad39aba982d2bb5a63b.tar.gz
13531 format: multiply-defined symbols
Reviewed by: C Fraire <cfraire@me.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/format/ctlr_ata.c25
-rw-r--r--usr/src/cmd/format/ctlr_ata.h29
-rw-r--r--usr/src/cmd/format/global.h94
-rw-r--r--usr/src/cmd/format/main.c30
-rw-r--r--usr/src/cmd/format/menu_command.c1
-rw-r--r--usr/src/cmd/format/menu_fdisk.c2
-rw-r--r--usr/src/cmd/format/startup.c74
7 files changed, 132 insertions, 123 deletions
diff --git a/usr/src/cmd/format/ctlr_ata.c b/usr/src/cmd/format/ctlr_ata.c
index c8f982d71b..e41c8e5580 100644
--- a/usr/src/cmd/format/ctlr_ata.c
+++ b/usr/src/cmd/format/ctlr_ata.c
@@ -56,25 +56,18 @@
#include "menu_fdisk.h"
+diskaddr_t altsec_offset;
+
int wr_altsctr();
int read_altsctr();
int updatebadsec();
-#ifdef __STDC__
static int ata_ck_format(void);
#ifdef i386
static int ata_ex_cur(struct defect_list *);
static int ata_wr_cur(struct defect_list *);
static int ata_repair(diskaddr_t, int);
#endif /* i386 */
-#else /* __STDC__ */
-static int ata_ck_format();
-#ifdef i386
-static int ata_ex_cur();
-static int ata_wr_cur();
-static int ata_repair();
-#endif /* i386 */
-#endif
struct ctlr_ops ataops = {
#if defined(sparc)
@@ -138,15 +131,9 @@ static char *dadkrawioerrs[] = {
};
/*ARGSUSED6*/
-#if defined(i386)
-int
-ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
- int flags, int *xfercntp)
-#else /* defined(i386) */
-static int
+_STATIC int
ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
- int flags, int *xfercntp)
-#endif /* defined(i386) */
+ int flags, int *xfercntp)
{
int tmpsec;
struct dadkio_rwcmd dadkio_rwcmd;
@@ -159,7 +146,7 @@ ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
/* Doing raw read */
dadkio_rwcmd.cmd = (dir == DIR_READ) ? DADKIO_RWCMD_READ :
- DADKIO_RWCMD_WRITE;
+ DADKIO_RWCMD_WRITE;
dadkio_rwcmd.blkaddr = blkno;
dadkio_rwcmd.buflen = tmpsec;
dadkio_rwcmd.flags = flags;
@@ -204,7 +191,7 @@ ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
if (dadkio_rwcmd.status.status) {
if ((flags & F_SILENT) == 0)
err_print(dadkrawioerrs[dadkio_rwcmd.status.status],
- dadkio_rwcmd.status.failed_blk);
+ dadkio_rwcmd.status.failed_blk);
return (1);
}
return (0);
diff --git a/usr/src/cmd/format/ctlr_ata.h b/usr/src/cmd/format/ctlr_ata.h
index 38e3fcdc10..dc1b5d4c87 100644
--- a/usr/src/cmd/format/ctlr_ata.h
+++ b/usr/src/cmd/format/ctlr_ata.h
@@ -46,43 +46,26 @@ extern "C" {
#define TRIPLET(u, m, l) ((int)((((u))&0xff<<16) + \
(((m)&0xff)<<8) + (l&0xff)))
#if defined(i386)
-diskaddr_t altsec_offset; /* Alternate sector offset */
+extern diskaddr_t altsec_offset; /* Alternate sector offset */
#endif /* defined(i386) */
-#ifdef __STDC__
/*
* Local prototypes for ANSI C compilers
*/
#if defined(i386)
-int ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
-#else /* defined(i386) */
-static int ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
+#define _STATIC
+#else
+#define _STATIC static
#endif /* defined(i386) */
+_STATIC int ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
+
int ata_ex_man(struct defect_list *);
int ata_ex_grown(struct defect_list *);
int ata_read_defect_data(struct defect_list *, int);
int apply_chg_list(int, int, uchar_t *, uchar_t *, struct chg_list *);
-#else /* ! _STDC_ */
-
-#if defined(i386)
-int ata_rdwr();
-int ata_ex_cur();
-#else /* defined(i386) */
-static int ata_rdwr();
-static int ata_ex_cur();
-#endif /* defined(i386) */
-
-int ata_ck_format();
-int ata_ex_man();
-int ata_ex_grown();
-int ata_read_defect_data();
-int apply_chg_list();
-
-#endif /* __STDC__ */
-
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/cmd/format/global.h b/usr/src/cmd/format/global.h
index 5163ac9e2a..ad8c80699e 100644
--- a/usr/src/cmd/format/global.h
+++ b/usr/src/cmd/format/global.h
@@ -76,67 +76,67 @@ extern "C" {
/*
* These declarations are global state variables.
*/
-struct disk_info *disk_list; /* list of found disks */
-struct ctlr_info *ctlr_list; /* list of found ctlrs */
-char cur_menu; /* current menu level */
-char last_menu; /* last menu level */
-char option_msg; /* extended message options */
-char diag_msg; /* extended diagnostic msgs */
-char option_s; /* silent mode option */
-char *option_f; /* input redirect option */
-char *option_l; /* log file option */
-FILE *log_file; /* log file pointer */
-char *option_d; /* forced disk option */
-char *option_t; /* forced disk type option */
-char *option_p; /* forced partition table option */
-char *option_x; /* data file redirection option */
-FILE *data_file; /* data file pointer */
-char *file_name; /* current data file name */
+extern struct disk_info *disk_list; /* list of found disks */
+extern struct ctlr_info *ctlr_list; /* list of found ctlrs */
+extern char cur_menu; /* current menu level */
+extern char last_menu; /* last menu level */
+extern char option_msg; /* extended message options */
+extern char diag_msg; /* extended diagnostic msgs */
+extern char option_s; /* silent mode option */
+extern char *option_f; /* input redirect option */
+extern char *option_l; /* log file option */
+extern FILE *log_file; /* log file pointer */
+extern char *option_d; /* forced disk option */
+extern char *option_t; /* forced disk type option */
+extern char *option_p; /* forced partition table option */
+extern char *option_x; /* data file redirection option */
+extern FILE *data_file; /* data file pointer */
+extern char *file_name; /* current data file name */
/* for useful error messages */
-int expert_mode; /* enable for expert mode */
+extern int expert_mode; /* enable for expert mode */
/* commands */
-int need_newline; /* for correctly formatted output */
-int dev_expert; /* enable for developer mode */
+extern int need_newline; /* for correctly formatted output */
+extern int dev_expert; /* enable for developer mode */
/* commands */
/*
* These declarations are used for quick access to information about
* the disk being worked on.
*/
-int cur_file; /* file descriptor for current disk */
-int cur_flags; /* flags for current disk */
-int cur_label; /* current label type */
-uint_t cur_blksz; /* currect disk block size */
-struct disk_info *cur_disk; /* current disk */
-struct disk_type *cur_dtype; /* current dtype */
-struct ctlr_info *cur_ctlr; /* current ctlr */
-struct ctlr_type *cur_ctype; /* current ctype */
-struct ctlr_ops *cur_ops; /* current ctlr's ops vector */
-struct partition_info *cur_parts; /* current disk's partitioning */
-struct defect_list cur_list; /* current disk's defect list */
-void *cur_buf; /* current disk's I/O buffer */
-void *pattern_buf; /* current disk's pattern buffer */
-uint_t pcyl; /* # physical cyls */
-uint_t ncyl; /* # data cyls */
-uint_t acyl; /* # alt cyls */
-uint_t nhead; /* # heads */
-uint_t phead; /* # physical heads */
-uint_t nsect; /* # data sects/track */
-uint_t psect; /* # physical sects/track */
-uint_t apc; /* # alternates/cyl */
-uint_t solaris_offset; /* Solaris offset, this value is zero */
+extern int cur_file; /* file descriptor for current disk */
+extern int cur_flags; /* flags for current disk */
+extern int cur_label; /* current label type */
+extern uint_t cur_blksz; /* currect disk block size */
+extern struct disk_info *cur_disk; /* current disk */
+extern struct disk_type *cur_dtype; /* current dtype */
+extern struct ctlr_info *cur_ctlr; /* current ctlr */
+extern struct ctlr_type *cur_ctype; /* current ctype */
+extern struct ctlr_ops *cur_ops; /* current ctlr's ops vector */
+extern struct partition_info *cur_parts; /* current disk's partitioning */
+extern struct defect_list cur_list; /* current disk's defect list */
+extern void *cur_buf; /* current disk's I/O buffer */
+extern void *pattern_buf; /* current disk's pattern buffer */
+extern uint_t pcyl; /* # physical cyls */
+extern uint_t ncyl; /* # data cyls */
+extern uint_t acyl; /* # alt cyls */
+extern uint_t nhead; /* # heads */
+extern uint_t phead; /* # physical heads */
+extern uint_t nsect; /* # data sects/track */
+extern uint_t psect; /* # physical sects/track */
+extern uint_t apc; /* # alternates/cyl */
+extern uint_t solaris_offset; /* Solaris offset, this value is zero */
/* for non-fdisk machines. */
-int prot_type; /* protection type to format disk */
+extern int prot_type; /* protection type to format disk */
#if defined(_SUNOS_VTOC_16)
-uint_t bcyl; /* # other cyls */
+extern uint_t bcyl; /* # other cyls */
#endif /* defined(_SUNOS_VTOC_16) */
-struct mboot boot_sec; /* fdisk partition info */
-uint_t xstart; /* solaris partition start */
-char x86_devname[MAXNAMELEN]; /* saved device name for fdisk */
+extern struct mboot boot_sec; /* fdisk partition info */
+extern uint_t xstart; /* solaris partition start */
+extern char x86_devname[MAXNAMELEN]; /* saved device name for fdisk */
/* information accesses */
-struct mctlr_list *controlp; /* master controller list ptr */
+extern struct mctlr_list *controlp; /* master controller list ptr */
/*
diff --git a/usr/src/cmd/format/main.c b/usr/src/cmd/format/main.c
index 489b1b88e5..bcf45e276b 100644
--- a/usr/src/cmd/format/main.c
+++ b/usr/src/cmd/format/main.c
@@ -56,6 +56,31 @@
#include "label.h"
extern struct menu_item menu_command[];
+uint_t apc;
+uint_t solaris_offset;
+char cur_menu;
+char last_menu;
+void *pattern_buf;
+FILE *log_file;
+void *cur_buf;
+struct disk_info *cur_disk;
+struct ctlr_ops *cur_ops;
+struct ctlr_info *cur_ctlr;
+struct ctlr_type *cur_ctype;
+struct disk_type *cur_dtype;
+struct partition_info *cur_parts;
+struct defect_list cur_list;
+int cur_file;
+int cur_flags;
+int cur_label;
+uint_t pcyl;
+uint_t ncyl;
+uint_t acyl;
+uint_t bcyl;
+uint_t nhead;
+uint_t phead;
+uint_t nsect;
+uint_t psect;
#ifdef __STDC__
@@ -326,8 +351,7 @@ main(int argc, char *argv[])
* disk wasn't labeled at boot time.
*/
void
-init_globals(disk)
- struct disk_info *disk;
+init_globals(struct disk_info *disk)
{
int status;
int found_mount;
@@ -374,7 +398,7 @@ init_globals(disk)
* Open a file for the new disk.
*/
if ((cur_file = open_disk(cur_disk->disk_path,
- O_RDWR | O_NDELAY)) < 0) {
+ O_RDWR | O_NDELAY)) < 0) {
err_print(
"Error: can't open selected disk '%s'.\n", cur_disk->disk_name);
fullabort();
diff --git a/usr/src/cmd/format/menu_command.c b/usr/src/cmd/format/menu_command.c
index 05a359b158..ff8c627b9d 100644
--- a/usr/src/cmd/format/menu_command.c
+++ b/usr/src/cmd/format/menu_command.c
@@ -67,6 +67,7 @@
extern struct menu_item menu_partition[];
extern struct menu_item menu_analyze[];
extern struct menu_item menu_defect[];
+int prot_type;
/*
* Choices for the p_tag vtoc field
diff --git a/usr/src/cmd/format/menu_fdisk.c b/usr/src/cmd/format/menu_fdisk.c
index 317954221f..40e06c4711 100644
--- a/usr/src/cmd/format/menu_fdisk.c
+++ b/usr/src/cmd/format/menu_fdisk.c
@@ -61,6 +61,8 @@
#include "auto_sense.h"
extern struct menu_item menu_fdisk[];
+struct mboot boot_sec;
+uint_t xstart;
/*
* Byte swapping macros for accessing struct ipart
diff --git a/usr/src/cmd/format/startup.c b/usr/src/cmd/format/startup.c
index ba71cd8bbc..07d46a6bab 100644
--- a/usr/src/cmd/format/startup.c
+++ b/usr/src/cmd/format/startup.c
@@ -62,6 +62,26 @@ extern long strtol();
extern int errno;
+char *file_name;
+char *option_d;
+char *option_f;
+char *option_l;
+char *option_p;
+char option_s;
+char *option_t;
+char *option_x;
+char diag_msg;
+char option_msg;
+int need_newline;
+int dev_expert;
+int expert_mode;
+uint_t cur_blksz;
+struct ctlr_info *ctlr_list;
+struct disk_info *disk_list;
+struct mctlr_list *controlp;
+char x86_devname[MAXNAMELEN];
+FILE *data_file;
+
#ifdef __STDC__
/* Function prototypes for ANSI C Compilers */
@@ -2218,13 +2238,11 @@ disk_is_known(struct dk_cinfo *dkinfo)
* in the disk label.
*/
int
-dtype_match(label, dtype)
- register struct dk_label *label;
- register struct disk_type *dtype;
+dtype_match(struct dk_label *label, struct disk_type *dtype)
{
if (dtype->dtype_asciilabel == NULL) {
- return (0);
+ return (0);
}
/*
@@ -2249,9 +2267,7 @@ dtype_match(label, dtype)
* in the disk label.
*/
int
-parts_match(label, pinfo)
- register struct dk_label *label;
- register struct partition_info *pinfo;
+parts_match(struct dk_label *label, struct partition_info *pinfo)
{
int i;
@@ -2286,10 +2302,10 @@ parts_match(label, pinfo)
return (0);
for (i = 0; i < NDKMAP; i++) {
if (label->dkl_vtoc.v_part[i].p_tag !=
- pinfo->vtoc.v_part[i].p_tag)
+ pinfo->vtoc.v_part[i].p_tag)
return (0);
if (label->dkl_vtoc.v_part[i].p_flag !=
- pinfo->vtoc.v_part[i].p_flag)
+ pinfo->vtoc.v_part[i].p_flag)
return (0);
}
/*
@@ -2457,9 +2473,7 @@ search_duplicate_pinfo()
* If so, print an error message and abort.
*/
static void
-check_dtypes_for_inconsistency(dp1, dp2)
- struct disk_type *dp1;
- struct disk_type *dp2;
+check_dtypes_for_inconsistency(struct disk_type *dp1, struct disk_type *dp2)
{
int i;
int result;
@@ -2520,13 +2534,13 @@ check_dtypes_for_inconsistency(dp1, dp2)
if (result) {
err_print("Inconsistent definitions for disk type '%s'\n",
- dp1->dtype_asciilabel);
+ dp1->dtype_asciilabel);
if (dp1->dtype_filename != NULL &&
- dp2->dtype_filename != NULL) {
+ dp2->dtype_filename != NULL) {
err_print("%s (%d) - %s (%d)\n",
- dp1->dtype_filename, dp1->dtype_lineno,
- dp2->dtype_filename, dp2->dtype_lineno);
- }
+ dp1->dtype_filename, dp1->dtype_lineno,
+ dp2->dtype_filename, dp2->dtype_lineno);
+ }
fullabort();
}
}
@@ -2538,9 +2552,8 @@ check_dtypes_for_inconsistency(dp1, dp2)
* If so, print an error message and abort.
*/
static void
-check_pinfo_for_inconsistency(pp1, pp2)
- struct partition_info *pp1;
- struct partition_info *pp2;
+check_pinfo_for_inconsistency(struct partition_info *pp1,
+ struct partition_info *pp2)
{
int i;
int result;
@@ -2588,13 +2601,13 @@ check_pinfo_for_inconsistency(pp1, pp2)
if (result) {
err_print("Inconsistent definitions for partition type '%s'\n",
- pp1->pinfo_name);
+ pp1->pinfo_name);
if (pp1->pinfo_filename != NULL &&
- pp2->pinfo_filename != NULL) {
+ pp2->pinfo_filename != NULL) {
err_print("%s (%d) - %s (%d)\n",
- pp1->pinfo_filename, pp1->pinfo_lineno,
- pp2->pinfo_filename, pp2->pinfo_lineno);
- }
+ pp1->pinfo_filename, pp1->pinfo_lineno,
+ pp2->pinfo_filename, pp2->pinfo_lineno);
+ }
fullabort();
}
}
@@ -2935,7 +2948,7 @@ disk_name_compare(
}
static void
-make_controller_list()
+make_controller_list(void)
{
int x;
struct mctlr_list *ctlrp;
@@ -2952,8 +2965,7 @@ make_controller_list()
}
static void
-check_for_duplicate_disknames(arglist)
-char *arglist[];
+check_for_duplicate_disknames(char *arglist[])
{
char *directory = "/dev/rdsk/";
char **disklist;
@@ -2974,9 +2986,9 @@ char *arglist[];
* disk list.
*/
for (i = 0; i < diskno; i++) {
- canonicalize_name(t, arglist[i]);
- if (strncmp(s, t, strlen(t)) == 0)
- break;
+ canonicalize_name(t, arglist[i]);
+ if (strncmp(s, t, strlen(t)) == 0)
+ break;
}
if (i != diskno)
continue;