summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorrin <rin@NetBSD.org>2019-07-31 00:14:25 +0000
committerrin <rin@NetBSD.org>2019-07-31 00:14:25 +0000
commit183a0df25774dc918cf198283d391eb9aa1a64fb (patch)
tree4aa8d591146319202b58f2f61deec9e361d17174 /sys/dev
parent80065541cb678cf1ad37c5d62f379b97409bfbec (diff)
Misc clean-up's:
- protect private stuff in rasops.h by _RASOPS_PRIVATE - staticify rasops_copycols() and rasops_isgray[] - G/C unused extern int cold
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/rasops/rasops.c19
-rw-r--r--sys/dev/rasops/rasops.h63
-rw-r--r--sys/dev/rasops/rasops1.c6
-rw-r--r--sys/dev/rasops/rasops15.c6
-rw-r--r--sys/dev/rasops/rasops2.c6
-rw-r--r--sys/dev/rasops/rasops24.c6
-rw-r--r--sys/dev/rasops/rasops32.c6
-rw-r--r--sys/dev/rasops/rasops4.c6
-rw-r--r--sys/dev/rasops/rasops8.c6
9 files changed, 67 insertions, 57 deletions
diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c
index 7ff571bec03..3febe62a327 100644
--- a/sys/dev/rasops/rasops.c
+++ b/sys/dev/rasops/rasops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.101 2019/07/30 15:29:40 rin Exp $ */
+/* $NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.101 2019/07/30 15:29:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@@ -47,6 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.101 2019/07/30 15:29:40 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wsfont/wsfont.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
#ifndef _KERNEL
@@ -127,11 +129,9 @@ const uint8_t rasops_cmap[256 * 3] = {
};
/* True if color is gray */
-const uint8_t rasops_isgray[16] = {
- 1, 0, 0, 0,
- 0, 0, 0, 1,
- 1, 0, 0, 0,
- 0, 0, 0, 1,
+static const uint8_t rasops_isgray[16] = {
+ 1, 0, 0, 0, 0, 0, 0, 1,
+ 1, 0, 0, 0, 0, 0, 0, 1,
};
#ifdef RASOPS_APPLE_PALETTE
@@ -181,6 +181,7 @@ static const uint8_t apple4_devcmap[16] = {
/* Generic functions */
static void rasops_copyrows(void *, int, int, int);
+static void rasops_copycols(void *, int, int, int, int);
static int rasops_mapchar(void *, int, u_int *);
static void rasops_cursor(void *, int, int, int);
static int rasops_allocattr_color(void *, int, int, int, long *);
@@ -223,8 +224,6 @@ void rasops_make_box_chars_16(struct rasops_info *);
void rasops_make_box_chars_32(struct rasops_info *);
void rasops_make_box_chars_alpha(struct rasops_info *);
-extern int cold;
-
/*
* Initialize a 'rasops_info' descriptor.
*/
@@ -725,7 +724,7 @@ rasops_copyrows(void *cookie, int src, int dst, int num)
* We simply cop-out here and use memmove(), since it handles all of
* these cases anyway.
*/
-void
+static void
rasops_copycols(void *cookie, int row, int src, int dst, int num)
{
struct rasops_info *ri = (struct rasops_info *)cookie;
diff --git a/sys/dev/rasops/rasops.h b/sys/dev/rasops/rasops.h
index 2655830eaa6..a4d9f3374c5 100644
--- a/sys/dev/rasops/rasops.h
+++ b/sys/dev/rasops/rasops.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.h,v 1.38 2019/07/29 08:13:50 rin Exp $ */
+/* $NetBSD: rasops.h,v 1.39 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -100,8 +100,7 @@ struct rasops_info {
* on depths other than 15, 16, 24 and 32 bits per pel. On
* 24 bit displays, ri_{r,g,b}num must be 8.
*/
- uint8_t ri_rnum;
- /* number of bits for red */
+ uint8_t ri_rnum; /* number of bits for red */
uint8_t ri_gnum; /* number of bits for green */
uint8_t ri_bnum; /* number of bits for blue */
uint8_t ri_rpos; /* which bit red starts at */
@@ -139,8 +138,6 @@ struct rasops_info {
#endif
};
-#define DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
-
#define CHAR_IN_FONT(c,font) \
((c) >= (font)->firstchar && \
((c) - (font)->firstchar) < (font)->numchars)
@@ -149,22 +146,6 @@ struct rasops_info {
(ri->ri_optfont.data != NULL)) ? \
&ri->ri_optfont : ri->ri_font
-#define FONT_GLYPH(uc, font, ri) \
- ((uint8_t *)(font)->data + ((uc) - ((font)->firstchar)) * \
- (ri)->ri_fontscale)
-
-static __inline uint32_t
-be32uatoh(uint8_t *p)
-{
- uint32_t u;
-
- u = p[0]; u <<= 8;
- u |= p[1]; u <<= 8;
- u |= p[2]; u <<= 8;
- u |= p[3];
- return u;
-}
-
/*
* rasops_init().
*
@@ -179,9 +160,19 @@ be32uatoh(uint8_t *p)
* to -1 (or a new, valid cookie).
*/
+/* rasops.c */
+int rasops_init(struct rasops_info *, int, int);
+int rasops_reconfig(struct rasops_info *, int, int);
+void rasops_unpack_attr(long, int *, int *, int *);
+void rasops_eraserows(void *, int, int, long);
+void rasops_erasecols(void *, int, int, int, long);
+int rasops_get_cmap(struct rasops_info *, uint8_t *, size_t);
+
+extern const uint8_t rasops_cmap[256 * 3];
+
+#ifdef _RASOPS_PRIVATE
/*
- * Per-depth initialization functions. These should not be called outside
- * the rasops code.
+ * Per-depth initialization functions.
*/
void rasops1_init(struct rasops_info *);
void rasops2_init(struct rasops_info *);
@@ -191,17 +182,23 @@ void rasops15_init(struct rasops_info *);
void rasops24_init(struct rasops_info *);
void rasops32_init(struct rasops_info *);
-/* rasops.c */
-int rasops_init(struct rasops_info *, int, int);
-int rasops_reconfig(struct rasops_info *, int, int);
-void rasops_unpack_attr(long, int *, int *, int *);
-void rasops_eraserows(void *, int, int, long);
-void rasops_erasecols(void *, int, int, int, long);
-void rasops_copycols(void *, int, int, int, int);
-int rasops_get_cmap(struct rasops_info *, uint8_t *, size_t);
+#define DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
+#define FONT_GLYPH(uc, font, ri) \
+ ((uint8_t *)(font)->data + ((uc) - ((font)->firstchar)) * \
+ (ri)->ri_fontscale)
-extern const uint8_t rasops_isgray[16];
-extern const uint8_t rasops_cmap[256*3];
+static __inline uint32_t
+be32uatoh(uint8_t *p)
+{
+ uint32_t u;
+
+ u = p[0]; u <<= 8;
+ u |= p[1]; u <<= 8;
+ u |= p[2]; u <<= 8;
+ u |= p[3];
+ return u;
+}
+#endif /* _RASOPS_PRIVATE */
#endif /* _RASOPS_H_ */
diff --git a/sys/dev/rasops/rasops1.c b/sys/dev/rasops/rasops1.c
index 913b0eed44a..dc3887c30b0 100644
--- a/sys/dev/rasops/rasops1.c
+++ b/sys/dev/rasops/rasops1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1.c,v 1.31 2019/07/30 15:29:40 rin Exp $ */
+/* $NetBSD: rasops1.c,v 1.32 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.31 2019/07/30 15:29:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.32 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.31 2019/07/30 15:29:40 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
#include <dev/rasops/rasops_masks.h>
diff --git a/sys/dev/rasops/rasops15.c b/sys/dev/rasops/rasops15.c
index b380dcaadcc..734305c7559 100644
--- a/sys/dev/rasops/rasops15.c
+++ b/sys/dev/rasops/rasops15.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops15.c,v 1.31 2019/07/29 10:55:56 rin Exp $ */
+/* $NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.31 2019/07/29 10:55:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
@@ -40,6 +40,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.31 2019/07/29 10:55:56 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
static void rasops15_putchar(void *, int, int, u_int, long);
diff --git a/sys/dev/rasops/rasops2.c b/sys/dev/rasops/rasops2.c
index 2b34ec172a5..7291a3cbf17 100644
--- a/sys/dev/rasops/rasops2.c
+++ b/sys/dev/rasops/rasops2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops2.c,v 1.26 2019/07/29 03:01:09 rin Exp $ */
+/* $NetBSD: rasops2.c,v 1.27 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.26 2019/07/29 03:01:09 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.27 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.26 2019/07/29 03:01:09 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
#include <dev/rasops/rasops_masks.h>
diff --git a/sys/dev/rasops/rasops24.c b/sys/dev/rasops/rasops24.c
index 554bcc114f6..595e823bcfc 100644
--- a/sys/dev/rasops/rasops24.c
+++ b/sys/dev/rasops/rasops24.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops24.c,v 1.39 2019/07/30 15:23:23 rin Exp $ */
+/* $NetBSD: rasops24.c,v 1.40 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.39 2019/07/30 15:23:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.40 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
@@ -43,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.39 2019/07/30 15:23:23 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
static void rasops24_erasecols(void *, int, int, int, long);
diff --git a/sys/dev/rasops/rasops32.c b/sys/dev/rasops/rasops32.c
index a8ef1e13015..e0963e1eff8 100644
--- a/sys/dev/rasops/rasops32.c
+++ b/sys/dev/rasops/rasops32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops32.c,v 1.39 2019/07/29 10:55:56 rin Exp $ */
+/* $NetBSD: rasops32.c,v 1.40 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.39 2019/07/29 10:55:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.40 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
@@ -40,6 +40,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.39 2019/07/29 10:55:56 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
static void rasops32_putchar(void *, int, int, u_int, long);
diff --git a/sys/dev/rasops/rasops4.c b/sys/dev/rasops/rasops4.c
index 73c89c3d92c..cbc950dccb9 100644
--- a/sys/dev/rasops/rasops4.c
+++ b/sys/dev/rasops/rasops4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops4.c,v 1.20 2019/07/29 03:01:09 rin Exp $ */
+/* $NetBSD: rasops4.c,v 1.21 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.20 2019/07/29 03:01:09 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.21 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.20 2019/07/29 03:01:09 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
#include <dev/rasops/rasops_masks.h>
diff --git a/sys/dev/rasops/rasops8.c b/sys/dev/rasops/rasops8.c
index 5fa7376327d..3de956cc109 100644
--- a/sys/dev/rasops/rasops8.c
+++ b/sys/dev/rasops/rasops8.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops8.c,v 1.44 2019/07/29 10:55:56 rin Exp $ */
+/* $NetBSD: rasops8.c,v 1.45 2019/07/31 00:14:25 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.44 2019/07/29 10:55:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.45 2019/07/31 00:14:25 rin Exp $");
#include "opt_rasops.h"
@@ -40,6 +40,8 @@ __KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.44 2019/07/29 10:55:56 rin Exp $");
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
+
+#define _RASOPS_PRIVATE
#include <dev/rasops/rasops.h>
static void rasops8_putchar(void *, int, int, u_int, long);