Sprinkle some const

This commit is contained in:
martin 2005-06-03 22:17:18 +00:00
parent 14fb304246
commit 32c7c3a692
7 changed files with 38 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.32 2004/03/17 17:04:59 pk Exp $ */
/* $NetBSD: kd.c,v 1.33 2005/06/03 22:17:18 martin Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.32 2004/03/17 17:04:59 pk Exp $");
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.33 2005/06/03 22:17:18 martin Exp $");
#include "opt_kgdb.h"
#include "fb.h"
@ -644,9 +644,10 @@ prom_get_device_args(prop, args, sz)
char *args;
unsigned int sz;
{
char *cp, buffer[128];
const char *cp;
char buffer[128];
cp = prom_getpropstringA(findroot(), (char *)prop, buffer, sizeof buffer);
cp = prom_getpropstringA(findroot(), prop, buffer, sizeof buffer);
/*
* Extract device-specific arguments from a PROM device path (if any)

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.h,v 1.40 2005/05/31 00:54:05 christos Exp $ */
/* $NetBSD: autoconf.h,v 1.41 2005/06/03 22:17:18 martin Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -120,7 +120,7 @@ struct rom_range { /* Only used on v3 PROMs */
struct mainbus_attach_args {
bus_space_tag_t ma_bustag; /* parent bus tag */
bus_dma_tag_t ma_dmatag;
char *ma_name; /* PROM node name */
const char *ma_name; /* PROM node name */
int ma_node; /* PROM handle */
bus_addr_t ma_paddr; /* register physical address */
bus_size_t ma_size; /* register physical size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.93 2003/07/15 00:05:02 lukem Exp $ */
/* $NetBSD: clock.c,v 1.94 2005/06/03 22:17:18 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.93 2003/07/15 00:05:02 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.94 2005/06/03 22:17:18 martin Exp $");
#include "opt_sparc_arch.h"
@ -224,7 +224,8 @@ void
inittodr(base)
time_t base;
{
int badbase = 0, waszero = base == 0;
struct timeval tv;
int tv_valid = 0, badbase = 0, waszero = base == 0;
if (base < 5 * SECYR) {
/*
@ -238,8 +239,11 @@ inittodr(base)
badbase = 1;
}
if (todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
time.tv_sec == 0) {
if (todr_gettime(todr_handle, &tv) == 0 && tv.tv_sec != 0) {
tv_valid = 1;
time = tv;
}
if (!tv_valid) {
printf("WARNING: bad date in battery clock");
/*
@ -273,12 +277,14 @@ inittodr(base)
void
resettodr()
{
struct timeval tv;
if (time.tv_sec == 0)
return;
sparc_clock_time_is_ok = 1;
if (todr_settime(todr_handle, (struct timeval *)&time) != 0)
tv = time;
if (todr_settime(todr_handle, &tv) != 0)
printf("Cannot set time in time-of-day clock\n");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_disasm.c,v 1.15 2003/07/15 00:05:03 lukem Exp $ */
/* $NetBSD: db_disasm.c,v 1.16 2005/06/03 22:17:18 martin Exp $ */
/*
* Copyright (c) 1994 David S. Miller, davem@nadzieja.rutgers.edu
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.15 2003/07/15 00:05:03 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.16 2005/06/03 22:17:18 martin Exp $");
#include <sys/param.h>
#include <machine/db_machdep.h>
@ -111,18 +111,18 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.15 2003/07/15 00:05:03 lukem Exp $")
struct sparc_insn {
unsigned int match;
char* name;
char* format;
const char* name;
const char* format;
};
char* regs[] = {
const char* regs[] = {
"g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
"o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
"l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
"i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7"
};
char* priv_regs[] = {
const char* priv_regs[] = {
"tpc", "tnpc", "tstate", "tt", "tick", "tba", "pstate", "tl",
"pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin",
"wstate", "fq",
@ -130,18 +130,18 @@ char* priv_regs[] = {
"", "", "", "", "", "", "", "ver"
};
char* state_regs[] = {
const char* state_regs[] = {
"y", "", "ccr", "asi", "tick", "pc", "fprs", "asr",
"", "", "", "", "", "", "", "",
"pcr", "pic", "dcr", "gsr", "set_softint", "clr_softint", "softint", "tick_cmpr", "",
"", "", "", "", "", "", "", ""
};
char* ccodes[] = {
const char* ccodes[] = {
"fcc0", "fcc1", "fcc2", "fcc3", "icc", "", "xcc", ""
};
char* prefetch[] = {
const char* prefetch[] = {
"n_reads", "one_read", "n_writes", "one_write", "page"
};
@ -879,7 +879,7 @@ db_disasm(loc, altfmt)
unsigned int insn, you_lose, bitmask;
int matchp;
char* f_ptr, *cp;
const char* f_ptr, *cp;
you_lose = 0;
matchp = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: emul.c,v 1.9 2004/04/13 14:00:24 pk Exp $ */
/* $NetBSD: emul.c,v 1.10 2005/06/03 22:17:18 martin Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.9 2004/04/13 14:00:24 pk Exp $");
__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.10 2005/06/03 22:17:18 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -98,10 +98,9 @@ writegpreg(tf, i, val)
if (i == 0)
return error;
else if (i < 16)
GPR(tf, i) = *(int32_t *) val;
GPR(tf, i) = *(const int32_t *) val;
else
/* XXX: Fix copyout prototype */
error = copyout((caddr_t) val, &IPR(tf, i), sizeof(int32_t));
error = copyout(val, &IPR(tf, i), sizeof(int32_t));
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msiiepvar.h,v 1.3 2002/03/28 19:50:21 uwe Exp $ */
/* $NetBSD: msiiepvar.h,v 1.4 2005/06/03 22:17:18 martin Exp $ */
/*
* Copyright (c) 2001 Valeriy E. Ushakov
@ -31,7 +31,7 @@
#define _SPARC_MSIIEP_VAR_H_
struct msiiep_attach_args {
char *msa_name;
const char *msa_name;
struct mainbus_attach_args *msa_ma;
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.11 2005/06/01 13:01:36 scw Exp $ */
/* $NetBSD: process_machdep.c,v 1.12 2005/06/03 22:17:18 martin Exp $ */
/*
* Copyright (c) 1993 The Regents of the University of California.
@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.11 2005/06/01 13:01:36 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.12 2005/06/03 22:17:18 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -125,7 +125,7 @@ process_write_regs(p, regs)
const struct reg *regs;
{
int psr = p->l_md.md_tf->tf_psr & ~PSR_ICC;
bcopy((caddr_t)regs, p->l_md.md_tf, sizeof(struct reg));
bcopy(regs, p->l_md.md_tf, sizeof(struct reg));
p->l_md.md_tf->tf_psr = psr | (regs->r_psr & PSR_ICC);
return (0);
}