Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc Sprinkle some const



details:   https://anonhg.NetBSD.org/src/rev/1c249c9fe571
branches:  trunk
changeset: 581704:1c249c9fe571
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jun 03 22:17:18 2005 +0000

description:
Sprinkle some const

diffstat:

 sys/arch/sparc/dev/kd.c                |   9 +++++----
 sys/arch/sparc/include/autoconf.h      |   4 ++--
 sys/arch/sparc/sparc/clock.c           |  18 ++++++++++++------
 sys/arch/sparc/sparc/db_disasm.c       |  20 ++++++++++----------
 sys/arch/sparc/sparc/emul.c            |   9 ++++-----
 sys/arch/sparc/sparc/msiiepvar.h       |   4 ++--
 sys/arch/sparc/sparc/process_machdep.c |   6 +++---
 7 files changed, 38 insertions(+), 32 deletions(-)

diffs (255 lines):

diff -r ab26ed3d8690 -r 1c249c9fe571 sys/arch/sparc/dev/kd.c
--- a/sys/arch/sparc/dev/kd.c   Fri Jun 03 22:15:49 2005 +0000
+++ b/sys/arch/sparc/dev/kd.c   Fri Jun 03 22:17:18 2005 +0000
@@ -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 @@
        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)
diff -r ab26ed3d8690 -r 1c249c9fe571 sys/arch/sparc/include/autoconf.h
--- a/sys/arch/sparc/include/autoconf.h Fri Jun 03 22:15:49 2005 +0000
+++ b/sys/arch/sparc/include/autoconf.h Fri Jun 03 22:17:18 2005 +0000
@@ -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 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 */
diff -r ab26ed3d8690 -r 1c249c9fe571 sys/arch/sparc/sparc/clock.c
--- a/sys/arch/sparc/sparc/clock.c      Fri Jun 03 22:15:49 2005 +0000
+++ b/sys/arch/sparc/sparc/clock.c      Fri Jun 03 22:17:18 2005 +0000
@@ -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 @@
 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 @@
                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 @@
 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");
 }
 
diff -r ab26ed3d8690 -r 1c249c9fe571 sys/arch/sparc/sparc/db_disasm.c
--- a/sys/arch/sparc/sparc/db_disasm.c  Fri Jun 03 22:15:49 2005 +0000
+++ b/sys/arch/sparc/sparc/db_disasm.c  Fri Jun 03 22:17:18 2005 +0000
@@ -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@localhost
@@ -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 @@
 
 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 @@
        "", "", "", "", "", "", "", "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 @@
 
        unsigned int insn, you_lose, bitmask;
        int matchp;
-       char* f_ptr, *cp;
+       const char* f_ptr, *cp;
 
        you_lose = 0;
        matchp = 0;
diff -r ab26ed3d8690 -r 1c249c9fe571 sys/arch/sparc/sparc/emul.c
--- a/sys/arch/sparc/sparc/emul.c       Fri Jun 03 22:15:49 2005 +0000
+++ b/sys/arch/sparc/sparc/emul.c       Fri Jun 03 22:17:18 2005 +0000
@@ -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 @@
        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;
 }
diff -r ab26ed3d8690 -r 1c249c9fe571 sys/arch/sparc/sparc/msiiepvar.h
--- a/sys/arch/sparc/sparc/msiiepvar.h  Fri Jun 03 22:15:49 2005 +0000
+++ b/sys/arch/sparc/sparc/msiiepvar.h  Fri Jun 03 22:17:18 2005 +0000
@@ -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;
 };
 
diff -r ab26ed3d8690 -r 1c249c9fe571 sys/arch/sparc/sparc/process_machdep.c
--- a/sys/arch/sparc/sparc/process_machdep.c    Fri Jun 03 22:15:49 2005 +0000
+++ b/sys/arch/sparc/sparc/process_machdep.c    Fri Jun 03 22:17:18 2005 +0000
@@ -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 @@
        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);
 }



Home | Main Index | Thread Index | Old Index