From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:05:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 232681065673; Sat, 14 Mar 2009 20:05:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06E408FC0C; Sat, 14 Mar 2009 20:05:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EK5Rhb006809; Sat, 14 Mar 2009 20:05:27 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EK5RiD006808; Sat, 14 Mar 2009 20:05:27 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903142005.n2EK5RiD006808@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 20:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189827 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Mar 2009 20:05:28 -0000 Author: das Date: Sat Mar 14 20:05:27 2009 New Revision: 189827 URL: http://svn.freebsd.org/changeset/base/189827 Log: Hide dbopen() in the POSIX namespace, and use standard type names throughout so that this compiles in strict POSIX mode. Modified: head/include/db.h Modified: head/include/db.h ============================================================================== --- head/include/db.h Sat Mar 14 20:04:28 2009 (r189826) +++ head/include/db.h Sat Mar 14 20:05:27 2009 (r189827) @@ -47,11 +47,11 @@ #define RET_SPECIAL 1 #define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ -typedef u_int32_t pgno_t; +typedef uint32_t pgno_t; #define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ -typedef u_int16_t indx_t; +typedef uint16_t indx_t; #define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ -typedef u_int32_t recno_t; +typedef uint32_t recno_t; /* Key/data structure -- a Data-Base Thang. */ typedef struct { @@ -101,11 +101,11 @@ typedef enum { DB_BTREE, DB_HASH, DB_REC typedef struct __db { DBTYPE type; /* Underlying db type. */ int (*close)(struct __db *); - int (*del)(const struct __db *, const DBT *, u_int); - int (*get)(const struct __db *, const DBT *, DBT *, u_int); - int (*put)(const struct __db *, DBT *, const DBT *, u_int); - int (*seq)(const struct __db *, DBT *, DBT *, u_int); - int (*sync)(const struct __db *, u_int); + int (*del)(const struct __db *, const DBT *, unsigned int); + int (*get)(const struct __db *, const DBT *, DBT *, unsigned int); + int (*put)(const struct __db *, DBT *, const DBT *, unsigned int); + int (*seq)(const struct __db *, DBT *, DBT *, unsigned int); + int (*sync)(const struct __db *, unsigned int); void *internal; /* Access method private. */ int (*fd)(const struct __db *); } DB; @@ -116,16 +116,16 @@ typedef struct __db { /* Structure used to pass parameters to the btree routines. */ typedef struct { #define R_DUP 0x01 /* duplicate keys */ - u_long flags; - u_int cachesize; /* bytes to cache */ - int maxkeypage; /* maximum keys per page */ - int minkeypage; /* minimum keys per page */ - u_int psize; /* page size */ - int (*compare) /* comparison function */ - (const DBT *, const DBT *); - size_t (*prefix) /* prefix function */ - (const DBT *, const DBT *); - int lorder; /* byte order */ + unsigned long flags; + unsigned int cachesize; /* bytes to cache */ + int maxkeypage; /* maximum keys per page */ + int minkeypage; /* minimum keys per page */ + unsigned int psize; /* page size */ + int (*compare) /* comparison function */ + (const DBT *, const DBT *); + size_t (*prefix) /* prefix function */ + (const DBT *, const DBT *); + int lorder; /* byte order */ } BTREEINFO; #define HASHMAGIC 0x061561 @@ -133,11 +133,11 @@ typedef struct { /* Structure used to pass parameters to the hashing routines. */ typedef struct { - u_int bsize; /* bucket size */ - u_int ffactor; /* fill factor */ - u_int nelem; /* number of elements */ - u_int cachesize; /* bytes to cache */ - u_int32_t /* hash function */ + unsigned int bsize; /* bucket size */ + unsigned int ffactor; /* fill factor */ + unsigned int nelem; /* number of elements */ + unsigned int cachesize; /* bytes to cache */ + uint32_t /* hash function */ (*hash)(const void *, size_t); int lorder; /* byte order */ } HASHINFO; @@ -147,12 +147,12 @@ typedef struct { #define R_FIXEDLEN 0x01 /* fixed-length records */ #define R_NOKEY 0x02 /* key not required */ #define R_SNAPSHOT 0x04 /* snapshot the input */ - u_long flags; - u_int cachesize; /* bytes to cache */ - u_int psize; /* page size */ - int lorder; /* byte order */ - size_t reclen; /* record length (fixed-length records) */ - u_char bval; /* delimiting byte (variable-length records */ + unsigned long flags; + unsigned int cachesize; /* bytes to cache */ + unsigned int psize; /* page size */ + int lorder; /* byte order */ + size_t reclen; /* record length (fixed-length records) */ + unsigned char bval; /* delimiting byte (variable-length records */ char *bfname; /* btree file name */ } RECNOINFO; @@ -164,14 +164,14 @@ typedef struct { * P_32_COPY swap from one location to another */ #define M_32_SWAP(a) { \ - u_int32_t _tmp = a; \ + uint32_t _tmp = a; \ ((char *)&a)[0] = ((char *)&_tmp)[3]; \ ((char *)&a)[1] = ((char *)&_tmp)[2]; \ ((char *)&a)[2] = ((char *)&_tmp)[1]; \ ((char *)&a)[3] = ((char *)&_tmp)[0]; \ } #define P_32_SWAP(a) { \ - u_int32_t _tmp = *(u_int32_t *)a; \ + uint32_t _tmp = *(uint32_t *)a; \ ((char *)a)[0] = ((char *)&_tmp)[3]; \ ((char *)a)[1] = ((char *)&_tmp)[2]; \ ((char *)a)[2] = ((char *)&_tmp)[1]; \ @@ -191,12 +191,12 @@ typedef struct { * P_16_COPY swap from one location to another */ #define M_16_SWAP(a) { \ - u_int16_t _tmp = a; \ + uint16_t _tmp = a; \ ((char *)&a)[0] = ((char *)&_tmp)[1]; \ ((char *)&a)[1] = ((char *)&_tmp)[0]; \ } #define P_16_SWAP(a) { \ - u_int16_t _tmp = *(u_int16_t *)a; \ + uint16_t _tmp = *(uint16_t *)a; \ ((char *)a)[0] = ((char *)&_tmp)[1]; \ ((char *)a)[1] = ((char *)&_tmp)[0]; \ } @@ -207,7 +207,9 @@ typedef struct { #endif __BEGIN_DECLS +#if __BSD_VISIBLE DB *dbopen(const char *, int, int, DBTYPE, const void *); +#endif #ifdef __DBINTERFACE_PRIVATE DB *__bt_open(const char *, int, int, const BTREEINFO *, int);