Add cdbr(3) support to tools/compat.

This commit is contained in:
joerg 2012-06-04 19:06:45 +00:00
parent 571103e860
commit 1fa9b84508
3 changed files with 19 additions and 4 deletions

View File

@ -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 <sys/cdefs.h>
__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 <sys/bitops.h>
#endif
#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#include <sys/mman.h>
#include <sys/stat.h>
#include <cdbr.h>
@ -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;

View File

@ -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 \

5
tools/compat/cdbr.h Normal file
View File

@ -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"