diff options
Diffstat (limited to 'sbin/fdisk')
-rw-r--r-- | sbin/fdisk/cmd.c | 93 | ||||
-rw-r--r-- | sbin/fdisk/disk.c | 29 | ||||
-rw-r--r-- | sbin/fdisk/fdisk.c | 9 | ||||
-rw-r--r-- | sbin/fdisk/mbr.c | 35 | ||||
-rw-r--r-- | sbin/fdisk/misc.c | 44 | ||||
-rw-r--r-- | sbin/fdisk/part.c | 40 | ||||
-rw-r--r-- | sbin/fdisk/user.c | 16 |
7 files changed, 62 insertions, 204 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index f345e9656bb..db55b7e1a8e 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.32 2003/06/03 01:13:19 weingart Exp $ */ +/* $OpenBSD: cmd.c,v 1.33 2003/06/11 06:22:12 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -41,12 +41,7 @@ #define MAX(a, b) ((a) >= (b) ? (a) : (b)) int -Xreinit(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xreinit(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { char buf[DEV_BSIZE]; @@ -66,12 +61,7 @@ Xreinit(cmd, disk, mbr, tt, offset) } int -Xdisk(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xdisk(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { int maxcyl = 1024; int maxhead = 256; @@ -103,12 +93,7 @@ Xdisk(cmd, disk, mbr, tt, offset) } int -Xedit(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xedit(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { int pn, num, ret; prt_t *pp; @@ -193,12 +178,7 @@ Xedit(cmd, disk, mbr, tt, offset) } int -Xsetpid(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xsetpid(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { int pn, num, ret; prt_t *pp; @@ -233,12 +213,7 @@ Xsetpid(cmd, disk, mbr, tt, offset) return (ret); } int -Xselect(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xselect(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { static int firstoff = 0; int off; @@ -276,12 +251,7 @@ Xselect(cmd, disk, mbr, tt, offset) } int -Xprint(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xprint(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { DISK_printmetrics(disk, cmd->args); @@ -292,12 +262,7 @@ Xprint(cmd, disk, mbr, tt, offset) } int -Xwrite(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xwrite(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { char mbr_buf[DEV_BSIZE]; int fd; @@ -325,12 +290,7 @@ Xquit(cmd, disk, r, tt, offset) } int -Xabort(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xabort(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { exit(0); @@ -340,12 +300,7 @@ Xabort(cmd, disk, mbr, tt, offset) int -Xexit(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xexit(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { /* Nothing to do here */ @@ -353,12 +308,7 @@ Xexit(cmd, disk, mbr, tt, offset) } int -Xhelp(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xhelp(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { cmd_table_t *cmd_table = cmd->table; int i; @@ -370,12 +320,7 @@ Xhelp(cmd, disk, mbr, tt, offset) } int -Xupdate(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xupdate(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { /* Update code */ @@ -385,12 +330,7 @@ Xupdate(cmd, disk, mbr, tt, offset) } int -Xflag(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xflag(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { int i, pn = -1; @@ -419,12 +359,7 @@ Xflag(cmd, disk, mbr, tt, offset) } int -Xmanual(cmd, disk, mbr, tt, offset) - cmd_t *cmd; - disk_t *disk; - mbr_t *mbr; - mbr_t *tt; - int offset; +Xmanual(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { char *pager = "/usr/bin/less"; char *p; diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index 4f86810f7c8..a48628b7a3f 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.17 2003/06/03 01:13:19 weingart Exp $ */ +/* $OpenBSD: disk.c,v 1.18 2003/06/11 06:22:12 deraadt Exp $ */ /* * Copyright (c) 1997, 2001 Tobias Weingartner @@ -46,9 +46,7 @@ #include "misc.h" int -DISK_open(disk, mode) - char *disk; - int mode; +DISK_open(char *disk, int mode) { int fd; struct stat st; @@ -64,8 +62,7 @@ DISK_open(disk, mode) } int -DISK_close(fd) - int fd; +DISK_close(int fd) { return (close(fd)); @@ -77,8 +74,7 @@ DISK_close(fd) * they seem. */ DISK_metrics * -DISK_getlabelmetrics(name) - char *name; +DISK_getlabelmetrics(char *name) { DISK_metrics *lm = NULL; struct disklabel dl; @@ -114,8 +110,7 @@ DISK_getlabelmetrics(name) * correlating the BIOS drive to the BSD drive. */ DISK_metrics * -DISK_getbiosmetrics(name) - char *name; +DISK_getbiosmetrics(char *name) { bios_diskinfo_t di; DISK_metrics *bm; @@ -165,8 +160,7 @@ DISK_getbiosmetrics(name) * with. Return NULL to indicate so. */ DISK_metrics * -DISK_getbiosmetrics(name) - char *name; +DISK_getbiosmetrics(char *name) { return (NULL); } @@ -182,9 +176,7 @@ DISK_getbiosmetrics(name) * geometry he/she wishes to use. */ int -DISK_getmetrics(disk, user) - disk_t *disk; - DISK_metrics *user; +DISK_getmetrics(disk_t *disk, DISK_metrics *user) { disk->label = DISK_getlabelmetrics(disk->name); @@ -203,7 +195,8 @@ DISK_getmetrics(disk, user) cyls = disk->label->size / (disk->bios->heads * disk->bios->sectors); secs = cyls * (disk->bios->heads * disk->bios->sectors); if ((disk->label->size - secs) < 0) - errx(1, "BIOS fixup botch (%d sectors)", disk->label->size - secs); + errx(1, "BIOS fixup botch (%d sectors)", + disk->label->size - secs); disk->bios->cylinders = cyls; disk->bios->size = secs; } @@ -230,9 +223,7 @@ DISK_getmetrics(disk, user) * to indicate the units that should be used for display. */ int -DISK_printmetrics(disk, units) - disk_t *disk; - char *units; +DISK_printmetrics(disk_t *disk, char *units) { int i; double size; diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 37d51aa02a7..f405c3b1e8c 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.35 2003/06/03 01:13:19 weingart Exp $ */ +/* $OpenBSD: fdisk.c,v 1.36 2003/06/11 06:22:12 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -44,9 +44,10 @@ static unsigned char builtin_mbr[] = { void -usage() +usage(void) { extern char * __progname; + fprintf(stderr, "usage: %s " "[-ieu] [-f mbrboot] [-c cyl -h head -s sect] disk\n" "\t-i: initialize disk with virgin MBR\n" @@ -61,9 +62,7 @@ usage() int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { int ch, fd; int i_flag = 0, m_flag = 0, u_flag = 0; diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index 1449fd99e62..286c24f8a3c 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.17 2003/06/03 01:13:19 weingart Exp $ */ +/* $OpenBSD: mbr.c,v 1.18 2003/06/11 06:22:12 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -44,9 +44,7 @@ void -MBR_init(disk, mbr) - disk_t *disk; - mbr_t *mbr; +MBR_init(disk_t *disk, mbr_t *mbr) { /* Fix up given mbr for this disk */ mbr->part[0].flag = 0; @@ -90,12 +88,7 @@ MBR_init(disk, mbr) } void -MBR_parse(disk, mbr_buf, offset, reloff, mbr) - disk_t *disk; - char *mbr_buf; - off_t offset; - off_t reloff; - mbr_t *mbr; +MBR_parse(disk_t *disk, char *mbr_buf, off_t offset, off_t reloff, mbr_t *mbr) { int i; @@ -110,9 +103,7 @@ MBR_parse(disk, mbr_buf, offset, reloff, mbr) } void -MBR_make(mbr, mbr_buf) - mbr_t *mbr; - char *mbr_buf; +MBR_make(mbr_t *mbr, char *mbr_buf) { int i; @@ -125,9 +116,7 @@ MBR_make(mbr, mbr_buf) } void -MBR_print(mbr, units) - mbr_t *mbr; - char *units; +MBR_print(mbr_t *mbr, char *units) { int i; @@ -142,10 +131,7 @@ MBR_print(mbr, units) } int -MBR_read(fd, where, buf) - int fd; - off_t where; - char *buf; +MBR_read(int fd, off_t where, char *buf) { off_t off; int len; @@ -161,10 +147,7 @@ MBR_read(fd, where, buf) } int -MBR_write(fd, where, buf) - int fd; - off_t where; - char *buf; +MBR_write(int fd, off_t where, char *buf) { off_t off; int len; @@ -181,9 +164,7 @@ MBR_write(fd, where, buf) } void -MBR_pcopy(disk, mbr) - disk_t *disk; - mbr_t *mbr; +MBR_pcopy(disk_t *disk, mbr_t *mbr) { /* * Copy partition table from the disk indicated diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c index 5ed9c2a2da7..558188804d4 100644 --- a/sbin/fdisk/misc.c +++ b/sbin/fdisk/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.12 2003/06/03 01:13:19 weingart Exp $ */ +/* $OpenBSD: misc.c,v 1.13 2003/06/11 06:22:12 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -36,8 +36,7 @@ #include "misc.h" int -unit_lookup(units) - char *units; +unit_lookup(char *units) { int i = 0; if (units == NULL) @@ -56,8 +55,7 @@ unit_lookup(units) } int -ask_cmd(cmd) - cmd_t *cmd; +ask_cmd(cmd_t *cmd) { char lbuf[100], *cp, *buf; @@ -79,13 +77,8 @@ ask_cmd(cmd) } int -ask_num(str, flags, dflt, low, high, help) - const char *str; - int flags; - int dflt; - int low; - int high; - void (*help)(void); +ask_num(const char *str, int flags, int dflt, int low, int high, + void (*help)(void)) { char lbuf[100], *cp; int num; @@ -128,8 +121,7 @@ again: } int -ask_yn(str) - const char *str; +ask_yn(const char *str) { int ch, first; @@ -147,8 +139,7 @@ ask_yn(str) } u_int16_t -getshort(p) - void *p; +getshort(void *p) { unsigned char *cp = p; @@ -156,9 +147,7 @@ getshort(p) } void -putshort(p, l) - void *p; - u_int16_t l; +putshort(void *p, u_int16_t l) { unsigned char *cp = p; @@ -167,8 +156,7 @@ putshort(p, l) } u_int32_t -getlong(p) - void *p; +getlong(void *p) { unsigned char *cp = p; @@ -176,9 +164,7 @@ getlong(p) } void -putlong(p, l) - void *p; - u_int32_t l; +putlong(void *p, u_int32_t l) { unsigned char *cp = p; @@ -193,14 +179,8 @@ putlong(p, l) * Returns UINT_MAX on error */ u_int32_t -getuint(disk, prompt, helpstring, oval, maxval, offset, flags) - disk_t *disk; - char *prompt; - char *helpstring; - u_int32_t oval; - u_int32_t maxval; - u_int32_t offset; - int flags; +getuint(disk_t *disk, char *prompt, char *helpstring, u_int32_t oval, + u_int32_t maxval, u_int32_t offset, int flags) { char buf[BUFSIZ], *endptr, *p, operator = '\0'; u_int32_t rval = oval; diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c index b2163faa91e..5292eab5f24 100644 --- a/sbin/fdisk/part.c +++ b/sbin/fdisk/part.c @@ -1,4 +1,4 @@ -/* $OpenBSD: part.c,v 1.33 2003/06/03 01:13:19 weingart Exp $ */ +/* $OpenBSD: part.c,v 1.34 2003/06/11 06:22:12 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -137,7 +137,7 @@ static const struct part_type { }; void -PRT_printall() +PRT_printall(void) { int i, idrows; @@ -160,8 +160,7 @@ PRT_printall() } const char * -PRT_ascii_id(id) - int id; +PRT_ascii_id(int id) { static char unknown[] = "<Unknown ID>"; int i; @@ -175,13 +174,8 @@ PRT_ascii_id(id) } void -PRT_parse(disk, prt, offset, reloff, partn, pn) - disk_t *disk; - void *prt; - off_t offset; - off_t reloff; - prt_t *partn; - int pn; +PRT_parse(disk_t *disk, void *prt, off_t offset, off_t reloff, + prt_t *partn, int pn) { unsigned char *p = prt; off_t off; @@ -211,8 +205,7 @@ PRT_parse(disk, prt, offset, reloff, partn, pn) } int -PRT_check_chs(partn) - prt_t *partn; +PRT_check_chs(prt_t *partn) { if ( (partn->shead > 255) || (partn->ssect >63) || @@ -226,11 +219,7 @@ PRT_check_chs(partn) return 1; } void -PRT_make(partn, offset, reloff, prt) - prt_t *partn; - off_t offset; - off_t reloff; - void *prt; +PRT_make(prt_t *partn, off_t offset, off_t reloff, void *prt) { unsigned char *p = prt; int ecsave, scsave; @@ -283,10 +272,7 @@ PRT_make(partn, offset, reloff, prt) } void -PRT_print(num, partn, units) - int num; - prt_t *partn; - char *units; +PRT_print(int num, prt_t *partn, char *units) { double size; int i; @@ -311,10 +297,7 @@ PRT_print(num, partn, units) } void -PRT_fix_BN(disk, part, pn) - disk_t *disk; - prt_t *part; - int pn; +PRT_fix_BN(disk_t *disk, prt_t *part, int pn) { int spt, tpc, spc; int start = 0; @@ -348,10 +331,7 @@ PRT_fix_BN(disk, part, pn) } void -PRT_fix_CHS(disk, part, pn) - disk_t *disk; - prt_t *part; - int pn; +PRT_fix_CHS(disk_t *disk, prt_t *part, int pn) { int spt, tpc, spc; int start, end, size; diff --git a/sbin/fdisk/user.c b/sbin/fdisk/user.c index 63cc38932e6..7be29c73636 100644 --- a/sbin/fdisk/user.c +++ b/sbin/fdisk/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.20 2003/06/03 01:13:19 weingart Exp $ */ +/* $OpenBSD: user.c,v 1.21 2003/06/11 06:22:12 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -63,10 +63,7 @@ static cmd_table_t cmd_table[] = { int -USER_init(disk, tt, preserve) - disk_t *disk; - mbr_t *tt; - int preserve; +USER_init(disk_t *disk, mbr_t *tt, int preserve) { int fd, yn; char mbr_buf[DEV_BSIZE]; @@ -102,11 +99,7 @@ USER_init(disk, tt, preserve) int modified; int -USER_modify(disk, tt, offset, reloff) - disk_t *disk; - mbr_t *tt; - off_t offset; - off_t reloff; +USER_modify(disk_t *disk, mbr_t *tt, off_t offset, off_t reloff) { static int editlevel; char mbr_buf[DEV_BSIZE]; @@ -187,8 +180,7 @@ again: } int -USER_print_disk(disk) - disk_t *disk; +USER_print_disk(disk_t *disk) { int fd, offset, firstoff, i; char mbr_buf[DEV_BSIZE]; |