From 7f5beafa6bd8708b8391cd3074c70c50129cff4b Mon Sep 17 00:00:00 2001 From: dsl Date: Fri, 25 Jul 2003 08:26:21 +0000 Subject: [PATCH] Sprinkle a load of consts, and change a few variable names. Now compiles with WARNS=3. --- distrib/utils/sysinst/Makefile.inc | 4 +- distrib/utils/sysinst/arch/acorn26/md.c | 12 ++-- distrib/utils/sysinst/arch/acorn26/md.h | 4 +- distrib/utils/sysinst/arch/acorn32/md.c | 12 ++-- distrib/utils/sysinst/arch/acorn32/md.h | 4 +- distrib/utils/sysinst/arch/alpha/md.c | 12 ++-- distrib/utils/sysinst/arch/alpha/md.h | 4 +- distrib/utils/sysinst/arch/amd64/md.h | 6 +- distrib/utils/sysinst/arch/amiga/md.h | 4 +- distrib/utils/sysinst/arch/arc/md.h | 4 +- distrib/utils/sysinst/arch/atari/md.h | 4 +- distrib/utils/sysinst/arch/bebox/md.h | 4 +- distrib/utils/sysinst/arch/cats/md.c | 12 ++-- distrib/utils/sysinst/arch/cats/md.h | 4 +- distrib/utils/sysinst/arch/evbarm/md.c | 12 ++-- distrib/utils/sysinst/arch/evbarm/md.h | 4 +- distrib/utils/sysinst/arch/evbppc/md.h | 4 +- distrib/utils/sysinst/arch/hp300/md.c | 18 +++--- distrib/utils/sysinst/arch/hp300/md.h | 4 +- distrib/utils/sysinst/arch/hpcmips/md.h | 4 +- distrib/utils/sysinst/arch/i386/md.c | 20 +++--- distrib/utils/sysinst/arch/i386/md.h | 6 +- distrib/utils/sysinst/arch/mac68k/md.c | 42 ++++++------- distrib/utils/sysinst/arch/mac68k/md.h | 6 +- distrib/utils/sysinst/arch/macppc/md.c | 12 ++-- distrib/utils/sysinst/arch/macppc/md.h | 4 +- distrib/utils/sysinst/arch/mipsco/md.c | 16 ++--- distrib/utils/sysinst/arch/mipsco/md.h | 4 +- distrib/utils/sysinst/arch/mvme68k/md.c | 18 +++--- distrib/utils/sysinst/arch/mvme68k/md.h | 4 +- distrib/utils/sysinst/arch/news68k/md.c | 12 ++-- distrib/utils/sysinst/arch/news68k/md.h | 4 +- distrib/utils/sysinst/arch/newsmips/md.c | 12 ++-- distrib/utils/sysinst/arch/newsmips/md.h | 4 +- distrib/utils/sysinst/arch/pc532/md.h | 4 +- distrib/utils/sysinst/arch/playstation2/md.h | 4 +- distrib/utils/sysinst/arch/pmax/md.c | 16 ++--- distrib/utils/sysinst/arch/pmax/md.h | 4 +- distrib/utils/sysinst/arch/prep/md.h | 4 +- distrib/utils/sysinst/arch/sandpoint/md.h | 4 +- distrib/utils/sysinst/arch/sgimips/md.h | 4 +- distrib/utils/sysinst/arch/shark/md.c | 12 ++-- distrib/utils/sysinst/arch/shark/md.h | 4 +- distrib/utils/sysinst/arch/sparc/md.c | 16 ++--- distrib/utils/sysinst/arch/sparc/md.h | 4 +- distrib/utils/sysinst/arch/sparc64/md.c | 16 ++--- distrib/utils/sysinst/arch/sparc64/md.h | 4 +- distrib/utils/sysinst/arch/vax/md.c | 16 ++--- distrib/utils/sysinst/arch/vax/md.h | 4 +- distrib/utils/sysinst/arch/x68k/md.c | 20 +++--- distrib/utils/sysinst/arch/x68k/md.h | 4 +- distrib/utils/sysinst/bsddisklabel.c | 4 +- distrib/utils/sysinst/defs.h | 12 ++-- distrib/utils/sysinst/disks.c | 24 ++++---- distrib/utils/sysinst/install.c | 5 +- distrib/utils/sysinst/label.c | 6 +- distrib/utils/sysinst/mbr.c | 64 ++++++++++---------- distrib/utils/sysinst/mbr.h | 4 +- distrib/utils/sysinst/menus.mi | 4 +- distrib/utils/sysinst/net.c | 12 ++-- distrib/utils/sysinst/run.c | 4 +- distrib/utils/sysinst/target.c | 11 ++-- distrib/utils/sysinst/txtwalk.c | 6 +- distrib/utils/sysinst/txtwalk.h | 8 +-- distrib/utils/sysinst/upgrade.c | 8 ++- distrib/utils/sysinst/util.c | 30 ++++----- 66 files changed, 319 insertions(+), 323 deletions(-) diff --git a/distrib/utils/sysinst/Makefile.inc b/distrib/utils/sysinst/Makefile.inc index 256a5004d1b4..83582b554f39 100644 --- a/distrib/utils/sysinst/Makefile.inc +++ b/distrib/utils/sysinst/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.25 2003/07/10 10:34:16 lukem Exp $ +# $NetBSD: Makefile.inc,v 1.26 2003/07/25 08:26:21 dsl Exp $ # # Makefile for sysinst @@ -53,7 +53,7 @@ CPPFLAGS+= -DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\" .endif -WARNS= 1 +WARNS= 3 CLEANFILES= menu_defs.c menu_defs.h menus.def \ msg_defs.c msg_defs.h msg.def msgtouch \ diff --git a/distrib/utils/sysinst/arch/acorn26/md.c b/distrib/utils/sysinst/arch/acorn26/md.c index 443534fd15b0..7524d8598bb7 100644 --- a/distrib/utils/sysinst/arch/acorn26/md.c +++ b/distrib/utils/sysinst/arch/acorn26/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.12 2003/07/11 15:29:00 dsl Exp $ */ +/* $NetBSD: md.c,v 1.13 2003/07/25 08:26:23 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -133,7 +133,7 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; static char bb[DEV_BSIZE]; struct filecore_bootblock *fcbb = (struct filecore_bootblock *)bb; int offset = 0; @@ -143,17 +143,17 @@ md_get_info(void) else disktype = "SCSI"; - snprintf(devname, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); + snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/acorn26/md.h b/distrib/utils/sysinst/arch/acorn26/md.h index 44d0de175c0b..f15b7d470fa8 100644 --- a/distrib/utils/sysinst/arch/acorn26/md.h +++ b/distrib/utils/sysinst/arch/acorn26/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.7 2003/06/14 12:58:46 dsl Exp $ */ +/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:23 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -73,7 +73,7 @@ * Default fileystem type for floppy disks. * On acorn26, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* * prototypes for MD code. diff --git a/distrib/utils/sysinst/arch/acorn32/md.c b/distrib/utils/sysinst/arch/acorn32/md.c index 2a528d96d4e8..b527d078d0ec 100644 --- a/distrib/utils/sysinst/arch/acorn32/md.c +++ b/distrib/utils/sysinst/arch/acorn32/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.13 2003/07/11 15:29:01 dsl Exp $ */ +/* $NetBSD: md.c,v 1.14 2003/07/25 08:26:23 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -132,7 +132,7 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; static char bb[DEV_BSIZE]; struct filecore_bootblock *fcbb = (struct filecore_bootblock *)bb; int offset = 0; @@ -142,17 +142,17 @@ md_get_info(void) else disktype = "SCSI"; - snprintf(devname, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); + snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/acorn32/md.h b/distrib/utils/sysinst/arch/acorn32/md.h index a0083da05f65..b659a1f89b78 100644 --- a/distrib/utils/sysinst/arch/acorn32/md.h +++ b/distrib/utils/sysinst/arch/acorn32/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.10 2003/06/14 12:58:46 dsl Exp $ */ +/* $NetBSD: md.h,v 1.11 2003/07/25 08:26:24 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -75,7 +75,7 @@ * Default fileystem type for floppy disks. * On acorn32, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* * prototypes for MD code. diff --git a/distrib/utils/sysinst/arch/alpha/md.c b/distrib/utils/sysinst/arch/alpha/md.c index 7cfcde74ebd0..0254c3687c0c 100644 --- a/distrib/utils/sysinst/arch/alpha/md.c +++ b/distrib/utils/sysinst/arch/alpha/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.34 2003/06/13 11:57:30 dsl Exp $ */ +/* $NetBSD: md.c,v 1.35 2003/07/25 08:26:24 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -66,19 +66,19 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf (devname, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); + snprintf (dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); - fd = open (devname, O_RDONLY, 0); + fd = open (dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf (stderr, "Can't open %s\n", devname); + fprintf (stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf (stderr, "Can't read disklabel on %s.\n", devname); + fprintf (stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/alpha/md.h b/distrib/utils/sysinst/arch/alpha/md.h index 640b21d6f576..ededef2b1732 100644 --- a/distrib/utils/sysinst/arch/alpha/md.h +++ b/distrib/utils/sysinst/arch/alpha/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.14 2003/06/11 21:35:37 dsl Exp $ */ +/* $NetBSD: md.h,v 1.15 2003/07/25 08:26:24 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -63,4 +63,4 @@ /* * Default file system type for floppies. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/amd64/md.h b/distrib/utils/sysinst/arch/amd64/md.h index 6fe5624ff3c7..fa10447ef292 100644 --- a/distrib/utils/sysinst/arch/amd64/md.h +++ b/distrib/utils/sysinst/arch/amd64/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.10 2003/06/14 12:58:47 dsl Exp $ */ +/* $NetBSD: md.h,v 1.11 2003/07/25 08:26:24 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -73,7 +73,7 @@ #define SET_MD_1_NAME "toolchain" /* Bootblock type */ -EXTERN char *boottype INIT(""); +EXTERN const char *boottype INIT(""); /* * Machine-specific command to write a new label to a disk. @@ -93,7 +93,7 @@ EXTERN char *boottype INIT(""); * Default fileystem type for floppy disks. * On x86_64, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); #define _PATH_MBR DEFAULT_BOOTDIR "/" DEFAULT_BOOTCODE #define _PATH_BOOTSEL DEFAULT_BOOTDIR "/" DEFAULT_BOOTSELCODE diff --git a/distrib/utils/sysinst/arch/amiga/md.h b/distrib/utils/sysinst/arch/amiga/md.h index 31e636e958fe..82b6ee42dbbb 100644 --- a/distrib/utils/sysinst/arch/amiga/md.h +++ b/distrib/utils/sysinst/arch/amiga/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.10 2003/06/13 22:27:05 dsl Exp $ */ +/* $NetBSD: md.h,v 1.11 2003/07/25 08:26:24 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -87,7 +87,7 @@ * Default fileystem type for floppy disks. * On amiga, that is ados. */ -EXTERN char *fdtype INIT("ados"); +EXTERN const char *fdtype INIT("ados"); /* diff --git a/distrib/utils/sysinst/arch/arc/md.h b/distrib/utils/sysinst/arch/arc/md.h index 72890f650d0e..efe5f2440d71 100644 --- a/distrib/utils/sysinst/arch/arc/md.h +++ b/distrib/utils/sysinst/arch/arc/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.7 2003/06/13 22:27:05 dsl Exp $ */ +/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:25 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -79,7 +79,7 @@ * Default fileystem type for floppy disks. * On arc, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* diff --git a/distrib/utils/sysinst/arch/atari/md.h b/distrib/utils/sysinst/arch/atari/md.h index c1ab5927490c..336c94a18704 100644 --- a/distrib/utils/sysinst/arch/atari/md.h +++ b/distrib/utils/sysinst/arch/atari/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.11 2003/06/14 12:58:47 dsl Exp $ */ +/* $NetBSD: md.h,v 1.12 2003/07/25 08:26:25 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -86,7 +86,7 @@ * Default fileystem type for floppy disks. * On atari, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* diff --git a/distrib/utils/sysinst/arch/bebox/md.h b/distrib/utils/sysinst/arch/bebox/md.h index aab2348358e2..b6cbe4e83c72 100644 --- a/distrib/utils/sysinst/arch/bebox/md.h +++ b/distrib/utils/sysinst/arch/bebox/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.10 2003/06/11 21:35:39 dsl Exp $ */ +/* $NetBSD: md.h,v 1.11 2003/07/25 08:26:25 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -76,7 +76,7 @@ * Default fileystem type for floppy disks. * On bebox, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/cats/md.c b/distrib/utils/sysinst/arch/cats/md.c index 8532b3d2c585..434635a291ec 100644 --- a/distrib/utils/sysinst/arch/cats/md.c +++ b/distrib/utils/sysinst/arch/cats/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.11 2003/07/11 15:29:02 dsl Exp $ */ +/* $NetBSD: md.c,v 1.12 2003/07/25 08:26:26 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -59,7 +59,7 @@ md_get_info (void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; #if 0 static char bb[DEV_BSIZE]; struct filecore_bootblock *fcbb = (struct filecore_bootblock *)bb; @@ -71,17 +71,17 @@ md_get_info (void) else disktype = "SCSI"; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/cats/md.h b/distrib/utils/sysinst/arch/cats/md.h index 68e0dcdd2212..6bbb0fd89a50 100644 --- a/distrib/utils/sysinst/arch/cats/md.h +++ b/distrib/utils/sysinst/arch/cats/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.7 2003/06/14 12:58:48 dsl Exp $ */ +/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:26 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -67,7 +67,7 @@ * Default fileystem type for floppy disks. * On cats, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* * prototypes for MD code. diff --git a/distrib/utils/sysinst/arch/evbarm/md.c b/distrib/utils/sysinst/arch/evbarm/md.c index 1a5e8a5bb41b..f4d1f37709a6 100644 --- a/distrib/utils/sysinst/arch/evbarm/md.c +++ b/distrib/utils/sysinst/arch/evbarm/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.12 2003/07/11 15:29:02 dsl Exp $ */ +/* $NetBSD: md.c,v 1.13 2003/07/25 08:26:26 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -58,24 +58,24 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; if (strncmp(diskdev, "wd", 2) == 0) disktype = "ST506"; else disktype = "SCSI"; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/evbarm/md.h b/distrib/utils/sysinst/arch/evbarm/md.h index 667582988369..aed69621eace 100644 --- a/distrib/utils/sysinst/arch/evbarm/md.h +++ b/distrib/utils/sysinst/arch/evbarm/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.8 2003/06/14 12:58:48 dsl Exp $ */ +/* $NetBSD: md.h,v 1.9 2003/07/25 08:26:26 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -72,7 +72,7 @@ * Default fileystem type for floppy disks. * On evbarm, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* * prototypes for MD code. diff --git a/distrib/utils/sysinst/arch/evbppc/md.h b/distrib/utils/sysinst/arch/evbppc/md.h index 4ac676ecb0df..76ffac69fbfb 100644 --- a/distrib/utils/sysinst/arch/evbppc/md.h +++ b/distrib/utils/sysinst/arch/evbppc/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.5 2003/06/11 21:35:41 dsl Exp $ */ +/* $NetBSD: md.h,v 1.6 2003/07/25 08:26:26 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -75,7 +75,7 @@ * Default fileystem type for floppy disks. * On bebox, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/hp300/md.c b/distrib/utils/sysinst/arch/hp300/md.c index 3aca18628f30..c322405be3ab 100644 --- a/distrib/utils/sysinst/arch/hp300/md.c +++ b/distrib/utils/sysinst/arch/hp300/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.10 2003/06/16 10:42:48 dsl Exp $ */ +/* $NetBSD: md.c,v 1.11 2003/07/25 08:26:27 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -57,25 +57,25 @@ md_get_info(void) { char buf[1024]; int fd; - char devname[100]; + char dev_name[100]; struct disklabel disklabel; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } @@ -95,7 +95,7 @@ md_get_info(void) if (read(fd, buf, 1024) < 0) { endwin(); - fprintf(stderr, "Can't read %s\n", devname); + fprintf(stderr, "Can't read %s\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/hp300/md.h b/distrib/utils/sysinst/arch/hp300/md.h index 2dc763ced9cf..8c51d6b6ad6a 100644 --- a/distrib/utils/sysinst/arch/hp300/md.h +++ b/distrib/utils/sysinst/arch/hp300/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.6 2003/06/13 11:57:31 dsl Exp $ */ +/* $NetBSD: md.h,v 1.7 2003/07/25 08:26:27 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -100,4 +100,4 @@ * Default fileystem type for floppy disks. * On hp300, if we had floppies, that would be ffs. */ -EXTERN char *fdtype INIT("ffs"); +EXTERN const char *fdtype INIT("ffs"); diff --git a/distrib/utils/sysinst/arch/hpcmips/md.h b/distrib/utils/sysinst/arch/hpcmips/md.h index 86be2716806f..6abb749714d1 100644 --- a/distrib/utils/sysinst/arch/hpcmips/md.h +++ b/distrib/utils/sysinst/arch/hpcmips/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.20 2003/06/13 22:27:07 dsl Exp $ */ +/* $NetBSD: md.h,v 1.21 2003/07/25 08:26:27 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -82,7 +82,7 @@ * Default fileystem type for floppy disks. * On i386, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* * prototypes for MD code. diff --git a/distrib/utils/sysinst/arch/i386/md.c b/distrib/utils/sysinst/arch/i386/md.c index 69dd25d51684..d59a7d7966be 100644 --- a/distrib/utils/sysinst/arch/i386/md.c +++ b/distrib/utils/sysinst/arch/i386/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.92 2003/07/10 13:36:50 dsl Exp $ */ +/* $NetBSD: md.c,v 1.93 2003/07/25 08:26:27 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -67,7 +67,7 @@ static struct biosdisk_info *biosdisk = NULL; static int mbr_root_above_chs(void); static void md_upgrade_mbrtype(void); -static int md_read_bootcode(const char *path, mbr_sector_t *mbr); +static int md_read_bootcode(const char *, mbr_sector_t *); #if defined(__i386__) static unsigned int get_bootmodel(void); #endif @@ -209,7 +209,7 @@ edit: * The existing partition table and bootselect configuration is kept. */ static int -md_read_bootcode(const char *path, mbr_sector_t *mbr) +md_read_bootcode(const char *path, mbr_sector_t *mbrs) { int fd; struct stat st; @@ -220,7 +220,7 @@ md_read_bootcode(const char *path, mbr_sector_t *mbr) if (fd < 0) return -1; - if (fstat(fd, &st) < 0 || st.st_size != sizeof *mbr) { + if (fstat(fd, &st) < 0 || st.st_size != sizeof *mbrs) { close(fd); return -1; } @@ -234,21 +234,21 @@ md_read_bootcode(const char *path, mbr_sector_t *mbr) if (new_mbr.mbr_bootsel.mbrb_magic != htole16(MBR_MAGIC)) return -1; - if (mbr->mbr_bootsel.mbrb_magic == htole16(MBR_MAGIC)) { + if (mbrs->mbr_bootsel.mbrb_magic == htole16(MBR_MAGIC)) { len = offsetof(mbr_sector_t, mbr_bootsel); - if (!(mbr->mbr_bootsel.mbrb_flags & BFL_NEWMBR)) + if (!(mbrs->mbr_bootsel.mbrb_flags & BFL_NEWMBR)) /* * Meaning of keys has changed, force a sensible * default (old code didn't preseve the answer). */ - mbr->mbr_bootsel.mbrb_defkey = SCAN_ENTER; + mbrs->mbr_bootsel.mbrb_defkey = SCAN_ENTER; } else len = offsetof(mbr_sector_t, mbr_parts); - memcpy(mbr, &new_mbr, len); + memcpy(mbrs, &new_mbr, len); /* Keep flags from object file - indicate the properties */ - mbr->mbr_bootsel.mbrb_flags = new_mbr.mbr_bootsel.mbrb_flags; - mbr->mbr_signature = htole16(MBR_MAGIC); + mbrs->mbr_bootsel.mbrb_flags = new_mbr.mbr_bootsel.mbrb_flags; + mbrs->mbr_signature = htole16(MBR_MAGIC); return 0; } diff --git a/distrib/utils/sysinst/arch/i386/md.h b/distrib/utils/sysinst/arch/i386/md.h index 15d901158f9c..4325173f6afa 100644 --- a/distrib/utils/sysinst/arch/i386/md.h +++ b/distrib/utils/sysinst/arch/i386/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.45 2003/07/07 12:30:25 dsl Exp $ */ +/* $NetBSD: md.h,v 1.46 2003/07/25 08:26:27 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -85,7 +85,7 @@ #define DISK_NAMES "wd", "sd", "ld", "ed" /* Bootblock type */ -EXTERN char *boottype INIT(""); +EXTERN const char *boottype INIT(""); /* * Machine-specific command to write a new label to a disk. @@ -105,7 +105,7 @@ EXTERN char *boottype INIT(""); * Default fileystem type for floppy disks. * On i386, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); #define _PATH_MBR DEFAULT_BOOTDIR "/" DEFAULT_BOOTCODE #define _PATH_BOOTSEL DEFAULT_BOOTDIR "/" DEFAULT_BOOTSELCODE diff --git a/distrib/utils/sysinst/arch/mac68k/md.c b/distrib/utils/sysinst/arch/mac68k/md.c index c800aeaddfa4..fb28c0ab5aa2 100644 --- a/distrib/utils/sysinst/arch/mac68k/md.c +++ b/distrib/utils/sysinst/arch/mac68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.37 2003/07/11 15:29:03 dsl Exp $ */ +/* $NetBSD: md.c,v 1.38 2003/07/25 08:26:28 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -238,7 +238,7 @@ getName(part, len_name, name) EBZB *bzb; int fd; off_t seek; - char devname[100], macosblk[512]; + char dev_name[100], macosblk[512]; *name = '\0'; bzb = (EBZB *)&part->pmBootArgs[0]; @@ -254,11 +254,11 @@ getName(part, len_name, name) /* * OK, this is stupid but it's damn nice to know! */ - snprintf (devname, sizeof(devname), "/dev/r%sc", diskdev); + snprintf (dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); /* * Open the disk as a raw device */ - if ((fd = open(devname, O_RDONLY, 0)) >= 0) { + if ((fd = open(dev_name, O_RDONLY, 0)) >= 0) { seek = (off_t)part->pmPyPartStart + (off_t)2; seek *= (off_t)blk_size; lseek(fd, seek, SEEK_SET); @@ -653,19 +653,19 @@ md_get_info() { struct disklabel disklabel; int fd, i; - char devname[100]; + char dev_name[100]; struct apple_part_map_entry block; - snprintf(devname, sizeof(devname), "/dev/r%s%c", + snprintf(dev_name, sizeof(dev_name), "/dev/r%s%c", diskdev, 'a' + getrawpartition()); /* * Open the disk as a raw device */ - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf (stderr, "Can't open %s\n", devname); + fprintf (stderr, "Can't open %s\n", dev_name); exit(1); } /* @@ -673,7 +673,7 @@ md_get_info() */ if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf (stderr, "Can't read disklabel on %s\n", devname); + fprintf (stderr, "Can't read disklabel on %s\n", dev_name); close(fd); exit(1); } @@ -753,7 +753,7 @@ int md_pre_disklabel() { int fd; - char devname[100]; + char dev_name[100]; struct disklabel lp; Block0 new_block0 = {APPLE_DRVR_MAP_MAGIC, 512, 0}; @@ -763,13 +763,13 @@ md_pre_disklabel() */ printf ("%s", msg_string (MSG_dodiskmap)); - snprintf (devname, sizeof(devname), "/dev/r%sc", diskdev); + snprintf (dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); /* * Open the disk as a raw device */ - if ((fd = open(devname, O_WRONLY, 0)) < 0) { + if ((fd = open(dev_name, O_WRONLY, 0)) < 0) { endwin(); - fprintf(stderr, "Can't open %s to rewrite the Disk Map\n", devname); + fprintf(stderr, "Can't open %s to rewrite the Disk Map\n", dev_name); exit (1); } /* @@ -840,17 +840,17 @@ md_post_disklabel(void) { struct disklabel updated_label; int fd, i, no_match; - char devname[100], buf[80]; - char *fst[] = {"free", "swap", " v6 ", " v7 ", "sysv", "v71k", - " v8 ", "ffs ", "dos ", "lfs ", "othr", "hpfs", - "9660", "boot", "ados", "hfs ", "fcor", "ex2f", - "ntfs", "raid", "ccd "}; - - snprintf(devname, sizeof(devname), "/dev/r%sc", diskdev); + char dev_name[100], buf[80]; + const char *fst[] = {"free", "swap", " v6 ", " v7 ", "sysv", "v71k", + " v8 ", "ffs ", "dos ", "lfs ", "othr", "hpfs", + "9660", "boot", "ados", "hfs ", "fcor", "ex2f", + "ntfs", "raid", "ccd "}; + + snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); /* * Open the disk as a raw device */ - if ((fd = open(devname, O_RDONLY, 0)) < 0) + if ((fd = open(dev_name, O_RDONLY, 0)) < 0) return 0; /* * Get the "new" label to see if we were successful. If we aren't diff --git a/distrib/utils/sysinst/arch/mac68k/md.h b/distrib/utils/sysinst/arch/mac68k/md.h index cc99576fdbea..d0851e434ef1 100644 --- a/distrib/utils/sysinst/arch/mac68k/md.h +++ b/distrib/utils/sysinst/arch/mac68k/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.18 2003/06/14 12:58:49 dsl Exp $ */ +/* $NetBSD: md.h,v 1.19 2003/07/25 08:26:28 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -57,7 +57,7 @@ typedef struct { int type; /* Entry type from above */ - char *name; /* Partition Type string */ + const char *name; /* Partition Type string */ } MAP_TYPE; /* @@ -246,7 +246,7 @@ EXTERN struct apple_part_map_entry new_map[] /* * Default fileystem type for floppy disks. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* * prototypes for MD code. diff --git a/distrib/utils/sysinst/arch/macppc/md.c b/distrib/utils/sysinst/arch/macppc/md.c index 7ab6f7681f06..a8b7f1dd5878 100644 --- a/distrib/utils/sysinst/arch/macppc/md.c +++ b/distrib/utils/sysinst/arch/macppc/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.29 2003/06/13 11:57:31 dsl Exp $ */ +/* $NetBSD: md.c,v 1.30 2003/07/25 08:26:28 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -66,19 +66,19 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf (devname, 100, "/dev/r%sc", diskdev); + snprintf (dev_name, 100, "/dev/r%sc", diskdev); - fd = open (devname, O_RDONLY, 0); + fd = open (dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf (stderr, "Can't open %s\n", devname); + fprintf (stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf (stderr, "Can't read disklabel on %s.\n", devname); + fprintf (stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/macppc/md.h b/distrib/utils/sysinst/arch/macppc/md.h index 33bed415e29c..69ab4dd0a245 100644 --- a/distrib/utils/sysinst/arch/macppc/md.h +++ b/distrib/utils/sysinst/arch/macppc/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.11 2003/06/11 21:35:44 dsl Exp $ */ +/* $NetBSD: md.h,v 1.12 2003/07/25 08:26:28 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -60,4 +60,4 @@ /* * Default file system type for floppies. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/mipsco/md.c b/distrib/utils/sysinst/arch/mipsco/md.c index 459cfb28bba0..d18c05ad4950 100644 --- a/distrib/utils/sysinst/arch/mipsco/md.c +++ b/distrib/utils/sysinst/arch/mipsco/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2003/06/13 11:57:32 dsl Exp $ */ +/* $NetBSD: md.c,v 1.6 2003/07/25 08:26:29 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -69,24 +69,24 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/mipsco/md.h b/distrib/utils/sysinst/arch/mipsco/md.h index d6c6ca63a79e..c8c8da9a9cae 100644 --- a/distrib/utils/sysinst/arch/mipsco/md.h +++ b/distrib/utils/sysinst/arch/mipsco/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.7 2003/06/13 11:57:32 dsl Exp $ */ +/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:29 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -80,4 +80,4 @@ * * On NetBSD/mipsco, we don't currently support a dedicated floppy-disk drive */ -EXTERN char *fdtype INIT(""); +EXTERN const char *fdtype INIT(""); diff --git a/distrib/utils/sysinst/arch/mvme68k/md.c b/distrib/utils/sysinst/arch/mvme68k/md.c index fe2d5dbb0a89..dc192fbd546f 100644 --- a/distrib/utils/sysinst/arch/mvme68k/md.c +++ b/distrib/utils/sysinst/arch/mvme68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.9 2003/06/16 10:42:51 dsl Exp $ */ +/* $NetBSD: md.c,v 1.10 2003/07/25 08:26:29 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -57,25 +57,25 @@ md_get_info(void) { char buf[1024]; int fd; - char devname[100]; + char dev_name[100]; struct disklabel disklabel; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } @@ -95,7 +95,7 @@ md_get_info(void) if (read(fd, buf, 1024) < 0) { endwin(); - fprintf(stderr, "Can't read %s\n", devname); + fprintf(stderr, "Can't read %s\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/mvme68k/md.h b/distrib/utils/sysinst/arch/mvme68k/md.h index a9bd0c41b7b3..b756e4ff368b 100644 --- a/distrib/utils/sysinst/arch/mvme68k/md.h +++ b/distrib/utils/sysinst/arch/mvme68k/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.6 2003/06/13 11:57:32 dsl Exp $ */ +/* $NetBSD: md.h,v 1.7 2003/07/25 08:26:29 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -91,4 +91,4 @@ * Default fileystem type for floppy disks. * On mvme68k, if we had floppies, that would be ffs. */ -EXTERN char *fdtype INIT("ffs"); +EXTERN const char *fdtype INIT("ffs"); diff --git a/distrib/utils/sysinst/arch/news68k/md.c b/distrib/utils/sysinst/arch/news68k/md.c index 6742de4f9ae7..76ba552e3266 100644 --- a/distrib/utils/sysinst/arch/news68k/md.c +++ b/distrib/utils/sysinst/arch/news68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.18 2003/06/13 11:57:32 dsl Exp $ */ +/* $NetBSD: md.c,v 1.19 2003/07/25 08:26:30 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -72,19 +72,19 @@ md_get_info() { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf (devname, 100, "/dev/r%sc", diskdev); + snprintf (dev_name, 100, "/dev/r%sc", diskdev); - fd = open (devname, O_RDONLY, 0); + fd = open (dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf (stderr, "Can't open %s\n", devname); + fprintf (stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf (stderr, "Can't read disklabel on %s.\n", devname); + fprintf (stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/news68k/md.h b/distrib/utils/sysinst/arch/news68k/md.h index 6031f0a98ede..a4e04a87ee3a 100644 --- a/distrib/utils/sysinst/arch/news68k/md.h +++ b/distrib/utils/sysinst/arch/news68k/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.16 2003/06/14 12:58:49 dsl Exp $ */ +/* $NetBSD: md.h,v 1.17 2003/07/25 08:26:30 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -76,5 +76,5 @@ /* * Default file system type for floppies. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/newsmips/md.c b/distrib/utils/sysinst/arch/newsmips/md.c index 5258f18484bb..995a001c61c9 100644 --- a/distrib/utils/sysinst/arch/newsmips/md.c +++ b/distrib/utils/sysinst/arch/newsmips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.7 2003/06/13 11:57:33 dsl Exp $ */ +/* $NetBSD: md.c,v 1.8 2003/07/25 08:26:30 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -72,19 +72,19 @@ md_get_info() { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf (devname, 100, "/dev/r%sc", diskdev); + snprintf (dev_name, 100, "/dev/r%sc", diskdev); - fd = open (devname, O_RDONLY, 0); + fd = open (dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf (stderr, "Can't open %s\n", devname); + fprintf (stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf (stderr, "Can't read disklabel on %s.\n", devname); + fprintf (stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/newsmips/md.h b/distrib/utils/sysinst/arch/newsmips/md.h index f302e14a5e26..f661dc32536b 100644 --- a/distrib/utils/sysinst/arch/newsmips/md.h +++ b/distrib/utils/sysinst/arch/newsmips/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.6 2003/06/13 11:57:33 dsl Exp $ */ +/* $NetBSD: md.h,v 1.7 2003/07/25 08:26:30 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -74,4 +74,4 @@ /* * Default file system type for floppies. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/pc532/md.h b/distrib/utils/sysinst/arch/pc532/md.h index b74b1bf6b3a3..a92bfc1953b8 100644 --- a/distrib/utils/sysinst/arch/pc532/md.h +++ b/distrib/utils/sysinst/arch/pc532/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.14 2003/06/11 21:35:46 dsl Exp $ */ +/* $NetBSD: md.h,v 1.15 2003/07/25 08:26:31 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -63,4 +63,4 @@ #define MD_SETS_VALID SET_SYSTEM -EXTERN char *fdtype INIT(""); +EXTERN const char *fdtype INIT(""); diff --git a/distrib/utils/sysinst/arch/playstation2/md.h b/distrib/utils/sysinst/arch/playstation2/md.h index 0bf3bd2bc7ee..5c9ff3730e53 100644 --- a/distrib/utils/sysinst/arch/playstation2/md.h +++ b/distrib/utils/sysinst/arch/playstation2/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.9 2003/06/13 11:57:33 dsl Exp $ */ +/* $NetBSD: md.h,v 1.10 2003/07/25 08:26:31 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -76,4 +76,4 @@ * Default fileystem type for IDE disk. * On playstation2, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/pmax/md.c b/distrib/utils/sysinst/arch/pmax/md.c index d72f381be8b9..1b04af0b227e 100644 --- a/distrib/utils/sysinst/arch/pmax/md.c +++ b/distrib/utils/sysinst/arch/pmax/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.51 2003/06/13 11:57:34 dsl Exp $ */ +/* $NetBSD: md.c,v 1.52 2003/07/25 08:26:31 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -69,24 +69,24 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/pmax/md.h b/distrib/utils/sysinst/arch/pmax/md.h index 1ddf3d6adb4a..1c05f0a54c3a 100644 --- a/distrib/utils/sysinst/arch/pmax/md.h +++ b/distrib/utils/sysinst/arch/pmax/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.25 2003/06/13 11:57:34 dsl Exp $ */ +/* $NetBSD: md.h,v 1.26 2003/07/25 08:26:32 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -77,5 +77,5 @@ * On pmax, we don't support a dedicated floppy-disk driver, only * SCSI floppy drives, so we can't recognize floppies by name. */ -EXTERN char *fdtype INIT(""); +EXTERN const char *fdtype INIT(""); diff --git a/distrib/utils/sysinst/arch/prep/md.h b/distrib/utils/sysinst/arch/prep/md.h index 6b34a6bfdb45..7a52875d2557 100644 --- a/distrib/utils/sysinst/arch/prep/md.h +++ b/distrib/utils/sysinst/arch/prep/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.7 2003/06/13 11:57:34 dsl Exp $ */ +/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:32 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -96,7 +96,7 @@ * Default fileystem type for floppy disks. * On prep, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* diff --git a/distrib/utils/sysinst/arch/sandpoint/md.h b/distrib/utils/sysinst/arch/sandpoint/md.h index f6bd117ebff1..a2f0715cb1fe 100644 --- a/distrib/utils/sysinst/arch/sandpoint/md.h +++ b/distrib/utils/sysinst/arch/sandpoint/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.6 2003/06/11 21:35:48 dsl Exp $ */ +/* $NetBSD: md.h,v 1.7 2003/07/25 08:26:32 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -76,7 +76,7 @@ * Default fileystem type for floppy disks. * On bebox, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/arch/sgimips/md.h b/distrib/utils/sysinst/arch/sgimips/md.h index 83189ee41b16..e67e38bb06d4 100644 --- a/distrib/utils/sysinst/arch/sgimips/md.h +++ b/distrib/utils/sysinst/arch/sgimips/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.11 2003/06/13 11:57:34 dsl Exp $ */ +/* $NetBSD: md.h,v 1.12 2003/07/25 08:26:33 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -85,5 +85,5 @@ * On sgimips, we don't support a dedicated floppy-disk driver, only * SCSI floppy drives, so we can't recognize floppies by name. */ -EXTERN char *fdtype INIT(""); +EXTERN const char *fdtype INIT(""); diff --git a/distrib/utils/sysinst/arch/shark/md.c b/distrib/utils/sysinst/arch/shark/md.c index 6c650037d0c4..85355cce8a68 100644 --- a/distrib/utils/sysinst/arch/shark/md.c +++ b/distrib/utils/sysinst/arch/shark/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.12 2003/07/11 15:29:04 dsl Exp $ */ +/* $NetBSD: md.c,v 1.13 2003/07/25 08:26:33 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -58,24 +58,24 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; if (strncmp(diskdev, "wd", 2) == 0) disktype = "ST506"; else disktype = "SCSI"; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/shark/md.h b/distrib/utils/sysinst/arch/shark/md.h index a87dc79a5105..302743f838d7 100644 --- a/distrib/utils/sysinst/arch/shark/md.h +++ b/distrib/utils/sysinst/arch/shark/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.8 2003/06/14 12:58:50 dsl Exp $ */ +/* $NetBSD: md.h,v 1.9 2003/07/25 08:26:33 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -66,7 +66,7 @@ * Default fileystem type for floppy disks. * On shark, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); /* * prototypes for MD code. diff --git a/distrib/utils/sysinst/arch/sparc/md.c b/distrib/utils/sysinst/arch/sparc/md.c index 7daed9974200..e3de4b473c6c 100644 --- a/distrib/utils/sysinst/arch/sparc/md.c +++ b/distrib/utils/sysinst/arch/sparc/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.36 2003/06/13 11:57:35 dsl Exp $ */ +/* $NetBSD: md.c,v 1.37 2003/07/25 08:26:33 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -63,24 +63,24 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf(devname, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); + snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/sparc/md.h b/distrib/utils/sysinst/arch/sparc/md.h index 59d4cf37cb0d..337dd7800dab 100644 --- a/distrib/utils/sysinst/arch/sparc/md.h +++ b/distrib/utils/sysinst/arch/sparc/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.18 2003/06/14 12:58:51 dsl Exp $ */ +/* $NetBSD: md.h,v 1.19 2003/07/25 08:26:34 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -79,4 +79,4 @@ /* * Default file system type for floppies. */ -EXTERN char *fdtype INIT("ffs"); +EXTERN const char *fdtype INIT("ffs"); diff --git a/distrib/utils/sysinst/arch/sparc64/md.c b/distrib/utils/sysinst/arch/sparc64/md.c index 7cc4785c4d62..b413762b1fae 100644 --- a/distrib/utils/sysinst/arch/sparc64/md.c +++ b/distrib/utils/sysinst/arch/sparc64/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.12 2003/06/13 11:57:35 dsl Exp $ */ +/* $NetBSD: md.c,v 1.13 2003/07/25 08:26:34 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -61,24 +61,24 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/sparc64/md.h b/distrib/utils/sysinst/arch/sparc64/md.h index 7c67ff50e3f8..1bfa30488311 100644 --- a/distrib/utils/sysinst/arch/sparc64/md.h +++ b/distrib/utils/sysinst/arch/sparc64/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.9 2003/06/13 11:57:36 dsl Exp $ */ +/* $NetBSD: md.h,v 1.10 2003/07/25 08:26:34 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -72,4 +72,4 @@ /* * Default file system type for floppies. */ -EXTERN char *fdtype INIT("ffs"); +EXTERN const char *fdtype INIT("ffs"); diff --git a/distrib/utils/sysinst/arch/vax/md.c b/distrib/utils/sysinst/arch/vax/md.c index cf8e98141870..b877227fa122 100644 --- a/distrib/utils/sysinst/arch/vax/md.c +++ b/distrib/utils/sysinst/arch/vax/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.22 2003/06/13 11:57:36 dsl Exp $ */ +/* $NetBSD: md.c,v 1.23 2003/07/25 08:26:34 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -61,24 +61,24 @@ md_get_info(void) { struct disklabel disklabel; int fd; - char devname[100]; + char dev_name[100]; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/vax/md.h b/distrib/utils/sysinst/arch/vax/md.h index f01a11926103..d7a3cd797d87 100644 --- a/distrib/utils/sysinst/arch/vax/md.h +++ b/distrib/utils/sysinst/arch/vax/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.15 2003/06/14 12:58:51 dsl Exp $ */ +/* $NetBSD: md.h,v 1.16 2003/07/25 08:26:34 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -77,5 +77,5 @@ /* * Default file system type for floppies. */ -EXTERN char *fdtype INIT("ffs"); +EXTERN const char *fdtype INIT("ffs"); diff --git a/distrib/utils/sysinst/arch/x68k/md.c b/distrib/utils/sysinst/arch/x68k/md.c index 9c0394af7b90..e5d55d8df21b 100644 --- a/distrib/utils/sysinst/arch/x68k/md.c +++ b/distrib/utils/sysinst/arch/x68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.24 2003/06/16 10:42:51 dsl Exp $ */ +/* $NetBSD: md.c,v 1.25 2003/07/25 08:26:34 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -73,25 +73,25 @@ md_get_info(void) { char buf[1024]; int fd; - char devname[100]; + char dev_name[100]; struct disklabel disklabel; - snprintf(devname, 100, "/dev/r%sc", diskdev); + snprintf(dev_name, 100, "/dev/r%sc", diskdev); - fd = open(devname, O_RDONLY, 0); + fd = open(dev_name, O_RDONLY, 0); if (fd < 0) { if (logging) - (void)fprintf(logfp, "Can't open %s\n", devname); + (void)fprintf(logfp, "Can't open %s\n", dev_name); endwin(); - fprintf(stderr, "Can't open %s\n", devname); + fprintf(stderr, "Can't open %s\n", dev_name); exit(1); } if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) { if (logging) (void)fprintf(logfp, "Can't read disklabel on %s.\n", - devname); + dev_name); endwin(); - fprintf(stderr, "Can't read disklabel on %s.\n", devname); + fprintf(stderr, "Can't read disklabel on %s.\n", dev_name); close(fd); exit(1); } @@ -111,7 +111,7 @@ md_get_info(void) if (read(fd, buf, 1024) < 0) { endwin(); - fprintf(stderr, "Can't read %s\n", devname); + fprintf(stderr, "Can't read %s\n", dev_name); close(fd); exit(1); } @@ -121,7 +121,7 @@ md_get_info(void) else if (read(fd, md_disklabel, sizeof(md_disklabel)) < 0) { endwin(); - fprintf(stderr, "Can't read %s\n", devname); + fprintf(stderr, "Can't read %s\n", dev_name); close(fd); exit(1); } diff --git a/distrib/utils/sysinst/arch/x68k/md.h b/distrib/utils/sysinst/arch/x68k/md.h index 83b0d39b02fd..2b4b55591d0c 100644 --- a/distrib/utils/sysinst/arch/x68k/md.h +++ b/distrib/utils/sysinst/arch/x68k/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.12 2003/06/13 11:57:37 dsl Exp $ */ +/* $NetBSD: md.h,v 1.13 2003/07/25 08:26:35 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -96,4 +96,4 @@ * Default fileystem type for floppy disks. * On x68k, that is msdos. */ -EXTERN char *fdtype INIT("msdos"); +EXTERN const char *fdtype INIT("msdos"); diff --git a/distrib/utils/sysinst/bsddisklabel.c b/distrib/utils/sysinst/bsddisklabel.c index a4cf8af1ef82..e3934fd6a80c 100644 --- a/distrib/utils/sysinst/bsddisklabel.c +++ b/distrib/utils/sysinst/bsddisklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.19 2003/07/07 12:30:19 dsl Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.20 2003/07/25 08:26:21 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -342,7 +342,7 @@ set_ptn_size(menudesc *m, menu_ent *opt, void *arg) } static void -get_ptn_sizes(int layoutkind, int part_start, int sectors) +get_ptn_sizes(int layout_kind, int part_start, int sectors) { int i; int maxpart = getmaxpartitions(); diff --git a/distrib/utils/sysinst/defs.h b/distrib/utils/sysinst/defs.h index bb25f9e5f100..1e10bc2cec14 100644 --- a/distrib/utils/sysinst/defs.h +++ b/distrib/utils/sysinst/defs.h @@ -1,4 +1,4 @@ -/* $NetBSD: defs.h,v 1.98 2003/07/19 22:07:36 abs Exp $ */ +/* $NetBSD: defs.h,v 1.99 2003/07/25 08:26:21 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -127,7 +127,7 @@ extern const char * const fstypenames[]; /* Types */ typedef struct distinfo { - char *name; + const char *name; int set; const char *desc; } distinfo; @@ -178,7 +178,7 @@ EXTERN unsigned int rammb INIT(0); /* Actual name of the disk. */ EXTERN char diskdev[SSTRSIZE] INIT(""); EXTERN int rootpart; /* partition we install into */ -EXTERN char *disktype INIT("unknown"); /* ST506, SCSI, ... */ +EXTERN const char *disktype INIT("unknown"); /* ST506, SCSI, ... */ /* Area of disk we can allocate, start and size in disk sectors. */ EXTERN int ptstart, ptsize; @@ -198,7 +198,7 @@ EXTERN int tmp_mfs_size INIT(0); #define DISKNAME_SIZE 80 EXTERN char bsddiskname[DISKNAME_SIZE]; -EXTERN char *doessf INIT(""); +EXTERN const char *doessf INIT(""); /* other vars for menu communication */ EXTERN int nodist; @@ -352,7 +352,7 @@ int get_via_floppy(void); int get_via_cdrom(void); int get_via_localfs(void); int get_via_localdir(void); -void cd_dist_dir(char *); +void cd_dist_dir(const char *); void show_cur_distsets(void); void make_ramdisk_dir(const char *); void ask_verbose_dist(void); @@ -386,7 +386,7 @@ int target_chdir(const char *); void target_chdir_or_die(const char *); int target_already_root(void); FILE *target_fopen(const char *, const char *); -int target_collect_file(int, char **, char *); +int target_collect_file(int, char **, const char *); int is_active_rootpart(const char *); int cp_to_target(const char *, const char *); void dup_file_into_target(const char *); diff --git a/distrib/utils/sysinst/disks.c b/distrib/utils/sysinst/disks.c index 8bde8147f479..d71fcf6d9079 100644 --- a/distrib/utils/sysinst/disks.c +++ b/distrib/utils/sysinst/disks.c @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.64 2003/07/11 15:28:58 dsl Exp $ */ +/* $NetBSD: disks.c,v 1.65 2003/07/25 08:26:21 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -93,12 +93,12 @@ static int target_mount_with_error_menu(const char *, char *, const char *); #define DISK_NAMES "wd", "sd", "ld" #endif -static char *disk_names[] = { DISK_NAMES, "vnd", NULL }; +static const char *disk_names[] = { DISK_NAMES, "vnd", NULL }; static int get_disks(struct disk_desc *dd) { - char **xd; + const char **xd; char d_name[SSTRSIZE]; struct disklabel l; int i; @@ -273,8 +273,8 @@ write_disklabel (void) static int ptn_sort(const void *a, const void *b) { - return strcmp(bsdlabel[*(int *)a].pi_mount, - bsdlabel[*(int *)b].pi_mount); + return strcmp(bsdlabel[*(const int *)a].pi_mount, + bsdlabel[*(const int *)b].pi_mount); } int @@ -485,7 +485,7 @@ static int do_fsck(const char *diskpart) { char rraw[SSTRSIZE]; - char *prog = "/sbin/fsck"; + const char *prog = "/sbin/fsck"; int err; /* cons up raw partition name. */ @@ -640,7 +640,7 @@ fsck_disks(void) } int -set_swap(const char *dev, partinfo *pp) +set_swap(const char *disk, partinfo *pp) { int i; char *cp; @@ -652,7 +652,7 @@ set_swap(const char *dev, partinfo *pp) for (i = 0; i < MAXPARTITIONS; i++) { if (pp[i].pi_fstype != FS_SWAP) continue; - asprintf(&cp, "/dev/%s%c", dev, 'a' + i); + asprintf(&cp, "/dev/%s%c", disk, 'a' + i); rval = swapctl(SWAP_ON, cp, 0); free(cp); if (rval != 0) @@ -663,7 +663,7 @@ set_swap(const char *dev, partinfo *pp) } int -check_swap(const char *dev, int remove) +check_swap(const char *disk, int remove_swap) { struct swapent *swap; char *cp; @@ -683,20 +683,20 @@ check_swap(const char *dev, int remove) if (nswap < 0) goto bad_swap; - l = strlen(dev); + l = strlen(disk); while (--nswap >= 0) { /* Should we check the se_dev or se_path? */ cp = swap[nswap].se_path; if (memcmp(cp, "/dev/", 5) != 0) continue; - if (memcmp(cp + 5, dev, l) != 0) + if (memcmp(cp + 5, disk, l) != 0) continue; if (!isalpha(*(unsigned char *)(cp + 5 + l))) continue; if (cp[5 + l + 1] != 0) continue; /* ok path looks like it is for this device */ - if (!remove) { + if (!remove_swap) { /* count active swap areas */ rval++; continue; diff --git a/distrib/utils/sysinst/install.c b/distrib/utils/sysinst/install.c index 3edc82bd7b96..f05ceb835ed7 100644 --- a/distrib/utils/sysinst/install.c +++ b/distrib/utils/sysinst/install.c @@ -1,4 +1,4 @@ -/* $NetBSD: install.c,v 1.36 2003/06/27 22:20:15 dsl Exp $ */ +/* $NetBSD: install.c,v 1.37 2003/07/25 08:26:21 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -75,7 +75,8 @@ do_install(void) /* if we need the user to mount root, ask them to. */ if (must_mount_root()) { - msg_display(MSG_pleasemountroot, diskdev, diskdev, diskdev, diskdev); + msg_display(MSG_pleasemountroot, + diskdev, diskdev, diskdev, diskdev); process_menu(MENU_ok, NULL); return; } diff --git a/distrib/utils/sysinst/label.c b/distrib/utils/sysinst/label.c index 8e49a88155cb..d219c1f48f8a 100644 --- a/distrib/utils/sysinst/label.c +++ b/distrib/utils/sysinst/label.c @@ -1,4 +1,4 @@ -/* $NetBSD: label.c,v 1.35 2003/07/08 17:38:56 dsl Exp $ */ +/* $NetBSD: label.c,v 1.36 2003/07/25 08:26:21 dsl Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -36,7 +36,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: label.c,v 1.35 2003/07/08 17:38:56 dsl Exp $"); +__RCSID("$NetBSD: label.c,v 1.36 2003/07/25 08:26:21 dsl Exp $"); #endif #include @@ -607,7 +607,7 @@ get_last_mounted(int fd, int partstart) const static int sblocks[] = SBLOCKSEARCH; const int *sbp; char *cp; - char *mnt = ""; + const char *mnt = ""; int l; if (fd == -1) diff --git a/distrib/utils/sysinst/mbr.c b/distrib/utils/sysinst/mbr.c index 379529d26a9e..92e589c9411a 100644 --- a/distrib/utils/sysinst/mbr.c +++ b/distrib/utils/sysinst/mbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.c,v 1.48 2003/07/14 09:59:00 dsl Exp $ */ +/* $NetBSD: mbr.c,v 1.49 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -85,7 +85,7 @@ struct part_id { int id; - char *name; + const char *name; } part_ids[] = { {0, "unused"}, {MBR_PTYPE_NETBSD, "NetBSD"}, @@ -181,7 +181,7 @@ remove_old_partitions(uint start, int size) } static int -find_mbr_space(mbr_sector_t *mbr, uint *start, uint *size, int from, int ignore) +find_mbr_space(mbr_sector_t *mbrs, uint *start, uint *size, int from, int ignore) { int sz; int i; @@ -192,8 +192,8 @@ find_mbr_space(mbr_sector_t *mbr, uint *start, uint *size, int from, int ignore) for (i = 0; i < NMBRPART; i++) { if (i == ignore) continue; - s = mbr->mbr_parts[i].mbrp_start; - e = s + mbr->mbr_parts[i].mbrp_size; + s = mbrs->mbr_parts[i].mbrp_start; + e = s + mbrs->mbr_parts[i].mbrp_size; if (s <= from && e > from) { from = e; goto check_again; @@ -1078,7 +1078,7 @@ set_mbr_header(menudesc *m, void *arg) int edit_mbr(mbr_info_t *mbri) { - mbr_sector_t *mbr = &mbri->mbr; + mbr_sector_t *mbrs = &mbri->mbr; mbr_info_t *ext; struct mbr_partition *part; int i, j; @@ -1091,7 +1091,7 @@ edit_mbr(mbr_info_t *mbri) /* Ask full/part */ - part = &mbr->mbr_parts[0]; + part = &mbrs->mbr_parts[0]; msg_display(MSG_fullpart, diskdev); process_menu(MENU_fullpart, &usefull); @@ -1209,7 +1209,7 @@ edit_mbr(mbr_info_t *mbri) return 1; } -char * +const char * get_partname(int typ) { int j; @@ -1227,7 +1227,7 @@ int read_mbr(const char *disk, mbr_info_t *mbri) { struct mbr_partition *mbrp; - mbr_sector_t *mbr = &mbri->mbr; + mbr_sector_t *mbrs = &mbri->mbr; mbr_info_t *ext = NULL; char diskpath[MAXPATHLEN]; int fd, i; @@ -1246,14 +1246,14 @@ read_mbr(const char *disk, mbr_info_t *mbri) goto bad_mbr; for (;;) { - if (pread(fd, mbr, sizeof *mbr, - (ext_base + next_ext) * (off_t)MBR_SECSIZE) < sizeof *mbr) + if (pread(fd, mbrs, sizeof *mbrs, + (ext_base + next_ext) * (off_t)MBR_SECSIZE) < sizeof *mbrs) break; - if (!valid_mbr(mbr)) + if (!valid_mbr(mbrs)) break; - mbrp = &mbr->mbr_parts[0]; + mbrp = &mbrs->mbr_parts[0]; if (ext_base != 0) { /* sanity check extended chain */ if (MBR_IS_EXTENDED(mbrp[0].mbrp_typ)) @@ -1271,14 +1271,14 @@ read_mbr(const char *disk, mbr_info_t *mbri) } #if BOOTSEL else { - if (mbr->mbr_bootsel.mbrb_magic == htole16(MBR_MAGIC)) - bootkey = mbr->mbr_bootsel.mbrb_defkey; + if (mbrs->mbr_bootsel.mbrb_magic == htole16(MBR_MAGIC)) + bootkey = mbrs->mbr_bootsel.mbrb_defkey; else bootkey = 0; bootkey -= SCAN_1; } - if (mbr->mbr_bootsel.mbrb_magic == htole16(MBR_MAGIC)) - memcpy(mbri->nametab, mbr->mbr_bootsel.mbrb_nametab, + if (mbrs->mbr_bootsel.mbrb_magic == htole16(MBR_MAGIC)) + memcpy(mbri->nametab, mbrs->mbr_bootsel.mbrb_nametab, sizeof mbri->nametab); #endif mbri->sector = next_ext + ext_base; @@ -1349,7 +1349,7 @@ read_mbr(const char *disk, mbr_info_t *mbri) ext = malloc(sizeof *ext); if (!ext) break; - mbr = &ext->mbr; + mbrs = &ext->mbr; } bad_mbr: @@ -1357,8 +1357,8 @@ read_mbr(const char *disk, mbr_info_t *mbri) if (fd >= 0) close(fd); if (rval == -1) { - memset(&mbr->mbr_parts, 0, sizeof mbr->mbr_parts); - mbr->mbr_signature = htole16(MBR_MAGIC); + memset(&mbrs->mbr_parts, 0, sizeof mbrs->mbr_parts); + mbrs->mbr_signature = htole16(MBR_MAGIC); } return rval; } @@ -1370,7 +1370,7 @@ write_mbr(const char *disk, mbr_info_t *mbri, int convert) int fd, i, ret = 0; struct mbr_partition *mbrp; u_int32_t pstart, psize; - mbr_sector_t *mbr; + mbr_sector_t *mbrs; mbr_info_t *ext; #ifdef BOOTSEL int netbsd_bootcode; @@ -1389,15 +1389,15 @@ write_mbr(const char *disk, mbr_info_t *mbri, int convert) return -1; for (ext = mbri; ext != NULL; ext = ext->extended) { - mbr = &ext->mbr; + mbrs = &ext->mbr; #ifdef BOOTSEL if (netbsd_bootcode) { - mbr->mbr_bootsel.mbrb_magic = htole16(MBR_MAGIC); - memcpy(&mbr->mbr_bootsel.mbrb_nametab, &ext->nametab, - sizeof mbr->mbr_bootsel.mbrb_nametab); + mbrs->mbr_bootsel.mbrb_magic = htole16(MBR_MAGIC); + memcpy(&mbrs->mbr_bootsel.mbrb_nametab, &ext->nametab, + sizeof mbrs->mbr_bootsel.mbrb_nametab); } #endif - mbrp = &mbr->mbr_parts[0]; + mbrp = &mbrs->mbr_parts[0]; for (i = 0; i < NMBRPART; i++) { if (mbrp[i].mbrp_start == 0 && mbrp[i].mbrp_size == 0) { mbrp[i].mbrp_scyl = 0; @@ -1429,12 +1429,12 @@ write_mbr(const char *disk, mbr_info_t *mbri, int convert) #endif } - mbr->mbr_signature = htole16(MBR_MAGIC); + mbrs->mbr_signature = htole16(MBR_MAGIC); /* * Sector zero is written outside the loop after we have * set mbrb_defkey. */ - if (ext->sector != 0 && pwrite(fd, mbr, sizeof *mbr, + if (ext->sector != 0 && pwrite(fd, mbrs, sizeof *mbrs, ext->sector * (off_t)MBR_SECSIZE) < 0) ret = -1; } @@ -1447,10 +1447,10 @@ write_mbr(const char *disk, mbr_info_t *mbri, int convert) } int -valid_mbr(mbr_sector_t *mbr) +valid_mbr(mbr_sector_t *mbrs) { - return (le16toh(mbr->mbr_signature) == MBR_MAGIC); + return (le16toh(mbrs->mbr_signature) == MBR_MAGIC); } static void @@ -1494,8 +1494,8 @@ convert_mbr_chs(int cyl, int head, int sec, int guess_biosgeom_from_mbr(mbr_info_t *mbri, int *cyl, int *head, int *sec) { - mbr_sector_t *mbr = &mbri->mbr; - struct mbr_partition *parts = &mbr->mbr_parts[0]; + mbr_sector_t *mbrs = &mbri->mbr; + struct mbr_partition *parts = &mbrs->mbr_parts[0]; int xcylinders, xheads, xsectors, i, j; int c1, h1, s1, c2, h2, s2; unsigned long a1, a2; diff --git a/distrib/utils/sysinst/mbr.h b/distrib/utils/sysinst/mbr.h index a2d188e8e1a3..a6f1bd2288ee 100644 --- a/distrib/utils/sysinst/mbr.h +++ b/distrib/utils/sysinst/mbr.h @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.h,v 1.16 2003/07/07 12:30:20 dsl Exp $ */ +/* $NetBSD: mbr.h,v 1.17 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997, 1988 Piermont Information Systems Inc. @@ -104,7 +104,7 @@ int md_bios_info(char *); void set_bios_geom(int, int, int); int otherpart(int); int ourpart(int); -char *get_partname(int); +const char *get_partname(int); void edit_ptn_bounds(void); #ifdef BOOTSEL void disp_bootsel(void); diff --git a/distrib/utils/sysinst/menus.mi b/distrib/utils/sysinst/menus.mi index ea8c3d264173..fa3d1162af07 100644 --- a/distrib/utils/sysinst/menus.mi +++ b/distrib/utils/sysinst/menus.mi @@ -1,4 +1,4 @@ -/* $NetBSD: menus.mi,v 1.8 2003/07/18 10:29:36 dsl Exp $ */ +/* $NetBSD: menus.mi,v 1.9 2003/07/25 08:26:22 dsl Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -274,7 +274,7 @@ menu localdirsource, title MSG_Change; menu localdirbad, title MSG_What_do_you_want_to_do; display action { msg_display(MSG_localdir, localfs_dir); - msg_display_add(arg, localfs_dir); }; + msg_display_add(*(msg *)arg, localfs_dir); }; option MSG_Change_directory_path, exit, action { yesno = 1; msg_prompt_win(MSG_dir, -1, 12, 0, 0, NULL, localfs_dir, 60); }; diff --git a/distrib/utils/sysinst/net.c b/distrib/utils/sysinst/net.c index 6a2d1474b547..0a30f0f120f4 100644 --- a/distrib/utils/sysinst/net.c +++ b/distrib/utils/sysinst/net.c @@ -1,4 +1,4 @@ -/* $NetBSD: net.c,v 1.90 2003/07/22 11:45:16 dsl Exp $ */ +/* $NetBSD: net.c,v 1.91 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -99,8 +99,8 @@ static void write_etc_hosts(FILE *f); #define DHCLIENT_EX "/sbin/dhclient" #include static int config_dhcp(char *); -static void get_command_out(char *, int, char *, char *); -static void get_dhcp_value(char *, char *); +static void get_command_out(char *, int, const char *, const char *); +static void get_dhcp_value(char *, const char *); #ifdef INET6 static int is_v6kernel (void); @@ -1047,11 +1047,11 @@ config_dhcp(char *inter) } static void -get_command_out(char *targ, int af, char *command, char *search) +get_command_out(char *targ, int af, const char *command, const char *search) { int textsize; char *textbuf; - char *t; + const char *t; #ifndef INET6 struct in_addr in; #else @@ -1083,7 +1083,7 @@ get_command_out(char *targ, int af, char *command, char *search) } static void -get_dhcp_value(char *targ, char *line) +get_dhcp_value(char *targ, const char *line) { int textsize; char *textbuf; diff --git a/distrib/utils/sysinst/run.c b/distrib/utils/sysinst/run.c index 030d2aa95cd4..2a333e437671 100644 --- a/distrib/utils/sysinst/run.c +++ b/distrib/utils/sysinst/run.c @@ -1,4 +1,4 @@ -/* $NetBSD: run.c,v 1.45 2003/07/18 09:34:42 dsl Exp $ */ +/* $NetBSD: run.c,v 1.46 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -417,7 +417,7 @@ launch_subwin(WINDOW *actionwin, char **args, struct winsize *win, int flags, for (selectfailed = 0;;) { if (selectfailed) { - char *mmsg = "select(2) failed but no child died?"; + const char *mmsg = "select(2) failed but no child died?"; if(logging) (void)fprintf(logfp, mmsg); errx(1, mmsg); diff --git a/distrib/utils/sysinst/target.c b/distrib/utils/sysinst/target.c index 1a8b41a15374..e3ad32cf73de 100644 --- a/distrib/utils/sysinst/target.c +++ b/distrib/utils/sysinst/target.c @@ -1,4 +1,4 @@ -/* $NetBSD: target.c,v 1.38 2003/07/08 17:38:58 dsl Exp $ */ +/* $NetBSD: target.c,v 1.39 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -75,7 +75,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: target.c,v 1.38 2003/07/08 17:38:58 dsl Exp $"); +__RCSID("$NetBSD: target.c,v 1.39 2003/07/25 08:26:22 dsl Exp $"); #endif /* @@ -687,7 +687,7 @@ target_mount(const char *fstype, const char *from, const char *on) } int -target_collect_file(int kind, char **buffer, char *name) +target_collect_file(int kind, char **buffer, const char *name) { const char *realname = target_expand(name); @@ -787,6 +787,7 @@ target_realpath(const char *path, char *resolved) struct stat sb; int fd, n, rootd, serrno, nlnk = 0; char *p, *q, wbuf[MAXPATHLEN]; + char solidus[] = "/", empty[] = ""; /* Save the starting point. */ if ((fd = open(".", O_RDONLY)) < 0) { @@ -813,7 +814,7 @@ loop: if (q != NULL) { p = q + 1; if (q == resolved) - q = "/"; + q = solidus; else { do { --q; @@ -847,7 +848,7 @@ loop: if (S_ISDIR(sb.st_mode)) { if (chdir(p) < 0) goto err1; - p = ""; + p = empty; } } diff --git a/distrib/utils/sysinst/txtwalk.c b/distrib/utils/sysinst/txtwalk.c index 3ae836fb594c..f8afc5162735 100644 --- a/distrib/utils/sysinst/txtwalk.c +++ b/distrib/utils/sysinst/txtwalk.c @@ -1,4 +1,4 @@ -/* $NetBSD: txtwalk.c,v 1.8 2003/06/16 19:42:14 dsl Exp $ */ +/* $NetBSD: txtwalk.c,v 1.9 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -122,7 +122,7 @@ process(struct lookfor *item, char *line) { struct data found[MAXDATA]; size_t numfound = 0; - char *p; + const char *p; size_t i, j; if (finddata(item, line, found, &numfound)) { @@ -191,7 +191,7 @@ process(struct lookfor *item, char *line) static int finddata(struct lookfor *item, char *line, struct data *found, size_t *numfound) { - char *fmt = item->fmt; + const char *fmt = item->fmt; size_t len; *numfound = 0; diff --git a/distrib/utils/sysinst/txtwalk.h b/distrib/utils/sysinst/txtwalk.h index 4570534d0ebb..e78c57fbf205 100644 --- a/distrib/utils/sysinst/txtwalk.h +++ b/distrib/utils/sysinst/txtwalk.h @@ -1,4 +1,4 @@ -/* $NetBSD: txtwalk.h,v 1.7 2003/01/10 20:00:28 christos Exp $ */ +/* $NetBSD: txtwalk.h,v 1.8 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -51,9 +51,9 @@ struct data { /* Strings of interest! */ struct lookfor { - char *head; /* Line starts this way. */ - char *fmt; /* Expected format. */ - char *todo; /* What to do ... */ + const char *head; /* Line starts this way. */ + const char *fmt; /* Expected format. */ + const char *todo; /* What to do ... */ void *var; /* Possible var */ size_t nument; /* Number of entries in the "array" */ size_t size; /* size of string variables */ diff --git a/distrib/utils/sysinst/upgrade.c b/distrib/utils/sysinst/upgrade.c index 86635498a5cc..3ffbfe760c9c 100644 --- a/distrib/utils/sysinst/upgrade.c +++ b/distrib/utils/sysinst/upgrade.c @@ -1,4 +1,4 @@ -/* $NetBSD: upgrade.c,v 1.39 2003/07/22 12:18:39 dsl Exp $ */ +/* $NetBSD: upgrade.c,v 1.40 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -80,7 +80,8 @@ do_upgrade(void) /* if we need the user to mount root, ask them to. */ if (must_mount_root()) { - msg_display(MSG_pleasemountroot, diskdev, diskdev, diskdev, diskdev); + msg_display(MSG_pleasemountroot, + diskdev, diskdev, diskdev, diskdev); process_menu(MENU_ok, NULL); return; } @@ -287,7 +288,8 @@ do_reinstall_sets(void) /* if we need the user to mount root, ask them to. */ if (must_mount_root()) { - msg_display(MSG_pleasemountroot, diskdev, diskdev, diskdev, diskdev); + msg_display(MSG_pleasemountroot, + diskdev, diskdev, diskdev, diskdev); process_menu(MENU_ok, NULL); return; } diff --git a/distrib/utils/sysinst/util.c b/distrib/utils/sysinst/util.c index 8b825d939ece..ed106d83f1e5 100644 --- a/distrib/utils/sysinst/util.c +++ b/distrib/utils/sysinst/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.106 2003/07/22 08:30:11 dsl Exp $ */ +/* $NetBSD: util.c,v 1.107 2003/07/25 08:26:22 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -267,7 +267,7 @@ get_via_floppy(void) first = 1; while (!mounted || stat(full_name, &sb)) { if (mounted) - run_prog(0, NULL, "/sbin/umount /mnt2"); + run_prog(0, NULL, "/sbin/umount /mnt2"); if (first) msg_display(MSG_fdmount, fname); else @@ -415,27 +415,19 @@ again: int get_via_localdir(void) { + msg errmsg; /* Get device, filesystem, and filepath */ process_menu(MENU_localdirsource, NULL); -again: - /* Complain if not a directory */ - if (dir_exists_p(localfs_dir) == 0) { - process_menu(MENU_localdirbad, (void *)MSG_badlocalsetdir); + /* Complain if not a directory or distribution files absent */ + while ((dir_exists_p(localfs_dir) == 0 && (errmsg = MSG_badlocalsetdir)) || + (distribution_sets_exist_p(localfs_dir) == 0 && (errmsg = MSG_badsetdir))) { + process_menu(MENU_localdirbad, &errmsg); if (!yesno) return (0); - if (!ignorerror) - goto again; - } - - /* Verify distribution files exist. */ - if (distribution_sets_exist_p(localfs_dir) == 0) { - process_menu(MENU_localdirbad, (void *)MSG_badsetdir); - if (!yesno) - return (0); - if (!ignorerror) - goto again; + if (ignorerror) + break; } /* return location, don't clean... */ @@ -447,7 +439,7 @@ again: void -cd_dist_dir(char *forwhat) +cd_dist_dir(const char *forwhat) { /* ask user for the mountpoint. */ @@ -1234,7 +1226,7 @@ timezone_sig(int sig) static int tz_sort(const void *a, const void *b) { - return strcmp(((menu_ent *)a)->opt_name, ((menu_ent *)b)->opt_name); + return strcmp(((const menu_ent *)a)->opt_name, ((const menu_ent *)b)->opt_name); } static void