summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-20 15:45:55 +0000
committerpfg <pfg@FreeBSD.org>2016-04-20 15:45:55 +0000
commit15369e2805f361b0ac3d32a98d1413add68c5b42 (patch)
treefb11ecd3a1afac76147418d282a50384f3e1427f /sys/sparc64
parentb09e37ef6cc1ad2e74a185000ee99cee5da7e798 (diff)
downloadFreeBSD-src-15369e2805f361b0ac3d32a98d1413add68c5b42.zip
FreeBSD-src-15369e2805f361b0ac3d32a98d1413add68c5b42.tar.gz
Use our nitems() macro when param.h is available.
Replacements specific to arm, mips, pc98, powerpc and sparc64. Discussed in: freebsd-current
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/sparc64/db_trace.c2
-rw-r--r--sys/sparc64/sparc64/elf_machdep.c3
-rw-r--r--sys/sparc64/sparc64/trap.c4
3 files changed, 4 insertions, 5 deletions
diff --git a/sys/sparc64/sparc64/db_trace.c b/sys/sparc64/sparc64/db_trace.c
index 5c1fae9..f18c301 100644
--- a/sys/sparc64/sparc64/db_trace.c
+++ b/sys/sparc64/sparc64/db_trace.c
@@ -74,7 +74,7 @@ struct db_variable db_regs[] = {
{ "tpc", DB_OFFSET(tf_tpc), db_frame },
{ "tstate", DB_OFFSET(tf_tstate), db_frame },
};
-struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
+struct db_variable *db_eregs = db_regs + nitems(db_regs);
static int
db_frame(struct db_variable *vp, db_expr_t *valuep, int op)
diff --git a/sys/sparc64/sparc64/elf_machdep.c b/sys/sparc64/sparc64/elf_machdep.c
index c2b0d26..90a7993 100644
--- a/sys/sparc64/sparc64/elf_machdep.c
+++ b/sys/sparc64/sparc64/elf_machdep.c
@@ -357,8 +357,7 @@ elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
return (0);
if (rtype == R_SPARC_JMP_SLOT || rtype == R_SPARC_COPY ||
- rtype >= sizeof(reloc_target_bitmask) /
- sizeof(*reloc_target_bitmask)) {
+ rtype >= nitems(reloc_target_bitmask)) {
printf("kldload: unexpected relocation type %ld\n", rtype);
return (-1);
}
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index 96e72ed..73719f2 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -215,8 +215,8 @@ static const int trap_sig[] = {
-1, /* kernel stack fault */
};
-CTASSERT(sizeof(trap_msg) / sizeof(*trap_msg) == T_MAX);
-CTASSERT(sizeof(trap_sig) / sizeof(*trap_sig) == T_MAX);
+CTASSERT(nitems(trap_msg) == T_MAX);
+CTASSERT(nitems(trap_sig) == T_MAX);
CTASSERT(sizeof(struct trapframe) == 256);
OpenPOWER on IntegriCloud