diff options
author | Toomas Soome <tsoome@me.com> | 2022-04-03 10:42:35 +0300 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2022-04-19 01:58:17 +0300 |
commit | b12aaafbf56c5a06b6cfd21655531a33e38a8ed9 (patch) | |
tree | ca10ca759be5de1857e5b2bea4c3ea821cfd1d04 | |
parent | c74f1323689f1dfea444e7fe0627eafc8c3b9076 (diff) | |
download | illumos-joyent-b12aaafbf56c5a06b6cfd21655531a33e38a8ed9.tar.gz |
14613 format: cstyle cleanup
Reviewed by: C Fraire <cfraire@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
45 files changed, 1058 insertions, 1431 deletions
diff --git a/usr/src/cmd/format/add_definition.c b/usr/src/cmd/format/add_definition.c index 7c1664a8e5..32ecfcda3a 100644 --- a/usr/src/cmd/format/add_definition.c +++ b/usr/src/cmd/format/add_definition.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains the code to add new disk_type and partition * definitions to a format data file. @@ -76,7 +74,7 @@ static int add_entry(); * Add new definitions for the current disk/partition to a format data file. */ int -add_definition() +add_definition(void) { FILE *fd; char *filename; @@ -107,7 +105,7 @@ add_definition() * information has been changed, there's nothing to save. */ if (cur_dtype->dtype_filename != NULL && - cur_parts->pinfo_filename != NULL) { + cur_parts->pinfo_filename != NULL) { err_print("\ Neither the disk type nor the partitioning has been changed.\n"); return (-1); @@ -125,7 +123,7 @@ Neither the disk type nor the partitioning has been changed.\n"); * Let the user know what we're doing */ if (cur_dtype->dtype_filename == NULL && - cur_parts->pinfo_filename == NULL) { + cur_parts->pinfo_filename == NULL) { fmt_print("Saving new disk and partition definitions\n"); } else if (cur_dtype->dtype_filename == NULL) { fmt_print("Saving new disk definition\n"); @@ -139,14 +137,14 @@ Neither the disk type nor the partitioning has been changed.\n"); prompt = "Enter file name"; (void) strcpy(x.deflt_str, "./format.dat"); filename = (char *)(uintptr_t)input(FIO_OSTR, prompt, - ':', (u_ioparam_t *)NULL, &x.xfoo, DATA_INPUT); + ':', NULL, &x.xfoo, DATA_INPUT); assert(filename != NULL); /* * Open the file in append mode, or create it, if necessary */ if ((fd = fopen(filename, "a")) == NULL) { err_print("Cannot open `%s' - %s\n", filename, - strerror(errno)); + strerror(errno)); destroy_data(filename); return (-1); } @@ -154,7 +152,7 @@ Neither the disk type nor the partitioning has been changed.\n"); * Write a header for the new definitions */ if ((cur_dtype->dtype_filename == NULL) && - (cur_parts->pinfo_filename == NULL)) { + (cur_parts->pinfo_filename == NULL)) { (void) fprintf(fd, "#\n# New disk/partition type "); } else if (cur_dtype->dtype_filename == NULL) { (void) fprintf(fd, "#\n# New disk type "); @@ -184,9 +182,7 @@ Neither the disk type nor the partitioning has been changed.\n"); * Add a disk_type definition to the file fd */ static void -add_disktype(fd, disk_info) - FILE *fd; - struct disk_info *disk_info; +add_disktype(FILE *fd, struct disk_info *disk_info) { int col; struct disk_type *disk_type; @@ -194,9 +190,9 @@ add_disktype(fd, disk_info) disk_type = disk_info->disk_type; (void) fprintf(fd, "disk_type = \"%s\" \\\n", - disk_type->dtype_asciilabel); + disk_type->dtype_asciilabel); col = add_entry(0, fd, " : ctlr = %s", - ((disk_info->disk_ctlr)->ctlr_ctype)->ctype_name); + ((disk_info->disk_ctlr)->ctlr_ctype)->ctype_name); col = add_entry(col, fd, " : ncyl = %d", disk_type->dtype_ncyl); @@ -208,14 +204,14 @@ add_disktype(fd, disk_info) if (disk_type->dtype_options & SUP_PHEAD) { col = add_entry(col, fd, " : phead = %d", - disk_type->dtype_phead); + disk_type->dtype_phead); } col = add_entry(col, fd, " : nsect = %d", disk_type->dtype_nsect); if (disk_type->dtype_options & SUP_PSECT) { col = add_entry(col, fd, " : psect = %d", - disk_type->dtype_psect); + disk_type->dtype_psect); } if (disk_type->dtype_options & SUP_BPT) { @@ -226,62 +222,62 @@ add_disktype(fd, disk_info) if (disk_type->dtype_options & SUP_FMTTIME) { col = add_entry(col, fd, " : fmt_time = %d", - disk_type->dtype_fmt_time); + disk_type->dtype_fmt_time); } if (disk_type->dtype_options & SUP_CYLSKEW) { col = add_entry(col, fd, " : cyl_skew = %d", - disk_type->dtype_cyl_skew); + disk_type->dtype_cyl_skew); } if (disk_type->dtype_options & SUP_TRKSKEW) { col = add_entry(col, fd, " : trk_skew = %d", - disk_type->dtype_trk_skew); + disk_type->dtype_trk_skew); } if (disk_type->dtype_options & SUP_TRKS_ZONE) { col = add_entry(col, fd, " : trks_zone = %d", - disk_type->dtype_trks_zone); + disk_type->dtype_trks_zone); } if (disk_type->dtype_options & SUP_ATRKS) { col = add_entry(col, fd, " : atrks = %d", - disk_type->dtype_atrks); + disk_type->dtype_atrks); } if (disk_type->dtype_options & SUP_ASECT) { col = add_entry(col, fd, " : asect = %d", - disk_type->dtype_asect); + disk_type->dtype_asect); } if (disk_type->dtype_options & SUP_CACHE) { col = add_entry(col, fd, " : cache = %d", - disk_type->dtype_cache); + disk_type->dtype_cache); } if (disk_type->dtype_options & SUP_PREFETCH) { col = add_entry(col, fd, " : prefetch = %d", - disk_type->dtype_threshold); + disk_type->dtype_threshold); } if (disk_type->dtype_options & SUP_CACHE_MIN) { col = add_entry(col, fd, " : min_prefetch = %d", - disk_type->dtype_prefetch_min); + disk_type->dtype_prefetch_min); } if (disk_type->dtype_options & SUP_CACHE_MAX) { col = add_entry(col, fd, " : max_prefetch = %d", - disk_type->dtype_prefetch_max); + disk_type->dtype_prefetch_max); } if (disk_type->dtype_options & SUP_BPS) { col = add_entry(col, fd, " : bps = %d", - disk_type->dtype_bps); + disk_type->dtype_bps); } if (disk_type->dtype_options & SUP_DRTYPE) { col = add_entry(col, fd, " : drive_type = %d", - disk_type->dtype_dr_type); + disk_type->dtype_dr_type); } /* @@ -301,10 +297,8 @@ add_disktype(fd, disk_info) * Add a partition definition to the file fd */ static void -add_partition(fd, disk_info, part) - FILE *fd; - struct disk_info *disk_info; - struct partition_info *part; +add_partition(FILE *fd, struct disk_info *disk_info, + struct partition_info *part) { int col; int i; @@ -327,8 +321,8 @@ add_partition(fd, disk_info, part) (void) fprintf(fd, "partition = \"%s\" \\\n", part->pinfo_name); (void) fprintf(fd, "\t : disk = \"%s\" : ctlr = %s \\\n", - disk_type->dtype_asciilabel, - ((disk_info->disk_ctlr)->ctlr_ctype)->ctype_name); + disk_type->dtype_asciilabel, + ((disk_info->disk_ctlr)->ctlr_ctype)->ctype_name); /* * Print the specifications for each useful partition @@ -340,22 +334,20 @@ add_partition(fd, disk_info, part) for (i = 0; i < NDKMAP; i++, pp++, pv++, dv++) { if (pp->dkl_nblk != 0) { col = add_entry(col, fd, " : %c = ", - i + PARTITION_BASE); + i + PARTITION_BASE); if (pv->p_tag != dv->p_tag || - pv->p_flag != dv->p_flag) { - s = find_string(ptag_choices, - (int)pv->p_tag); + pv->p_flag != dv->p_flag) { + s = find_string(ptag_choices, (int)pv->p_tag); if (s != NULL) { col = add_entry(col, fd, " %s,", s); } - s = find_string(pflag_choices, - (int)pv->p_flag); + s = find_string(pflag_choices, (int)pv->p_flag); if (s != NULL) { col = add_entry(col, fd, " %s,", s); } } col = add_entry(col, fd, " %d, %d", pp->dkl_cylno, - pp->dkl_nblk); + pp->dkl_nblk); } } diff --git a/usr/src/cmd/format/add_definition.h b/usr/src/cmd/format/add_definition.h index b51f742126..af568c4384 100644 --- a/usr/src/cmd/format/add_definition.h +++ b/usr/src/cmd/format/add_definition.h @@ -27,8 +27,6 @@ #ifndef _ADD_DEFINITION_H #define _ADD_DEFINITION_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/analyze.c b/usr/src/cmd/format/analyze.c index e887058a2c..1815952b8a 100644 --- a/usr/src/cmd/format/analyze.c +++ b/usr/src/cmd/format/analyze.c @@ -94,23 +94,12 @@ static unsigned int purge_patterns[] = { /* patterns to be written */ static unsigned int alpha_pattern = 0x40404040; /* 10000000... == @@@@... */ -/* Function prototypes */ -#ifdef __STDC__ - static int scan_repair(diskaddr_t bn, int mode); static int analyze_blocks(int flags, diskaddr_t blkno, uint_t blkcnt, unsigned data, int init, int driver_flags, int *xfercntp); static int handle_error_conditions(void); static int verify_blocks(int flags, diskaddr_t blkno, uint_t blkcnt, unsigned data, int driver_flags, int *xfercntp); -#else /* __STDC__ */ - -static int scan_repair(); -static int analyze_blocks(); -static int handle_error_conditions(); -static int verify_blocks(); - -#endif /* __STDC__ */ /* * This routine performs a surface analysis based upon the global @@ -119,8 +108,7 @@ static int verify_blocks(); * analysis is enable). */ int -do_scan(flags, mode) - int flags, mode; +do_scan(int flags, int mode) { diskaddr_t start, end, curnt; int pass, needinit, data; @@ -135,7 +123,7 @@ do_scan(flags, mode) * if the controller can correct the defect. */ if (scan_correct && !EMBEDDED_SCSI && (cur_ops->op_repair != NULL) && - (cur_list.list == NULL)) { + (cur_list.list == NULL)) { err_print("Current Defect List must be initialized "); err_print("to do automatic repair.\n"); return (-1); @@ -145,14 +133,14 @@ do_scan(flags, mode) */ if (scan_entire) { start = 0; - if (cur_label == L_TYPE_SOLARIS) { - if (cur_ctype->ctype_flags & CF_SCSI) - end = datasects() - 1; - else - end = physsects() - 1; - } else if (cur_label == L_TYPE_EFI) { - end = cur_parts->etoc->efi_last_lba; - } + if (cur_label == L_TYPE_SOLARIS) { + if (cur_ctype->ctype_flags & CF_SCSI) + end = datasects() - 1; + else + end = physsects() - 1; + } else if (cur_label == L_TYPE_EFI) { + end = cur_parts->etoc->efi_last_lba; + } } else { start = scan_lower; end = scan_upper; @@ -195,20 +183,20 @@ do_scan(flags, mode) * we mark the defect list and/or label dirty so it will get rewritten. */ if (flags & (SCAN_PATTERN | SCAN_WRITE)) { - if (cur_label == L_TYPE_SOLARIS) { - if (start < (diskaddr_t)totalsects() && - end >= (diskaddr_t)datasects()) { - if (!EMBEDDED_SCSI) { - cur_list.flags |= LIST_DIRTY; + if (cur_label == L_TYPE_SOLARIS) { + if (start < (diskaddr_t)totalsects() && + end >= (diskaddr_t)datasects()) { + if (!EMBEDDED_SCSI) { + cur_list.flags |= LIST_DIRTY; + } + if (cur_disk->disk_flags & DSK_LABEL) + cur_flags |= LABEL_DIRTY; } + } + if (start == 0) { if (cur_disk->disk_flags & DSK_LABEL) cur_flags |= LABEL_DIRTY; } - } - if (start == 0) { - if (cur_disk->disk_flags & DSK_LABEL) - cur_flags |= LABEL_DIRTY; - } } /* * Initialize the summary info on sectors repaired. @@ -230,18 +218,18 @@ do_scan(flags, mode) if (flags & SCAN_PURGE) { flags &= ~(SCAN_PURGE_READ_PASS - | SCAN_PURGE_ALPHA_PASS); + | SCAN_PURGE_ALPHA_PASS); switch (pattern % (NPPATTERNS + 1)) { case NPPATTERNS: pattern = 0; if (!error) { - fmt_print( + fmt_print( "\nThe last %d passes were successful, running alpha pattern pass", NPPATTERNS); - flags |= SCAN_PURGE_ALPHA_PASS; - data = alpha_pattern; + flags |= SCAN_PURGE_ALPHA_PASS; + data = alpha_pattern; } else { - data = purge_patterns[pattern]; - pattern++; + data = purge_patterns[pattern]; + pattern++; }; break; case READPATTERN: @@ -418,7 +406,7 @@ out: * if scan_restore_defects (the default) is true. */ if (!EMBEDDED_SCSI && (cur_list.flags & LIST_DIRTY) && - (scan_restore_defects)) { + (scan_restore_defects)) { cur_list.flags = 0; write_deflist(&cur_list); } @@ -439,7 +427,7 @@ out: log_print("\n"); } fmt_print("Total of %lld defective blocks repaired.\n", - scan_blocks_fixed); + scan_blocks_fixed); /* * Reinitialize the logging variables so they don't get used * when they are not really valid. @@ -456,9 +444,7 @@ out: * (This has been extracted out of do_scan(), to simplify it.) */ static int -scan_repair(bn, mode) - diskaddr_t bn; - int mode; +scan_repair(diskaddr_t bn, int mode) { int status; int result = 1; @@ -488,7 +474,7 @@ scan_repair(bn, mode) buf_is_good = 0; for (i = 0; i < 5; i++) { status = (*cur_ops->op_rdwr)(DIR_READ, cur_file, bn, 1, - buf, F_SILENT, NULL); + buf, F_SILENT, NULL); if (status == 0) { buf_is_good = 1; break; @@ -496,7 +482,7 @@ scan_repair(bn, mode) } fmt_print("Repairing %s error on %llu (", - buf_is_good ? "soft" : "hard", bn); + buf_is_good ? "soft" : "hard", bn); pr_dblock(fmt_print, bn); fmt_print(")..."); @@ -521,10 +507,10 @@ scan_repair(bn, mode) fmt_print("ok.\n"); } status = (*cur_ops->op_rdwr)(DIR_WRITE, cur_file, bn, - 1, buf, (F_SILENT | F_ALLERRS), NULL); + 1, buf, (F_SILENT | F_ALLERRS), NULL); if (status == 0) { status = (*cur_ops->op_rdwr)(DIR_READ, cur_file, bn, - 1, buf, (F_SILENT | F_ALLERRS), NULL); + 1, buf, (F_SILENT | F_ALLERRS), NULL); } if (status) { fmt_print("The new block also appears defective.\n"); @@ -581,17 +567,13 @@ scan_repair(bn, mode) * an error if a defect is found. It is called by do_scan(). */ static int -analyze_blocks(flags, blkno, blkcnt, data, init, driver_flags, xfercntp) - int flags, driver_flags, init; - uint_t blkcnt; - register unsigned data; - diskaddr_t blkno; - int *xfercntp; +analyze_blocks(int flags, diskaddr_t blkno, uint_t blkcnt, unsigned data, + int init, int driver_flags, int *xfercntp) { int corrupt = 0; int status; - register diskaddr_t i, nints; - register unsigned *ptr = (uint_t *)pattern_buf; + diskaddr_t i, nints; + unsigned *ptr = (uint_t *)pattern_buf; media_error = 0; if (flags & SCAN_VERIFY) { @@ -642,7 +624,7 @@ analyze_blocks(flags, blkno, blkcnt, data, init, driver_flags, xfercntp) blkcnt, (caddr_t)pattern_buf, driver_flags, xfercntp); if (status) - goto bad; + goto bad; } /* * Only read if we are on the read pass of SCAN_PURGE, if we @@ -653,7 +635,7 @@ analyze_blocks(flags, blkno, blkcnt, data, init, driver_flags, xfercntp) blkcnt, (caddr_t)pattern_buf, driver_flags, xfercntp); if (status) - goto bad; + goto bad; } } /* @@ -667,11 +649,11 @@ analyze_blocks(flags, blkno, blkcnt, data, init, driver_flags, xfercntp) if (*ptr++ != data) { err_print("Data miscompare error (expecting "); err_print("0x%x, got 0x%x) at ", data, - *((int *)((int *)pattern_buf + - (nints - i)))); + *((int *)((int *)pattern_buf + + (nints - i)))); pr_dblock(err_print, blkno); err_print(", offset = 0x%llx.\n", - (nints - i) * sizeof (int)); + (nints - i) * sizeof (int)); goto bad; } } @@ -696,7 +678,7 @@ bad: */ if (corrupt) { if ((*cur_ops->op_rdwr)(DIR_WRITE, cur_file, blkno, - blkcnt, (caddr_t)cur_buf, F_NORMAL, xfercntp)) + blkcnt, (caddr_t)cur_buf, F_NORMAL, xfercntp)) err_print("Warning: unable to restore original data.\n"); } exit_critical(); @@ -720,12 +702,8 @@ bad: * This should eliminate any caching effect on the drives. */ static int -verify_blocks(int flags, - diskaddr_t blkno, - uint_t blkcnt, - unsigned data, - int driver_flags, - int *xfercntp) +verify_blocks(int flags, diskaddr_t blkno, uint_t blkcnt, unsigned data, + int driver_flags, int *xfercntp) { int status, i, nints; unsigned *ptr = (uint_t *)pattern_buf; @@ -791,7 +769,7 @@ bad: static int -handle_error_conditions() +handle_error_conditions(void) { /* diff --git a/usr/src/cmd/format/auto_sense.c b/usr/src/cmd/format/auto_sense.c index eefb43809e..709cde540f 100644 --- a/usr/src/cmd/format/auto_sense.c +++ b/usr/src/cmd/format/auto_sense.c @@ -172,11 +172,6 @@ static struct default_partitions { */ #define SUN_MIN_CYL 3 - - -/* - * ANSI prototypes for local static functions - */ static struct disk_type *generic_disk_sense( int fd, int can_prompt, @@ -276,14 +271,14 @@ auto_efi_sense(int fd, struct efi_info *label) * get vendor, product, revision and capacity info. */ if (get_disk_info(fd, label, disk_info) == -1) { - return ((struct disk_type *)NULL); + return (NULL); } /* * Now build the default partition table */ if (efi_alloc_and_init(fd, EFI_NUMPAR, &vtoc) != 0) { err_print("efi_alloc_and_init failed. \n"); - return ((struct disk_type *)NULL); + return (NULL); } label->e_parts = vtoc; @@ -395,7 +390,7 @@ find_ctlr_type(ushort_t type) impossible("no DIRECT/VBD/BLKDEV controller type"); - return ((struct ctlr_type *)NULL); + return (NULL); } static struct ctlr_info * @@ -417,7 +412,7 @@ find_ctlr_info(struct dk_cinfo *dkinfo, ushort_t type) impossible("no DIRECT/VBD/BLKDEV controller info"); /*NOTREACHED*/ - return ((struct ctlr_info *)NULL); + return (NULL); } static struct disk_info * @@ -442,7 +437,7 @@ find_disk_info(struct dk_cinfo *dkinfo, ushort_t type) impossible("No DIRECT/VBD/BLKDEV disk info instance\n"); /*NOTREACHED*/ - return ((struct disk_info *)NULL); + return (NULL); } /* @@ -805,7 +800,7 @@ auto_sense( * no hope for this disk, so give up. */ if (uscsi_inquiry(fd, (char *)&inquiry, sizeof (inquiry))) { - return ((struct disk_type *)NULL); + return (NULL); } if (option_msg && diag_msg) { err_print("Product id: "); @@ -817,7 +812,7 @@ auto_sense( * Get the Read Capacity */ if (uscsi_read_capacity(fd, &capacity)) { - return ((struct disk_type *)NULL); + return (NULL); } /* @@ -833,7 +828,7 @@ auto_sense( if (option_msg && diag_msg) { err_print("Invalid capacity\n"); } - return ((struct disk_type *)NULL); + return (NULL); } if (option_msg && diag_msg) { err_print("blocks: %llu (0x%llx)\n", @@ -853,7 +848,7 @@ auto_sense( if (scsi_rdwr(DIR_READ, fd, (diskaddr_t)0, 1, (caddr_t)buf, F_SILENT, NULL)) { free(buf); - return ((struct disk_type *)NULL); + return (NULL); } free(buf); @@ -1714,7 +1709,7 @@ find_scsi_disk_type( } } - return ((struct disk_type *)NULL); + return (NULL); } @@ -1738,7 +1733,7 @@ find_scsi_disk_by_name( } } - return ((struct disk_type *)NULL); + return (NULL); } @@ -1749,7 +1744,7 @@ find_scsi_disk_by_name( * totally mangles the code. */ static struct ctlr_type * -find_scsi_ctlr_type() +find_scsi_ctlr_type(void) { struct mctlr_list *mlp; @@ -1764,7 +1759,7 @@ find_scsi_ctlr_type() impossible("no SCSI controller type"); - return ((struct ctlr_type *)NULL); + return (NULL); } @@ -1794,7 +1789,7 @@ find_scsi_ctlr_info( impossible("no SCSI controller info"); - return ((struct ctlr_info *)NULL); + return (NULL); } @@ -2020,7 +2015,7 @@ find_scsi_disk_info( impossible("No SCSI disk info instance\n"); - return ((struct disk_info *)NULL); + return (NULL); } diff --git a/usr/src/cmd/format/checkdev.c b/usr/src/cmd/format/checkdev.c index 94476bac91..fce436d188 100644 --- a/usr/src/cmd/format/checkdev.c +++ b/usr/src/cmd/format/checkdev.c @@ -56,36 +56,23 @@ #include <sys/efi_partition.h> /* Function prototypes */ -#ifdef __STDC__ - static struct swaptable *getswapentries(void); static void freeswapentries(struct swaptable *); static int getpartition(char *pathname); static int checkpartitions(int bm_mounted); -#else /* __STDC__ */ - -static struct swaptable *getswapentries(); -static void freeswapentries(); -static int getpartition(); -static int checkpartitions(); - -#endif /* __STDC__ */ - -extern char *getfullname(); - static struct swaptable * getswapentries(void) { - register struct swaptable *st; - register struct swapent *swapent; + struct swaptable *st; + struct swapent *swapent; int i, num; char fullpathname[MAXPATHLEN]; /* * get the number of swap entries */ - if ((num = swapctl(SC_GETNSWP, (void *)NULL)) == -1) { + if ((num = swapctl(SC_GETNSWP, NULL)) == -1) { err_print("swapctl error "); fullabort(); } @@ -120,10 +107,9 @@ getswapentries(void) } static void -freeswapentries(st) -struct swaptable *st; +freeswapentries(struct swaptable *st) { - register struct swapent *swapent; + struct swapent *swapent; int i; swapent = st->swt_ent; @@ -137,8 +123,7 @@ struct swaptable *st; * function getpartition: */ static int -getpartition(pathname) -char *pathname; +getpartition(char *pathname) { int mfd; struct dk_cinfo dkinfo; @@ -184,10 +169,9 @@ char *pathname; * If it's not the disk we're interested in, it doesn't apply. */ if (cur_disk->disk_dkinfo.dki_ctype != dkinfo.dki_ctype || - cur_disk->disk_dkinfo.dki_cnum != dkinfo.dki_cnum || - cur_disk->disk_dkinfo.dki_unit != dkinfo.dki_unit || - strcmp(cur_disk->disk_dkinfo.dki_dname, - dkinfo.dki_dname) != 0) { + cur_disk->disk_dkinfo.dki_cnum != dkinfo.dki_cnum || + cur_disk->disk_dkinfo.dki_unit != dkinfo.dki_unit || + strcmp(cur_disk->disk_dkinfo.dki_dname, dkinfo.dki_dname) != 0) { return (found); } @@ -203,8 +187,7 @@ char *pathname; * that the entire disk should be checked */ int -checkswap(start, end) - diskaddr_t start, end; +checkswap(diskaddr_t start, diskaddr_t end) { struct swaptable *st; struct swapent *swapent; @@ -228,7 +211,7 @@ checkswap(start, end) /* * if there are no swap entries return. */ - if (st == (struct swaptable *)NULL) + if (st == NULL) return (0); swapent = st->swt_ent; for (i = 0; i < st->swt_n; i++, swapent++) { @@ -239,8 +222,8 @@ checkswap(start, end) } map = &cur_parts->pinfo_map[part]; if ((start >= (int)(map->dkl_cylno * spc() + - map->dkl_nblk)) || (end < (int)(map->dkl_cylno - * spc()))) { + map->dkl_nblk)) || + (end < (int)(map->dkl_cylno * spc()))) { continue; } found = -1; @@ -270,7 +253,7 @@ checkswap(start, end) */ int checkdevinuse(char *cur_disk_path, diskaddr_t start, diskaddr_t end, int print, - int check_label) + int check_label) { int error; @@ -559,8 +542,7 @@ checkdevinuse(char *cur_disk_path, diskaddr_t start, diskaddr_t end, int print, * that the entire disk should be checked. */ int -checkmount(start, end) - diskaddr_t start, end; +checkmount(diskaddr_t start, diskaddr_t end) { FILE *fp; int found = 0; @@ -613,7 +595,7 @@ checkmount(start, end) */ map = &cur_parts->pinfo_map[part]; if ((start >= (int)(map->dkl_cylno * spc() + map->dkl_nblk)) || - (end < (int)(map->dkl_cylno * spc()))) { + (end < (int)(map->dkl_cylno * spc()))) { continue; } found = -1; @@ -641,7 +623,7 @@ checkmount(start, end) } int -check_label_with_swap() +check_label_with_swap(void) { int i; struct swaptable *st; @@ -664,7 +646,7 @@ check_label_with_swap() /* * if there are no swap entries return. */ - if (st == (struct swaptable *)NULL) + if (st == NULL) return (0); swapent = st->swt_ent; for (i = 0; i < st->swt_n; i++, swapent++) @@ -681,7 +663,7 @@ check_label_with_swap() * affected by writing the new label. */ int -check_label_with_mount() +check_label_with_mount(void) { FILE *fp; int part; diff --git a/usr/src/cmd/format/checkdev.h b/usr/src/cmd/format/checkdev.h index 8e4910d8b3..438d4982e0 100644 --- a/usr/src/cmd/format/checkdev.h +++ b/usr/src/cmd/format/checkdev.h @@ -27,8 +27,6 @@ #ifndef _CHECKDEV_H #define _CHECKDEV_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/ctlr_ata.c b/usr/src/cmd/format/ctlr_ata.c index e41c8e5580..e5ee8af0c0 100644 --- a/usr/src/cmd/format/ctlr_ata.c +++ b/usr/src/cmd/format/ctlr_ata.c @@ -198,7 +198,7 @@ ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr, } int -ata_ck_format() +ata_ck_format(void) { char *bufaddr; int status; @@ -216,7 +216,7 @@ ata_ck_format() #if defined(i386) static int -get_alts_slice() +get_alts_slice(void) { int i; @@ -249,7 +249,7 @@ get_alts_slice() static int -put_alts_slice() +put_alts_slice(void) { int status; diff --git a/usr/src/cmd/format/ctlr_scsi.c b/usr/src/cmd/format/ctlr_scsi.c index 657be3f212..0e9108581b 100644 --- a/usr/src/cmd/format/ctlr_scsi.c +++ b/usr/src/cmd/format/ctlr_scsi.c @@ -66,10 +66,6 @@ #define PROGRESS_INDICATION_BASE 65536 -#ifdef __STDC__ -/* - * Local prototypes for ANSI C compilers - */ static int scsi_format(uint64_t, uint64_t, struct defect_list *); static int scsi_raw_format(void); static int scsi_ms_page8(int); @@ -98,37 +94,6 @@ static int scsi_repair(uint64_t, int); static int scsi_read_defect_data(struct defect_list *, int); static int scsi_ck_format(void); -#else /* __STDC__ */ - -static int scsi_format(); -static int scsi_raw_format(); -static int scsi_ms_page8(); -static int scsi_ms_page38(); -static void scsi_convert_list_to_new(); -static char *scsi_find_command_name(); -static int chg_list_affects_page(); -static void scsi_printerr(); -static diskaddr_t scsi_extract_sense_info_descr(); -static void scsi_print_extended_sense(); -static void scsi_print_descr_sense(); - -static int test_until_ready(); - -static int uscsi_reserve_release(); -static int check_support_for_defects(); -static int scsi_format_without_defects(); -static int scsi_ms_page1(); -static int scsi_ms_page2(); -static int scsi_ms_page3(); -static int scsi_ms_page4(); -static int scsi_repair(); -static int scsi_read_defect_data(); -static int scsi_ck_format(); - -#endif /* __STDC__ */ - - - struct ctlr_ops scsiops = { scsi_rdwr, scsi_ck_format, @@ -183,7 +148,7 @@ static slist_t mode_select_strings[] = { }; static int scsi_format_revolutions = 5; -static int scsi_format_timeout = 2*60*60; /* two hours */ +static int scsi_format_timeout = 2 * 60 * 60; /* two hours */ /* * READ DEFECT DATA commands is optional as per SCSI-2 spec. @@ -197,14 +162,8 @@ static int scsi_format_timeout = 2*60*60; /* two hours */ * Read or write the disk. */ int -scsi_rdwr(dir, fd, blkno, secnt, bufaddr, flags, xfercntp) - int dir; - int fd; - diskaddr_t blkno; - int secnt; - caddr_t bufaddr; - int flags; - int *xfercntp; +scsi_rdwr(int dir, int fd, diskaddr_t blkno, int secnt, caddr_t bufaddr, + int flags, int *xfercntp) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -293,7 +252,7 @@ scsi_rdwr(dir, fd, blkno, secnt, bufaddr, flags, xfercntp) if (xfercntp != NULL && max_sectors < *xfercntp) { if (diag_msg) err_print("reducing xfercnt %d %d\n", - *xfercntp, max_sectors); + *xfercntp, max_sectors); *xfercntp = max_sectors; } return (rc); @@ -305,11 +264,7 @@ scsi_rdwr(dir, fd, blkno, secnt, bufaddr, flags, xfercntp) * If we are able to read the first track, we conclude that * the disk has been formatted. */ -#ifdef i386 static int -#else /* i386 */ -static int -#endif /* i386 */ scsi_ck_format(void) { int status; @@ -326,12 +281,8 @@ scsi_ck_format(void) /* * Format the disk, the whole disk, and nothing but the disk. */ -/*ARGSUSED*/ static int -scsi_format(start, end, list) - uint64_t start; /* irrelevant for us */ - uint64_t end; - struct defect_list *list; +scsi_format(uint64_t start __unused, uint64_t end, struct defect_list *list) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -379,8 +330,8 @@ scsi_format(start, end, list) * in format.dat. */ if (scsi_ms_page1(flag) || scsi_ms_page2(flag) || - scsi_ms_page4(flag) || scsi_ms_page38(flag) || - scsi_ms_page8(flag) || scsi_ms_page3(flag)) { + scsi_ms_page4(flag) || scsi_ms_page38(flag) || + scsi_ms_page8(flag) || scsi_ms_page3(flag)) { (void) uscsi_reserve_release(cur_file, SCMD_RELEASE); return (-1); } @@ -479,7 +430,7 @@ scsi_format(start, end, list) fmt_print("Formatting...\n"); (void) fflush(stdout); status = uscsi_cmd(cur_file, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); /* check if format with immed was successfully accepted */ if (status == 0) { @@ -515,7 +466,7 @@ scsi_format(start, end, list) * formatting failed with fmtdata = 1. * Check if defects list command is supported, if it * is not supported then use fmtdata = 0. - * From SCSI Spec + * From SCSI Spec * A FmtData bit of zero indicates, the * source of defect information is not specified. * else @@ -614,7 +565,7 @@ scsi_raw_format(void) * Caller should add 50% margin to cover defect management overhead. */ int -scsi_format_time() +scsi_format_time(void) { struct mode_geometry *page4; struct scsi_ms_header header; @@ -697,10 +648,8 @@ scsi_format_time() * Check disk error recovery parameters via mode sense. * Issue a mode select if we need to change something. */ -/*ARGSUSED*/ static int -scsi_ms_page1(scsi2_flag) - int scsi2_flag; +scsi_ms_page1(int scsi2_flag __unused) { struct mode_err_recov *page1; struct mode_err_recov *fixed; @@ -726,11 +675,11 @@ scsi_ms_page1(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_ERR_RECOV, - MODE_SENSE_PC_DEFAULT, (caddr_t)page1, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_DEFAULT, (caddr_t)page1, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_ERR_RECOV, - MODE_SENSE_PC_CURRENT, (caddr_t)page1, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page1, + MAX_MODE_SENSE_SIZE, &header); } /* @@ -738,12 +687,12 @@ scsi_ms_page1(scsi2_flag) * If the saved values fail, use the current instead. */ status = uscsi_mode_sense(cur_file, DAD_MODE_ERR_RECOV, - MODE_SENSE_PC_SAVED, (caddr_t)page1, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page1, + MAX_MODE_SENSE_SIZE, &header); if (status) { status = uscsi_mode_sense(cur_file, DAD_MODE_ERR_RECOV, - MODE_SENSE_PC_CURRENT, (caddr_t)page1, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page1, + MAX_MODE_SENSE_SIZE, &header); if (status) { return (0); } @@ -765,8 +714,8 @@ scsi_ms_page1(scsi2_flag) * Ask for changeable parameters. */ status = uscsi_mode_sense(cur_file, DAD_MODE_ERR_RECOV, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, - MAX_MODE_SENSE_SIZE, &fixed_hdr); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, + MAX_MODE_SENSE_SIZE, &fixed_hdr); if (status || MODESENSE_PAGE_LEN(fixed) < MIN_PAGE1_LEN) { return (0); } @@ -780,35 +729,34 @@ scsi_ms_page1(scsi2_flag) tmp1 = page1->read_retry_count; tmp2 = page1->write_retry_count; if (cur_dtype->dtype_options & SUP_READ_RETRIES && - fixed->read_retry_count != 0) { + fixed->read_retry_count != 0) { flag |= (page1->read_retry_count != - cur_dtype->dtype_read_retries); + cur_dtype->dtype_read_retries); page1->read_retry_count = cur_dtype->dtype_read_retries; } if (length > 8) { if (cur_dtype->dtype_options & SUP_WRITE_RETRIES && - fixed->write_retry_count != 0) { + fixed->write_retry_count != 0) { flag |= (page1->write_retry_count != - cur_dtype->dtype_write_retries); + cur_dtype->dtype_write_retries); page1->write_retry_count = - cur_dtype->dtype_write_retries; + cur_dtype->dtype_write_retries; } } /* * Report any changes so far... */ if (flag && option_msg) { - fmt_print( -"PAGE 1: read retries= %d (%d) write retries= %d (%d)\n", - page1->read_retry_count, tmp1, - page1->write_retry_count, tmp2); + fmt_print("PAGE 1: read retries= %d (%d) " + " write retries= %d (%d)\n", + page1->read_retry_count, tmp1, + page1->write_retry_count, tmp2); } /* * Apply any changes requested via the change list method */ flag |= apply_chg_list(DAD_MODE_ERR_RECOV, length, - (uchar_t *)page1, (uchar_t *)fixed, - cur_dtype->dtype_chglist); + (uchar_t *)page1, (uchar_t *)fixed, cur_dtype->dtype_chglist); /* * If no changes required, do not issue a mode select */ @@ -828,16 +776,16 @@ scsi_ms_page1(scsi2_flag) header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, DAD_MODE_ERR_RECOV, - sp_flags, (caddr_t)page1, length, &header); + sp_flags, (caddr_t)page1, length, &header); if (status && (sp_flags & MODE_SELECT_SP)) { /* If failed, try not saving mode select params. */ sp_flags &= ~MODE_SELECT_SP; status = uscsi_mode_select(cur_file, DAD_MODE_ERR_RECOV, - sp_flags, (caddr_t)page1, length, &header); + sp_flags, (caddr_t)page1, length, &header); } if (status && option_msg) { - err_print("\ -Warning: Using default error recovery parameters.\n\n"); + err_print("Warning: Using default error recovery " + "parameters.\n\n"); } /* @@ -847,11 +795,11 @@ Warning: Using default error recovery parameters.\n\n"); */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_ERR_RECOV, - MODE_SENSE_PC_CURRENT, (caddr_t)page1, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page1, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_ERR_RECOV, - MODE_SENSE_PC_SAVED, (caddr_t)page1, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page1, + MAX_MODE_SENSE_SIZE, &header); } return (0); @@ -861,10 +809,8 @@ Warning: Using default error recovery parameters.\n\n"); * Check disk disconnect/reconnect parameters via mode sense. * Issue a mode select if we need to change something. */ -/*ARGSUSED*/ static int -scsi_ms_page2(scsi2_flag) - int scsi2_flag; +scsi_ms_page2(int scsi2_flag __unused) { struct mode_disco_reco *page2; struct mode_disco_reco *fixed; @@ -888,11 +834,11 @@ scsi_ms_page2(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, MODEPAGE_DISCO_RECO, - MODE_SENSE_PC_DEFAULT, (caddr_t)page2, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_DEFAULT, (caddr_t)page2, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, MODEPAGE_DISCO_RECO, - MODE_SENSE_PC_CURRENT, (caddr_t)page2, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page2, + MAX_MODE_SENSE_SIZE, &header); } /* @@ -900,12 +846,12 @@ scsi_ms_page2(scsi2_flag) * If the saved values fail, use the current instead. */ status = uscsi_mode_sense(cur_file, MODEPAGE_DISCO_RECO, - MODE_SENSE_PC_SAVED, (caddr_t)page2, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page2, + MAX_MODE_SENSE_SIZE, &header); if (status) { status = uscsi_mode_sense(cur_file, MODEPAGE_DISCO_RECO, - MODE_SENSE_PC_CURRENT, (caddr_t)page2, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page2, + MAX_MODE_SENSE_SIZE, &header); if (status) { return (0); } @@ -927,8 +873,8 @@ scsi_ms_page2(scsi2_flag) * Ask for changeable parameters. */ status = uscsi_mode_sense(cur_file, MODEPAGE_DISCO_RECO, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, - MAX_MODE_SENSE_SIZE, &fixed_hdr); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, + MAX_MODE_SENSE_SIZE, &fixed_hdr); if (status || MODESENSE_PAGE_LEN(fixed) < MIN_PAGE2_LEN) { return (0); } @@ -943,8 +889,7 @@ scsi_ms_page2(scsi2_flag) * Apply any changes requested via the change list method */ flag |= apply_chg_list(MODEPAGE_DISCO_RECO, length, - (uchar_t *)page2, (uchar_t *)fixed, - cur_dtype->dtype_chglist); + (uchar_t *)page2, (uchar_t *)fixed, cur_dtype->dtype_chglist); /* * If no changes required, do not issue a mode select */ @@ -964,12 +909,12 @@ scsi_ms_page2(scsi2_flag) header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, MODEPAGE_DISCO_RECO, - MODE_SELECT_SP, (caddr_t)page2, length, &header); + MODE_SELECT_SP, (caddr_t)page2, length, &header); if (status && (sp_flags & MODE_SELECT_SP)) { /* If failed, try not saving mode select params. */ sp_flags &= ~MODE_SELECT_SP; status = uscsi_mode_select(cur_file, MODEPAGE_DISCO_RECO, - sp_flags, (caddr_t)page2, length, &header); + sp_flags, (caddr_t)page2, length, &header); } if (status && option_msg) { err_print("Warning: Using default .\n\n"); @@ -982,11 +927,11 @@ scsi_ms_page2(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, MODEPAGE_DISCO_RECO, - MODE_SENSE_PC_CURRENT, (caddr_t)page2, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page2, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, MODEPAGE_DISCO_RECO, - MODE_SENSE_PC_SAVED, (caddr_t)page2, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page2, + MAX_MODE_SENSE_SIZE, &header); } return (0); @@ -996,10 +941,8 @@ scsi_ms_page2(scsi2_flag) * Check disk format parameters via mode sense. * Issue a mode select if we need to change something. */ -/*ARGSUSED*/ static int -scsi_ms_page3(scsi2_flag) - int scsi2_flag; +scsi_ms_page3(int scsi2_flag __unused) { struct mode_format *page3; struct mode_format *fixed; @@ -1026,11 +969,11 @@ scsi_ms_page3(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_FORMAT, - MODE_SENSE_PC_DEFAULT, (caddr_t)page3, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_DEFAULT, (caddr_t)page3, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_FORMAT, - MODE_SENSE_PC_CURRENT, (caddr_t)page3, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page3, + MAX_MODE_SENSE_SIZE, &header); } /* @@ -1038,12 +981,12 @@ scsi_ms_page3(scsi2_flag) * If the saved values fail, use the current instead. */ status = uscsi_mode_sense(cur_file, DAD_MODE_FORMAT, - MODE_SENSE_PC_SAVED, (caddr_t)page3, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page3, + MAX_MODE_SENSE_SIZE, &header); if (status) { status = uscsi_mode_sense(cur_file, DAD_MODE_FORMAT, - MODE_SENSE_PC_CURRENT, (caddr_t)page3, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page3, + MAX_MODE_SENSE_SIZE, &header); if (status) { return (0); } @@ -1065,8 +1008,8 @@ scsi_ms_page3(scsi2_flag) * Ask for changeable parameters. */ status = uscsi_mode_sense(cur_file, DAD_MODE_FORMAT, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, - MAX_MODE_SENSE_SIZE, &fixed_hdr); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, + MAX_MODE_SENSE_SIZE, &fixed_hdr); if (status || MODESENSE_PAGE_LEN(fixed) < MIN_PAGE3_LEN) { return (0); } @@ -1090,32 +1033,29 @@ scsi_ms_page3(scsi2_flag) page3->interleave = 1; if (cur_dtype->dtype_options & SUP_CYLSKEW && - fixed->cylinder_skew != 0) { + fixed->cylinder_skew != 0) { flag |= (page3->cylinder_skew != cur_dtype->dtype_cyl_skew); page3->cylinder_skew = cur_dtype->dtype_cyl_skew; } - if (cur_dtype->dtype_options & SUP_TRKSKEW && - fixed->track_skew != 0) { + if (cur_dtype->dtype_options & SUP_TRKSKEW && fixed->track_skew != 0) { flag |= (page3->track_skew != cur_dtype->dtype_trk_skew); page3->track_skew = cur_dtype->dtype_trk_skew; } - if (cur_dtype->dtype_options & SUP_PSECT && - fixed->sect_track != 0) { + if (cur_dtype->dtype_options & SUP_PSECT && fixed->sect_track != 0) { flag |= (page3->sect_track != psect); page3->sect_track = (ushort_t)psect; } if (cur_dtype->dtype_options & SUP_TRKS_ZONE && - fixed->tracks_per_zone != 0) { + fixed->tracks_per_zone != 0) { flag |= (page3->tracks_per_zone != cur_dtype->dtype_trks_zone); page3->tracks_per_zone = cur_dtype->dtype_trks_zone; } - if (cur_dtype->dtype_options & SUP_ASECT && - fixed->alt_sect_zone != 0) { + if (cur_dtype->dtype_options & SUP_ASECT && fixed->alt_sect_zone != 0) { flag |= (page3->alt_sect_zone != cur_dtype->dtype_asect); page3->alt_sect_zone = cur_dtype->dtype_asect; } if (cur_dtype->dtype_options & SUP_ATRKS && - fixed->alt_tracks_vol != 0) { + fixed->alt_tracks_vol != 0) { flag |= (page3->alt_tracks_vol != cur_dtype->dtype_atrks); page3->alt_tracks_vol = cur_dtype->dtype_atrks; } @@ -1124,20 +1064,19 @@ scsi_ms_page3(scsi2_flag) */ if (flag && option_msg) { fmt_print("PAGE 3: trk skew= %d (%d) cyl skew= %d (%d) ", - page3->track_skew, tmp1, page3->cylinder_skew, tmp2); + page3->track_skew, tmp1, page3->cylinder_skew, tmp2); fmt_print("sects/trk= %d (%d)\n", page3->sect_track, tmp3); fmt_print(" trks/zone= %d (%d) alt trks= %d (%d) ", - page3->tracks_per_zone, tmp4, - page3->alt_tracks_vol, tmp5); + page3->tracks_per_zone, tmp4, + page3->alt_tracks_vol, tmp5); fmt_print("alt sects/zone= %d (%d)\n", - page3->alt_sect_zone, tmp6); + page3->alt_sect_zone, tmp6); } /* * Apply any changes requested via the change list method */ flag |= apply_chg_list(DAD_MODE_FORMAT, length, - (uchar_t *)page3, (uchar_t *)fixed, - cur_dtype->dtype_chglist); + (uchar_t *)page3, (uchar_t *)fixed, cur_dtype->dtype_chglist); /* * If no changes required, do not issue a mode select */ @@ -1160,12 +1099,12 @@ scsi_ms_page3(scsi2_flag) header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, DAD_MODE_FORMAT, - MODE_SELECT_SP, (caddr_t)page3, length, &header); + MODE_SELECT_SP, (caddr_t)page3, length, &header); if (status && (sp_flags & MODE_SELECT_SP)) { /* If failed, try not saving mode select params. */ sp_flags &= ~MODE_SELECT_SP; status = uscsi_mode_select(cur_file, DAD_MODE_FORMAT, - sp_flags, (caddr_t)page3, length, &header); + sp_flags, (caddr_t)page3, length, &header); } if (status && option_msg) { err_print("Warning: Using default drive format parameters.\n"); @@ -1179,11 +1118,11 @@ scsi_ms_page3(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_FORMAT, - MODE_SENSE_PC_CURRENT, (caddr_t)page3, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page3, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_FORMAT, - MODE_SENSE_PC_SAVED, (caddr_t)page3, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page3, + MAX_MODE_SENSE_SIZE, &header); } return (0); @@ -1193,10 +1132,8 @@ scsi_ms_page3(scsi2_flag) * Check disk geometry parameters via mode sense. * Issue a mode select if we need to change something. */ -/*ARGSUSED*/ static int -scsi_ms_page4(scsi2_flag) - int scsi2_flag; +scsi_ms_page4(int scsi2_flag __unused) { struct mode_geometry *page4; struct mode_geometry *fixed; @@ -1221,11 +1158,11 @@ scsi_ms_page4(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_GEOMETRY, - MODE_SENSE_PC_DEFAULT, (caddr_t)page4, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_DEFAULT, (caddr_t)page4, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_GEOMETRY, - MODE_SENSE_PC_CURRENT, (caddr_t)page4, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page4, + MAX_MODE_SENSE_SIZE, &header); } /* @@ -1233,12 +1170,12 @@ scsi_ms_page4(scsi2_flag) * If the saved values fail, use the current instead. */ status = uscsi_mode_sense(cur_file, DAD_MODE_GEOMETRY, - MODE_SENSE_PC_SAVED, (caddr_t)page4, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page4, + MAX_MODE_SENSE_SIZE, &header); if (status) { status = uscsi_mode_sense(cur_file, DAD_MODE_GEOMETRY, - MODE_SENSE_PC_CURRENT, (caddr_t)page4, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page4, + MAX_MODE_SENSE_SIZE, &header); if (status) { return (0); } @@ -1260,8 +1197,8 @@ scsi_ms_page4(scsi2_flag) * Ask for changeable parameters. */ status = uscsi_mode_sense(cur_file, DAD_MODE_GEOMETRY, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, - MAX_MODE_SENSE_SIZE, &fixed_hdr); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, + MAX_MODE_SENSE_SIZE, &fixed_hdr); if (status || MODESENSE_PAGE_LEN(fixed) < MIN_PAGE4_LEN) { return (0); } @@ -1284,14 +1221,13 @@ scsi_ms_page4(scsi2_flag) */ if (flag && option_msg) { fmt_print("PAGE 4: cylinders= %d heads= %d (%d)\n", - tmp1, page4->heads, tmp2); + tmp1, page4->heads, tmp2); } /* * Apply any changes requested via the change list method */ flag |= apply_chg_list(DAD_MODE_GEOMETRY, length, - (uchar_t *)page4, (uchar_t *)fixed, - cur_dtype->dtype_chglist); + (uchar_t *)page4, (uchar_t *)fixed, cur_dtype->dtype_chglist); /* * If no changes required, do not issue a mode select */ @@ -1314,12 +1250,12 @@ scsi_ms_page4(scsi2_flag) header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, DAD_MODE_GEOMETRY, - MODE_SELECT_SP, (caddr_t)page4, length, &header); + MODE_SELECT_SP, (caddr_t)page4, length, &header); if (status && (sp_flags & MODE_SELECT_SP)) { /* If failed, try not saving mode select params. */ sp_flags &= ~MODE_SELECT_SP; status = uscsi_mode_select(cur_file, DAD_MODE_GEOMETRY, - sp_flags, (caddr_t)page4, length, &header); + sp_flags, (caddr_t)page4, length, &header); } if (status && option_msg) { err_print("Warning: Using default drive geometry.\n\n"); @@ -1332,11 +1268,11 @@ scsi_ms_page4(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_GEOMETRY, - MODE_SENSE_PC_CURRENT, (caddr_t)page4, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page4, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_GEOMETRY, - MODE_SENSE_PC_SAVED, (caddr_t)page4, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page4, + MAX_MODE_SENSE_SIZE, &header); } return (0); @@ -1346,10 +1282,8 @@ scsi_ms_page4(scsi2_flag) * Check SCSI-2 disk cache parameters via mode sense. * Issue a mode select if we need to change something. */ -/*ARGSUSED*/ static int -scsi_ms_page8(scsi2_flag) - int scsi2_flag; +scsi_ms_page8(int scsi2_flag __unused) { struct mode_cache *page8; struct mode_cache *fixed; @@ -1380,11 +1314,11 @@ scsi_ms_page8(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_DEFAULT, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_DEFAULT, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CURRENT, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); } /* @@ -1392,12 +1326,12 @@ scsi_ms_page8(scsi2_flag) * If the saved values fail, use the current instead. */ status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_SAVED, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status) { status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CURRENT, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status) { return (0); } @@ -1419,8 +1353,8 @@ scsi_ms_page8(scsi2_flag) * Ask for changeable parameters. */ status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, - MAX_MODE_SENSE_SIZE, &fixed_hdr); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, + MAX_MODE_SENSE_SIZE, &fixed_hdr); if (status || MODESENSE_PAGE_LEN(fixed) < MIN_PAGE8_LEN) { return (0); } @@ -1435,8 +1369,7 @@ scsi_ms_page8(scsi2_flag) * Apply any changes requested via the change list method */ flag |= apply_chg_list(DAD_MODE_CACHE, length, - (uchar_t *)page8, (uchar_t *)fixed, - cur_dtype->dtype_chglist); + (uchar_t *)page8, (uchar_t *)fixed, cur_dtype->dtype_chglist); /* * If no changes required, do not issue a mode select */ @@ -1459,16 +1392,16 @@ scsi_ms_page8(scsi2_flag) header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, DAD_MODE_CACHE, - sp_flags, (caddr_t)page8, length, &header); + sp_flags, (caddr_t)page8, length, &header); if (status && (sp_flags & MODE_SELECT_SP)) { /* If failed, try not saving mode select params. */ sp_flags &= ~MODE_SELECT_SP; status = uscsi_mode_select(cur_file, DAD_MODE_CACHE, - sp_flags, (caddr_t)page8, length, &header); - } + sp_flags, (caddr_t)page8, length, &header); + } if (status && option_msg) { - err_print("\ -Warning: Using default SCSI-2 cache parameters.\n\n"); + err_print( + "Warning: Using default SCSI-2 cache parameters.\n\n"); } /* @@ -1478,11 +1411,11 @@ Warning: Using default SCSI-2 cache parameters.\n\n"); */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CURRENT, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_SAVED, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); } return (0); @@ -1492,10 +1425,8 @@ Warning: Using default SCSI-2 cache parameters.\n\n"); * Check CCS disk cache parameters via mode sense. * Issue a mode select if we need to change something. */ -/*ARGSUSED*/ static int -scsi_ms_page38(scsi2_flag) - int scsi2_flag; +scsi_ms_page38(int scsi2_flag __unused) { struct mode_cache_ccs *page38; struct mode_cache_ccs *fixed; @@ -1516,9 +1447,8 @@ scsi_ms_page38(scsi2_flag) * Not all devices support it. */ if (((cur_dtype->dtype_options & (SUP_CACHE | SUP_PREFETCH | - SUP_CACHE_MIN | SUP_CACHE_MAX)) == 0) && - (!chg_list_affects_page(cur_dtype->dtype_chglist, - 0x38))) { + SUP_CACHE_MIN | SUP_CACHE_MAX)) == 0) && + (!chg_list_affects_page(cur_dtype->dtype_chglist, 0x38))) { return (0); } @@ -1531,11 +1461,11 @@ scsi_ms_page38(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE_CCS, - MODE_SENSE_PC_DEFAULT, (caddr_t)page38, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_DEFAULT, (caddr_t)page38, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE_CCS, - MODE_SENSE_PC_CURRENT, (caddr_t)page38, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page38, + MAX_MODE_SENSE_SIZE, &header); } /* @@ -1543,12 +1473,12 @@ scsi_ms_page38(scsi2_flag) * If the saved values fail, use the current instead. */ status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE_CCS, - MODE_SENSE_PC_SAVED, (caddr_t)page38, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page38, + MAX_MODE_SENSE_SIZE, &header); if (status) { status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE_CCS, - MODE_SENSE_PC_CURRENT, (caddr_t)page38, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page38, + MAX_MODE_SENSE_SIZE, &header); if (status) { return (0); } @@ -1570,8 +1500,8 @@ scsi_ms_page38(scsi2_flag) * Ask for changeable parameters. */ status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE_CCS, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, - MAX_MODE_SENSE_SIZE, &fixed_hdr); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)fixed, + MAX_MODE_SENSE_SIZE, &fixed_hdr); if (status || MODESENSE_PAGE_LEN(fixed) < MIN_PAGE38_LEN) { return (0); } @@ -1588,26 +1518,26 @@ scsi_ms_page38(scsi2_flag) flag = 0; if ((cur_dtype->dtype_options & SUP_CACHE) && - (fixed->mode & cur_dtype->dtype_cache) == - cur_dtype->dtype_cache) { + (fixed->mode & cur_dtype->dtype_cache) == + cur_dtype->dtype_cache) { flag |= (page38->mode != cur_dtype->dtype_cache); page38->mode = cur_dtype->dtype_cache; } if ((cur_dtype->dtype_options & SUP_PREFETCH) && - (fixed->threshold & cur_dtype->dtype_threshold) == - cur_dtype->dtype_threshold) { + (fixed->threshold & cur_dtype->dtype_threshold) == + cur_dtype->dtype_threshold) { flag |= (page38->threshold != cur_dtype->dtype_threshold); page38->threshold = cur_dtype->dtype_threshold; } if ((cur_dtype->dtype_options & SUP_CACHE_MIN) && - (fixed->min_prefetch & cur_dtype->dtype_prefetch_min) == - cur_dtype->dtype_prefetch_min) { + (fixed->min_prefetch & cur_dtype->dtype_prefetch_min) == + cur_dtype->dtype_prefetch_min) { flag |= (page38->min_prefetch != cur_dtype->dtype_prefetch_min); page38->min_prefetch = cur_dtype->dtype_prefetch_min; } if ((cur_dtype->dtype_options & SUP_CACHE_MAX) && - (fixed->max_prefetch & cur_dtype->dtype_prefetch_max) == - cur_dtype->dtype_prefetch_max) { + (fixed->max_prefetch & cur_dtype->dtype_prefetch_max) == + cur_dtype->dtype_prefetch_max) { flag |= (page38->max_prefetch != cur_dtype->dtype_prefetch_max); page38->max_prefetch = cur_dtype->dtype_prefetch_max; } @@ -1616,24 +1546,24 @@ scsi_ms_page38(scsi2_flag) */ if (flag && option_msg) { fmt_print("PAGE 38: cache mode= 0x%x (0x%x)\n", - page38->mode, tmp1); + page38->mode, tmp1); fmt_print(" min. prefetch multiplier= %d ", - page38->min_multiplier); + page38->min_multiplier); fmt_print("max. prefetch multiplier= %d\n", - page38->max_multiplier); + page38->max_multiplier); fmt_print(" threshold= %d (%d) ", - page38->threshold, tmp2); + page38->threshold, tmp2); fmt_print("min. prefetch= %d (%d) ", - page38->min_prefetch, tmp3); + page38->min_prefetch, tmp3); fmt_print("max. prefetch= %d (%d)\n", - page38->max_prefetch, tmp4); + page38->max_prefetch, tmp4); } /* * Apply any changes requested via the change list method */ flag |= apply_chg_list(DAD_MODE_CACHE_CCS, length, - (uchar_t *)page38, (uchar_t *)fixed, - cur_dtype->dtype_chglist); + (uchar_t *)page38, (uchar_t *)fixed, + cur_dtype->dtype_chglist); /* * If no changes required, do not issue a mode select */ @@ -1655,13 +1585,13 @@ scsi_ms_page38(scsi2_flag) header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, DAD_MODE_CACHE_CCS, - sp_flags, (caddr_t)page38, length, &header); + sp_flags, (caddr_t)page38, length, &header); if (status && (sp_flags & MODE_SELECT_SP)) { /* If failed, try not saving mode select params. */ sp_flags &= ~MODE_SELECT_SP; status = uscsi_mode_select(cur_file, DAD_MODE_CACHE_CCS, - sp_flags, (caddr_t)page38, length, &header); - } + sp_flags, (caddr_t)page38, length, &header); + } if (status && option_msg) { err_print("Warning: Using default CCS cache parameters.\n\n"); } @@ -1673,11 +1603,11 @@ scsi_ms_page38(scsi2_flag) */ if (option_msg && diag_msg) { (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE_CCS, - MODE_SENSE_PC_CURRENT, (caddr_t)page38, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page38, + MAX_MODE_SENSE_SIZE, &header); (void) uscsi_mode_sense(cur_file, DAD_MODE_CACHE_CCS, - MODE_SENSE_PC_SAVED, (caddr_t)page38, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page38, + MAX_MODE_SENSE_SIZE, &header); } return (0); @@ -1688,8 +1618,7 @@ scsi_ms_page38(scsi2_flag) * Extract the manufacturer's defect list. */ int -scsi_ex_man(list) - struct defect_list *list; +scsi_ex_man(struct defect_list *list) { int i; @@ -1706,8 +1635,7 @@ scsi_ex_man(list) * and the grown (G) lists. */ int -scsi_ex_cur(list) - struct defect_list *list; +scsi_ex_cur(struct defect_list *list) { int i; @@ -1723,8 +1651,7 @@ scsi_ex_cur(list) * Extract the grown list only */ int -scsi_ex_grown(list) - struct defect_list *list; +scsi_ex_grown(struct defect_list *list) { int i; @@ -1737,9 +1664,7 @@ scsi_ex_grown(list) static int -scsi_read_defect_data(list, pglist_flags) - struct defect_list *list; - int pglist_flags; +scsi_read_defect_data(struct defect_list *list, int pglist_flags) { struct uscsi_cmd ucmd; char rqbuf[255]; @@ -1778,22 +1703,21 @@ scsi_read_defect_data(list, pglist_flags) rq = (struct scsi_extended_sense *)ucmd.uscsi_rqbuf; status = uscsi_cmd(cur_file, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); if (status != 0) { /* * check if read_defect_list_is_supported. */ if (ucmd.uscsi_rqstatus == STATUS_GOOD && - rq->es_key == KEY_ILLEGAL_REQUEST && - rq->es_add_code == INVALID_OPCODE) { + rq->es_key == KEY_ILLEGAL_REQUEST && + rq->es_add_code == INVALID_OPCODE) { err_print("\nWARNING: Current Disk does not support" - " defect lists. \n"); - } else - if (option_msg) { + " defect lists.\n"); + } else if (option_msg) { err_print("No %s defect list.\n", - pglist_flags & DLD_GROWN_DEF_LIST ? - "grown" : "manufacturer's"); + pglist_flags & DLD_GROWN_DEF_LIST ? + "grown" : "manufacturer's"); } return (-1); } @@ -1818,7 +1742,7 @@ scsi_read_defect_data(list, pglist_flags) ucmd.uscsi_bufaddr = (caddr_t)defects; ucmd.uscsi_buflen = nbytes; status = uscsi_cmd(cur_file, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); if (status) { err_print("can't read defect list 2nd time"); @@ -1834,7 +1758,7 @@ scsi_read_defect_data(list, pglist_flags) return (-1); } scsi_convert_list_to_new(list, (struct scsi_defect_list *)defects, - DLD_BFI_FORMAT); + DLD_BFI_FORMAT); destroy_data((char *)defects); return (0); } @@ -1843,11 +1767,8 @@ scsi_read_defect_data(list, pglist_flags) /* * Map a block. */ -/*ARGSUSED*/ static int -scsi_repair(bn, flag) - uint64_t bn; - int flag; +scsi_repair(uint64_t bn, int flag __unused) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -1859,7 +1780,7 @@ scsi_repair(bn, flag) (void) memset((char *)&ucmd, 0, sizeof (ucmd)); (void) memset((char *)&cdb, 0, sizeof (union scsi_cdb)); (void) memset((char *)&defect_list, 0, - sizeof (struct scsi_reassign_blk)); + sizeof (struct scsi_reassign_blk)); cdb.scc_cmd = SCMD_REASSIGN_BLOCK; ucmd.uscsi_cdb = (caddr_t)&cdb; ucmd.uscsi_cdblen = CDB_GROUP0; @@ -1870,7 +1791,7 @@ scsi_repair(bn, flag) defect_list.defect = bn; defect_list.defect = BE_32(defect_list.defect); return (uscsi_cmd(cur_file, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT)); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT)); } /* @@ -1878,15 +1799,13 @@ scsi_repair(bn, flag) * We can handle different format lists. */ static void -scsi_convert_list_to_new(list, def_list, list_format) - struct defect_list *list; - struct scsi_defect_list *def_list; - int list_format; +scsi_convert_list_to_new(struct defect_list *list, + struct scsi_defect_list *def_list, int list_format) { - register struct scsi_bfi_defect *old_defect, *old_defect1; - register struct defect_entry *new_defect; - register int len, new_len, obfi, nbfi; - register int i; + struct scsi_bfi_defect *old_defect, *old_defect1; + struct defect_entry *new_defect; + int len, new_len, obfi, nbfi; + int i; int old_cyl, new_cyl; unsigned char *cp; @@ -1940,9 +1859,9 @@ scsi_convert_list_to_new(list, def_list, list_format) * and update the length of the defect */ while ((i < len) && - (old_cyl == new_cyl) && - (old_defect->head == old_defect1->head) && - (nbfi == (obfi + BITSPERBYTE))) { + (old_cyl == new_cyl) && + (old_defect->head == old_defect1->head) && + (nbfi == (obfi + BITSPERBYTE))) { old_defect1 = old_defect++; cp = (unsigned char *)old_defect; new_cyl = (cp[0] << 16 | cp[1] << 8) | cp[2]; @@ -1981,10 +1900,7 @@ scsi_convert_list_to_new(list, def_list, list_format) * */ int -uscsi_cmd(fd, ucmd, flags) - int fd; - struct uscsi_cmd *ucmd; - int flags; +uscsi_cmd(int fd, struct uscsi_cmd *ucmd, int flags) { struct scsi_extended_sense *rq; char rqbuf[255]; @@ -2055,7 +1971,7 @@ uscsi_cmd(fd, ucmd, flags) } if (option_msg && diag_msg) { err_print("format_timeout set to %d seconds, %d" - " required\n", ucmd->uscsi_timeout, timeout); + " required\n", ucmd->uscsi_timeout, timeout); } break; @@ -2118,26 +2034,26 @@ uscsi_cmd(fd, ucmd, flags) if (ucmd->uscsi_rqstatus == IMPOSSIBLE_SCSI_STATUS) { if (option_msg && diag_msg) { err_print("No request sense for command %s\n", - scsi_find_command_name(ucmd->uscsi_cdb[0])); + scsi_find_command_name(ucmd->uscsi_cdb[0])); } return (-1); } if (ucmd->uscsi_rqstatus != STATUS_GOOD) { if (option_msg && diag_msg) { err_print("Request sense status for command %s: 0x%x\n", - scsi_find_command_name(ucmd->uscsi_cdb[0]), - ucmd->uscsi_rqstatus); + scsi_find_command_name(ucmd->uscsi_cdb[0]), + ucmd->uscsi_rqstatus); } return (-1); } rq = (struct scsi_extended_sense *)ucmd->uscsi_rqbuf; rqlen = ucmd->uscsi_rqlen - ucmd->uscsi_rqresid; if ((((int)rq->es_add_len) + 8) < MIN_REQUEST_SENSE_LEN || - rq->es_class != CLASS_EXTENDED_SENSE || - rqlen < MIN_REQUEST_SENSE_LEN) { + rq->es_class != CLASS_EXTENDED_SENSE || + rqlen < MIN_REQUEST_SENSE_LEN) { if (option_msg) { err_print("Request sense for command %s failed\n", - scsi_find_command_name(ucmd->uscsi_cdb[0])); + scsi_find_command_name(ucmd->uscsi_cdb[0])); } if (option_msg && diag_msg) { err_print("Sense data:\n"); @@ -2160,9 +2076,9 @@ uscsi_cmd(fd, ucmd, flags) */ if (ucmd->uscsi_cdb[0] == SCMD_MODE_SELECT) { if (rq->es_key == KEY_RECOVERABLE_ERROR && - rq->es_add_code == ROUNDED_PARAMETER && - rq->es_qual_code == 0) { - return (0); + rq->es_add_code == ROUNDED_PARAMETER && + rq->es_qual_code == 0) { + return (0); } } @@ -2204,13 +2120,8 @@ uscsi_cmd(fd, ucmd, flags) * will be returned to it upon subsequent mode selects. */ int -uscsi_mode_sense(fd, page_code, page_control, page_data, page_size, header) - int fd; /* file descriptor */ - int page_code; /* requested page number */ - int page_control; /* current, changeable, etc. */ - caddr_t page_data; /* place received data here */ - int page_size; /* size of page_data */ - struct scsi_ms_header *header; /* mode header/block descriptor */ +uscsi_mode_sense(int fd, int page_code, int page_control, caddr_t page_data, + int page_size, struct scsi_ms_header *header) { caddr_t mode_sense_buf; struct mode_header *hdr; @@ -2223,15 +2134,15 @@ uscsi_mode_sense(fd, page_code, page_control, page_data, page_size, header) assert(page_size >= 0 && page_size < 256); assert(page_control == MODE_SENSE_PC_CURRENT || - page_control == MODE_SENSE_PC_CHANGEABLE || - page_control == MODE_SENSE_PC_DEFAULT || - page_control == MODE_SENSE_PC_SAVED); + page_control == MODE_SENSE_PC_CHANGEABLE || + page_control == MODE_SENSE_PC_DEFAULT || + page_control == MODE_SENSE_PC_SAVED); /* * Allocate a buffer for the mode sense headers * and mode sense data itself. */ nbytes = sizeof (struct block_descriptor) + - sizeof (struct mode_header) + page_size; + sizeof (struct mode_header) + page_size; nbytes = page_size; if ((mode_sense_buf = malloc((uint_t)nbytes)) == NULL) { err_print("cannot malloc %d bytes\n", nbytes); @@ -2252,11 +2163,11 @@ uscsi_mode_sense(fd, page_code, page_control, page_data, page_size, header) ucmd.uscsi_bufaddr = mode_sense_buf; ucmd.uscsi_buflen = nbytes; status = uscsi_cmd(fd, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); if (status) { if (option_msg) { err_print("Mode sense page 0x%x failed\n", - page_code); + page_code); } free(mode_sense_buf); return (-1); @@ -2272,30 +2183,29 @@ uscsi_mode_sense(fd, page_code, page_control, page_data, page_size, header) hdr = (struct mode_header *)mode_sense_buf; (void) memset((caddr_t)header, 0, sizeof (struct scsi_ms_header)); if (hdr->bdesc_length != sizeof (struct block_descriptor) && - hdr->bdesc_length != 0) { + hdr->bdesc_length != 0) { if (option_msg) { - err_print("\ -\nMode sense page 0x%x: block descriptor length %d incorrect\n", - page_code, hdr->bdesc_length); + err_print("\nMode sense page 0x%x: block " + "descriptor length %d incorrect\n", + page_code, hdr->bdesc_length); if (diag_msg) dump("Mode sense: ", mode_sense_buf, - nbytes, HEX_ONLY); + nbytes, HEX_ONLY); } free(mode_sense_buf); return (-1); } (void) memcpy((caddr_t)header, mode_sense_buf, - (int) (sizeof (struct mode_header) + hdr->bdesc_length)); + sizeof (struct mode_header) + hdr->bdesc_length); pg = (struct mode_page *)((ulong_t)mode_sense_buf + - sizeof (struct mode_header) + hdr->bdesc_length); + sizeof (struct mode_header) + hdr->bdesc_length); if (pg->code != page_code) { if (option_msg) { - err_print("\ -\nMode sense page 0x%x: incorrect page code 0x%x\n", - page_code, pg->code); + err_print("\nMode sense page 0x%x: incorrect page " + "code 0x%x\n", page_code, pg->code); if (diag_msg) dump("Mode sense: ", mode_sense_buf, - nbytes, HEX_ONLY); + nbytes, HEX_ONLY); } free(mode_sense_buf); return (-1); @@ -2309,12 +2219,12 @@ uscsi_mode_sense(fd, page_code, page_control, page_data, page_size, header) maximum = page_size - sizeof (struct mode_page) - hdr->bdesc_length; if (((int)pg->length) > maximum) { if (option_msg) { - err_print("\ -Mode sense page 0x%x: incorrect page length %d - expected max %d\n", - page_code, pg->length, maximum); + err_print("Mode sense page 0x%x: incorrect page " + "length %d - expected max %d\n", + page_code, pg->length, maximum); if (diag_msg) dump("Mode sense: ", mode_sense_buf, - nbytes, HEX_ONLY); + nbytes, HEX_ONLY); } free(mode_sense_buf); return (-1); @@ -2324,12 +2234,13 @@ Mode sense page 0x%x: incorrect page length %d - expected max %d\n", if (option_msg && diag_msg) { char *pc = find_string(page_control_strings, page_control); + err_print("\nMode sense page 0x%x (%s):\n", page_code, - pc != NULL ? pc : ""); + pc != NULL ? pc : ""); dump("header: ", (caddr_t)header, - sizeof (struct scsi_ms_header), HEX_ONLY); + sizeof (struct scsi_ms_header), HEX_ONLY); dump("data: ", page_data, - MODESENSE_PAGE_LEN(pg), HEX_ONLY); + MODESENSE_PAGE_LEN(pg), HEX_ONLY); } free(mode_sense_buf); @@ -2341,13 +2252,8 @@ Mode sense page 0x%x: incorrect page length %d - expected max %d\n", * Execute a uscsi mode select command. */ int -uscsi_mode_select(fd, page_code, options, page_data, page_size, header) - int fd; /* file descriptor */ - int page_code; /* mode select page */ - int options; /* save page/page format */ - caddr_t page_data; /* place received data here */ - int page_size; /* size of page_data */ - struct scsi_ms_header *header; /* mode header/block descriptor */ +uscsi_mode_select(int fd, int page_code, int options, caddr_t page_data, + int page_size, struct scsi_ms_header *header) { caddr_t mode_select_buf; int nbytes; @@ -2364,7 +2270,7 @@ uscsi_mode_select(fd, page_code, options, page_data, page_size, header) * Allocate a buffer for the mode select header and data */ nbytes = sizeof (struct block_descriptor) + - sizeof (struct mode_header) + page_size; + sizeof (struct mode_header) + page_size; if ((mode_select_buf = malloc((uint_t)nbytes)) == NULL) { err_print("cannot malloc %d bytes\n", nbytes); return (-1); @@ -2378,7 +2284,7 @@ uscsi_mode_select(fd, page_code, options, page_data, page_size, header) (void) memset(mode_select_buf, 0, nbytes); nbytes = sizeof (struct mode_header); if (header->mode_header.bdesc_length == - sizeof (struct block_descriptor)) { + sizeof (struct block_descriptor)) { nbytes += sizeof (struct block_descriptor); } @@ -2387,14 +2293,15 @@ uscsi_mode_select(fd, page_code, options, page_data, page_size, header) */ if (option_msg && diag_msg) { char *s; + s = find_string(mode_select_strings, - options & (MODE_SELECT_SP|MODE_SELECT_PF)); + options & (MODE_SELECT_SP|MODE_SELECT_PF)); err_print("\nMode select page 0x%x%s:\n", page_code, - s != NULL ? s : ""); + s != NULL ? s : ""); dump("header: ", (caddr_t)header, - nbytes, HEX_ONLY); + nbytes, HEX_ONLY); dump("data: ", (caddr_t)page_data, - page_size, HEX_ONLY); + page_size, HEX_ONLY); } /* @@ -2488,7 +2395,7 @@ uscsi_mode_select(fd, page_code, options, page_data, page_size, header) ucmd.uscsi_bufaddr = mode_select_buf; ucmd.uscsi_buflen = nbytes; status = uscsi_cmd(fd, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); if (status && option_msg) { err_print("Mode select page 0x%x failed\n", page_code); @@ -2504,10 +2411,7 @@ uscsi_mode_select(fd, page_code, options, page_data, page_size, header) * resulting data. */ int -uscsi_inquiry(fd, inqbuf, inqbufsiz) - int fd; - caddr_t inqbuf; - int inqbufsiz; +uscsi_inquiry(int fd, caddr_t inqbuf, int inqbufsiz) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -2515,8 +2419,7 @@ uscsi_inquiry(fd, inqbuf, inqbufsiz) int n; int status; - assert(inqbufsiz >= sizeof (struct scsi_inquiry) && - inqbufsiz < 256); + assert(inqbufsiz >= sizeof (struct scsi_inquiry) && inqbufsiz < 256); /* * Build and execute the uscsi ioctl @@ -2531,7 +2434,7 @@ uscsi_inquiry(fd, inqbuf, inqbufsiz) ucmd.uscsi_bufaddr = (caddr_t)inqbuf; ucmd.uscsi_buflen = inqbufsiz; status = uscsi_cmd(fd, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); if (status) { if (option_msg) { err_print("Inquiry failed\n"); @@ -2553,10 +2456,7 @@ uscsi_inquiry(fd, inqbuf, inqbufsiz) * Execute a uscsi inquiry command with page code 86h */ int -uscsi_inquiry_page_86h(fd, inqbuf, inqbufsiz) - int fd; - caddr_t inqbuf; - int inqbufsiz; +uscsi_inquiry_page_86h(int fd, caddr_t inqbuf, int inqbufsiz) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -2595,9 +2495,7 @@ uscsi_inquiry_page_86h(fd, inqbuf, inqbufsiz) * Return the Read Capacity information */ int -uscsi_read_capacity_16(fd, capacity) - int fd; - struct scsi_capacity_16 *capacity; +uscsi_read_capacity_16(int fd, struct scsi_capacity_16 *capacity) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -2654,9 +2552,7 @@ uscsi_read_capacity_16(fd, capacity) } int -uscsi_read_capacity(fd, capacity) - int fd; - struct scsi_capacity_16 *capacity; +uscsi_read_capacity(int fd, struct scsi_capacity_16 *capacity) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -2676,7 +2572,7 @@ uscsi_read_capacity(fd, capacity) ucmd.uscsi_bufaddr = (caddr_t)&cap_old; ucmd.uscsi_buflen = sizeof (struct scsi_capacity); status = uscsi_cmd(fd, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); if (cap_old.capacity == UINT_MAX32) { /* @@ -2687,8 +2583,7 @@ uscsi_read_capacity(fd, capacity) * to get the correct size. */ (void) memset((char *)&ucmd, 0, sizeof (ucmd)); - (void) memset((char *)&cdb, 0, - sizeof (union scsi_cdb)); + (void) memset((char *)&cdb, 0, sizeof (union scsi_cdb)); ucmd.uscsi_cdb = (caddr_t)&cdb; ucmd.uscsi_cdblen = CDB_GROUP4; @@ -2716,7 +2611,7 @@ uscsi_read_capacity(fd, capacity) (uchar_t)(ucmd.uscsi_buflen & 0x000000ff); status = uscsi_cmd(fd, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); } if (status) { @@ -2736,10 +2631,10 @@ uscsi_read_capacity(fd, capacity) */ if (cap_old.capacity == UINT_MAX32) { dump("Capacity: ", (caddr_t)capacity, - sizeof (struct scsi_capacity_16), HEX_ONLY); + sizeof (struct scsi_capacity_16), HEX_ONLY); } else { dump("Capacity: ", (caddr_t)&cap_old, - sizeof (struct scsi_capacity), HEX_ONLY); + sizeof (struct scsi_capacity), HEX_ONLY); } } @@ -2759,7 +2654,7 @@ uscsi_read_capacity(fd, capacity) * Reserve the current disk */ static int -uscsi_reserve_release(int fd, int cmd) +uscsi_reserve_release(int fd __maybe_unused, int cmd __maybe_unused) { int status = 0; #ifdef sparc @@ -2798,21 +2693,13 @@ uscsi_reserve_release(int fd, int cmd) } } } -#else /* not sparc */ - -#ifdef lint - fd = fd; - cmd = cmd; -#endif /* lint */ - -#endif /* not sparc */ +#endif /* sparc */ return (status); } int -scsi_dump_mode_sense_pages(page_control) - int page_control; +scsi_dump_mode_sense_pages(int page_control) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -2849,20 +2736,20 @@ scsi_dump_mode_sense_pages(page_control) ucmd.uscsi_bufaddr = msbuf; ucmd.uscsi_buflen = nbytes; status = uscsi_cmd(cur_file, &ucmd, - (option_msg && diag_msg) ? F_NORMAL : F_SILENT); + (option_msg && diag_msg) ? F_NORMAL : F_SILENT); if (status) { err_print("\nMode sense page 0x3f (%s) failed\n", - pc_str); + pc_str); result = 1; } else { err_print("\nMode sense pages (%s):\n", pc_str); mh = (struct mode_header *)msbuf; nbytes = mh->length - sizeof (struct mode_header) - - mh->bdesc_length + 1; + mh->bdesc_length + 1; p = msbuf + sizeof (struct mode_header) + - mh->bdesc_length; + mh->bdesc_length; dump(" ", msbuf, sizeof (struct mode_header) + - (int)mh->bdesc_length, HEX_ONLY); + (int)mh->bdesc_length, HEX_ONLY); while (nbytes > 0) { mp = (struct mode_page *)p; n = mp->length + sizeof (struct mode_page); @@ -2875,7 +2762,7 @@ scsi_dump_mode_sense_pages(page_control) } if (nbytes < 0) { err_print(" Sense data formatted incorrectly:\n"); - dump(" ", msbuf, (int)mh->length+1, HEX_ONLY); + dump(" ", msbuf, (int)mh->length + 1, HEX_ONLY); result = 1; } err_print("\n"); @@ -2887,10 +2774,7 @@ scsi_dump_mode_sense_pages(page_control) static void -scsi_printerr(ucmd, rq, rqlen) - struct uscsi_cmd *ucmd; - struct scsi_extended_sense *rq; - int rqlen; +scsi_printerr(struct uscsi_cmd *ucmd, struct scsi_extended_sense *rq, int rqlen) { diskaddr_t blkno; struct scsi_descr_sense_hdr *sdsp = @@ -3114,15 +2998,16 @@ scsi_find_command_name(uint_t cmd) * Return true if we support a particular mode page */ int -scsi_supported_page(int page) { +scsi_supported_page(int page) +{ return (page == 1 || page == 2 || page == 3 || page == 4 || - page == 8 || page == 0x38); + page == 8 || page == 0x38); } int apply_chg_list(int pageno, int pagsiz, uchar_t *curbits, - uchar_t *chgbits, struct chg_list *chglist) + uchar_t *chgbits, struct chg_list *chglist) { uchar_t c; int i; @@ -3174,9 +3059,7 @@ apply_chg_list(int pageno, int pagsiz, uchar_t *curbits, * the change list. */ static int -chg_list_affects_page(chglist, pageno) - struct chg_list *chglist; - int pageno; +chg_list_affects_page(struct chg_list *chglist, int pageno) { while (chglist != NULL) { if (chglist->pageno == pageno) { @@ -3215,9 +3098,7 @@ static char *scsi_extended_sense_labels[] = { * Display the full scsi_extended_sense as returned by the device */ static void -scsi_print_extended_sense(rq, rqlen) - struct scsi_extended_sense *rq; - int rqlen; +scsi_print_extended_sense(struct scsi_extended_sense *rq, int rqlen) { char **p; @@ -3240,18 +3121,18 @@ scsi_print_extended_sense(rq, rqlen) fmt_print("%s%d\n", *p++, rq->es_key); fmt_print("%s0x%02x 0x%02x 0x%02x 0x%02x\n", *p++, rq->es_info_1, - rq->es_info_2, rq->es_info_3, rq->es_info_4); + rq->es_info_2, rq->es_info_3, rq->es_info_4); fmt_print("%s%d\n", *p++, rq->es_add_len); fmt_print("%s0x%02x 0x%02x 0x%02x 0x%02x\n", *p++, rq->es_cmd_info[0], - rq->es_cmd_info[1], rq->es_cmd_info[2], rq->es_cmd_info[3]); + rq->es_cmd_info[1], rq->es_cmd_info[2], rq->es_cmd_info[3]); fmt_print("%s0x%02x = %d\n", *p++, rq->es_add_code, rq->es_add_code); fmt_print("%s0x%02x = %d\n", *p++, rq->es_qual_code, rq->es_qual_code); fmt_print("%s%d\n", *p++, rq->es_fru_code); fmt_print("%s0x%02x 0x%02x 0x%02x\n", *p++, rq->es_skey_specific[0], - rq->es_skey_specific[1], rq->es_skey_specific[2]); + rq->es_skey_specific[1], rq->es_skey_specific[2]); if (rqlen >= sizeof (*rq)) { fmt_print("%s0x%02x 0x%02x%s\n", *p, rq->es_add_info[0], - rq->es_add_info[1], (rqlen > sizeof (*rq)) ? " ..." : ""); + rq->es_add_info[1], (rqlen > sizeof (*rq)) ? " ..." : ""); } fmt_print("\n"); @@ -3275,9 +3156,7 @@ static char *scsi_descr_sense_labels[] = { */ static void -scsi_print_descr_sense(rq, rqlen) - struct scsi_descr_sense_hdr *rq; - int rqlen; +scsi_print_descr_sense(struct scsi_descr_sense_hdr *rq, int rqlen) { char **p; uint8_t *descr_offset; @@ -3312,7 +3191,7 @@ scsi_print_descr_sense(rq, rqlen) */ valid_sense_length = min((sizeof (struct scsi_descr_sense_hdr) + - rq->ds_addl_sense_length), rqlen); + rq->ds_addl_sense_length), rqlen); /* * Iterate through the list of descriptors, stopping when we @@ -3335,13 +3214,13 @@ scsi_print_descr_sense(rq, rqlen) information = (((uint64_t)isd->isd_information[0] << 56) | - ((uint64_t)isd->isd_information[1] << 48) | - ((uint64_t)isd->isd_information[2] << 40) | - ((uint64_t)isd->isd_information[3] << 32) | - ((uint64_t)isd->isd_information[4] << 24) | - ((uint64_t)isd->isd_information[5] << 16) | - ((uint64_t)isd->isd_information[6] << 8) | - ((uint64_t)isd->isd_information[7])); + ((uint64_t)isd->isd_information[1] << 48) | + ((uint64_t)isd->isd_information[2] << 40) | + ((uint64_t)isd->isd_information[3] << 32) | + ((uint64_t)isd->isd_information[4] << 24) | + ((uint64_t)isd->isd_information[5] << 16) | + ((uint64_t)isd->isd_information[6] << 8) | + ((uint64_t)isd->isd_information[7])); fmt_print("Information field: " "%0llx\n", information); break; @@ -3353,13 +3232,13 @@ scsi_print_descr_sense(rq, rqlen) cmd_specific = (((uint64_t)c->css_cmd_specific_info[0] << 56) | - ((uint64_t)c->css_cmd_specific_info[1] << 48) | - ((uint64_t)c->css_cmd_specific_info[2] << 40) | - ((uint64_t)c->css_cmd_specific_info[3] << 32) | - ((uint64_t)c->css_cmd_specific_info[4] << 24) | - ((uint64_t)c->css_cmd_specific_info[5] << 16) | - ((uint64_t)c->css_cmd_specific_info[6] << 8) | - ((uint64_t)c->css_cmd_specific_info[7])); + ((uint64_t)c->css_cmd_specific_info[1] << 48) | + ((uint64_t)c->css_cmd_specific_info[2] << 40) | + ((uint64_t)c->css_cmd_specific_info[3] << 32) | + ((uint64_t)c->css_cmd_specific_info[4] << 24) | + ((uint64_t)c->css_cmd_specific_info[5] << 16) | + ((uint64_t)c->css_cmd_specific_info[6] << 8) | + ((uint64_t)c->css_cmd_specific_info[7])); fmt_print("Command-specific information: " "%0llx\n", cmd_specific); break; @@ -3409,7 +3288,7 @@ scsi_print_descr_sense(rq, rqlen) * on the current disk. */ static int -check_support_for_defects() +check_support_for_defects(void) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -3465,7 +3344,7 @@ check_support_for_defects() * which do not support read defect list command. */ static int -scsi_format_without_defects() +scsi_format_without_defects(void) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -3516,7 +3395,7 @@ static int test_until_ready(int fd) { union scsi_cdb cdb; struct scsi_extended_sense sense; time_t start, check, time_left; - uint16_t progress; + uint16_t progress; int hour, min, sec; (void) memset((char *)&ucmd, 0, sizeof (ucmd)); diff --git a/usr/src/cmd/format/disk_generic.c b/usr/src/cmd/format/disk_generic.c index d053660a04..d303778248 100644 --- a/usr/src/cmd/format/disk_generic.c +++ b/usr/src/cmd/format/disk_generic.c @@ -59,19 +59,9 @@ #include "ctlr_scsi.h" #include "auto_sense.h" -#ifdef __STDC__ -/* - * Local prototypes for ANSI C compilers - */ static int generic_ck_format(void); static int generic_rdwr(int dir, int fd, diskaddr_t blkno, int secnt, caddr_t bufaddr, int flags, int *xfercntp); -#else /* __STDC__ */ - -static int generic_ck_format(); -static int generic_rdwr(); - -#endif /* __STDC__ */ struct ctlr_ops genericops = { generic_rdwr, @@ -90,7 +80,7 @@ struct ctlr_ops genericops = { * the disk has been formatted. */ static int -generic_ck_format() +generic_ck_format(void) { int status; @@ -108,14 +98,8 @@ generic_ck_format() */ /*ARGSUSED*/ static int -generic_rdwr(dir, fd, blkno, secnt, bufaddr, flags, xfercntp) - int dir; - int fd; - diskaddr_t blkno; - int secnt; - caddr_t bufaddr; - int flags; - int *xfercntp; +generic_rdwr(int dir, int fd, diskaddr_t blkno, int secnt, caddr_t bufaddr, + int flags, int *xfercntp) { offset_t tmpsec, status, tmpblk; diff --git a/usr/src/cmd/format/format.dat b/usr/src/cmd/format/format.dat index 740406ea93..be6640f512 100644 --- a/usr/src/cmd/format/format.dat +++ b/usr/src/cmd/format/format.dat @@ -1,6 +1,4 @@ # -#pragma ident "%Z%%M% %I% %E% SMI" -# # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # diff --git a/usr/src/cmd/format/init_ci386.c b/usr/src/cmd/format/init_ci386.c index bb211cb034..9463cec72f 100644 --- a/usr/src/cmd/format/init_ci386.c +++ b/usr/src/cmd/format/init_ci386.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file defines the known controller types. To add a new controller * type, simply add a new line to the array and define the necessary diff --git a/usr/src/cmd/format/init_csparc.c b/usr/src/cmd/format/init_csparc.c index a3ce6e6b97..3b284c38a9 100644 --- a/usr/src/cmd/format/init_csparc.c +++ b/usr/src/cmd/format/init_csparc.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file defines the known controller types. To add a new controller * type, simply add a new line to the array and define the necessary diff --git a/usr/src/cmd/format/init_menus.c b/usr/src/cmd/format/init_menus.c index 0831e19205..ffb2670cb4 100644 --- a/usr/src/cmd/format/init_menus.c +++ b/usr/src/cmd/format/init_menus.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains the declarations of menus for the program. To add * a new command/menu, simply add it to the appropriate table and define diff --git a/usr/src/cmd/format/io.c b/usr/src/cmd/format/io.c index e9171a7fdc..06342e975e 100644 --- a/usr/src/cmd/format/io.c +++ b/usr/src/cmd/format/io.c @@ -48,7 +48,7 @@ extern int data_lineno; -extern char *space2str(); +extern char *space2str(uint_t); /* * This variable is used to determine whether a token is present in the pipe @@ -194,7 +194,7 @@ clean_token(char *cleantoken, char *token) * This routine checks if a token is already present on the input line */ int -istokenpresent() +istokenpresent(void) { return (token_present); } @@ -205,7 +205,7 @@ istokenpresent() * may have already been swallowed by the last gettoken. */ static void -flushline() +flushline(void) { if (token_present) { /* @@ -497,7 +497,7 @@ reprompt: * the first item in the list. */ s = find_string(param->io_slist, *deflt); - if (s == (char *)NULL) { + if (s == NULL) { s = (param->io_slist)->str; } fmt_print("[%s]", s); @@ -701,10 +701,10 @@ reprompt: */ s = find_string(param->io_slist, *deflt); if ((cur_label == L_TYPE_EFI) && - (s == (char *)NULL)) { + (s == NULL)) { return (*deflt); } - if (s == (char *)NULL) { + if (s == NULL) { return ((param->io_slist)->value); } else { return (*deflt); @@ -772,8 +772,7 @@ reprompt: * Convert token to a disk block number. */ if (cur_label == L_TYPE_EFI) { - if (geti64(cleantoken, (uint64_t *)&bn64, - (uint64_t *)NULL)) + if (geti64(cleantoken, (uint64_t *)&bn64, NULL)) break; } else { if (getbn(cleantoken, &bn64)) @@ -812,7 +811,7 @@ reprompt: /* * Convert the token into an integer. */ - if (geti(cleantoken, (int *)&bn, (int *)NULL)) + if (geti(cleantoken, (int *)&bn, NULL)) break; /* * Check to be sure it is within the legal bounds. @@ -842,7 +841,7 @@ reprompt: /* * Convert the token into an integer. */ - if (geti64(cleantoken, (uint64_t *)&bn64, (uint64_t *)NULL)) { + if (geti64(cleantoken, (uint64_t *)&bn64, NULL)) { break; } /* @@ -876,7 +875,7 @@ reprompt: /* * Convert the token into an integer. */ - if (geti(cleantoken, (int *)&bn, (int *)NULL)) + if (geti(cleantoken, (int *)&bn, NULL)) break; /* * Check to be sure it is within the legal bounds. @@ -1335,7 +1334,7 @@ or g(gigabytes)\n"); */ /* convert token to integer */ - if (geti(cleantoken, &cylno, (int *)NULL)) { + if (geti(cleantoken, &cylno, NULL)) { break; } @@ -1548,7 +1547,7 @@ or g(gigabytes)\n"); /* * Token is number of blocks */ - if (geti64(cleantoken, &blokno, (uint64_t *)NULL)) { + if (geti64(cleantoken, &blokno, NULL)) { break; } if (blokno > bounds->upper) { @@ -1564,7 +1563,7 @@ or g(gigabytes)\n"); */ /* convert token to integer */ - if (geti64(cleantoken, &blokno, (uint64_t *)NULL)) { + if (geti64(cleantoken, &blokno, NULL)) { break; } diff --git a/usr/src/cmd/format/ix_altsctr.c b/usr/src/cmd/format/ix_altsctr.c index d90847cdf3..ca117c9e72 100644 --- a/usr/src/cmd/format/ix_altsctr.c +++ b/usr/src/cmd/format/ix_altsctr.c @@ -69,16 +69,16 @@ struct alts_mempart *ap = &alts_part; /* pointer to incore */ /* prototypes */ int updatebadsec(struct dkl_partition *, int); int read_altsctr(struct dkl_partition *); -static int chk_badsec(); -static int init_altsctr(); -static int get_altsctr(); -int wr_altsctr(); -static void get_badsec(); -static int count_badsec(); -static int gen_alts_ent(); -static int assign_altsctr(); -static void expand_map(); -static void compress_map(); +static int chk_badsec(void); +static int init_altsctr(void); +static int get_altsctr(void); +int wr_altsctr(void); +static void get_badsec(void); +static int count_badsec(void); +static int gen_alts_ent(void); +static int assign_altsctr(void); +static void expand_map(void); +static void compress_map(void); static int altsmap_getbit(blkaddr_t); static blkaddr_t altsmap_alloc(blkaddr_t, blkaddr_t, int, int); static void ent_sort(struct alts_ent *, int); @@ -92,9 +92,7 @@ static int chk_bad_altsctr(blkaddr_t); * updatebadsec () -- update bad sector/track mapping tables */ int -updatebadsec(part, init_flag) -int init_flag; -struct dkl_partition *part; +updatebadsec(struct dkl_partition *part, int init_flag) { if (init_flag) ap->ap_flag |= ALTS_ADDPART; @@ -115,54 +113,55 @@ int read_altsctr(struct dkl_partition *part) { if (ap->ap_tblp == NULL) { -/* allocate buffer for the alts partition table (sector size) */ - ap->ap_tbl_secsiz = byte_to_secsiz(ALTS_PARTTBL_SIZE, NBPSCTR); - ap->ap_tblp = (struct alts_parttbl *)malloc(ap->ap_tbl_secsiz); - if (ap->ap_tblp == NULL) { - (void) fprintf(stderr, - "Unable to malloc alternate partition table.\n"); - return (50); - } - -/* allocate buffer for the alts partition map (sector size) */ -/* buffers include the disk image bit map */ -/* and the incore transformed char map */ - - if ((ap->ap_memmapp = (uchar_t *)malloc(part->p_size)) == NULL) { - (void) fprintf(stderr, - "Unable to malloc incore alternate partition map.\n"); - return (51); - } - ap->ap_tblp->alts_map_len = (part->p_size + 8 - 1) / 8; - ap->ap_map_secsiz = byte_to_secsiz(ap->ap_tblp->alts_map_len, - NBPSCTR); - ap->ap_map_sectot = ap->ap_map_secsiz / NBPSCTR; - if ((ap->ap_mapp = (uchar_t *)malloc(ap->ap_map_secsiz)) == NULL) { - (void) fprintf(stderr, - "Unable to malloc alternate partition map.\n"); - return (52); - } -/* clear the buffers to zero */ - (void) memset(ap->ap_memmapp, 0, part->p_size); - (void) memset(ap->ap_mapp, 0, ap->ap_map_secsiz); - ap->part = *part; /* struct copy */ + /* allocate buffer for the alts partition table (sector size) */ + ap->ap_tbl_secsiz = byte_to_secsiz(ALTS_PARTTBL_SIZE, NBPSCTR); + ap->ap_tblp = malloc(ap->ap_tbl_secsiz); + if (ap->ap_tblp == NULL) { + (void) fprintf(stderr, + "Unable to malloc alternate partition table.\n"); + return (50); + } -/* - * if add alternate partition flag is set, then install the partition - * otherwise read the alts partition info from disk - * if failed, then assume the first installation - */ - if (ap->ap_flag & ALTS_ADDPART) - { - (void) fprintf(stderr, - "WARNING: Manually initializing alternate table.\n"); - (void) init_altsctr(); - } else { - if (get_altsctr() == SUCCESS) - (void) chk_badsec(); - else - (void) init_altsctr(); - } + /* + * allocate buffer for the alts partition map (sector size) + * buffers include the disk image bit map + * and the incore transformed char map. + */ + + if ((ap->ap_memmapp = malloc(part->p_size)) == NULL) { + (void) fprintf(stderr, "Unable to malloc incore " + "alternate partition map.\n"); + return (51); + } + ap->ap_tblp->alts_map_len = (part->p_size + 8 - 1) / 8; + ap->ap_map_secsiz = byte_to_secsiz(ap->ap_tblp->alts_map_len, + NBPSCTR); + ap->ap_map_sectot = ap->ap_map_secsiz / NBPSCTR; + if ((ap->ap_mapp = malloc(ap->ap_map_secsiz)) == NULL) { + (void) fprintf(stderr, "Unable to malloc alternate " + "partition map.\n"); + return (52); + } + /* clear the buffers to zero */ + (void) memset(ap->ap_memmapp, 0, part->p_size); + (void) memset(ap->ap_mapp, 0, ap->ap_map_secsiz); + ap->part = *part; /* struct copy */ + + /* + * if add alternate partition flag is set, then install + * the partition. Otherwise read the alts partition info + * from disk. If failed, then assume the first installation + */ + if (ap->ap_flag & ALTS_ADDPART) { + (void) fprintf(stderr, "WARNING: Manually " + "initializing alternate table.\n"); + (void) init_altsctr(); + } else { + if (get_altsctr() == SUCCESS) + (void) chk_badsec(); + else + (void) init_altsctr(); + } } return (SUCCESS); } @@ -172,7 +171,7 @@ read_altsctr(struct dkl_partition *part) * checking duplicate bad sectors or bad sectors in ALTSCTR partition */ static int -chk_badsec() +chk_badsec(void) { blkaddr_t badsec; blkaddr_t altsp_srtsec = ap->part.p_start; @@ -181,51 +180,63 @@ chk_badsec() int status; for (cnt = 0; cnt < ap->ap_gbadcnt; cnt++) { - badsec = (ap->ap_gbadp)[cnt].bad_start; - - /* if bad sector is within the ATLSCTR partition */ - if ((badsec >= altsp_srtsec) && (badsec <= altsp_endsec)) { - if ((ap->ap_memmapp)[badsec - altsp_srtsec] != ALTS_BAD) { - if ((badsec >= altsp_srtsec) && (badsec <= (altsp_srtsec + - ap->ap_tbl_secsiz / NBPSCTR - 1))) { - (void) fprintf(stderr, - "Alternate partition information table is bad.\n"); - return (53); - } - if ((badsec >= altsp_srtsec+ap->ap_tblp->alts_map_base) && - (badsec <= (altsp_srtsec + ap->ap_tblp->alts_map_base + - ap->ap_map_sectot - 1))) { - (void) fprintf(stderr, - "Alternate partition map is bad.\n"); - return (54); - } - if ((badsec >= altsp_srtsec+ap->ap_tblp->alts_ent_base) && - (badsec <= (altsp_srtsec + ap->ap_tblp->alts_ent_base + - ap->ap_ent_secsiz / NBPSCTR - 1))) { - (void) fprintf(stderr, - "Alternate partition entry table is bad.\n"); - return (55); - } - (ap->ap_memmapp)[badsec - altsp_srtsec] = ALTS_BAD; - (ap->ap_gbadp)[cnt].bad_start = (uint32_t)ALTS_ENT_EMPTY; + badsec = (ap->ap_gbadp)[cnt].bad_start; + + /* if bad sector is within the ATLSCTR partition */ + if ((badsec >= altsp_srtsec) && (badsec <= altsp_endsec)) { + if ((ap->ap_memmapp)[badsec - altsp_srtsec] != + ALTS_BAD) { + if ((badsec >= altsp_srtsec) && + (badsec <= (altsp_srtsec + + ap->ap_tbl_secsiz / NBPSCTR - 1))) { + (void) fprintf(stderr, + "Alternate partition information " + "table is bad.\n"); + return (53); + } + if ((badsec >= + altsp_srtsec+ap->ap_tblp->alts_map_base) && + (badsec <= + (altsp_srtsec + ap->ap_tblp->alts_map_base + + ap->ap_map_sectot - 1))) { + (void) fprintf(stderr, "Alternate " + "partition map is bad.\n"); + return (54); + } + if ((badsec >= + altsp_srtsec+ap->ap_tblp->alts_ent_base) && + (badsec <= + (altsp_srtsec + ap->ap_tblp->alts_ent_base + + ap->ap_ent_secsiz / NBPSCTR - 1))) { + (void) fprintf(stderr, "Alternate " + "partition entry table is bad.\n"); + return (55); + } + (ap->ap_memmapp)[badsec - altsp_srtsec] = + ALTS_BAD; + (ap->ap_gbadp)[cnt].bad_start = + (uint32_t)ALTS_ENT_EMPTY; + } else { + status = chk_bad_altsctr(badsec); + (ap->ap_gbadp)[cnt].bad_start = + (uint32_t)ALTS_ENT_EMPTY; + } } else { - status = chk_bad_altsctr(badsec); - (ap->ap_gbadp)[cnt].bad_start = (uint32_t)ALTS_ENT_EMPTY; - } - } else { -/* - * binary search for bad sector in the alts entry table - */ - status = ent_bsearch(ap->ap_entp, ap->ap_tblp->alts_ent_used, - &((ap->ap_gbadp)[cnt])); -/* - * if the bad sector had already been remapped(found in alts_entry) - * then ignore the bad sector - */ - if (status != -1) { - (ap->ap_gbadp)[cnt].bad_start = (uint32_t)ALTS_ENT_EMPTY; + /* + * binary search for bad sector in the alts entry table + */ + status = ent_bsearch(ap->ap_entp, + ap->ap_tblp->alts_ent_used, + &((ap->ap_gbadp)[cnt])); + /* + * if the bad sector had already been remapped + * (found in alts_entry), then ignore the bad sector. + */ + if (status != -1) { + (ap->ap_gbadp)[cnt].bad_start = + (uint32_t)ALTS_ENT_EMPTY; + } } - } } return (SUCCESS); } @@ -234,7 +245,7 @@ chk_badsec() * initialize the alternate partition tables */ static int -init_altsctr() +init_altsctr(void) { blkaddr_t badsec; blkaddr_t altsp_srtsec = ap->part.p_start; @@ -251,28 +262,29 @@ init_altsctr() ap->ap_tblp->alts_ent_end = 0; ap->ap_tblp->alts_resv_base = ap->part.p_size - 1; for (cnt = 0; cnt < 5; cnt++) - ap->ap_tblp->alts_pad[cnt] = 0; + ap->ap_tblp->alts_pad[cnt] = 0; for (cnt = 0; cnt < ap->ap_gbadcnt; cnt++) { - badsec = (ap->ap_gbadp)[cnt].bad_start; - if ((badsec >= altsp_srtsec) && (badsec <= altsp_endsec)) { - if (badsec == altsp_srtsec) { - (void) fprintf(stderr, - "First sector of alternate partition is bad.\n"); - return (56); + badsec = (ap->ap_gbadp)[cnt].bad_start; + if ((badsec >= altsp_srtsec) && (badsec <= altsp_endsec)) { + if (badsec == altsp_srtsec) { + (void) fprintf(stderr, "First sector of " + "alternate partition is bad.\n"); + return (56); + } + (ap->ap_memmapp)[badsec - altsp_srtsec] = ALTS_BAD; + (ap->ap_gbadp)[cnt].bad_start = + (uint32_t)ALTS_ENT_EMPTY; } - (ap->ap_memmapp)[badsec - altsp_srtsec] = ALTS_BAD; - (ap->ap_gbadp)[cnt].bad_start = (uint32_t)ALTS_ENT_EMPTY; - } } -/* allocate the alts_map on disk skipping possible bad sectors */ + /* allocate the alts_map on disk skipping possible bad sectors */ ap->ap_tblp->alts_map_base = - altsmap_alloc(ap->ap_tbl_secsiz / NBPSCTR, - ap->part.p_size, ap->ap_map_sectot, ALTS_MAP_UP); + altsmap_alloc(ap->ap_tbl_secsiz / NBPSCTR, + ap->part.p_size, ap->ap_map_sectot, ALTS_MAP_UP); if (ap->ap_tblp->alts_map_base == 0) { - perror("Unable to allocate alternate map on disk: "); - return (57); + perror("Unable to allocate alternate map on disk: "); + return (57); } (void) wr_altsctr(); @@ -289,51 +301,50 @@ get_altsctr(void) int mystatus = FAILURE; int status = 0; -/* get alts partition table info */ + /* get alts partition table info */ status = ata_rdwr(DIR_READ, cur_file, altsec_offset, - ap->ap_tbl_secsiz / UBSIZE, (char *)ap->ap_tblp, - 0, NULL); + ap->ap_tbl_secsiz / UBSIZE, (char *)ap->ap_tblp, 0, NULL); if (status == FAILURE) { - perror("Unable to read alternate sector partition: "); - return (58); + perror("Unable to read alternate sector partition: "); + return (58); } if (ap->ap_tblp->alts_sanity != ALTS_SANITY) - return (mystatus); + return (mystatus); -/* get the alts map */ + /* get the alts map */ status = ata_rdwr(DIR_READ, cur_file, - (ap->ap_tblp->alts_map_base) + altsec_offset, - ap->ap_map_secsiz / UBSIZE, (char *)ap->ap_mapp, 0, NULL); + (ap->ap_tblp->alts_map_base) + altsec_offset, + ap->ap_map_secsiz / UBSIZE, (char *)ap->ap_mapp, 0, NULL); if (status == FAILURE) { - perror("Unable to read alternate sector partition map: "); - return (59); + perror("Unable to read alternate sector partition map: "); + return (59); } -/* transform the disk image bit-map to incore char map */ + /* transform the disk image bit-map to incore char map */ expand_map(); if (ap->ap_tblp->alts_ent_used == 0) { - ap->ap_entp = NULL; - ap->ap_ent_secsiz = 0; + ap->ap_entp = NULL; + ap->ap_ent_secsiz = 0; } else { - ap->ap_ent_secsiz = byte_to_secsiz( - (ap->ap_tblp->alts_ent_used*ALTS_ENT_SIZE), NBPSCTR); - if ((ap->ap_entp = - (struct alts_ent *)malloc(ap->ap_ent_secsiz)) == NULL) { - (void) fprintf(stderr, - "Unable to malloc alternate sector entry table.\n"); - return (60); - } + ap->ap_ent_secsiz = byte_to_secsiz( + (ap->ap_tblp->alts_ent_used*ALTS_ENT_SIZE), NBPSCTR); + ap->ap_entp = malloc(ap->ap_ent_secsiz); + if (ap->ap_entp == NULL) { + (void) fprintf(stderr, + "Unable to malloc alternate sector entry table.\n"); + return (60); + } - status = ata_rdwr(DIR_READ, cur_file, - (ap->ap_tblp->alts_ent_base) + altsec_offset, - ap->ap_ent_secsiz / UBSIZE, (char *)ap->ap_entp, - 0, NULL); - if (status == FAILURE) { - perror("Unable to read alternate sector entry table: "); - return (61); - } + status = ata_rdwr(DIR_READ, cur_file, + (ap->ap_tblp->alts_ent_base) + altsec_offset, + ap->ap_ent_secsiz / UBSIZE, (char *)ap->ap_entp, + 0, NULL); + if (status == FAILURE) { + perror("Unable to read alternate sector entry table: "); + return (61); + } } return (SUCCESS); @@ -344,7 +355,7 @@ get_altsctr(void) * update the new alternate partition tables on disk */ int -wr_altsctr() +wr_altsctr(void) { int status; @@ -360,20 +371,21 @@ wr_altsctr() } if (ata_rdwr(DIR_WRITE, cur_file, (ap->ap_tblp->alts_map_base) + - altsec_offset, ap->ap_map_secsiz / UBSIZE, - (char *)ap->ap_mapp, 0, NULL) == FAILURE) { - perror("Unable to write alternate sector partition map: "); - return (63); + altsec_offset, ap->ap_map_secsiz / UBSIZE, + (char *)ap->ap_mapp, 0, NULL) == FAILURE) { + perror("Unable to write alternate sector partition map: "); + return (63); } if (ap->ap_tblp->alts_ent_used != 0) { - if (ata_rdwr(DIR_WRITE, cur_file, - (ap->ap_tblp->alts_ent_base)+ altsec_offset, - ap->ap_ent_secsiz / UBSIZE, - (char *)ap->ap_entp, 0, NULL) == FAILURE) { - perror("Unable to write alternate sector entry table: "); - return (64); - } + if (ata_rdwr(DIR_WRITE, cur_file, + (ap->ap_tblp->alts_ent_base)+ altsec_offset, + ap->ap_ent_secsiz / UBSIZE, + (char *)ap->ap_entp, 0, NULL) == FAILURE) { + perror("Unable to write alternate sector " + "entry table: "); + return (64); + } } return (0); } @@ -383,49 +395,51 @@ wr_altsctr() * get a list of bad sector */ static void -get_badsec() +get_badsec(void) { int cnt; struct badsec_lst *blc_p; blkaddr_t curbad; blkaddr_t maxsec = cur_dtype->dtype_nhead * - cur_dtype->dtype_ncyl * - cur_dtype->dtype_nsect; + cur_dtype->dtype_ncyl * cur_dtype->dtype_nsect; struct alts_ent *growbadp; int i; cnt = count_badsec(); - if (!cnt) { - ap->ap_gbadp = NULL; - ap->ap_gbadcnt = 0; + if (cnt == 0) { + ap->ap_gbadp = NULL; + ap->ap_gbadcnt = 0; } else { - ap->ap_gbadp = malloc(cnt*ALTS_ENT_SIZE); - if (ap->ap_gbadp == NULL) { - err_print("get_badsec: unable to malloc %d bytes\n", - cnt*ALTS_ENT_SIZE); - fullabort(); - } - (void) memset(ap->ap_gbadp, 0, cnt*ALTS_ENT_SIZE); - - for (growbadp = ap->ap_gbadp, cnt = 0, blc_p = badsl_chain; - blc_p; blc_p = blc_p->bl_nxt) { - for (i = 0; i < blc_p->bl_cnt; i++) { - curbad = blc_p->bl_sec[i]; - if (curbad < (blkaddr_t)cur_dtype->dtype_nsect) { - (void) fprintf(stderr, -"Ignoring bad sector %ld which is in first track of the drive.\n", curbad); - continue; - } - if (curbad >= maxsec) { - (void) fprintf(stderr, -"Ignoring bad sector %ld which is past the end of the drive.\n", curbad); - continue; - } - growbadp[cnt].bad_start = curbad; - growbadp[cnt].bad_end = curbad; - cnt++; + ap->ap_gbadp = malloc(cnt * ALTS_ENT_SIZE); + if (ap->ap_gbadp == NULL) { + err_print("get_badsec: unable to malloc %d bytes\n", + cnt * ALTS_ENT_SIZE); + fullabort(); + } + (void) memset(ap->ap_gbadp, 0, cnt * ALTS_ENT_SIZE); + + for (growbadp = ap->ap_gbadp, cnt = 0, blc_p = badsl_chain; + blc_p; blc_p = blc_p->bl_nxt) { + for (i = 0; i < blc_p->bl_cnt; i++) { + curbad = blc_p->bl_sec[i]; + if (curbad < + (blkaddr_t)cur_dtype->dtype_nsect) { + (void) fprintf(stderr, "Ignoring bad " + "sector %ld which is in first " + "track of the drive.\n", curbad); + continue; + } + if (curbad >= maxsec) { + (void) fprintf(stderr, "Ignoring bad " + "sector %ld which is past the end " + "of the drive.\n", curbad); + continue; + } + growbadp[cnt].bad_start = curbad; + growbadp[cnt].bad_end = curbad; + cnt++; + } } - } } ap->ap_gbadcnt = cnt; } @@ -436,14 +450,13 @@ get_badsec() * one given through the command line */ static int -count_badsec() +count_badsec(void) { - struct badsec_lst *blc_p; - if (!badsl_chain) + if (!badsl_chain) { badsl_chain = gbadsl_chain; - else { + } else { for (blc_p = badsl_chain; blc_p->bl_nxt; blc_p = blc_p->bl_nxt) ; blc_p->bl_nxt = gbadsl_chain; @@ -459,12 +472,13 @@ count_badsec() * the new entry list. */ static int -gen_alts_ent() { +gen_alts_ent(void) +{ uint_t ent_used; struct alts_ent *entp; if (ap->ap_gbadcnt == 0) - return (0); + return (0); ent_used = ap->ap_tblp->alts_ent_used + ap->ap_gbadcnt; ap->ap_ent_secsiz = byte_to_secsiz(ent_used*ALTS_ENT_SIZE, NBPSCTR); @@ -476,32 +490,30 @@ gen_alts_ent() { } ent_used = ent_merge(entp, ap->ap_entp, ap->ap_tblp->alts_ent_used, - ap->ap_gbadp, ap->ap_gbadcnt); - if (ap->ap_entp) - free(ap->ap_entp); - if (ap->ap_gbadp) - free(ap->ap_gbadp); + ap->ap_gbadp, ap->ap_gbadcnt); + free(ap->ap_entp); + free(ap->ap_gbadp); ap->ap_entp = entp; ap->ap_ent_secsiz = byte_to_secsiz(ent_used*ALTS_ENT_SIZE, NBPSCTR); ap->ap_tblp->alts_ent_used = ent_used; ap->ap_gbadp = NULL; ap->ap_gbadcnt = 0; -/* assign alternate sectors to the bad sectors */ + /* assign alternate sectors to the bad sectors */ (void) assign_altsctr(); -/* allocate the alts_entry on disk skipping possible bad sectors */ + /* allocate the alts_entry on disk skipping possible bad sectors */ ap->ap_tblp->alts_ent_base = - altsmap_alloc((blkaddr_t)ap->ap_tblp->alts_map_base + - ap->ap_map_sectot, (blkaddr_t)ap->part.p_size, - ap->ap_ent_secsiz / NBPSCTR, ALTS_MAP_UP); + altsmap_alloc((blkaddr_t)ap->ap_tblp->alts_map_base + + ap->ap_map_sectot, (blkaddr_t)ap->part.p_size, + ap->ap_ent_secsiz / NBPSCTR, ALTS_MAP_UP); if (ap->ap_tblp->alts_ent_base == 0) { - perror("Unable to allocate alternate entry table on disk: "); - return (65); + perror("Unable to allocate alternate entry table on disk: "); + return (65); } ap->ap_tblp->alts_ent_end = ap->ap_tblp->alts_ent_base + - (ap->ap_ent_secsiz / NBPSCTR) - 1; + (ap->ap_ent_secsiz / NBPSCTR) - 1; return (0); } @@ -510,7 +522,7 @@ gen_alts_ent() { * assign alternate sectors for bad sector mapping */ static int -assign_altsctr() +assign_altsctr(void) { uint_t i; uint_t j; @@ -518,26 +530,26 @@ assign_altsctr() uint_t cluster; for (i = 0; i < ap->ap_tblp->alts_ent_used; i++) { - if ((ap->ap_entp)[i].bad_start == (uint32_t)ALTS_ENT_EMPTY) - continue; - if ((ap->ap_entp)[i].good_start != 0) - continue; - cluster = (ap->ap_entp)[i].bad_end-(ap->ap_entp)[i].bad_start +1; - alts_ind = - altsmap_alloc(ap->part.p_size-1, ap->ap_tblp->alts_map_base + - ap->ap_map_sectot - 1, cluster, ALTS_MAP_DOWN); - if (alts_ind == 0) { - (void) fprintf(stderr, - "Unable to allocate alternates for bad starting sector %u.\n", - (ap->ap_entp)[i].bad_start); - return (65); - } - alts_ind = alts_ind - cluster + 1; - (ap->ap_entp)[i].good_start = alts_ind +ap->part.p_start; - for (j = 0; j < cluster; j++) { - (ap->ap_memmapp)[alts_ind+j] = ALTS_BAD; - } - + if ((ap->ap_entp)[i].bad_start == (uint32_t)ALTS_ENT_EMPTY) + continue; + if ((ap->ap_entp)[i].good_start != 0) + continue; + cluster = + (ap->ap_entp)[i].bad_end - (ap->ap_entp)[i].bad_start + 1; + alts_ind = altsmap_alloc(ap->part.p_size - 1, + ap->ap_tblp->alts_map_base + + ap->ap_map_sectot - 1, cluster, ALTS_MAP_DOWN); + if (alts_ind == 0) { + (void) fprintf(stderr, "Unable to allocate alternates " + "for bad starting sector %u.\n", + (ap->ap_entp)[i].bad_start); + return (65); + } + alts_ind = alts_ind - cluster + 1; + (ap->ap_entp)[i].good_start = alts_ind +ap->part.p_start; + for (j = 0; j < cluster; j++) { + (ap->ap_memmapp)[alts_ind+j] = ALTS_BAD; + } } return (SUCCESS); } @@ -551,7 +563,7 @@ expand_map(void) int i; for (i = 0; i < ap->part.p_size; i++) { - (ap->ap_memmapp)[i] = altsmap_getbit(i); + (ap->ap_memmapp)[i] = altsmap_getbit(i); } } @@ -567,20 +579,19 @@ compress_map(void) int maplen = 0; for (i = 0, bytesz = 7; i < ap->part.p_size; i++) { - mask |= ((ap->ap_memmapp)[i] << bytesz--); - if (bytesz < 0) { - (ap->ap_mapp)[maplen++] = mask; - bytesz = 7; - mask = 0; - } + mask |= ((ap->ap_memmapp)[i] << bytesz--); + if (bytesz < 0) { + (ap->ap_mapp)[maplen++] = mask; + bytesz = 7; + mask = 0; + } } -/* - * if partition size != multiple number of bytes - * then record the last partial byte - */ + /* + * if partition size != multiple number of bytes + * then record the last partial byte + */ if (bytesz != 7) - (ap->ap_mapp)[maplen] = mask; - + (ap->ap_mapp)[maplen] = mask; } /* @@ -588,8 +599,7 @@ compress_map(void) * and identify the sector as good or bad */ static int -altsmap_getbit(badsec) -blkaddr_t badsec; +altsmap_getbit(blkaddr_t badsec) { uint_t slot = badsec / 8; uint_t field = badsec % 8; @@ -598,7 +608,7 @@ blkaddr_t badsec; mask = ALTS_BAD<<7; mask >>= field; if ((ap->ap_mapp)[slot] & mask) - return (ALTS_BAD); + return (ALTS_BAD); return (ALTS_GOOD); } @@ -607,11 +617,7 @@ blkaddr_t badsec; * allocate a range of sectors from the alternate partition */ static blkaddr_t -altsmap_alloc(srt_ind, end_ind, cnt, dir) -blkaddr_t srt_ind; -blkaddr_t end_ind; -int cnt; -int dir; +altsmap_alloc(blkaddr_t srt_ind, blkaddr_t end_ind, int cnt, int dir) { blkaddr_t i; blkaddr_t total; @@ -619,15 +625,14 @@ int dir; for (i = srt_ind, first_ind = srt_ind, total = 0; i != end_ind; i += dir) { - if ((ap->ap_memmapp)[i] == ALTS_BAD) { - total = 0; - first_ind = i + dir; - continue; - } - total++; - if (total == cnt) - return (first_ind); - + if ((ap->ap_memmapp)[i] == ALTS_BAD) { + total = 0; + first_ind = i + dir; + continue; + } + total++; + if (total == cnt) + return (first_ind); } return (0); } @@ -638,31 +643,29 @@ int dir; * bubble sort the entry table into ascending order */ static void -ent_sort(buf, cnt) -struct alts_ent buf[]; -int cnt; +ent_sort(struct alts_ent buf[], int cnt) { -struct alts_ent temp; -int flag; -int i, j; + struct alts_ent temp; + int flag; + int i, j; for (i = 0; i < cnt-1; i++) { - temp = buf[cnt-1]; - flag = 1; - - for (j = cnt-1; j > i; j--) { - if (buf[j-1].bad_start < temp.bad_start) { - buf[j] = temp; - temp = buf[j-1]; - } else { - buf[j] = buf[j-1]; - flag = 0; + temp = buf[cnt-1]; + flag = 1; + + for (j = cnt-1; j > i; j--) { + if (buf[j-1].bad_start < temp.bad_start) { + buf[j] = temp; + temp = buf[j - 1]; + } else { + buf[j] = buf[j - 1]; + flag = 0; + } } - } - buf[i] = temp; - if (flag) break; + buf[i] = temp; + if (flag) + break; } - } @@ -672,26 +675,25 @@ int i, j; * before the compression. */ static void -ent_compress(buf, cnt) -struct alts_ent buf[]; -int cnt; +ent_compress(struct alts_ent buf[], int cnt) { -int keyp; -int movp; -int i; + int keyp; + int movp; + int i; for (i = 0; i < cnt; i++) { - if (buf[i].bad_start == (uint32_t)ALTS_ENT_EMPTY) - continue; - for (keyp = i, movp = i+1; movp < cnt; movp++) { - if (buf[movp].bad_start == (uint32_t)ALTS_ENT_EMPTY) + if (buf[i].bad_start == (uint32_t)ALTS_ENT_EMPTY) continue; - if (buf[keyp].bad_end+1 != buf[movp].bad_start) - break; - buf[keyp].bad_end++; - buf[movp].bad_start = (uint32_t)ALTS_ENT_EMPTY; - } - if (movp == cnt) break; + for (keyp = i, movp = i+1; movp < cnt; movp++) { + if (buf[movp].bad_start == (uint32_t)ALTS_ENT_EMPTY) + continue; + if (buf[keyp].bad_end+1 != buf[movp].bad_start) + break; + buf[keyp].bad_end++; + buf[movp].bad_start = (uint32_t)ALTS_ENT_EMPTY; + } + if (movp == cnt) + break; } } @@ -701,39 +703,35 @@ int i; * all empty slots in the entry table will be removed. */ static int -ent_merge(buf, list1, lcnt1, list2, lcnt2) -struct alts_ent buf[]; -struct alts_ent list1[]; -int lcnt1; -struct alts_ent list2[]; -int lcnt2; +ent_merge(struct alts_ent buf[], struct alts_ent list1[], int lcnt1, + struct alts_ent list2[], int lcnt2) { int i; int j1, j2; for (i = 0, j1 = 0, j2 = 0; j1 < lcnt1 && j2 < lcnt2; ) { - if (list1[j1].bad_start == (uint32_t)ALTS_ENT_EMPTY) { - j1++; - continue; - } - if (list2[j2].bad_start == (uint32_t)ALTS_ENT_EMPTY) { - j2++; - continue; - } - if (list1[j1].bad_start < list2[j2].bad_start) - buf[i++] = list1[j1++]; - else - buf[i++] = list2[j2++]; + if (list1[j1].bad_start == (uint32_t)ALTS_ENT_EMPTY) { + j1++; + continue; + } + if (list2[j2].bad_start == (uint32_t)ALTS_ENT_EMPTY) { + j2++; + continue; + } + if (list1[j1].bad_start < list2[j2].bad_start) + buf[i++] = list1[j1++]; + else + buf[i++] = list2[j2++]; } for (; j1 < lcnt1; j1++) { - if (list1[j1].bad_start == (uint32_t)ALTS_ENT_EMPTY) - continue; - buf[i++] = list1[j1]; + if (list1[j1].bad_start == (uint32_t)ALTS_ENT_EMPTY) + continue; + buf[i++] = list1[j1]; } for (; j2 < lcnt2; j2++) { - if (list2[j2].bad_start == (uint32_t)ALTS_ENT_EMPTY) - continue; - buf[i++] = list2[j2]; + if (list2[j2].bad_start == (uint32_t)ALTS_ENT_EMPTY) + continue; + buf[i++] = list2[j2]; } return (i); } @@ -743,10 +741,7 @@ int lcnt2; * binary search for bad sector in the alternate entry table */ static int -ent_bsearch(buf, cnt, key) -struct alts_ent buf[]; -int cnt; -struct alts_ent *key; +ent_bsearch(struct alts_ent buf[], int cnt, struct alts_ent *key) { int i; int ind; @@ -754,27 +749,31 @@ struct alts_ent *key; int mystatus = -1; if (!cnt) - return (mystatus); + return (mystatus); for (i = 1; i <= cnt; i <<= 1) - ind = i; + ind = i; for (interval = ind; interval; ) { - if ((key->bad_start >= buf[ind-1].bad_start) && - (key->bad_start <= buf[ind-1].bad_end)) { - return (mystatus = ind-1); - } else { - interval >>= 1; - if (!interval) break; - if (key->bad_start < buf[ind-1].bad_start) { - ind = ind - interval; + if ((key->bad_start >= buf[ind-1].bad_start) && + (key->bad_start <= buf[ind-1].bad_end)) { + return (mystatus = ind-1); } else { -/* if key is larger than the last element then break */ - if (ind == cnt) break; - if ((ind+interval) <= cnt) - ind += interval; + interval >>= 1; + if (!interval) break; + if (key->bad_start < buf[ind-1].bad_start) { + ind = ind - interval; + } else { + /* + * if key is larger than the last element, + * then break. + */ + if (ind == cnt) + break; + if ((ind + interval) <= cnt) + ind += interval; + } } - } } return (mystatus); } @@ -783,8 +782,7 @@ struct alts_ent *key; * check for bad sector in assigned alternate sectors */ static int -chk_bad_altsctr(badsec) -blkaddr_t badsec; +chk_bad_altsctr(blkaddr_t badsec) { int i; blkaddr_t numsec; @@ -794,12 +792,13 @@ blkaddr_t badsec; */ for (i = 0; i < cnt; i++) { - numsec = (ap->ap_entp)[i].bad_end - (ap->ap_entp)[i].bad_start; - if ((badsec >= (ap->ap_entp)[i].good_start) && - (badsec <= ((ap->ap_entp)[i].good_start + numsec))) { - (void) fprintf(stderr, - "Bad sector %ld is an assigned alternate sector.\n", badsec); - return (66); + numsec = (ap->ap_entp)[i].bad_end - (ap->ap_entp)[i].bad_start; + if ((badsec >= (ap->ap_entp)[i].good_start) && + (badsec <= ((ap->ap_entp)[i].good_start + numsec))) { + (void) fprintf(stderr, + "Bad sector %ld is an assigned alternate sector.\n", + badsec); + return (66); /* * if (!numsec) { * (ap->ap_entp)[i].good_start = 0; @@ -809,9 +808,9 @@ blkaddr_t badsec; * intv[1] = 1; * intv[2] = (ap->ap_entp)[i].good_start + numsec - badsec; */ - } + } } -/* the bad sector has already been identified as bad */ + /* the bad sector has already been identified as bad */ return (SUCCESS); } diff --git a/usr/src/cmd/format/label.c b/usr/src/cmd/format/label.c index 56a5f3d394..046c2e7713 100644 --- a/usr/src/cmd/format/label.c +++ b/usr/src/cmd/format/label.c @@ -173,7 +173,7 @@ trim_id(char *id) * in this margin, then such illegal geometries can slip through the cracks. */ static int -do_geometry_sanity_check() +do_geometry_sanity_check(void) { struct scsi_capacity_16 capacity; @@ -250,7 +250,7 @@ SMI_vtoc_to_EFI(int fd, struct dk_gpt **new_vtoc) * the label and partition information it has written on the disk. */ int -write_label() +write_label(void) { int error = 0, head, sec; struct dk_label label; diff --git a/usr/src/cmd/format/main.c b/usr/src/cmd/format/main.c index bcf45e276b..595c8817cc 100644 --- a/usr/src/cmd/format/main.c +++ b/usr/src/cmd/format/main.c @@ -118,7 +118,7 @@ main(int argc, char *argv[]) * Initialize cur_ctype to avoid null pointer dereference * in auto_efi_sense(). */ - cur_ctype = (struct ctlr_type *)NULL; + cur_ctype = NULL; /* * Decode the command line options. */ @@ -153,7 +153,7 @@ main(int argc, char *argv[]) * look like disks. */ if (i < 0) { - arglist = (char **)NULL; + arglist = NULL; /* * There were disks on the command line. They comprise the * search list. @@ -174,7 +174,7 @@ main(int argc, char *argv[]) act.sa_handler = cmdabort; (void) memset(&act.sa_mask, 0, sizeof (sigset_t)); act.sa_flags = SA_RESTART | SA_NODEFER; - if (sigaction(SIGINT, &act, (struct sigaction *)NULL) == -1) { + if (sigaction(SIGINT, &act, NULL) == -1) { err_print("sigaction(SIGINT) failed - %s\n", strerror(errno)); fullabort(); @@ -183,7 +183,7 @@ main(int argc, char *argv[]) act.sa_handler = onsusp; (void) memset(&act.sa_mask, 0, sizeof (sigset_t)); act.sa_flags = SA_RESTART | SA_NODEFER; - if (sigaction(SIGTSTP, &act, (struct sigaction *)NULL) == -1) { + if (sigaction(SIGTSTP, &act, NULL) == -1) { err_print("sigaction(SIGTSTP) failed - %s\n", strerror(errno)); fullabort(); @@ -192,7 +192,7 @@ main(int argc, char *argv[]) act.sa_handler = onalarm; (void) memset(&act.sa_mask, 0, sizeof (sigset_t)); act.sa_flags = SA_RESTART; - if (sigaction(SIGALRM, &act, (struct sigaction *)NULL) == -1) { + if (sigaction(SIGALRM, &act, NULL) == -1) { err_print("sigaction(SIGALRM) failed - %s\n", strerror(errno)); fullabort(); @@ -613,7 +613,7 @@ Select <partition> <expand> to adjust the label capacity. \n"); * prompting for everything that isn't in the label. */ static void -get_disk_characteristics() +get_disk_characteristics(void) { /* * The need_spefs flag is used to tell us that this disk diff --git a/usr/src/cmd/format/main.h b/usr/src/cmd/format/main.h index f3801d49e8..cfd41605d1 100644 --- a/usr/src/cmd/format/main.h +++ b/usr/src/cmd/format/main.h @@ -28,8 +28,6 @@ #ifndef _MAIN_H #define _MAIN_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu.c b/usr/src/cmd/format/menu.c index ea2cb1d248..159356610a 100644 --- a/usr/src/cmd/format/menu.c +++ b/usr/src/cmd/format/menu.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains routines relating to running the menus. */ @@ -33,17 +31,7 @@ #include "menu.h" #include "misc.h" -#ifdef __STDC__ - -/* Function prototypes for ANSI C Compilers */ -static int (*find_enabled_menu_item())(struct menu_item *menu, int item); - -#else /* __STDC__ */ - -/* Function prototypes for non-ANSI C Compilers */ -static int (*find_enabled_menu_item())(); - -#endif /* __STDC__ */ +static int (*find_enabled_menu_item(struct menu_item *, int))(void); static char cur_title[MAXPATHLEN]; @@ -53,12 +41,11 @@ static char cur_title[MAXPATHLEN]; * All menus have a 'quit' command at the bottom to exit the menu. */ char ** -create_menu_list(menu) - struct menu_item *menu; +create_menu_list(struct menu_item *menu) { - register struct menu_item *mptr; - register char **cpptr; - register char **list; + struct menu_item *mptr; + char **cpptr; + char **list; int nitems; /* @@ -96,10 +83,9 @@ create_menu_list(menu) * prints it nicely on the screen. */ void -display_menu_list(list) - char **list; +display_menu_list(char **list) { - register char **str; + char **str; for (str = list; *str != NULL; str++) fmt_print(" %s\n", *str); @@ -111,9 +97,7 @@ display_menu_list(list) * original list of enabled commands was constructed. */ static int (* -find_enabled_menu_item(menu, item))() - struct menu_item *menu; - int item; +find_enabled_menu_item(struct menu_item *menu, int item))(void) { struct menu_item *mp; @@ -135,11 +119,7 @@ find_enabled_menu_item(menu, item))() */ /*ARGSUSED*/ void -run_menu(menu, title, prompt, display_flag) - struct menu_item *menu; - char *title; - char *prompt; - int display_flag; +run_menu(struct menu_item *menu, char *title, char *prompt, int display_flag) { char **list; int i; @@ -164,8 +144,7 @@ run_menu(menu, title, prompt, display_flag) * Ask the user which command they want to run. */ ioparam.io_charlist = list; - i = input(FIO_MSTR, prompt, '>', &ioparam, - (int *)NULL, CMD_INPUT); + i = input(FIO_MSTR, prompt, '>', &ioparam, NULL, CMD_INPUT); /* * If they choose 'quit', the party's over. */ @@ -217,8 +196,7 @@ run_menu(menu, title, prompt, display_flag) * */ void -redisplay_menu_list(list) -char **list; +redisplay_menu_list(char **list) { fmt_print("\n\n%s MENU:\n", cur_title); display_menu_list(list); @@ -230,7 +208,7 @@ char **list; * are always enabled. */ int -true() +true(void) { return (1); } @@ -248,7 +226,7 @@ true() * Return true for menu items enabled only for embedded SCSI controllers */ int -embedded_scsi() +embedded_scsi(void) { if (cur_ctype == NULL && option_f) return (0); @@ -259,7 +237,7 @@ embedded_scsi() * Return false for menu items disabled only for embedded SCSI controllers */ int -not_embedded_scsi() +not_embedded_scsi(void) { if (cur_ctype == NULL && option_f) return (0); @@ -270,7 +248,7 @@ not_embedded_scsi() * Return false for menu items disabled for scsi controllers */ int -not_scsi() +not_scsi(void) { if (cur_ctype == NULL && option_f) return (0); @@ -281,7 +259,7 @@ not_scsi() * Return false for menu items disabled for efi labels */ int -not_efi() +not_efi(void) { if ((cur_disk == NULL) && option_f) return (0); @@ -291,7 +269,7 @@ not_efi() } int -disp_expert_change_expert_efi() +disp_expert_change_expert_efi(void) { if ((cur_disk == NULL) && option_f) return (0); @@ -303,7 +281,7 @@ disp_expert_change_expert_efi() } int -disp_expand_efi() +disp_expand_efi(void) { if ((cur_disk == NULL) && option_f) return (0); @@ -315,7 +293,7 @@ disp_expand_efi() } int -disp_all_change_expert_efi() +disp_all_change_expert_efi(void) { if ((cur_disk == NULL) && option_f) return (0); @@ -328,7 +306,7 @@ disp_all_change_expert_efi() * Return true for menu items enabled scsi controllers */ int -scsi() +scsi(void) { if (cur_ctype == NULL && option_f) return (0); @@ -340,7 +318,7 @@ scsi() * Return true for menu items enabled if expert mode is enabled */ int -scsi_expert() +scsi_expert(void) { if (cur_ctype == NULL && option_f) return (0); @@ -352,7 +330,7 @@ scsi_expert() * Return true for menu items enabled if expert mode is enabled */ int -expert() +expert(void) { return (expert_mode); } @@ -362,7 +340,7 @@ expert() * Return true for menu items enabled if developer mode is enabled */ int -developer() +developer(void) { return (dev_expert); } @@ -374,7 +352,7 @@ developer() * if a PCATA disk is selected. */ int -support_fdisk_on_sparc() +support_fdisk_on_sparc(void) { #if defined(sparc) /* diff --git a/usr/src/cmd/format/menu.h b/usr/src/cmd/format/menu.h index facc950678..5a33341282 100644 --- a/usr/src/cmd/format/menu.h +++ b/usr/src/cmd/format/menu.h @@ -26,8 +26,6 @@ #ifndef _MENU_H #define _MENU_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_analyze.c b/usr/src/cmd/format/menu_analyze.c index e932c258c8..e6d35f658a 100644 --- a/usr/src/cmd/format/menu_analyze.c +++ b/usr/src/cmd/format/menu_analyze.c @@ -33,15 +33,13 @@ #include "menu_analyze.h" #include "param.h" - - /* * This routine implements the 'read' command. It performs surface * analysis by reading the disk. It is ok to run this command on * mounted file systems. */ int -a_read() +a_read(void) { /* * The current disk must be formatted before disk analysis. @@ -65,7 +63,7 @@ a_read() * they are mounted. */ int -a_refresh() +a_refresh(void) { /* * The current disk must be formatted before disk analysis. @@ -90,7 +88,7 @@ a_refresh() * mounted. */ int -a_test() +a_test(void) { /* * The current disk must be formatted before disk analysis. @@ -113,7 +111,7 @@ a_test() * It is not ok to run this command on any data you want to keep. */ int -a_write() +a_write(void) { /* * The current disk must be formatted before disk analysis. @@ -137,7 +135,7 @@ a_write() * It is not ok to run this command on any data you want to keep. */ int -a_compare() +a_compare(void) { /* * The current disk must be formatted before disk analysis. @@ -160,7 +158,7 @@ a_compare() * a specific set of data (by reading it then printing it). */ int -a_print() +a_print(void) { int i, j, lines, nomore = 0; int c, one_line = 0; @@ -250,7 +248,7 @@ PRINT_EXIT: * value as the default. */ int -a_setup() +a_setup(void) { int deflt; uint64_t size; @@ -358,7 +356,7 @@ a_setup() * check the current setup. */ int -a_config() +a_config(void) { fmt_print(" Analyze entire disk? "); @@ -413,7 +411,7 @@ a_config() * It is not ok to run this command on any data you want to keep. */ int -a_purge() +a_purge(void) { int status = 0; @@ -459,7 +457,7 @@ a_purge() * It is not ok to run this command on any data you want to keep. */ int -a_verify() +a_verify(void) { /* * The current disk must be formatted before disk analysis. diff --git a/usr/src/cmd/format/menu_analyze.h b/usr/src/cmd/format/menu_analyze.h index d20f1e29a5..747a393f5e 100644 --- a/usr/src/cmd/format/menu_analyze.h +++ b/usr/src/cmd/format/menu_analyze.h @@ -26,8 +26,6 @@ #ifndef _MENU_ANALYZE_H #define _MENU_ANALYZE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_cache.c b/usr/src/cmd/format/menu_cache.c index b903b3e4e7..a01f21f90f 100644 --- a/usr/src/cmd/format/menu_cache.c +++ b/usr/src/cmd/format/menu_cache.c @@ -25,8 +25,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains functions that implement the cache menu commands. */ @@ -63,7 +61,7 @@ extern struct menu_item menu_read_cache[]; int -c_cache() +c_cache(void) { cur_menu++; last_menu = cur_menu; @@ -73,7 +71,7 @@ c_cache() } int -ca_write_cache() +ca_write_cache(void) { cur_menu++; last_menu = cur_menu; @@ -83,7 +81,7 @@ ca_write_cache() } int -ca_read_cache() +ca_read_cache(void) { cur_menu++; last_menu = cur_menu; @@ -93,7 +91,7 @@ ca_read_cache() } int -ca_write_display() +ca_write_display(void) { struct mode_cache *page8; struct scsi_ms_header header; @@ -106,8 +104,8 @@ ca_write_display() page8 = &u_page8.page8; status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CURRENT, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status == 0) { if (page8->wce) { @@ -122,7 +120,7 @@ ca_write_display() } int -ca_write_enable() +ca_write_enable(void) { struct mode_cache *page8; struct scsi_ms_header header; @@ -137,18 +135,19 @@ ca_write_enable() page8 = &u_page8.page8; status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status == 0) { if (page8->wce) { status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_SAVED, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status != 0) { status = uscsi_mode_sense(cur_file, - DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, - (caddr_t)page8, MAX_MODE_SENSE_SIZE, &header); + DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, + (caddr_t)page8, MAX_MODE_SENSE_SIZE, + &header); } if (status == 0) { @@ -165,8 +164,8 @@ This setting is valid until next reset only. It is not saved permanently.\n"); header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, - DAD_MODE_CACHE, sp_flags, - (caddr_t)page8, length, &header); + DAD_MODE_CACHE, sp_flags, + (caddr_t)page8, length, &header); if (status != 0) { err_print("Mode select failed\n"); return (0); @@ -183,7 +182,7 @@ This setting is valid until next reset only. It is not saved permanently.\n"); } int -ca_write_disable() +ca_write_disable(void) { struct mode_cache *page8; struct scsi_ms_header header; @@ -198,18 +197,19 @@ ca_write_disable() page8 = &u_page8.page8; status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status == 0) { if (page8->wce) { status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_SAVED, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status != 0) { status = uscsi_mode_sense(cur_file, - DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, - (caddr_t)page8, MAX_MODE_SENSE_SIZE, &header); + DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, + (caddr_t)page8, MAX_MODE_SENSE_SIZE, + &header); } if (status == 0) { @@ -226,8 +226,8 @@ This setting is valid until next reset only. It is not saved permanently.\n"); header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, - DAD_MODE_CACHE, sp_flags, - (caddr_t)page8, length, &header); + DAD_MODE_CACHE, sp_flags, + (caddr_t)page8, length, &header); if (status != 0) { err_print("Mode select failed\n"); return (0); @@ -244,7 +244,7 @@ This setting is valid until next reset only. It is not saved permanently.\n"); } int -ca_read_display() +ca_read_display(void) { struct mode_cache *page8; struct scsi_ms_header header; @@ -257,8 +257,8 @@ ca_read_display() page8 = &u_page8.page8; status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CURRENT, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CURRENT, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status == 0) { if (page8->rcd) { @@ -273,7 +273,7 @@ ca_read_display() } int -ca_read_enable() +ca_read_enable(void) { struct mode_cache *page8; struct scsi_ms_header header; @@ -288,18 +288,19 @@ ca_read_enable() page8 = &u_page8.page8; status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status == 0) { if (page8->rcd) { status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_SAVED, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status != 0) { status = uscsi_mode_sense(cur_file, - DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, - (caddr_t)page8, MAX_MODE_SENSE_SIZE, &header); + DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, + (caddr_t)page8, MAX_MODE_SENSE_SIZE, + &header); } if (status == 0) { @@ -316,8 +317,8 @@ This setting is valid until next reset only. It is not saved permanently.\n"); header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, - DAD_MODE_CACHE, sp_flags, - (caddr_t)page8, length, &header); + DAD_MODE_CACHE, sp_flags, + (caddr_t)page8, length, &header); if (status != 0) { err_print("Mode select failed\n"); return (0); @@ -334,7 +335,7 @@ This setting is valid until next reset only. It is not saved permanently.\n"); } int -ca_read_disable() +ca_read_disable(void) { struct mode_cache *page8; struct scsi_ms_header header; @@ -349,18 +350,19 @@ ca_read_disable() page8 = &u_page8.page8; status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_CHANGEABLE, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status == 0) { if (page8->rcd) { status = uscsi_mode_sense(cur_file, DAD_MODE_CACHE, - MODE_SENSE_PC_SAVED, (caddr_t)page8, - MAX_MODE_SENSE_SIZE, &header); + MODE_SENSE_PC_SAVED, (caddr_t)page8, + MAX_MODE_SENSE_SIZE, &header); if (status != 0) { status = uscsi_mode_sense(cur_file, - DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, - (caddr_t)page8, MAX_MODE_SENSE_SIZE, &header); + DAD_MODE_CACHE, MODE_SENSE_PC_CURRENT, + (caddr_t)page8, MAX_MODE_SENSE_SIZE, + &header); } if (status == 0) { @@ -377,8 +379,8 @@ This setting is valid until next reset only. It is not saved permanently.\n"); header.mode_header.length = 0; header.mode_header.device_specific = 0; status = uscsi_mode_select(cur_file, - DAD_MODE_CACHE, sp_flags, - (caddr_t)page8, length, &header); + DAD_MODE_CACHE, sp_flags, + (caddr_t)page8, length, &header); if (status != 0) { err_print("Mode select failed\n"); return (0); diff --git a/usr/src/cmd/format/menu_cache.h b/usr/src/cmd/format/menu_cache.h index c2b532091a..706089e1fc 100644 --- a/usr/src/cmd/format/menu_cache.h +++ b/usr/src/cmd/format/menu_cache.h @@ -27,8 +27,6 @@ #ifndef _MENU_CACHE_H #define _MENU_CACHE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_command.c b/usr/src/cmd/format/menu_command.c index ff8c627b9d..a4f291c3b1 100644 --- a/usr/src/cmd/format/menu_command.c +++ b/usr/src/cmd/format/menu_command.c @@ -113,7 +113,7 @@ slist_t pflag_choices[] = { * disks that were found at startup time. */ int -c_disk() +c_disk(void) { struct disk_info *disk; u_ioparam_t ioparam; @@ -159,7 +159,7 @@ c_disk() /* * Convert the token into an integer. */ - if (geti(cleantoken, &index, (int *)NULL)) + if (geti(cleantoken, &index, NULL)) return (0); /* @@ -175,7 +175,7 @@ c_disk() fmt_print("\n\nAVAILABLE DISK SELECTIONS:\n"); i = 0; - if ((option_f == (char *)NULL) && isatty(0) == 1 && isatty(1) == 1) { + if ((option_f == NULL) && isatty(0) == 1 && isatty(1) == 1) { /* * We have a real terminal for std input and output, enable * more style of output for disk selection list. @@ -359,7 +359,7 @@ exit: * in the data file. */ int -c_type() +c_type(void) { struct disk_type *type, *tptr, *oldtype; u_ioparam_t ioparam; @@ -694,7 +694,7 @@ c_type() * the partition menu. */ int -c_partition() +c_partition(void) { /* @@ -738,7 +738,7 @@ c_partition() * current disk. */ int -c_current() +c_current(void) { /* @@ -797,7 +797,7 @@ c_current() * to format and verify any portion of the disk. */ int -c_format() +c_format(void) { diskaddr_t start, end; time_t clock; @@ -1219,7 +1219,7 @@ currently being used for swapping.\n"); * to reallocate sectors on the disk that have gone bad. */ int -c_repair() +c_repair(void) { diskaddr_t bn; int status; @@ -1277,7 +1277,7 @@ c_repair() } bn = input(FIO_BN, "Enter absolute block number of defect", ':', - &ioparam, (int *)NULL, DATA_INPUT); + &ioparam, NULL, DATA_INPUT); /* * Check to see if there is a mounted file system over the * specified sector. If there is, make sure the user is @@ -1440,7 +1440,7 @@ This block doesn't appear to be bad. Repair it anyway")) { * cylinder/head/sector format. */ int -c_show() +c_show(void) { u_ioparam_t ioparam; diskaddr_t bn; @@ -1462,7 +1462,7 @@ c_show() ioparam.io_bounds.upper = cur_parts->etoc->efi_last_lba; } bn = input(FIO_BN, "Enter a disk block", ':', - &ioparam, (int *)NULL, DATA_INPUT); + &ioparam, NULL, DATA_INPUT); /* * Echo it back. */ @@ -1477,7 +1477,7 @@ c_show() * primary and backup labels onto the current disk. */ int -c_label() +c_label(void) { int status; int deflt, *defltptr = NULL; @@ -1767,7 +1767,7 @@ expert_end: * the analyze menu. */ int -c_analyze() +c_analyze(void) { /* @@ -1793,7 +1793,7 @@ c_analyze() * the defect menu. */ int -c_defect() +c_defect(void) { int i; @@ -1866,7 +1866,7 @@ c_defect() * the current defect list is written out if a backup label is found. */ int -c_backup() +c_backup(void) { struct dk_label label; struct disk_type *dtype; @@ -2065,7 +2065,7 @@ Unknown disk type in backup label\n"); * This routine is called by c_verify() for an EFI labeled disk */ static int -c_verify_efi() +c_verify_efi(void) { struct efi_info efi_info; struct partition_info tmp_pinfo; @@ -2119,7 +2119,7 @@ c_verify_efi() * to read the labels on the current disk. */ int -c_verify() +c_verify(void) { struct dk_label p_label, b_label, *label; struct partition_info tmp_pinfo; @@ -2354,7 +2354,7 @@ Warning: Check the current partitioning and 'label' the disk or use the\n\ * displays the resulting vendor, product id and revision level. */ int -c_inquiry() +c_inquiry(void) { char inqbuf[255]; struct scsi_inquiry *inq; @@ -2386,7 +2386,7 @@ c_inquiry() * primary and backup labels onto the current disk. */ int -c_volname() +c_volname(void) { int status; char *prompt; diff --git a/usr/src/cmd/format/menu_command.h b/usr/src/cmd/format/menu_command.h index b77d394e73..09a2ef94c0 100644 --- a/usr/src/cmd/format/menu_command.h +++ b/usr/src/cmd/format/menu_command.h @@ -27,8 +27,6 @@ #ifndef _MENU_COMMAND_H #define _MENU_COMMAND_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_defect.c b/usr/src/cmd/format/menu_defect.c index 2b6425b8cc..0cf943ce01 100644 --- a/usr/src/cmd/format/menu_defect.c +++ b/usr/src/cmd/format/menu_defect.c @@ -43,24 +43,14 @@ */ struct defect_list work_list; -#ifdef __STDC__ - -/* Function prototypes for ANSI C Compilers */ static int commit_list(void); -#else /* __STDC__ */ - -/* Function prototypes for non-ANSI C Compilers */ -static int commit_list(); - -#endif /* __STDC__ */ - /* * This routine implements the 'restore' command. It sets the working * list equal to the current list. */ int -d_restore() +d_restore(void) { int i; @@ -116,7 +106,7 @@ d_restore() * manufacturer's defect list from the current disk. */ int -d_original() +d_original(void) { int status; @@ -176,7 +166,7 @@ and may take a long while. Continue")) * entire defect list from the current disk. */ int -d_extract() +d_extract(void) { int status; @@ -261,7 +251,7 @@ and may take a long while. Continue")) * the user breaks out with a ctrl-C. */ int -d_add() +d_add(void) { int type, deflt, index; diskaddr_t bn; @@ -295,7 +285,7 @@ loop: ioparam.io_bounds.upper = cur_parts->etoc->efi_last_lba; } bn = input(FIO_BN, "Enter defective block number", ':', - &ioparam, (int *)NULL, DATA_INPUT); + &ioparam, NULL, DATA_INPUT); def.cyl = bn2c(bn); def.head = bn2h(bn); def.sect = bn2s(bn); @@ -309,13 +299,13 @@ loop: ioparam.io_bounds.upper = pcyl - 1; def.cyl = input(FIO_INT, "Enter defect's cylinder number", ':', - &ioparam, (int *)NULL, DATA_INPUT); + &ioparam, NULL, DATA_INPUT); ioparam.io_bounds.upper = nhead - 1; def.head = input(FIO_INT, "Enter defect's head number", - ':', &ioparam, (int *)NULL, DATA_INPUT); + ':', &ioparam, NULL, DATA_INPUT); ioparam.io_bounds.upper = cur_dtype->dtype_bpt - 1; def.bfi = input(FIO_INT, "Enter defect's bytes-from-index", - ':', &ioparam, (int *)NULL, DATA_INPUT); + ':', &ioparam, NULL, DATA_INPUT); ioparam.io_bounds.lower = -1; ioparam.io_bounds.upper = (cur_dtype->dtype_bpt - def.bfi) * 8; if (ioparam.io_bounds.upper >= 32 * 1024) @@ -374,7 +364,7 @@ loop: * to manually delete a defect from the working list. */ int -d_delete() +d_delete(void) { int i, count, num; u_ioparam_t ioparam; @@ -397,7 +387,7 @@ d_delete() ioparam.io_bounds.lower = 1; ioparam.io_bounds.upper = count; num = input(FIO_INT, "Specify defect to be deleted (enter its number)", - ':', &ioparam, (int *)NULL, DATA_INPUT); + ':', &ioparam, NULL, DATA_INPUT); /* * * The user thinks it's one relative but it's not really. @@ -449,7 +439,7 @@ d_delete() * defect list out in human-readable format. */ int -d_print() +d_print(void) { int i, nomore = 0; int c, one_line = 0; @@ -537,7 +527,7 @@ PRINT_EXIT: * defect list to a file. */ int -d_dump() +d_dump(void) { int i, status = 0; char *str; @@ -561,7 +551,7 @@ d_dump() * type OSTR. */ str = (char *)(uintptr_t)input(FIO_OSTR, "Enter name of defect file", - ':', (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT); + ':', NULL, NULL, DATA_INPUT); /* * Lock out interrupts so the file doesn't get half written. */ @@ -610,7 +600,7 @@ out: * list in from a file. */ int -d_load() +d_load(void) { int i, items, status = 0, count, cksum; uint_t magicno; @@ -626,7 +616,7 @@ d_load() * input will be malloc'd space since we inputted type OSTR. */ str = (char *)(uintptr_t)input(FIO_OSTR, "Enter name of defect file", - ':', (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT); + ':', NULL, 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 @@ -752,7 +742,7 @@ out: * the next format. */ int -d_commit() +d_commit(void) { /* * If the working list wasn't modified, no commit is necessary. @@ -771,7 +761,7 @@ d_commit() } int -do_commit() +do_commit(void) { int status; @@ -788,7 +778,7 @@ do_commit() static int -commit_list() +commit_list(void) { int i; @@ -846,7 +836,7 @@ commit_list() * manufacturer's defect on the current disk from the defect list */ int -d_create() +d_create(void) { int status; @@ -898,7 +888,7 @@ IT WILL DESTROY ALL OF THE DATA ON THE DISK! Continue")) * Extract primary defect list - SCSI only */ int -d_primary() +d_primary(void) { int status; @@ -941,7 +931,7 @@ d_primary() * Extract grown defects list - SCSI only */ int -d_grown() +d_grown(void) { int status; @@ -984,7 +974,7 @@ d_grown() * Extract both primary and grown defects list - SCSI only */ int -d_both() +d_both(void) { int status; diff --git a/usr/src/cmd/format/menu_defect.h b/usr/src/cmd/format/menu_defect.h index e1838c4ea5..fa7fcd2726 100644 --- a/usr/src/cmd/format/menu_defect.h +++ b/usr/src/cmd/format/menu_defect.h @@ -27,8 +27,6 @@ #ifndef _MENU_DEFECT_H #define _MENU_DEFECT_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_developer.c b/usr/src/cmd/format/menu_developer.c index 5ed1b23ff1..5b29b681a9 100644 --- a/usr/src/cmd/format/menu_developer.c +++ b/usr/src/cmd/format/menu_developer.c @@ -25,8 +25,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains functions that implement the fdisk menu commands. */ @@ -61,7 +59,7 @@ extern struct menu_item menu_developer[]; int -c_developer() +c_developer(void) { cur_menu++; @@ -76,7 +74,7 @@ c_developer() } int -dv_disk() +dv_disk(void) { struct disk_info *diskp; @@ -86,13 +84,13 @@ dv_disk() (void) printf("\ndisk_name %s ", diskp->disk_name); (void) printf("disk_path %s\n", diskp->disk_path); (void) printf("ctlr_cname = %s ", - diskp->disk_ctlr->ctlr_cname); + diskp->disk_ctlr->ctlr_cname); (void) printf("cltr_dname = %s ", - diskp->disk_ctlr->ctlr_dname); + diskp->disk_ctlr->ctlr_dname); (void) printf("ctype_name = %s\n", - diskp->disk_ctlr->ctlr_ctype->ctype_name); + diskp->disk_ctlr->ctlr_ctype->ctype_name); (void) printf("ctype_ctype = %d\n", - diskp->disk_ctlr->ctlr_ctype->ctype_ctype); + diskp->disk_ctlr->ctlr_ctype->ctype_ctype); (void) printf("devfsname = %s\n", diskp->devfs_name); diskp = diskp->disk_next; } @@ -100,7 +98,7 @@ dv_disk() } int -dv_cont() +dv_cont(void) { struct ctlr_info *contp; @@ -108,18 +106,18 @@ dv_cont() while (contp != NULL) { (void) printf("\nctype_name = %s ", - contp->ctlr_ctype->ctype_name); + contp->ctlr_ctype->ctype_name); (void) printf("cname = %s dname = %s ", - contp->ctlr_cname, contp->ctlr_dname); + contp->ctlr_cname, contp->ctlr_dname); (void) printf("ctype_ctype = %d\n", - contp->ctlr_ctype->ctype_ctype); + contp->ctlr_ctype->ctype_ctype); contp = contp->ctlr_next; } return (0); } int -dv_cont_chain() +dv_cont_chain(void) { struct mctlr_list *ctlrp; @@ -130,14 +128,14 @@ dv_cont_chain() while (ctlrp != NULL) { (void) printf("ctlrp->ctlr_type->ctype_name = %s\n", - ctlrp->ctlr_type->ctype_name); + ctlrp->ctlr_type->ctype_name); ctlrp = ctlrp->next; } return (0); } int -dv_params() +dv_params(void) { (void) printf("ncyl = %d\n", ncyl); (void) printf("acyl = %d\n", acyl); diff --git a/usr/src/cmd/format/menu_developer.h b/usr/src/cmd/format/menu_developer.h index b880c42c49..8ed709ae93 100644 --- a/usr/src/cmd/format/menu_developer.h +++ b/usr/src/cmd/format/menu_developer.h @@ -27,8 +27,6 @@ #ifndef _MENU_DEVELOPER_H #define _MENU_DEVELOPER_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_fdisk.c b/usr/src/cmd/format/menu_fdisk.c index 40e06c4711..29a86d375f 100644 --- a/usr/src/cmd/format/menu_fdisk.c +++ b/usr/src/cmd/format/menu_fdisk.c @@ -354,7 +354,7 @@ open_cur_file(int mode) * Use of this is restricted to interactive mode only. */ int -c_fdisk() +c_fdisk(void) { char buf[MAXPATHLEN]; @@ -364,7 +364,7 @@ c_fdisk() /* * We must be in interactive mode to use the fdisk command */ - if (option_f != (char *)NULL || isatty(0) != 1 || isatty(1) != 1) { + if (option_f != NULL || isatty(0) != 1 || isatty(1) != 1) { err_print("Fdisk command is for interactive use only!\n"); return (-1); } @@ -424,7 +424,7 @@ c_fdisk() */ #ifdef DEADCODE static void -update_cur_parts() +update_cur_parts(void) { int i; @@ -959,7 +959,7 @@ auto_solaris_part(struct dk_label *label) int -good_fdisk() +good_fdisk(void) { char buf[MAXPATHLEN]; struct stat statbuf; diff --git a/usr/src/cmd/format/menu_fdisk.h b/usr/src/cmd/format/menu_fdisk.h index 54145fcd9e..386a3962ef 100644 --- a/usr/src/cmd/format/menu_fdisk.h +++ b/usr/src/cmd/format/menu_fdisk.h @@ -28,8 +28,6 @@ #ifndef _MENU_FDISK_H #define _MENU_FDISK_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_partition.c b/usr/src/cmd/format/menu_partition.c index 26e0867018..6294ebd6e8 100644 --- a/usr/src/cmd/format/menu_partition.c +++ b/usr/src/cmd/format/menu_partition.c @@ -35,7 +35,6 @@ #include "misc.h" #include "param.h" -/* Function prototypes for ANSI C Compilers */ static void nspaces(int); static int ndigits(uint64_t); @@ -344,7 +343,7 @@ p_name(void) */ name = (char *)(uintptr_t)input(FIO_OSTR, "Enter table name (remember quotes)", - ':', (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT); + ':', NULL, NULL, DATA_INPUT); /* * Lock out interrupts. */ @@ -493,13 +492,13 @@ print_efi_partition(struct dk_gpt *map, int partnum, int want_header) fmt_print(" %d ", partnum); s = find_string(ptag_choices, (int)map->efi_parts[partnum].p_tag); - if (s == (char *)NULL) + if (s == NULL) s = "-"; nspaces(10 - (int)strlen(s)); fmt_print("%s", s); s = find_string(pflag_choices, (int)map->efi_parts[partnum].p_flag); - if (s == (char *)NULL) + if (s == NULL) s = "-"; nspaces(6 - (int)strlen(s)); fmt_print("%s", s); @@ -594,7 +593,7 @@ print_partition(struct partition_info *pinfo, int partnum, int want_header) * Print the partition tag. If invalid, print - */ s = find_string(ptag_choices, (int)pinfo->vtoc.v_part[partnum].p_tag); - if (s == (char *)NULL) + if (s == NULL) s = "-"; nspaces(10 - (int)strlen(s)); fmt_print("%s", s); diff --git a/usr/src/cmd/format/menu_partition.h b/usr/src/cmd/format/menu_partition.h index 481309903a..545677eb63 100644 --- a/usr/src/cmd/format/menu_partition.h +++ b/usr/src/cmd/format/menu_partition.h @@ -26,8 +26,6 @@ #ifndef _MENU_PARTITION_H #define _MENU_PARTITION_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/menu_scsi.c b/usr/src/cmd/format/menu_scsi.c index 491aa79f84..c1173f6490 100644 --- a/usr/src/cmd/format/menu_scsi.c +++ b/usr/src/cmd/format/menu_scsi.c @@ -44,11 +44,6 @@ #include "startup.h" #include "checkdev.h" - -#ifdef __STDC__ -/* - * ANSI prototypes for local static functions - */ static int do_mode_sense(int); static int do_mode_sense_all(void); static int do_mode_select(struct chg_list *); @@ -64,24 +59,6 @@ static void free_change_list(void); static void do_default(char *); static void default_all_pages(void); static int default_page(int); -#else -static int do_mode_sense(); -static int do_mode_sense_all(); -static int do_mode_select(); -static int do_format(); -static void do_list(); -static int do_inquiry(); -static void do_apply(); -static void do_cancel(); -static void do_display(); -static int parse_change_spec(); -static void add_new_change_list_item(); -static void free_change_list(); -static void do_default(); -static void default_all_pages(); -static int default_page(); -#endif /* __STDC__ */ - /* * Menu data for the SCSI menu display @@ -159,7 +136,7 @@ static struct chg_list *change_list; * so we cannot use the standard format menu-handling functions. */ int -c_scsi() +c_scsi(void) { int i; struct env env; @@ -336,8 +313,7 @@ exit: * Get all the various flavors: default, current, saved, changeable. */ static int -do_mode_sense(pageno) - int pageno; +do_mode_sense(int pageno) { struct scsi_ms_header header; struct mode_page *pg; @@ -354,39 +330,35 @@ do_mode_sense(pageno) fmt_print("\nPage 0x%x:\n", pageno); if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_DEFAULT, - msbuf, MAX_MODE_SENSE_SIZE, &header)) { + msbuf, MAX_MODE_SENSE_SIZE, &header)) { err_print("%sfailed\n", default_msg); result = 1; } else { - dump(default_msg, msbuf, MODESENSE_PAGE_LEN(pg), - HEX_ONLY); + dump(default_msg, msbuf, MODESENSE_PAGE_LEN(pg), HEX_ONLY); } if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_CURRENT, - msbuf, MAX_MODE_SENSE_SIZE, &header)) { + msbuf, MAX_MODE_SENSE_SIZE, &header)) { err_print("%sfailed\n", current_msg); result = 1; } else { - dump(current_msg, msbuf, MODESENSE_PAGE_LEN(pg), - HEX_ONLY); + dump(current_msg, msbuf, MODESENSE_PAGE_LEN(pg), HEX_ONLY); } if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_SAVED, - msbuf, MAX_MODE_SENSE_SIZE, &header)) { + msbuf, MAX_MODE_SENSE_SIZE, &header)) { err_print("%sfailed\n", saved_msg); result = 1; } else { - dump(saved_msg, msbuf, MODESENSE_PAGE_LEN(pg), - HEX_ONLY); + dump(saved_msg, msbuf, MODESENSE_PAGE_LEN(pg), HEX_ONLY); } if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_CHANGEABLE, - msbuf, MAX_MODE_SENSE_SIZE, &header)) { + msbuf, MAX_MODE_SENSE_SIZE, &header)) { err_print("%sfailed\n", changeable_msg); result = 1; } else { - dump(changeable_msg, msbuf, MODESENSE_PAGE_LEN(pg), - HEX_ONLY); + dump(changeable_msg, msbuf, MODESENSE_PAGE_LEN(pg), HEX_ONLY); } fmt_print("\n"); @@ -398,7 +370,7 @@ do_mode_sense(pageno) * Dump all the pages a device supports */ static int -do_mode_sense_all() +do_mode_sense_all(void) { int result = 0; @@ -426,8 +398,7 @@ do_mode_sense_all() * are changeable. */ static int -do_mode_select(change_item) - struct chg_list *change_item; +do_mode_select(struct chg_list *change_item) { struct scsi_ms_header header; char saved[MAX_MODE_SENSE_SIZE]; @@ -445,9 +416,9 @@ do_mode_select(change_item) * Get changeable mode sense */ if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_CHANGEABLE, - changeable, MAX_MODE_SENSE_SIZE, &header)) { + changeable, MAX_MODE_SENSE_SIZE, &header)) { err_print("Mode sense on page %x (changeable) failed\n", - pageno); + pageno); return (1); } @@ -455,13 +426,12 @@ do_mode_select(change_item) * Get saved mode sense. If saved fails, use current values. */ if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_SAVED, - saved, MAX_MODE_SENSE_SIZE, &header)) { - err_print("Mode sense on page %x (saved) failed\n", - pageno); + saved, MAX_MODE_SENSE_SIZE, &header)) { + err_print("Mode sense on page %x (saved) failed\n", pageno); if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_CURRENT, - saved, MAX_MODE_SENSE_SIZE, &header)) { + saved, MAX_MODE_SENSE_SIZE, &header)) { err_print("Mode sense on page %x (current) failed\n", - pageno); + pageno); return (1); } else { err_print("Using current values instead\n"); @@ -479,7 +449,7 @@ do_mode_select(change_item) * Try making this change to this page */ if (apply_chg_list(pageno, length, (uchar_t *)saved, - (uchar_t *)changeable, change_item)) { + (uchar_t *)changeable, change_item)) { /* * A change was made. Do a mode select * We always want to set the Page Format bit. @@ -494,7 +464,7 @@ do_mode_select(change_item) header.mode_header.length = 0; header.mode_header.device_specific = 0; if (uscsi_mode_select(cur_file, pageno, flags, - saved, length, &header)) { + saved, length, &header)) { /* * Failed - try not saving parameters, * if possible. @@ -502,8 +472,7 @@ do_mode_select(change_item) if (flags & MODE_SELECT_SP) { flags &= ~MODE_SELECT_SP; if (uscsi_mode_select(cur_file, pageno, - flags, saved, - length, &header)) { + flags, saved, length, &header)) { result = 1; } } else { @@ -535,7 +504,7 @@ Mode select on page %x ok.\n", pageno); * Ask if we should format with the P or the P&G lists. */ static int -do_format() +do_format(void) { struct uscsi_cmd ucmd; union scsi_cdb cdb; @@ -621,7 +590,7 @@ currently being used for swapping.\n\n"); * List common SCSI-2 mode pages */ static void -do_list() +do_list(void) { fmt_print("\n\ Common SCSI-2 pages applicable to direct-access devices:\n\n"); @@ -666,7 +635,7 @@ static char *scsi_inquiry_labels[] = { * Dump the full inquiry as returned by the device */ static int -do_inquiry() +do_inquiry(void) { char inqbuf[255]; struct scsi_inquiry *inq; @@ -721,7 +690,7 @@ do_inquiry() static void -do_apply() +do_apply(void) { if (change_list == NULL) { fmt_print("\nlist empty.\n"); @@ -733,7 +702,7 @@ do_apply() static void -do_cancel() +do_cancel(void) { if (change_list == NULL) { fmt_print("\nlist empty.\n"); @@ -744,7 +713,7 @@ do_cancel() static void -do_display() +do_display(void) { struct chg_list *cp; @@ -776,11 +745,8 @@ do_display() static int -parse_change_spec(full_input, input, pageno, chg_item) - char *full_input; - char *input; - int pageno; - struct chg_list *chg_item; +parse_change_spec(char *full_input, char *input, int pageno, + struct chg_list *chg_item) { char *p; int tilde; @@ -797,8 +763,7 @@ parse_change_spec(full_input, input, pageno, chg_item) return (0); } if (chg_item->byteno < 2) { - err_print(" Unsupported byte offset: %d\n", - chg_item->byteno); + err_print(" Unsupported byte offset: %d\n", chg_item->byteno); return (0); } for (input = p; *input == ' '; input++) @@ -851,8 +816,7 @@ parse_change_spec(full_input, input, pageno, chg_item) static void -add_new_change_list_item(chg_item) - struct chg_list *chg_item; +add_new_change_list_item(struct chg_list *chg_item) { struct chg_list *cp; @@ -868,7 +832,7 @@ add_new_change_list_item(chg_item) static void -free_change_list() +free_change_list(void) { struct chg_list *cp; struct chg_list *cp2; @@ -884,8 +848,7 @@ free_change_list() static void -do_default(input) - char *input; +do_default(char *input) { char *s = input; char *p; @@ -935,7 +898,7 @@ do_default(input) static void -default_all_pages() +default_all_pages(void) { char *p; struct mode_header *mh; @@ -1004,8 +967,7 @@ error: static int -default_page(pageno) - int pageno; +default_page(int pageno) { struct scsi_ms_header header; char saved[MAX_MODE_SENSE_SIZE]; @@ -1023,9 +985,8 @@ default_page(pageno) * Get default mode sense */ if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_DEFAULT, - dfault, MAX_MODE_SENSE_SIZE, &header)) { - err_print("Mode sense on page %x (dfault) failed\n", - pageno); + dfault, MAX_MODE_SENSE_SIZE, &header)) { + err_print("Mode sense on page %x (dfault) failed\n", pageno); return (0); } @@ -1033,9 +994,8 @@ default_page(pageno) * Get the current mode sense. */ if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_CURRENT, - current, MAX_MODE_SENSE_SIZE, &header)) { - err_print("Mode sense on page %x (current) failed\n", - pageno); + current, MAX_MODE_SENSE_SIZE, &header)) { + err_print("Mode sense on page %x (current) failed\n", pageno); return (0); } @@ -1044,7 +1004,7 @@ default_page(pageno) * the same as the current. */ if (uscsi_mode_sense(cur_file, pageno, MODE_SENSE_PC_SAVED, - saved, MAX_MODE_SENSE_SIZE, &header)) { + saved, MAX_MODE_SENSE_SIZE, &header)) { (void) memcpy(saved, current, MAX_MODE_SENSE_SIZE); } @@ -1067,8 +1027,7 @@ default_page(pageno) } if (need_mode_select == 0) { - fmt_print("Defaulting page 0x%x: ok\n", - pageno); + fmt_print("Defaulting page 0x%x: ok\n", pageno); return (1); } @@ -1087,7 +1046,7 @@ default_page(pageno) header.mode_header.length = 0; header.mode_header.device_specific = 0; if (uscsi_mode_select(cur_file, pageno, flags, - current, length, &header)) { + current, length, &header)) { /* * Failed - try not saving parameters, * if possible. @@ -1095,12 +1054,11 @@ default_page(pageno) if (flags & MODE_SELECT_SP) { flags &= ~MODE_SELECT_SP; if (uscsi_mode_select(cur_file, pageno, flags, - saved, length, &header)) { + saved, length, &header)) { fmt_print("Defaulting page 0x%x: failed\n", - pageno); + pageno); } else { - fmt_print("Defaulting page 0x%x: ", - pageno); + fmt_print("Defaulting page 0x%x: ", pageno); fmt_print("cannot save page permanently\n"); } } else { diff --git a/usr/src/cmd/format/menu_scsi.h b/usr/src/cmd/format/menu_scsi.h index d238416af9..78de1e2fca 100644 --- a/usr/src/cmd/format/menu_scsi.h +++ b/usr/src/cmd/format/menu_scsi.h @@ -27,8 +27,6 @@ #ifndef _MENU_SCSI_H #define _MENU_SCSI_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/misc.c b/usr/src/cmd/format/misc.c index 785bf642bf..9d477b6a29 100644 --- a/usr/src/cmd/format/misc.c +++ b/usr/src/cmd/format/misc.c @@ -44,18 +44,9 @@ #include "label.h" #include "startup.h" -#ifdef __STDC__ - /* Function prototypes for ANSI C Compilers */ static void cleanup(int sig); -#else /* __STDC__ */ - -/* Function prototypes for non-ANSI C Compilers */ -static void cleanup(); - -#endif /* __STDC__ */ - struct env *current_env = NULL; /* ptr to current environment */ static int stop_pending = 0; /* ctrl-Z is pending */ struct ttystate ttystate; /* tty info */ @@ -82,12 +73,11 @@ char *confirm_list[] = { * and checks the return value so the caller doesn't have to. */ void * -zalloc(count) - int count; +zalloc(int count) { void *ptr; - if ((ptr = (void *) calloc(1, (unsigned)count)) == NULL) { + if ((ptr = calloc(1, (unsigned)count)) == NULL) { err_print("Error: unable to calloc more space.\n"); fullabort(); } @@ -101,15 +91,12 @@ zalloc(count) * zeroed. */ void * -rezalloc(ptr, count) - void *ptr; - int count; +rezalloc(void *ptr, int count) { void *new_ptr; - if ((new_ptr = (void *) realloc((char *)ptr, - (unsigned)count)) == NULL) { + if ((new_ptr = realloc((char *)ptr, (unsigned)count)) == NULL) { err_print("Error: unable to realloc more space.\n"); fullabort(); } @@ -120,10 +107,9 @@ rezalloc(ptr, count) * This routine is a wrapper for free. */ void -destroy_data(data) - char *data; +destroy_data(char *data) { - free((char *)data); + free(data); } #ifdef not @@ -132,28 +118,27 @@ destroy_data(data) * returns a mnemonic name for that space. */ char * -space2str(space) - uint_t space; +space2str(uint_t space) { char *name; switch (space&SP_BUSMASK) { - case SP_VIRTUAL: + case SP_VIRTUAL: name = "virtual"; break; - case SP_OBMEM: + case SP_OBMEM: name = "obmem"; break; - case SP_OBIO: + case SP_OBIO: name = "obio"; break; - case SP_MBMEM: + case SP_MBMEM: name = "mbmem"; break; - case SP_MBIO: + case SP_MBIO: name = "mbio"; break; - default: + default: err_print("Error: unknown address space type encountered.\n"); fullabort(); } @@ -166,8 +151,7 @@ space2str(space) * the response. */ int -check(question) - char *question; +check(char *question) { int answer; u_ioparam_t ioparam; @@ -181,8 +165,7 @@ check(question) * Ask the user. */ ioparam.io_charlist = confirm_list; - answer = input(FIO_MSTR, question, '?', &ioparam, - (int *)NULL, DATA_INPUT); + answer = input(FIO_MSTR, question, '?', &ioparam, NULL, DATA_INPUT); return (answer); } @@ -190,12 +173,9 @@ check(question) * This routine aborts the current command. It is called by a ctrl-C * interrupt and also under certain error conditions. */ -/*ARGSUSED*/ void -cmdabort(sig) - int sig; +cmdabort(int sig __unused) { - /* * If there is no usable saved environment, gracefully exit. This * allows the user to interrupt the program even when input is from @@ -233,10 +213,8 @@ cmdabort(sig) * This routine implements the ctrl-Z suspend mechanism. It is called * when a suspend signal is received. */ -/*ARGSUSED*/ void -onsusp(sig) - int sig; +onsusp(int sig __unused) { int fix_term; #ifdef NOT_DEF @@ -267,7 +245,7 @@ onsusp(sig) * to cause us to stop. */ sigmask.sigbits[0] = (ulong_t)0xffffffff; - if (sigprocmask(SIG_SETMASK, &sigmask, (sigset_t *)NULL) == -1) + if (sigprocmask(SIG_SETMASK, &sigmask, NULL) == -1) err_print("sigprocmask failed %d\n", errno); #endif /* NOT_DEF */ (void) signal(SIGTSTP, SIG_DFL); @@ -294,10 +272,8 @@ onsusp(sig) * disk operations (e.g. formatting). It is called when an alarm signal * is received. */ -/*ARGSUSED*/ void -onalarm(sig) - int sig; +onalarm(int sig __unused) { } @@ -306,7 +282,7 @@ onalarm(sig) * This routine gracefully exits the program. */ void -fullabort() +fullabort(void) { fmt_print("\n"); @@ -386,7 +362,7 @@ cleanup(int sig) * necessarily pairing between calls to enter_critical() and exit_critical(). */ void -enter_critical() +enter_critical(void) { /* @@ -406,7 +382,7 @@ enter_critical() * one call to exit_critical() will erase any number of such calls. */ void -exit_critical() +exit_critical(void) { /* @@ -436,7 +412,7 @@ exit_critical() * This routine turns off echoing on the controlling tty for the program. */ void -echo_off() +echo_off(void) { /* * Open the tty and store the file pointer for later. @@ -472,7 +448,7 @@ echo_off() * This routine turns on echoing on the controlling tty for the program. */ void -echo_on() +echo_on(void) { /* @@ -496,7 +472,7 @@ echo_on() * This routine turns off single character entry mode for tty. */ void -charmode_on() +charmode_on(void) { /* @@ -540,7 +516,7 @@ charmode_on() * Note, this routine must be called before echo_on. */ void -charmode_off() +charmode_off(void) { /* @@ -570,15 +546,14 @@ charmode_off() * Use destroy_data() to free when no longer used. */ char * -alloc_string(s) - char *s; +alloc_string(char *s) { char *ns; - if (s == (char *)NULL) { - ns = (char *)zalloc(1); + if (s == NULL) { + ns = zalloc(1); } else { - ns = (char *)zalloc(strlen(s) + 1); + ns = zalloc(strlen(s) + 1); (void) strcpy(ns, s); } return (ns); @@ -614,22 +589,16 @@ alloc_string(s) #define INCR_LISTSIZE 32 char ** -build_argvlist(argvlist, size, alloc, str) - char **argvlist; - int *size; - int *alloc; - char *str; +build_argvlist(char **argvlist, int *size, int *alloc, char *str) { if (*size + 2 > *alloc) { if (*alloc == 0) { *alloc = INITIAL_LISTSIZE; - argvlist = (char **) - zalloc(sizeof (char *) * (*alloc)); + argvlist = zalloc(sizeof (char *) * (*alloc)); } else { *alloc += INCR_LISTSIZE; - argvlist = (char **) - rezalloc((void *) argvlist, - sizeof (char *) * (*alloc)); + argvlist = rezalloc((void *) argvlist, + sizeof (char *) * (*alloc)); } } @@ -734,8 +703,7 @@ fdisk_physical_name(char *name) * would appear in the device directory itself. */ int -whole_disk_name(name) - char *name; +whole_disk_name(char *name) { must_be(name, 'c'); skip_digits(name); @@ -755,8 +723,7 @@ whole_disk_name(name) * Return true if a name is in the internal canonical form */ int -canonical_name(name) - char *name; +canonical_name(char *name) { must_be(name, 'c'); skip_digits(name); @@ -775,8 +742,7 @@ canonical_name(name) * Used to support 4.x naming conventions under 5.0. */ int -canonical4x_name(name) - char *name; +canonical4x_name(char *name) { char **p; int i; @@ -801,9 +767,7 @@ canonical4x_name(name) * /dev/rdsk/c0t0d0s0 -> c0t0d0 */ void -canonicalize_name(dst, src) - char *dst; - char *src; +canonicalize_name(char *dst, char *src) { char *s; @@ -832,9 +796,7 @@ canonicalize_name(dst, src) * s1, but we do have to match all of s2 */ int -match_substr(s1, s2) - char *s1; - char *s2; +match_substr(char *s1, char *s2) { while (*s2 != 0) { if (*s1++ != *s2++) @@ -851,11 +813,7 @@ match_substr(s1, s2) #define BYTES_PER_LINE 16 void -dump(hdr, src, nbytes, format) - char *hdr; - caddr_t src; - int nbytes; - int format; +dump(char *hdr, caddr_t src, int nbytes, int format) { int i; int n; @@ -883,8 +841,7 @@ dump(hdr, src, nbytes, format) } err_print(" "); for (i = 0; i < n; i++) { - err_print("%c", - isprint(src[i]) ? src[i] : '.'); + err_print("%c", isprint(src[i]) ? src[i] : '.'); } } err_print("\n"); @@ -946,12 +903,12 @@ gb2bn(float gb) * window. The default value of TTY_LINES is returned on error. */ int -get_tty_lines() +get_tty_lines(void) { int tty_lines = TTY_LINES; struct winsize winsize; - if ((option_f == (char *)NULL) && isatty(0) == 1 && isatty(1) == 1) { + if ((option_f == NULL) && isatty(0) == 1 && isatty(1) == 1) { /* * We have a real terminal for std input and output */ diff --git a/usr/src/cmd/format/modify_partition.h b/usr/src/cmd/format/modify_partition.h index 6865c006c1..a03988cc31 100644 --- a/usr/src/cmd/format/modify_partition.h +++ b/usr/src/cmd/format/modify_partition.h @@ -28,8 +28,6 @@ #ifndef _MODIFY_PARTITION_H #define _MODIFY_PARTITION_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/partition.c b/usr/src/cmd/format/partition.c index 1a376bd333..fd71fa128c 100644 --- a/usr/src/cmd/format/partition.c +++ b/usr/src/cmd/format/partition.c @@ -357,7 +357,7 @@ change_partition(int num) * created. */ int -get_partition() +get_partition(void) { register struct partition_info *pptr; register struct partition_info *parts; @@ -408,7 +408,7 @@ get_partition() * the new map starts out all zeroes. */ void -make_partition() +make_partition(void) { register struct partition_info *pptr, *parts; int i; diff --git a/usr/src/cmd/format/partition.h b/usr/src/cmd/format/partition.h index 4c8fac82f2..4e5d98f8bc 100644 --- a/usr/src/cmd/format/partition.h +++ b/usr/src/cmd/format/partition.h @@ -27,8 +27,6 @@ #ifndef _PARTITION_H #define _PARTITION_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/prompts.c b/usr/src/cmd/format/prompts.c index e6ef368bbb..06607bec66 100644 --- a/usr/src/cmd/format/prompts.c +++ b/usr/src/cmd/format/prompts.c @@ -43,7 +43,7 @@ * Prompt for max number of LBA */ uint64_t -get_mlba() +get_mlba(void) { u_ioparam_t ioparam; @@ -51,29 +51,28 @@ get_mlba() ioparam.io_bounds.upper = UINT_MAX64; return (input(FIO_INT64, "Enter maximum number of LBAs", - ':', &ioparam, (int *)NULL, DATA_INPUT)); + ':', &ioparam, NULL, DATA_INPUT)); } /* * Prompt for number of cylinders */ int -get_ncyl() +get_ncyl(void) { u_ioparam_t ioparam; ioparam.io_bounds.lower = 1; ioparam.io_bounds.upper = MAX_CYLS; return (input(FIO_INT, "Enter number of data cylinders", - ':', &ioparam, (int *)NULL, DATA_INPUT)); + ':', &ioparam, NULL, DATA_INPUT)); } /* * Prompt for number of alternate cylinders */ int -get_acyl(n_cyls) - int n_cyls; +get_acyl(int n_cyls) { u_ioparam_t ioparam; int deflt; @@ -89,9 +88,7 @@ get_acyl(n_cyls) * Prompt for number of physical cylinders */ int -get_pcyl(n_cyls, a_cyls) - int n_cyls; - int a_cyls; +get_pcyl(int n_cyls, int a_cyls) { u_ioparam_t ioparam; int deflt; @@ -107,23 +104,21 @@ get_pcyl(n_cyls, a_cyls) * Prompt for number of heads */ int -get_nhead() +get_nhead(void) { u_ioparam_t ioparam; ioparam.io_bounds.lower = 1; ioparam.io_bounds.upper = MAX_HEADS; return (input(FIO_INT, "Enter number of heads", ':', - &ioparam, (int *)NULL, DATA_INPUT)); + &ioparam, NULL, DATA_INPUT)); } /* * Prompt for number of physical heads */ int -get_phead(n_heads, options) - int n_heads; - ulong_t *options; +get_phead(int n_heads, ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -132,7 +127,7 @@ get_phead(n_heads, options) ioparam.io_bounds.lower = n_heads; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter physical number of heads", - ':', &ioparam, &deflt, DATA_INPUT)) { + ':', &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_PHEAD; return (deflt); } @@ -145,7 +140,7 @@ get_phead(n_heads, options) * Prompt for number of sectors per track */ int -get_nsect() +get_nsect(void) { u_ioparam_t ioparam; @@ -153,15 +148,14 @@ get_nsect() ioparam.io_bounds.upper = MAX_SECTS; return (input(FIO_INT, "Enter number of data sectors/track", ':', - &ioparam, (int *)NULL, DATA_INPUT)); + &ioparam, NULL, DATA_INPUT)); } /* * Prompt for number of physical sectors per track */ int -get_psect(options) - ulong_t *options; +get_psect(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -170,7 +164,7 @@ get_psect(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter number of physical sectors/track", - ':', &ioparam, &deflt, DATA_INPUT)) { + ':', &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_PSECT; return (deflt); } @@ -182,9 +176,7 @@ get_psect(options) * Prompt for bytes per track */ int -get_bpt(n_sects, options) - int n_sects; - ulong_t *options; +get_bpt(int n_sects, ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -195,7 +187,7 @@ get_bpt(n_sects, options) ioparam.io_bounds.upper = INFINITY; deflt = n_sects * cur_blksz; return (input(FIO_INT, "Enter number of bytes/track", - ':', &ioparam, &deflt, DATA_INPUT)); + ':', &ioparam, &deflt, DATA_INPUT)); } return (0); @@ -205,7 +197,7 @@ get_bpt(n_sects, options) * Prompt for rpm */ int -get_rpm() +get_rpm(void) { u_ioparam_t ioparam; int deflt; @@ -221,8 +213,7 @@ get_rpm() * Prompt for formatting time */ int -get_fmt_time(options) - ulong_t *options; +get_fmt_time(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -230,7 +221,7 @@ get_fmt_time(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter format time", ':', - &ioparam, &deflt, DATA_INPUT)) { + &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_FMTTIME; return (deflt); } @@ -241,8 +232,7 @@ get_fmt_time(options) * Prompt for cylinder skew */ int -get_cyl_skew(options) - ulong_t *options; +get_cyl_skew(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -250,7 +240,7 @@ get_cyl_skew(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter cylinder skew", ':', - &ioparam, &deflt, DATA_INPUT)) { + &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_CYLSKEW; return (deflt); } @@ -261,8 +251,7 @@ get_cyl_skew(options) * Prompt for track skew */ int -get_trk_skew(options) - ulong_t *options; +get_trk_skew(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -270,7 +259,7 @@ get_trk_skew(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter track skew", ':', - &ioparam, &deflt, DATA_INPUT)) { + &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_TRKSKEW; return (deflt); } @@ -281,8 +270,7 @@ get_trk_skew(options) * Prompt for tracks per zone */ int -get_trks_zone(options) - ulong_t *options; +get_trks_zone(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -290,7 +278,7 @@ get_trks_zone(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter tracks per zone", ':', - &ioparam, &deflt, DATA_INPUT)) { + &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_TRKS_ZONE; return (deflt); } @@ -301,8 +289,7 @@ get_trks_zone(options) * Prompt for alternate tracks */ int -get_atrks(options) - ulong_t *options; +get_atrks(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -310,7 +297,7 @@ get_atrks(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter alternate tracks", ':', - &ioparam, &deflt, DATA_INPUT)) { + &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_ATRKS; return (deflt); } @@ -321,8 +308,7 @@ get_atrks(options) * Prompt for alternate sectors */ int -get_asect(options) - ulong_t *options; +get_asect(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -330,7 +316,7 @@ get_asect(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter alternate sectors", ':', - &ioparam, &deflt, DATA_INPUT)) { + &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_ASECT; return (deflt); } @@ -341,8 +327,7 @@ get_asect(options) * Prompt for cache setting */ int -get_cache(options) - ulong_t *options; +get_cache(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -350,7 +335,7 @@ get_cache(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = 0xff; if (input(FIO_OPINT, "Enter cache control", ':', - &ioparam, &deflt, DATA_INPUT)) { + &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_CACHE; return (deflt); } @@ -361,8 +346,7 @@ get_cache(options) * Prompt for prefetch threshold */ int -get_threshold(options) - ulong_t *options; +get_threshold(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -370,7 +354,7 @@ get_threshold(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter prefetch threshold", - ':', &ioparam, &deflt, DATA_INPUT)) { + ':', &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_PREFETCH; return (deflt); } @@ -381,8 +365,7 @@ get_threshold(options) * Prompt for minimum prefetch */ int -get_min_prefetch(options) - ulong_t *options; +get_min_prefetch(ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -390,7 +373,7 @@ get_min_prefetch(options) ioparam.io_bounds.lower = 0; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter minimum prefetch", - ':', &ioparam, &deflt, DATA_INPUT)) { + ':', &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_CACHE_MIN; return (deflt); } @@ -401,9 +384,7 @@ get_min_prefetch(options) * Prompt for maximum prefetch */ int -get_max_prefetch(min_prefetch, options) - int min_prefetch; - ulong_t *options; +get_max_prefetch(int min_prefetch, ulong_t *options) { u_ioparam_t ioparam; int deflt; @@ -411,7 +392,7 @@ get_max_prefetch(min_prefetch, options) ioparam.io_bounds.lower = min_prefetch; ioparam.io_bounds.upper = INFINITY; if (input(FIO_OPINT, "Enter maximum prefetch", - ':', &ioparam, &deflt, DATA_INPUT)) { + ':', &ioparam, &deflt, DATA_INPUT)) { *options |= SUP_CACHE_MAX; return (deflt); } @@ -422,7 +403,7 @@ get_max_prefetch(min_prefetch, options) * Prompt for bytes per sector */ int -get_bps() +get_bps(void) { u_ioparam_t ioparam; int deflt; @@ -442,9 +423,9 @@ get_bps() * Prompt for ascii label */ char * -get_asciilabel() +get_asciilabel(void) { return ((char *)(uintptr_t)input(FIO_OSTR, "Enter disk type name (remember quotes)", ':', - (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT)); + NULL, NULL, DATA_INPUT)); } diff --git a/usr/src/cmd/format/prompts.h b/usr/src/cmd/format/prompts.h index 1f58fce23c..861b027ed6 100644 --- a/usr/src/cmd/format/prompts.h +++ b/usr/src/cmd/format/prompts.h @@ -27,8 +27,6 @@ #ifndef _PROMPTS_H #define _PROMPTS_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/scsi_com.h b/usr/src/cmd/format/scsi_com.h index 08568fffba..cff098b289 100644 --- a/usr/src/cmd/format/scsi_com.h +++ b/usr/src/cmd/format/scsi_com.h @@ -27,8 +27,6 @@ #ifndef _SCSI_COM_H #define _SCSI_COM_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/format/startup.c b/usr/src/cmd/format/startup.c index 07d46a6bab..d01fb18b71 100644 --- a/usr/src/cmd/format/startup.c +++ b/usr/src/cmd/format/startup.c @@ -287,7 +287,7 @@ badopt: static void -usage() +usage(void) { err_print("Usage: format [-s][-d disk_name]"); err_print("[-t disk_type][-p partition_name]\n"); @@ -311,7 +311,7 @@ usage() * the problem is occurring. */ void -sup_init() +sup_init(void) { int nopened_files = 0; char fname[MAXPATHLEN]; @@ -411,7 +411,7 @@ sup_init() * for the descriptor. Return true if able to open the file. */ static int -sup_prxfile() +sup_prxfile(void) { int status; TOKEN token; @@ -486,7 +486,7 @@ sup_prxfile() * enable supporting multiple search path definitions. */ static void -sup_setpath() +sup_setpath(void) { TOKEN token; TOKEN cleaned; @@ -550,7 +550,7 @@ sup_setpath() * controller type. */ static void -sup_setdtype() +sup_setdtype(void) { TOKEN token, cleaned, ident; int val, status, i; @@ -952,7 +952,7 @@ sup_change_spec(struct disk_type *disk, char *id) * controller type. */ static void -sup_setpart() +sup_setpart(void) { TOKEN token, cleaned, disk, ctlr, ident; struct disk_type *dtype = NULL; @@ -2406,7 +2406,7 @@ datafile_error(char *errmsg, char *token) * That may or may not be a problem... */ static void -search_duplicate_dtypes() +search_duplicate_dtypes(void) { struct disk_type *dp1; struct disk_type *dp2; @@ -2439,7 +2439,7 @@ search_duplicate_dtypes() * That may or may not be a problem... */ static void -search_duplicate_pinfo() +search_duplicate_pinfo(void) { struct disk_type *dp; struct partition_info *pp1; @@ -2853,7 +2853,7 @@ exit: static void -sort_disk_list() +sort_disk_list(void) { int n; struct disk_info **disks; diff --git a/usr/src/cmd/format/startup.h b/usr/src/cmd/format/startup.h index de2bc6c24d..8aaf3e1aa4 100644 --- a/usr/src/cmd/format/startup.h +++ b/usr/src/cmd/format/startup.h @@ -27,8 +27,6 @@ #ifndef _STARTUP_H #define _STARTUP_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif |