2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
9 * $Id: exf.h,v 10.19 2002/03/02 23:36:23 skimo Exp $ (Berkeley) $Date: 2002/03/02 23:36:23 $
17 CIRCLEQ_ENTRY(_exf
) q
; /* Linked list of file structures. */
18 int refcnt
; /* Reference count. */
20 CIRCLEQ_HEAD(_escrh
, _scr
) scrq
; /* Attached screens */
21 /* Underlying database state. */
22 DB_ENV
*env
; /* The DB environment. */
23 char *env_path
; /* DB environment directory. */
24 DB
*db
; /* File db structure. */
25 db_recno_t c_nlines
; /* Cached lines in the file. */
27 DB
*log
; /* Log db structure. */
28 db_recno_t l_high
; /* Log last + 1 record number. */
29 db_recno_t l_cur
; /* Log current record number. */
30 #ifdef USE_DB4_LOGGING
32 DB_LSN lsn_high
; /* LSN of last record. */
33 DB_LSN lsn_cur
; /* LSN of first record to undo. */
35 MARK l_cursor
; /* Log cursor position. */
36 dir_t lundo
; /* Last undo direction. */
37 WIN
*l_win
; /* Window owning transaction. */
39 LIST_HEAD(_markh
, _lmark
) marks
;/* Linked list of file MARK's. */
43 * Mtime should be a struct timespec, but time_t is more portable.
45 dev_t mdev
; /* Device. */
46 ino_t minode
; /* Inode. */
47 time_t mtime
; /* Last modification time. */
49 int fcntl_fd
; /* Fcntl locking fd; see exf.c. */
50 int fd
; /* File descriptor */
53 * Recovery in general, and these fields specifically, are described
56 #define RCV_PERIOD 120 /* Sync every two minutes. */
57 char *rcv_path
; /* Recover file name. */
58 char *rcv_mpath
; /* Recover mail file name. */
59 int rcv_fd
; /* Locked mail file descriptor. */
61 void *lock
; /* Lock for log. */
63 #define F_DEVSET 0x001 /* mdev/minode fields initialized. */
64 #define F_FIRSTMODIFY 0x002 /* File not yet modified. */
65 #define F_MODIFIED 0x004 /* File is currently dirty. */
66 #define F_MULTILOCK 0x008 /* Multiple processes running, lock. */
67 #define F_NOLOG 0x010 /* Logging turned off. */
68 #define F_RCV_NORM 0x020 /* Don't delete recovery files. */
69 #define F_RCV_ON 0x040 /* Recovery is possible. */
70 #define F_UNDO 0x080 /* No change since last undo. */
74 /* Flags to db_get(). */
75 #define DBG_FATAL 0x001 /* If DNE, error message. */
76 #define DBG_NOCACHE 0x002 /* Ignore the front-end cache. */
78 /* Flags to file_init() and file_write(). */
79 #define FS_ALL 0x001 /* Write the entire file. */
80 #define FS_APPEND 0x002 /* Append to the file. */
81 #define FS_FORCE 0x004 /* Force is set. */
82 #define FS_OPENERR 0x008 /* Open failed, try it again. */
83 #define FS_POSSIBLE 0x010 /* Force could have been set. */
84 #define FS_SETALT 0x020 /* Set alternate file name. */
86 /* Flags to rcv_sync(). */
87 #define RCV_EMAIL 0x01 /* Send the user email, IFF file modified. */
88 #define RCV_ENDSESSION 0x02 /* End the file session. */
89 #define RCV_PRESERVE 0x04 /* Preserve backup file, IFF file modified. */
90 #define RCV_SNAPSHOT 0x08 /* Snapshot the recovery, and send email. */