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.8 2000/04/21 19:00:33 skimo Exp $ (Berkeley) $Date: 2000/04/21 19:00:33 $
17 int refcnt
; /* Reference count. */
19 /* Underlying database state. */
20 DB
*db
; /* File db structure. */
21 char *c_lp
; /* Cached line. */
22 size_t c_len
; /* Cached line length. */
23 db_recno_t c_lno
; /* Cached line number. */
24 db_recno_t c_nlines
; /* Cached lines in the file. */
26 DB
*log
; /* Log db structure. */
27 char *l_lp
; /* Log buffer. */
28 size_t l_len
; /* Log buffer length. */
29 db_recno_t l_high
; /* Log last + 1 record number. */
30 db_recno_t l_cur
; /* Log current record number. */
31 MARK l_cursor
; /* Log cursor position. */
32 dir_t lundo
; /* Last undo direction. */
34 LIST_HEAD(_markh
, _lmark
) marks
;/* Linked list of file MARK's. */
38 * Mtime should be a struct timespec, but time_t is more portable.
40 dev_t mdev
; /* Device. */
41 ino_t minode
; /* Inode. */
42 time_t mtime
; /* Last modification time. */
44 int fcntl_fd
; /* Fcntl locking fd; see exf.c. */
47 * Recovery in general, and these fields specifically, are described
50 #define RCV_PERIOD 120 /* Sync every two minutes. */
51 char *rcv_path
; /* Recover file name. */
52 char *rcv_mpath
; /* Recover mail file name. */
53 int rcv_fd
; /* Locked mail file descriptor. */
55 #define F_DEVSET 0x001 /* mdev/minode fields initialized. */
56 #define F_FIRSTMODIFY 0x002 /* File not yet modified. */
57 #define F_MODIFIED 0x004 /* File is currently dirty. */
58 #define F_MULTILOCK 0x008 /* Multiple processes running, lock. */
59 #define F_NOLOG 0x010 /* Logging turned off. */
60 #define F_RCV_NORM 0x020 /* Don't delete recovery files. */
61 #define F_RCV_ON 0x040 /* Recovery is possible. */
62 #define F_UNDO 0x080 /* No change since last undo. */
66 /* Flags to db_get(). */
67 #define DBG_FATAL 0x001 /* If DNE, error message. */
68 #define DBG_NOCACHE 0x002 /* Ignore the front-end cache. */
70 /* Flags to file_init() and file_write(). */
71 #define FS_ALL 0x001 /* Write the entire file. */
72 #define FS_APPEND 0x002 /* Append to the file. */
73 #define FS_FORCE 0x004 /* Force is set. */
74 #define FS_OPENERR 0x008 /* Open failed, try it again. */
75 #define FS_POSSIBLE 0x010 /* Force could have been set. */
76 #define FS_SETALT 0x020 /* Set alternate file name. */
78 /* Flags to rcv_sync(). */
79 #define RCV_EMAIL 0x01 /* Send the user email, IFF file modified. */
80 #define RCV_ENDSESSION 0x02 /* End the file session. */
81 #define RCV_PRESERVE 0x04 /* Preserve backup file, IFF file modified. */
82 #define RCV_SNAPSHOT 0x08 /* Snapshot the recovery, and send email. */