Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Enumerations | Functions
mcom_db.h File Reference
#include <sys/types.h>
#include "prtypes.h"
#include <limits.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>

Go to the source code of this file.

Classes

struct  DBT
struct  __db
struct  BTREEINFO
struct  HASHINFO
struct  RECNOINFO

Defines

#define EFTYPE   EINVAL /* POSIX 1003.1 format errno. */
#define RET_ERROR   -1 /* Return values. */
#define RET_SUCCESS   0
#define RET_SPECIAL   1
#define MAX_PAGE_NUMBER   0xffffffff /* >= # of pages in a file */
#define MAX_PAGE_OFFSET   65535 /* >= # of bytes in a page */
#define MAX_REC_NUMBER   0xffffffff /* >= # of records in a tree */
#define R_CURSOR   1 /* del, put, seq */
#define __R_UNUSED   2 /* UNUSED */
#define R_FIRST   3 /* seq */
#define R_IAFTER   4 /* put (RECNO) */
#define R_IBEFORE   5 /* put (RECNO) */
#define R_LAST   6 /* seq (BTREE, RECNO) */
#define R_NEXT   7 /* seq */
#define R_NOOVERWRITE   8 /* put */
#define R_PREV   9 /* seq (BTREE, RECNO) */
#define R_SETCURSOR   10 /* put (RECNO) */
#define R_RECNOSYNC   11 /* sync (RECNO) */
#define DB_LOCK   0x2000 /* Do locking. */
#define DB_SHMEM   0x4000 /* Use shared memory. */
#define DB_TXN   0x8000 /* Do transactions. */
#define BTREEMAGIC   0x053162
#define BTREEVERSION   3
#define R_DUP   0x01 /* duplicate keys */
#define HASHMAGIC   0x061561
#define HASHVERSION   2
#define R_FIXEDLEN   0x01 /* fixed-length records */
#define R_NOKEY   0x02 /* key not required */
#define R_SNAPSHOT   0x04 /* snapshot the input */

Typedefs

typedef uint32 pgno_t
typedef uint16 indx_t
typedef uint32 recno_t
typedef struct __db DB

Enumerations

enum  DBTYPE { DB_BTREE, DB_HASH, DB_RECNO }
enum  DBLockFlagEnum { LockOutDatabase, UnlockDatabase }

Functions

PR_BEGIN_EXTERN_C dbopen (const char *, int, int, DBTYPE, const void *)
void dbSetOrClearDBLock (DBLockFlagEnum type)

Class Documentation

struct DBT

Definition at line 287 of file mcom_db.h.

Class Members
void * data
size_t size
struct RECNOINFO

Definition at line 378 of file mcom_db.h.

Collaboration diagram for RECNOINFO:
Class Members
char * bfname
uint8 bval
uint cachesize
uint32 flags
int lorder
uint psize
size_t reclen

Define Documentation

#define __R_UNUSED   2 /* UNUSED */

Definition at line 294 of file mcom_db.h.

#define BTREEMAGIC   0x053162

Definition at line 345 of file mcom_db.h.

Definition at line 346 of file mcom_db.h.

#define DB_LOCK   0x2000 /* Do locking. */

Definition at line 327 of file mcom_db.h.

#define DB_SHMEM   0x4000 /* Use shared memory. */

Definition at line 328 of file mcom_db.h.

#define DB_TXN   0x8000 /* Do transactions. */

Definition at line 329 of file mcom_db.h.

#define EFTYPE   EINVAL /* POSIX 1003.1 format errno. */

Definition at line 268 of file mcom_db.h.

#define HASHMAGIC   0x061561

Definition at line 363 of file mcom_db.h.

Definition at line 364 of file mcom_db.h.

#define MAX_PAGE_NUMBER   0xffffffff /* >= # of pages in a file */

Definition at line 275 of file mcom_db.h.

#define MAX_PAGE_OFFSET   65535 /* >= # of bytes in a page */

Definition at line 281 of file mcom_db.h.

