diff options
| author | he <he@NetBSD.org> | 2005-06-08 07:49:45 +0000 |
|---|---|---|
| committer | he <he@NetBSD.org> | 2005-06-08 07:49:45 +0000 |
| commit | 3ffd57432ba7faeff10dcef42dcdc9766ffd83aa (patch) | |
| tree | d428bdefebb71baa0ba9aa464882f3597abe62c5 /sys/dev/hpc | |
| parent | 50d7457a5f387c3b8d5f312fe71e8c18fdcda6fa (diff) | |
Add an __UNCONST() to appease -Wcast-qual.
XXX The way this is done is really wrong, as this function ends up
modifying read-only data marked with 'const'.
The reason we can get away with this is that apparently all the
ports using this code maps text and read-only data read-write.
Reviewed by christos, who suggested "a big XXX comment".
Diffstat (limited to 'sys/dev/hpc')
| -rw-r--r-- | sys/dev/hpc/hpckbd.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/hpc/hpckbd.c b/sys/dev/hpc/hpckbd.c index 16cc1309e6f..f63ee062d1c 100644 --- a/sys/dev/hpc/hpckbd.c +++ b/sys/dev/hpc/hpckbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: hpckbd.c,v 1.12 2005/02/27 00:26:59 perry Exp $ */ +/* $NetBSD: hpckbd.c,v 1.13 2005/06/08 07:49:45 he Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.12 2005/02/27 00:26:59 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.13 2005/06/08 07:49:45 he Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -268,7 +268,15 @@ hpckbd_keymap_setup(struct hpckbd_core *hc, const keysym_t *map, int mapsize) struct wscons_keydesc *desc; /* fix keydesc table */ - desc = (struct wscons_keydesc *)hpckbd_keymapdata.keydesc; + /* + * XXX The way this is done is really wrong. The __UNCONST() + * is a hint as to what is wrong. This actally ends up modifying + * initialized data which is marked "const". + * The reason we get away with it here is apparently that text + * and read-only data gets mapped read/write on the platforms + * using this code. + */ + desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc); for (i = 0; desc[i].name != 0; i++) { if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) { desc[i].map = map; |
