summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorbg159949 <none@none>2005-08-17 11:53:32 -0700
committerbg159949 <none@none>2005-08-17 11:53:32 -0700
commit052b6e8a13e1fb4be51ba482db6bb2e9833fa717 (patch)
tree2196a553b7f5da9228c4905970bc3be987b55413 /usr/src
parentc8393ed7bc7b32f6789bec13aa1294cff6389188 (diff)
downloadillumos-joyent-052b6e8a13e1fb4be51ba482db6bb2e9833fa717.tar.gz
6268939 cmd/addbadsec and gcc don't get along
6271029 gcc and cmd/diskscan don't get along 6271084 gcc and cmd/format don't get along
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/addbadsec/addbadsec.c26
-rw-r--r--usr/src/cmd/addbadsec/ix_altsctr.c131
-rw-r--r--usr/src/cmd/diskscan/diskscan.c4
-rw-r--r--usr/src/cmd/format/add_definition.c4
-rw-r--r--usr/src/cmd/format/auto_sense.c9
-rw-r--r--usr/src/cmd/format/global.h4
-rw-r--r--usr/src/cmd/format/main.c13
-rw-r--r--usr/src/cmd/format/main.h5
-rw-r--r--usr/src/cmd/format/menu_command.c2
-rw-r--r--usr/src/cmd/format/menu_defect.c10
-rw-r--r--usr/src/cmd/format/menu_partition.c3
-rw-r--r--usr/src/cmd/format/prompts.c4
12 files changed, 123 insertions, 92 deletions
diff --git a/usr/src/cmd/addbadsec/addbadsec.c b/usr/src/cmd/addbadsec/addbadsec.c
index 5c625db211..956eabbd87 100644
--- a/usr/src/cmd/addbadsec/addbadsec.c
+++ b/usr/src/cmd/addbadsec/addbadsec.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -64,10 +64,12 @@ extern int gbadsl_chain_cnt;
int alts_fd;
-void
-main(argc, argv)
-int argc;
-char *argv[];
+static void giveusage(void);
+static void rd_gbad(FILE *badsecfd);
+static void add_gbad(int badsec_entry);
+
+int
+main(int argc, char *argv[])
{
extern int optind;
extern char *optarg;
@@ -243,14 +245,15 @@ char *argv[];
fclose(badsecfd);
close (alts_fd);
close (devfd);
- exit(0);
+ return(0);
}
/*
* Giveusage ()
* Give a (not so) concise message on how to use this program.
*/
-giveusage()
+static
+void giveusage(void)
{
fprintf(stderr, "%s [-p] [-a sector] [-f filename] raw-device\n", progname);
fprintf(stderr, " p - Print existing bad block map\n");
@@ -264,8 +267,8 @@ giveusage()
/*
* read in the additional growing bad sectors
*/
-rd_gbad(badsecfd)
-FILE *badsecfd;
+static void
+rd_gbad(FILE *badsecfd)
{
int badsec_entry;
int status;
@@ -277,8 +280,8 @@ FILE *badsecfd;
}
}
-add_gbad(badsec_entry)
-int badsec_entry;
+static void
+add_gbad(int badsec_entry)
{
struct badsec_lst *blc_p;
@@ -385,6 +388,7 @@ byte_swap_16 (u_short niv)
return (rc);
}
+int
try_hw_remap ()
{
struct badsec_lst *blc_p;
diff --git a/usr/src/cmd/addbadsec/ix_altsctr.c b/usr/src/cmd/addbadsec/ix_altsctr.c
index 5b1e9e6964..5fa19d8a15 100644
--- a/usr/src/cmd/addbadsec/ix_altsctr.c
+++ b/usr/src/cmd/addbadsec/ix_altsctr.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 1994 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -69,12 +69,37 @@ extern int alts_fd;
struct alts_mempart alts_part = { 0, NULL, 0 };
struct alts_mempart *ap = &alts_part; /* pointer to incore alts tables */
+static void read_altsctr(struct partition *part, int badok);
+static void chk_badsec (void);
+static void init_altsctr (void);
+ void wr_altsctr (void);
+static void get_badsec (void);
+static int count_badsec (void);
+static void gen_alts_ent (void);
+static void assign_altsctr(void);
+static void expand_map (void);
+static void compress_map (void);
+static int altsmap_getbit(daddr_t badsec);
+static int altsmap_alloc(daddr_t srt_ind, daddr_t end_ind, int cnt, int dir);
+static void ent_sort(struct alts_ent buf[], int cnt);
+static void ent_compress(struct alts_ent buf[], int cnt);
+static int ent_merge(
+ struct alts_ent buf[],
+ struct alts_ent list1[],
+ int lcnt1,
+ struct alts_ent list2[],
+ int lcnt2);
+static int ent_bsearch(struct alts_ent buf[], int cnt, struct alts_ent *key);
+static int chk_bad_altsctr(daddr_t badsec);
+ int print_altsec(struct partition *part);
+static void print_altsctr(void);
+static int absdsk_io(int fd, uint srtsec, char *bufp, uint len, int ioflag);
+
/*
* updatebadsec () -- update bad sector/track mapping tables
*/
-updatebadsec(part, init_flag)
-int init_flag;
-struct partition *part;
+int
+updatebadsec(struct partition *part, int init_flag)
{
if (init_flag)
ap->ap_flag |= ALTS_ADDPART;
@@ -91,9 +116,8 @@ struct partition *part;
* read_altsctr( ptr to alternate sector partition )
* -- read the alternate sector partition tables
*/
-read_altsctr(part, badok)
-struct partition *part;
-int badok;
+static void
+read_altsctr(struct partition *part, int badok)
{
int ret;
@@ -149,7 +173,8 @@ int badok;
/*
* checking duplicate bad sectors or bad sectors in ALTSCTR partition
*/
-chk_badsec()
+static void
+chk_badsec(void)
{
daddr_t badsec;
daddr_t altsp_srtsec = ap->part.p_start;
@@ -209,7 +234,8 @@ chk_badsec()
/*
* initialize the alternate partition tables
*/
-init_altsctr()
+static void
+init_altsctr(void)
{
daddr_t badsec;
daddr_t altsp_srtsec = ap->part.p_start;
@@ -315,20 +341,21 @@ int badok;
/*
* update the new alternate partition tables on disk
*/
-wr_altsctr()
+void
+wr_altsctr(void)
{
int mystatus = FAILURE;
if (ap->ap_tblp == NULL)
return;
- if (absdsk_io(alts_fd, 0, ap->ap_tblp,
+ if (absdsk_io(alts_fd, 0, (char *)ap->ap_tblp,
ap->ap_tbl_secsiz, CMD_WRITE) == FAILURE) {
perror("Unable to write alternate sector partition: ");
exit(62);
}
if (absdsk_io(alts_fd, ap->ap_tblp->alts_map_base,
- ap->ap_mapp, ap->ap_map_secsiz, CMD_WRITE) == FAILURE){
+ (char *)ap->ap_mapp, ap->ap_map_secsiz, CMD_WRITE) == FAILURE) {
perror("Unable to write alternate sector partition map: ");
exit(63);
}
@@ -350,7 +377,8 @@ wr_altsctr()
/*
* get a list of bad sector
*/
-get_badsec()
+static void
+get_badsec(void)
{
int cnt;
struct badsec_lst *blc_p;
@@ -396,7 +424,8 @@ get_badsec()
* merging the bad sector list from surface analysis and the
* one given through the command line
*/
-count_badsec()
+static int
+count_badsec(void)
{
struct badsec_lst *blc_p;
@@ -418,7 +447,9 @@ count_badsec()
* generate alternate entry table by merging the existing and
* the new entry list.
*/
-gen_alts_ent() {
+static void
+gen_alts_ent(void)
+{
int ent_used;
struct alts_ent *entp;
@@ -461,7 +492,8 @@ gen_alts_ent() {
/*
* assign alternate sectors for bad sector mapping
*/
-assign_altsctr()
+static void
+assign_altsctr(void)
{
int i;
int j;
@@ -494,7 +526,8 @@ assign_altsctr()
/*
* transform the disk image alts bit map to incore char map
*/
-expand_map()
+static void
+expand_map(void)
{
int i;
@@ -506,7 +539,8 @@ expand_map()
/*
* transform the incore alts char map to the disk image bit map
*/
-compress_map()
+static void
+compress_map(void)
{
int i;
@@ -535,8 +569,8 @@ compress_map()
* given a bad sector number, search in the alts bit map
* and identify the sector as good or bad
*/
-altsmap_getbit(badsec)
-daddr_t badsec;
+static int
+altsmap_getbit(daddr_t badsec)
{
int slot = badsec / 8;
int field = badsec % 8;
@@ -553,11 +587,8 @@ daddr_t badsec;
/*
* allocate a range of sectors from the alternate partition
*/
-altsmap_alloc(srt_ind, end_ind, cnt, dir)
-daddr_t srt_ind;
-daddr_t end_ind;
-int cnt;
-int dir;
+static int
+altsmap_alloc(daddr_t srt_ind, daddr_t end_ind, int cnt, int dir)
{
int i;
int total;
@@ -574,7 +605,7 @@ int dir;
return(first_ind);
}
- return(NULL);
+ return(0);
}
@@ -582,9 +613,8 @@ int dir;
/*
* bubble sort the entry table into ascending order
*/
-ent_sort(buf, cnt)
-struct alts_ent buf[];
-int cnt;
+static void
+ent_sort(struct alts_ent buf[], int cnt)
{
struct alts_ent temp;
int flag;
@@ -615,9 +645,8 @@ int i,j;
* in the entry table. The entry table must be sorted into ascending
* before the compression.
*/
-ent_compress(buf, cnt)
-struct alts_ent buf[];
-int cnt;
+static void
+ent_compress(struct alts_ent buf[], int cnt)
{
int keyp;
int movp;
@@ -643,12 +672,13 @@ int i;
* merging two entry tables into a single table. In addition,
* all empty slots in the entry table will be removed.
*/
-ent_merge(buf, list1, lcnt1, list2, lcnt2)
-struct alts_ent buf[];
-struct alts_ent list1[];
-int lcnt1;
-struct alts_ent list2[];
-int lcnt2;
+static int
+ent_merge(
+ struct alts_ent buf[],
+ struct alts_ent list1[],
+ int lcnt1,
+ struct alts_ent list2[],
+ int lcnt2)
{
int i;
int j1,j2;
@@ -684,10 +714,8 @@ int lcnt2;
/*
* binary search for bad sector in the alternate entry table
*/
-ent_bsearch(buf, cnt, key)
-struct alts_ent buf[];
-int cnt;
-struct alts_ent *key;
+static int
+ent_bsearch(struct alts_ent buf[], int cnt, struct alts_ent *key)
{
int i;
int ind;
@@ -725,8 +753,8 @@ struct alts_ent *key;
/*
* check for bad sector in assigned alternate sectors
*/
-chk_bad_altsctr(badsec)
-daddr_t badsec;
+static int
+chk_bad_altsctr(daddr_t badsec)
{
int i;
int j;
@@ -761,8 +789,8 @@ daddr_t badsec;
/*
* print_altsec () -- print alternate sector information
*/
-print_altsec(part)
-struct partition *part;
+int
+print_altsec(struct partition *part)
{
ap->ap_tblp = NULL;
ap->ap_flag &= ~ALTS_ADDPART;
@@ -771,7 +799,8 @@ struct partition *part;
return(SUCCESS);
}
-print_altsctr()
+static void
+print_altsctr(void)
{
int i;
int totalloc;
@@ -806,12 +835,8 @@ print_altsctr()
}
-absdsk_io(fd, srtsec, bufp, len, ioflag)
-int fd;
-uint srtsec;
-char *bufp;
-uint len;
-int ioflag;
+static int
+absdsk_io(int fd, uint srtsec, char *bufp, uint len, int ioflag)
{
int rc;
diff --git a/usr/src/cmd/diskscan/diskscan.c b/usr/src/cmd/diskscan/diskscan.c
index 359ad54911..7d2e0d239d 100644
--- a/usr/src/cmd/diskscan/diskscan.c
+++ b/usr/src/cmd/diskscan/diskscan.c
@@ -68,7 +68,7 @@ static char eol = '\n'; /* end-of-line char (if -n, we set to '\n') */
static int print_warn = 1; /* should the warning message be printed? */
static int do_scan = VER_READ;
-void
+int
main(int argc, char *argv[]) {
extern int optind;
int devfd; /* device file descriptor */
@@ -151,7 +151,7 @@ main(int argc, char *argv[]) {
unix_base = part_info.p_start;
unix_size = part_info.p_length;
scandisk(device, devfd, do_scan);
- exit(0);
+ return (0);
}
/*
diff --git a/usr/src/cmd/format/add_definition.c b/usr/src/cmd/format/add_definition.c
index 3745782701..7c1664a8e5 100644
--- a/usr/src/cmd/format/add_definition.c
+++ b/usr/src/cmd/format/add_definition.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 1991-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -138,7 +138,7 @@ Neither the disk type nor the partitioning has been changed.\n");
*/
prompt = "Enter file name";
(void) strcpy(x.deflt_str, "./format.dat");
- filename = (char *)input(FIO_OSTR, prompt,
+ filename = (char *)(uintptr_t)input(FIO_OSTR, prompt,
':', (u_ioparam_t *)NULL, &x.xfoo, DATA_INPUT);
assert(filename != NULL);
/*
diff --git a/usr/src/cmd/format/auto_sense.c b/usr/src/cmd/format/auto_sense.c
index fb85b7f788..ccdb728045 100644
--- a/usr/src/cmd/format/auto_sense.c
+++ b/usr/src/cmd/format/auto_sense.c
@@ -1314,7 +1314,8 @@ find_scsi_ctlr_type()
}
impossible("no SCSI controller type");
- /*NOTREACHED*/
+
+ return ((struct ctlr_type *)NULL);
}
@@ -1344,7 +1345,8 @@ find_scsi_ctlr_info(
}
impossible("no SCSI controller info");
- /*NOTREACHED*/
+
+ return ((struct ctlr_info *)NULL);
}
@@ -1519,7 +1521,8 @@ find_scsi_disk_info(
}
impossible("No SCSI disk info instance\n");
- /*NOTREACHED*/
+
+ return ((struct disk_info *)NULL);
}
diff --git a/usr/src/cmd/format/global.h b/usr/src/cmd/format/global.h
index fae5dead26..47f8f019e3 100644
--- a/usr/src/cmd/format/global.h
+++ b/usr/src/cmd/format/global.h
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 1991-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -41,7 +41,7 @@ extern "C" {
#define L_TYPE_EFI 1
#ifndef UINT_MAX64
-#define UINT_MAX64 0xffffffffffffffff
+#define UINT_MAX64 0xffffffffffffffffULL
#endif
#ifndef UINT_MAX32
diff --git a/usr/src/cmd/format/main.c b/usr/src/cmd/format/main.c
index 19d1f1671f..242fc7bb6d 100644
--- a/usr/src/cmd/format/main.c
+++ b/usr/src/cmd/format/main.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -79,10 +79,8 @@ static void get_disk_characteristics();
/*
* This is the main entry point.
*/
-void
-main(argc, argv)
- int argc;
- char *argv[];
+int
+main(int argc, char *argv[])
{
int i;
int ret_code = 1;
@@ -312,10 +310,9 @@ main(argc, argv)
run_menu(menu_command, "FORMAT", "format", 1);
/*
- * normal ending. Explicitly exit(0);
+ * normal ending. Explicitly return(0);
*/
- exit(0);
- /* NOTREACHED */
+ return (0);
}
/*
diff --git a/usr/src/cmd/format/main.h b/usr/src/cmd/format/main.h
index 268ace1f42..f3801d49e8 100644
--- a/usr/src/cmd/format/main.h
+++ b/usr/src/cmd/format/main.h
@@ -21,7 +21,8 @@
*/
/*
- * Copyright (c) 1991-2001 by Sun Microsystems, Inc.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
#ifndef _MAIN_H
@@ -36,7 +37,7 @@ extern "C" {
/*
* Prototypes for ANSI C compilers
*/
-void main(int argc, char *argv[]);
+int main(int argc, char *argv[]);
int notify_unix(void);
void init_globals(struct disk_info *disk);
diff --git a/usr/src/cmd/format/menu_command.c b/usr/src/cmd/format/menu_command.c
index 02a78a8da2..b679017d7d 100644
--- a/usr/src/cmd/format/menu_command.c
+++ b/usr/src/cmd/format/menu_command.c
@@ -1497,7 +1497,7 @@ c_label()
(void) strlcpy(cur_dtype->revision, efinfo.revision, 5);
cur_dtype->capacity = efinfo.capacity;
free(cur_dtype->dtype_asciilabel);
- ncyl = pcyl = nsect = psect = acyl = psect = phead = 0;
+ ncyl = pcyl = nsect = psect = acyl = phead = 0;
return (0);
}
diff --git a/usr/src/cmd/format/menu_defect.c b/usr/src/cmd/format/menu_defect.c
index 33b27ffafa..e8c20dccaf 100644
--- a/usr/src/cmd/format/menu_defect.c
+++ b/usr/src/cmd/format/menu_defect.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 1991-2002 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -558,8 +558,8 @@ d_dump()
* input will be in malloc'd space since we are inputting
* type OSTR.
*/
- str = (char *)input(FIO_OSTR, "Enter name of defect file", ':',
- (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT);
+ str = (char *)(uintptr_t)input(FIO_OSTR, "Enter name of defect file",
+ ':', (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT);
/*
* Lock out interrupts so the file doesn't get half written.
*/
@@ -623,8 +623,8 @@ d_load()
* Ask the user for the name of the defect file. Note that the
* input will be malloc'd space since we inputted type OSTR.
*/
- str = (char *)input(FIO_OSTR, "Enter name of defect file", ':',
- (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT);
+ str = (char *)(uintptr_t)input(FIO_OSTR, "Enter name of defect file",
+ ':', (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT);
/*
* Copy the file name into local space then destroy the string
* it came in. This is simply a precaution against later having
diff --git a/usr/src/cmd/format/menu_partition.c b/usr/src/cmd/format/menu_partition.c
index 32a6937396..3223dd5bc9 100644
--- a/usr/src/cmd/format/menu_partition.c
+++ b/usr/src/cmd/format/menu_partition.c
@@ -330,7 +330,8 @@ p_name()
* Ask for the name. Note that the input routine will malloc
* space for the name since we are using the OSTR input type.
*/
- name = (char *)input(FIO_OSTR, "Enter table name (remember quotes)",
+ name = (char *)(uintptr_t)input(FIO_OSTR,
+ "Enter table name (remember quotes)",
':', (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT);
/*
* Lock out interrupts.
diff --git a/usr/src/cmd/format/prompts.c b/usr/src/cmd/format/prompts.c
index f86671da26..ce87f06349 100644
--- a/usr/src/cmd/format/prompts.c
+++ b/usr/src/cmd/format/prompts.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 1991, 2001-2002 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -447,7 +447,7 @@ get_bps()
char *
get_asciilabel()
{
- return ((char *)input(FIO_OSTR,
+ return ((char *)(uintptr_t)input(FIO_OSTR,
"Enter disk type name (remember quotes)", ':',
(u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT));
}