From f60b3cb6d01f37251c358470223a411e2f05a51a Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Tue, 16 May 2006 22:52:10 +0000 Subject: Make standalone binaries compile with -Wall -Werror --- sys/arch/mvme88k/stand/Makefile.inc | 4 ++-- sys/arch/mvme88k/stand/bootsd/boot.c | 8 +++---- sys/arch/mvme88k/stand/bootst/boot.c | 6 ++--- sys/arch/mvme88k/stand/bootst/dev_tape.c | 3 +-- sys/arch/mvme88k/stand/bootst/rawfs.c | 7 +++--- sys/arch/mvme88k/stand/bootxx/bootxx.c | 29 +++++++++++++----------- sys/arch/mvme88k/stand/installboot/installboot.c | 22 ++++++++---------- sys/arch/mvme88k/stand/libsa/bugdev.c | 7 +++--- sys/arch/mvme88k/stand/libsa/parse_args.c | 6 ++--- sys/arch/mvme88k/stand/netboot/dev_net.c | 6 ++++- sys/arch/mvme88k/stand/netboot/devopen.c | 3 +-- sys/arch/mvme88k/stand/netboot/if_ie.c | 15 ++++++------ sys/arch/mvme88k/stand/tftpboot/netdev.c | 3 ++- sys/arch/mvme88k/stand/tftpboot/tftpfs.c | 15 ++++++------ 14 files changed, 68 insertions(+), 66 deletions(-) (limited to 'sys') diff --git a/sys/arch/mvme88k/stand/Makefile.inc b/sys/arch/mvme88k/stand/Makefile.inc index 93a7e80ed0a..c92f766a57d 100644 --- a/sys/arch/mvme88k/stand/Makefile.inc +++ b/sys/arch/mvme88k/stand/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.9 2005/12/30 02:03:49 millert Exp $ +# $OpenBSD: Makefile.inc,v 1.10 2006/05/16 22:52:07 miod Exp $ MDEC_DIR?=/usr/mdec -CFLAGS+= -fno-stack-protector -mmemcpy +CFLAGS+=-Wall -Werror -fno-stack-protector -mmemcpy # Load addresses for first and second stage bootstraps STAGE1_RELOC=0x009F0000 diff --git a/sys/arch/mvme88k/stand/bootsd/boot.c b/sys/arch/mvme88k/stand/bootsd/boot.c index 99c8553eb36..eb25f430ff1 100644 --- a/sys/arch/mvme88k/stand/bootsd/boot.c +++ b/sys/arch/mvme88k/stand/bootsd/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.7 2003/06/02 23:27:52 millert Exp $ */ +/* $OpenBSD: boot.c,v 1.8 2006/05/16 22:52:09 miod Exp $ */ /* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */ /*- @@ -49,10 +49,10 @@ int main() { char *cp, *file; - int io, flag, ret; - int ask = 0; + int flag, ret; + int ask = 0; - printf("\n>> OpenBSD/mvme88k bootsd [%s]\n", version); + printf(">> OpenBSD/mvme88k bootsd [%s]\n", version); ret = parse_args(&file, &flag); for (;;) { diff --git a/sys/arch/mvme88k/stand/bootst/boot.c b/sys/arch/mvme88k/stand/bootst/boot.c index 7c937bcc0c4..6992e8a0266 100644 --- a/sys/arch/mvme88k/stand/bootst/boot.c +++ b/sys/arch/mvme88k/stand/bootst/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.3 2003/06/02 23:27:52 millert Exp $ */ +/* $OpenBSD: boot.c,v 1.4 2006/05/16 22:52:09 miod Exp $ */ /*- * Changes Copyright (c) 1998 steve Murphree, Jr. * Copyright (c) 1982, 1986, 1990, 1993 @@ -38,8 +38,6 @@ #include "stand.h" #include "libsa.h" -#define LOADADDR 0x10000 - extern char *version; extern int errno; @@ -47,7 +45,7 @@ int main() { static char dnm[32] = "2"; char line[80]; - char *cp, *filename; + char *filename; int bflag = 0; printf(">> OpenBSD/mvme88k tapeboot [%s]\n", version); diff --git a/sys/arch/mvme88k/stand/bootst/dev_tape.c b/sys/arch/mvme88k/stand/bootst/dev_tape.c index a4352b8def7..792ded19ac9 100644 --- a/sys/arch/mvme88k/stand/bootst/dev_tape.c +++ b/sys/arch/mvme88k/stand/bootst/dev_tape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_tape.c,v 1.2 2002/03/14 03:15:57 millert Exp $ */ +/* $OpenBSD: dev_tape.c,v 1.3 2006/05/16 22:52:09 miod Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -75,7 +75,6 @@ tape_open(f, fname) struct open_file *f; char *fname; /* partition number, i.e. "1" */ { - int error = 0; int part; struct mvmeprom_dskio *ti; diff --git a/sys/arch/mvme88k/stand/bootst/rawfs.c b/sys/arch/mvme88k/stand/bootst/rawfs.c index db522f8391a..abf23291c35 100644 --- a/sys/arch/mvme88k/stand/bootst/rawfs.c +++ b/sys/arch/mvme88k/stand/bootst/rawfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rawfs.c,v 1.3 2006/01/16 18:03:54 deraadt Exp $ */ +/* $OpenBSD: rawfs.c,v 1.4 2006/05/16 22:52:09 miod Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -159,14 +159,15 @@ rawfs_get_block(f) struct open_file *f; { struct cfile *fs; - int error, len; + int error; + size_t len; fs = (struct cfile *)f->f_fsdata; fs->fs_ptr = fs->fs_buf; twiddle(); error = f->f_dev->dv_strategy(f->f_devdata, F_READ, - fs->fs_nextblk, RAWFS_BSIZE, fs->fs_buf, &len); + fs->fs_nextblk, RAWFS_BSIZE, fs->fs_buf, &len); if (!error) { fs->fs_len = len; diff --git a/sys/arch/mvme88k/stand/bootxx/bootxx.c b/sys/arch/mvme88k/stand/bootxx/bootxx.c index c5805457543..8d02e700a1f 100644 --- a/sys/arch/mvme88k/stand/bootxx/bootxx.c +++ b/sys/arch/mvme88k/stand/bootxx/bootxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bootxx.c,v 1.5 2002/03/14 03:15:57 millert Exp $ */ +/* $OpenBSD: bootxx.c,v 1.6 2006/05/16 22:52:09 miod Exp $ */ /* * Copyright (c) 1994 Paul Kranenburg @@ -61,22 +61,26 @@ * in terms of 512-byte blocks. Each non-zero value * will result in a read of block_size bytes. */ -int block_size = 512; /* default */ +size_t block_size = 512; /* default */ int block_count = MAXBLOCKNUM; /* length of table */ daddr_t block_table[MAXBLOCKNUM] = { 0 }; extern char *version; +int copyboot(struct open_file *, char *); +int main() { - struct open_file f; - char *addr; - int n, error; + struct open_file f; + char *addr; + int error; - printf("Boot: bug device: ctrl=%d, dev=%d\n", + printf("\nbootxx: first level bootstrap program [%s]\n", version); +#ifdef DEBUG + printf("boot device: ctrl=%d, dev=%d\n", bugargs.ctrl_lun, bugargs.dev_lun); - printf("\nbootxx: first level bootstrap program [%s]\n\n", version); +#endif f.f_flags = F_RAW; if (devopen(&f, 0, &addr)) { @@ -92,14 +96,14 @@ main() } /* copyboot had a problem... */ _rtt(); + return (0); } int -copyboot(fp, addr) - struct open_file *fp; - char *addr; +copyboot(struct open_file *fp, char *addr) { - int n, i, blknum; + size_t n; + int i, blknum; struct exec *x; addr -= sizeof(struct exec); /* assume OMAGIC, verify below */ @@ -119,8 +123,7 @@ copyboot(fp, addr) printf("bootxx: read block # %d = %d\n", i, blknum); #endif if ((fp->f_dev->dv_strategy)(fp->f_devdata, F_READ, - blknum, block_size, addr, &n)) - { + blknum, block_size, addr, &n)) { printf("bootxx: read failed\n"); return -1; } diff --git a/sys/arch/mvme88k/stand/installboot/installboot.c b/sys/arch/mvme88k/stand/installboot/installboot.c index 3f10148edf6..6bb14f7a251 100644 --- a/sys/arch/mvme88k/stand/installboot/installboot.c +++ b/sys/arch/mvme88k/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.8 2003/08/25 23:36:46 tedu Exp $ */ +/* $OpenBSD: installboot.c,v 1.9 2006/05/16 22:52:09 miod Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -55,12 +55,12 @@ char cdev[80]; struct nlist nl[] = { #define X_BLOCK_SIZE 0 - {"_block_size"}, + { { "_block_size" } }, #define X_BLOCK_COUNT 1 - {"_block_count"}, + { { "_block_count" } }, #define X_BLOCK_TABLE 2 - {"_block_table"}, - {NULL} + { { "_block_table" } }, + { { NULL } } }; int *block_size_p; /* block size var. in prototype image */ @@ -140,7 +140,7 @@ main(argc, argv) /* XXX - Paranoia: Make sure size is aligned! */ if (protosize & (DEV_BSIZE - 1)) - err(1, "proto bootblock bad size=%d", protosize); + err(1, "proto bootblock bad size=%ld", protosize); /* Open and check raw disk device */ if ((devfd = open(dev, O_RDONLY, 0)) < 0) @@ -252,7 +252,7 @@ loadprotoblocks(fname, size) if (verbose) { printf("%s: entry point %#x\n", fname, eh.a_entry); printf("proto bootblock size %ld\n", *size); - printf("room for %d filesystem blocks at %#x\n", + printf("room for %d filesystem blocks at %#lx\n", maxblocknum, nl[X_BLOCK_TABLE].n_value); } @@ -399,13 +399,11 @@ char *bootproto; struct cpu_disklabel *pcpul; struct stat stat; unsigned int exe_addr; - unsigned short exe_addr_u; - unsigned short exe_addr_l; pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel)); bzero(pcpul, sizeof(struct cpu_disklabel)); - if (verbose) + if (verbose) printf("modifying vid.\n"); exe_file = open(bootproto, O_RDONLY, 0444); @@ -417,7 +415,7 @@ char *bootproto; f = opendev(dkname, O_RDWR, OPENDEV_PART, &specname); if (lseek(f, 0, SEEK_SET) < 0 || - read(f, pcpul, sizeof(struct cpu_disklabel)) + read(f, pcpul, sizeof(struct cpu_disklabel)) < sizeof(struct cpu_disklabel)) err(4, "%s", specname); @@ -462,7 +460,7 @@ char *bootproto; pcpul->cfg_psm = 0x200; if (!nowrite) { - if (lseek(f, 0, SEEK_SET) < 0 || + if (lseek(f, 0, SEEK_SET) < 0 || write(f, pcpul, sizeof(struct cpu_disklabel)) < sizeof(struct cpu_disklabel)) err(4, "%s", specname); diff --git a/sys/arch/mvme88k/stand/libsa/bugdev.c b/sys/arch/mvme88k/stand/libsa/bugdev.c index 1267a7dc35e..923a026dcba 100644 --- a/sys/arch/mvme88k/stand/libsa/bugdev.c +++ b/sys/arch/mvme88k/stand/libsa/bugdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bugdev.c,v 1.2 2002/03/14 01:26:40 millert Exp $ */ +/* $OpenBSD: bugdev.c,v 1.3 2006/05/16 22:52:09 miod Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -56,7 +56,8 @@ devopen(f, fname, file) char **file; { register struct bugsc_softc *pp = &bugsc_softc[0]; - int error, i, dn = 0, pn = 0; + size_t i; + int error, pn = 0; char *dev, *cp; static char iobuf[MAXBSIZE]; struct disklabel sdlabel; @@ -233,6 +234,6 @@ cputobsdlabel(lp, clp) lp->d_bbsize = clp->bbsize; lp->d_sbsize = clp->sbsize; bcopy(clp->vid_4, &(lp->d_partitions[0]),sizeof (struct partition) * 4); - bcopy(clp->cfg_4, &(lp->d_partitions[4]), sizeof (struct partition) + bcopy(clp->cfg_4, &(lp->d_partitions[4]), sizeof (struct partition) * ((MAXPARTITIONS < 16) ? (MAXPARTITIONS - 4) : 12)); } diff --git a/sys/arch/mvme88k/stand/libsa/parse_args.c b/sys/arch/mvme88k/stand/libsa/parse_args.c index 5432ca2f1b4..3bbe717a863 100644 --- a/sys/arch/mvme88k/stand/libsa/parse_args.c +++ b/sys/arch/mvme88k/stand/libsa/parse_args.c @@ -1,8 +1,8 @@ -/* $OpenBSD: parse_args.c,v 1.4 2003/06/04 16:36:15 deraadt Exp $ */ +/* $OpenBSD: parse_args.c,v 1.5 2006/05/16 22:52:09 miod Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -61,7 +61,7 @@ parse_args(filep, flagp) if (bugargs.arg_start != bugargs.arg_end) { ptr = bugargs.arg_start; - while (c = *ptr) { + while ((c = *ptr) != '\0') { while (c == ' ') c = *++ptr; if (c == '\0') diff --git a/sys/arch/mvme88k/stand/netboot/dev_net.c b/sys/arch/mvme88k/stand/netboot/dev_net.c index 35bb7fdd7c7..fc2922a293b 100644 --- a/sys/arch/mvme88k/stand/netboot/dev_net.c +++ b/sys/arch/mvme88k/stand/netboot/dev_net.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_net.c,v 1.3 1999/01/11 05:11:46 millert Exp $ */ +/* $OpenBSD: dev_net.c,v 1.4 2006/05/16 22:52:09 miod Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -63,6 +63,7 @@ #include "netif.h" #include "config.h" #include "bootparam.h" +#include "nfs.h" extern int nfs_root_node[]; /* XXX - get from nfs_mount() */ @@ -72,6 +73,8 @@ char rootpath[FNAME_SIZE]; int netdev_sock = -1; static int open_count; +int net_mountroot(struct open_file *, char *); + /* * Called by devopen after it sets f->f_dev to our devsw entry. * This opens the low-level device and sets f->f_devdata. @@ -105,6 +108,7 @@ net_close(f) if (--open_count == 0) netif_close(netdev_sock); f->f_devdata = NULL; + return (0); } int diff --git a/sys/arch/mvme88k/stand/netboot/devopen.c b/sys/arch/mvme88k/stand/netboot/devopen.c index e8d4893bf24..36e38fee4b1 100644 --- a/sys/arch/mvme88k/stand/netboot/devopen.c +++ b/sys/arch/mvme88k/stand/netboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.2 2002/03/14 03:15:58 millert Exp $ */ +/* $OpenBSD: devopen.c,v 1.3 2006/05/16 22:52:09 miod Exp $ */ #include #include @@ -20,7 +20,6 @@ devopen(f, fname, file) char **file; { struct devsw *dp; - char *cp, *path, *devname; int error; *file = (char *)fname; diff --git a/sys/arch/mvme88k/stand/netboot/if_ie.c b/sys/arch/mvme88k/stand/netboot/if_ie.c index 0965facb7b7..cfcc47dea5f 100644 --- a/sys/arch/mvme88k/stand/netboot/if_ie.c +++ b/sys/arch/mvme88k/stand/netboot/if_ie.c @@ -1,8 +1,8 @@ -/* $OpenBSD: if_ie.c,v 1.7 2003/06/04 16:36:15 deraadt Exp $ */ +/* $OpenBSD: if_ie.c,v 1.8 2006/05/16 22:52:09 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -45,6 +45,7 @@ #include "libsa.h" #include "netif.h" #include "config.h" +#include "net.h" #include "i82586.h" #include "if_iereg.h" @@ -61,6 +62,7 @@ int ie_poll(struct iodesc *, void *, int); int ie_probe(struct netif *, void *); int ie_put(struct iodesc *, void *, size_t); void ie_reset(struct netif *, u_char *); +extern void machdep_common_ether(u_char *); struct netif_stats ie_stats; @@ -144,6 +146,7 @@ ie_error(nif, str, ier) panic("ie%d: unknown error", nif->nif_unit); } +void ieack(ier, iem) volatile struct iereg *ier; struct iemem *iem; @@ -162,7 +165,7 @@ ie_reset(nif, myea) { volatile struct iereg *ier = ie_softc.sc_reg; struct iemem *iem = ie_softc.sc_mem; - int timo = 10000, stat, i; + int timo = 10000, i; volatile int t; u_int a; @@ -290,10 +293,8 @@ ie_poll(desc, pkt, len) { volatile struct iereg *ier = ie_softc.sc_reg; struct iemem *iem = ie_softc.sc_mem; - u_char *p = pkt; static int slot; int length = 0; - u_int a; u_short status; asm(".word 0xf518\n"); @@ -359,8 +360,6 @@ ie_put(desc, pkt, len) volatile struct iereg *ier = ie_softc.sc_reg; struct iemem *iem = ie_softc.sc_mem; u_char *p = pkt; - int timo = 10000, stat, i; - volatile int t; u_int a; int xx = 0; @@ -400,7 +399,7 @@ ie_put(desc, pkt, len) ier->ie_attention = 1; /* chan attention! */ if (ie_debug) { - printf("ie%d: send %d to %x:%x:%x:%x:%x:%x\n", + printf("ie%d: send %ld to %x:%x:%x:%x:%x:%x\n", desc->io_netif->nif_unit, len, p[0], p[1], p[2], p[3], p[4], p[5]); } diff --git a/sys/arch/mvme88k/stand/tftpboot/netdev.c b/sys/arch/mvme88k/stand/tftpboot/netdev.c index 39ed9146b17..9c50bd76798 100644 --- a/sys/arch/mvme88k/stand/tftpboot/netdev.c +++ b/sys/arch/mvme88k/stand/tftpboot/netdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netdev.c,v 1.1 2004/01/26 19:48:34 miod Exp $ */ +/* $OpenBSD: netdev.c,v 1.2 2006/05/16 22:52:09 miod Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -32,6 +32,7 @@ #include #include +#include #include "stand.h" #include "tftpfs.h" diff --git a/sys/arch/mvme88k/stand/tftpboot/tftpfs.c b/sys/arch/mvme88k/stand/tftpboot/tftpfs.c index 42cef91e583..6fe0576ef2b 100644 --- a/sys/arch/mvme88k/stand/tftpboot/tftpfs.c +++ b/sys/arch/mvme88k/stand/tftpboot/tftpfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftpfs.c,v 1.1 2004/01/26 19:48:34 miod Exp $ */ +/* $OpenBSD: tftpfs.c,v 1.2 2006/05/16 22:52:09 miod Exp $ */ /*- * Copyright (c) 2001 Steve Murphree, Jr. @@ -41,6 +41,7 @@ #include #include "stand.h" +#include "tftpfs.h" /* * In-core open file. @@ -59,8 +60,6 @@ struct tftp_file { #define TFTP_BLOCK_NO(x) ((x >> TFTP_BLOCK_SHIFT) + 1) #define TFTP_BLOCK_OFF(x) (x % TFTP_BLOCK_SIZE) -static int read_inode(ino_t, struct open_file *); -static int block_map(struct open_file *, daddr_t, daddr_t *); static int tftp_read_file(struct open_file *, char **, size_t *); #ifdef COMPAT_UFS static void ffs_oldfscompat(struct fs *); @@ -91,7 +90,7 @@ tftp_read_file(f, buf_p, size_p) block_size = TFTP_BLOCK_SIZE; if (file_block == fp->f_buf_blkno + 1) { - /* + /* * Normal, incremental block transfer. */ rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, @@ -102,8 +101,8 @@ tftp_read_file(f, buf_p, size_p) twiddle(); fp->f_buf_blkno = file_block; } else if (file_block > fp->f_buf_blkno + 1) { - /* - * Read ahead to the requested block; If we need + /* + * Read ahead to the requested block; If we need * those we skipped, see below. */ for (i = (fp->f_buf_blkno + 1); i <= file_block; i++) { @@ -114,8 +113,8 @@ tftp_read_file(f, buf_p, size_p) } fp->f_buf_blkno = file_block; } else if (file_block < fp->f_buf_blkno) { - /* - * Uh oh... We can't rewind. Reopen the file + /* + * Uh oh... We can't rewind. Reopen the file * and start again. */ char filename[64]; -- cgit v1.2.3