log.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 1997, 1998
* Sleepycat Software. All rights reserved.
*
* @(#)log.h 10.30 (Sleepycat) 10/11/98
*/
#ifndef _LOG_H_
#define _LOG_H_
#ifndef MAXLFNAME
#endif
/* Default log name. */
#define DB_DEFAULT_LOG_FILE "__db_log.share"
#define LOCK_LOGTHREAD(dblp) \
#define UNLOCK_LOGTHREAD(dblp) \
#define LOCK_LOGREGION(dblp) \
#define UNLOCK_LOGREGION(dblp) \
/* Check for region catastrophic shutdown. */
#define LOG_PANIC_CHECK(dblp) { \
return (DB_RUNRECOVERY); \
}
/*
* The per-process table that maps log file-id's to DB structures.
*/
typedef struct __db_entry {
char *name; /* File name. */
int deleted; /* File was not found during open. */
} DB_ENTRY;
/*
* DB_LOG
* Per-process log structure.
*/
struct __db_log {
/* These fields need to be protected for multi-threaded support. */
#define DB_GROW_SIZE 64
/*
* These fields are always accessed while the region lock is held, so they do
* not have to be protected by the thread lock as well OR, they are only used
* when threads are not being used, i.e. most cursor operations are disallowed
* on threaded logs.
*/
int lfd; /* Log file descriptor. */
int c_fd; /* Cursor: file descriptor. */
/* These fields are not protected. */
void *addr; /* Address of shalloc() region. */
char *dir; /* Directory argument. */
/*
* These fields are used by XA; since XA forbids threaded execution, these
* do not have to be protected.
*/
void *xa_info; /* Committed transaction list that
* has to be carried between calls
* to xa_recover. */
for this XA recovery scan. */
/*
* !!!
* Currently used to hold:
* DB_AM_THREAD (a DB flag)
* DBC_RECOVER (a DBC flag)
* If they are ever the same bits, we're in serious trouble.
*/
#if DB_AM_THREAD == DBC_RECOVER
#endif
};
/*
* HDR --
* Log record header.
*/
struct __hdr {
};
struct __log_persist {
int mode; /* Log file mode. */
};
/*
* LOG --
* Shared log region. One of these is allocated in shared memory,
* and describes the log.
*/
struct __log {
/*
* The lsn LSN is the file offset that we're about to write and which
* we will return to the user.
*/
/*
* The s_lsn LSN is the last LSN that we know is on disk, not just
* written, but synced.
*/
/*
* The f_lsn LSN is the LSN (returned to the user) that "owns" the
* first byte of the buffer. If the record associated with the LSN
* spans buffers, it may not reflect the physical file location of
* the first byte of the buffer.
*/
};
/*
* FNAME --
* File name and id.
*/
struct __fname {
SH_TAILQ_ENTRY q; /* File name queue. */
};
#include "log_auto.h"
#include "log_ext.h"
#endif /* _LOG_H_ */