#define MAX_REC_NUMBER   0xffffffff /* >= # of records in a tree */

Definition at line 283 of file mcom_db.h.

#define R_CURSOR   1 /* del, put, seq */

Definition at line 293 of file mcom_db.h.

#define R_DUP   0x01 /* duplicate keys */

Definition at line 350 of file mcom_db.h.

#define R_FIRST   3 /* seq */

Definition at line 295 of file mcom_db.h.

#define R_FIXEDLEN   0x01 /* fixed-length records */

Definition at line 379 of file mcom_db.h.

#define R_IAFTER   4 /* put (RECNO) */

Definition at line 296 of file mcom_db.h.

#define R_IBEFORE   5 /* put (RECNO) */

Definition at line 297 of file mcom_db.h.

#define R_LAST   6 /* seq (BTREE, RECNO) */

Definition at line 298 of file mcom_db.h.

#define R_NEXT   7 /* seq */

Definition at line 299 of file mcom_db.h.

#define R_NOKEY   0x02 /* key not required */

Definition at line 380 of file mcom_db.h.

#define R_NOOVERWRITE   8 /* put */

Definition at line 300 of file mcom_db.h.

#define R_PREV   9 /* seq (BTREE, RECNO) */

Definition at line 301 of file mcom_db.h.

#define R_RECNOSYNC   11 /* sync (RECNO) */

Definition at line 303 of file mcom_db.h.

#define R_SETCURSOR   10 /* put (RECNO) */

Definition at line 302 of file mcom_db.h.

#define R_SNAPSHOT   0x04 /* snapshot the input */

Definition at line 381 of file mcom_db.h.

#define RET_ERROR   -1 /* Return values. */

Definition at line 271 of file mcom_db.h.

Definition at line 273 of file mcom_db.h.

Definition at line 272 of file mcom_db.h.


Typedef Documentation

typedef struct __db DB
typedef uint16 indx_t

Definition at line 282 of file mcom_db.h.

typedef uint32 pgno_t

Definition at line 278 of file mcom_db.h.

typedef uint32 recno_t

Definition at line 284 of file mcom_db.h.


Enumeration Type Documentation

Enumerator:
LockOutDatabase 
UnlockDatabase 

Definition at line 307 of file mcom_db.h.

enum DBTYPE
Enumerator:
DB_BTREE 
DB_HASH 
DB_RECNO 

Definition at line 305 of file mcom_db.h.


Function Documentation

PR_BEGIN_EXTERN_C dbopen ( const char *  ,
int  ,
int  ,
DBTYPE  ,
const void  
)

Definition at line 74 of file db.c.

{

       /* lock out all file databases.  Let in-memory databases through
        */
       if(all_databases_locked_closed && fname)
         {
              errno = EINVAL;
              return(NULL);
         }

#define       DB_FLAGS      (DB_LOCK | DB_SHMEM | DB_TXN)


#if 0  /* most systems dont have EXLOCK and SHLOCK */
#define       USE_OPEN_FLAGS                                                 \
       (O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY |         \
        O_RDWR | O_SHLOCK | O_TRUNC)
#else
#define       USE_OPEN_FLAGS                                                 \
       (O_CREAT | O_EXCL  | O_RDONLY |           \
        O_RDWR | O_TRUNC)
#endif

       if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
              switch (type) {
/* we don't need btree and recno right now */    
#if 0
              case DB_BTREE:
                     return (__bt_open(fname, flags & USE_OPEN_FLAGS,
                         mode, openinfo, flags & DB_FLAGS));
              case DB_RECNO:
                     return (__rec_open(fname, flags & USE_OPEN_FLAGS,
                         mode, openinfo, flags & DB_FLAGS));
#endif

              case DB_HASH:
                     return (__hash_open(fname, flags & USE_OPEN_FLAGS,
                         mode, (const HASHINFO *)openinfo, flags & DB_FLAGS));
              default:
                     break;
              }
       errno = EINVAL;
       return (NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 61 of file db.c.