From 1fa9b845086ceeaa45ba0c1b3d4cfd7bfa426c47 Mon Sep 17 00:00:00 2001 From: joerg Date: Mon, 4 Jun 2012 19:06:45 +0000 Subject: [PATCH] Add cdbr(3) support to tools/compat. --- lib/libc/cdb/cdbr.c | 14 ++++++++++++-- tools/compat/Makefile | 4 ++-- tools/compat/cdbr.h | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 tools/compat/cdbr.h diff --git a/lib/libc/cdb/cdbr.c b/lib/libc/cdb/cdbr.c index a71ac42aedef..667c81899ad7 100644 --- a/lib/libc/cdb/cdbr.c +++ b/lib/libc/cdb/cdbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: cdbr.c,v 1.2 2010/06/03 12:40:52 veego Exp $ */ +/* $NetBSD: cdbr.c,v 1.3 2012/06/04 19:06:45 joerg Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. * All rights reserved. @@ -36,12 +36,17 @@ #endif #include -__RCSID("$NetBSD: cdbr.c,v 1.2 2010/06/03 12:40:52 veego Exp $"); +__RCSID("$NetBSD: cdbr.c,v 1.3 2012/06/04 19:06:45 joerg Exp $"); #include "namespace.h" +#if !HAVE_NBTOOL_CONFIG_H #include +#endif +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H #include +#endif + #include #include #include @@ -59,6 +64,11 @@ __weak_alias(cdbr_get,_cdbr_get) __weak_alias(cdbr_open,_cdbr_open) #endif +#if HAVE_NBTOOL_CONFIG_H +#define fast_divide32_prepare(d,m,s1,s2) (void)0 +#define fast_remainder32(v,d,m,s1,s2) (v%d) +#endif + struct cdbr { uint8_t *mmap_base; size_t mmap_size; diff --git a/tools/compat/Makefile b/tools/compat/Makefile index 5e4a43accf93..237fa98cf01a 100644 --- a/tools/compat/Makefile +++ b/tools/compat/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.58 2012/06/04 18:53:02 joerg Exp $ +# $NetBSD: Makefile,v 1.59 2012/06/04 19:06:45 joerg Exp $ HOSTLIB= nbcompat -SRCS= atoll.c basename.c cdbw.c dirname.c \ +SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \ fgetln.c flock.c fparseln.c fpurge.c \ getcap.c getline.c getmode.c getopt_long.c gettemp.c \ heapsort.c \ diff --git a/tools/compat/cdbr.h b/tools/compat/cdbr.h new file mode 100644 index 000000000000..bdf5cd6c8bbd --- /dev/null +++ b/tools/compat/cdbr.h @@ -0,0 +1,5 @@ +/* $NetBSD: cdbr.h,v 1.1 2012/06/04 19:06:45 joerg Exp $ */ + +/* We unconditionally use the NetBSD cdbr(3) in libnbcompat. */ +#include "nbtool_config.h" +#include "../../include/cdbr.h"