DB3 support
[nvi.git] / common / exf.h
bloba3c4b62adc41538743ef6989c96ba4a97cc89c14
1 /*-
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.9 2000/04/21 21:26:19 skimo Exp $ (Berkeley) $Date: 2000/04/21 21:26:19 $
11 /* Undo direction. */
13 * exf --
14 * The file structure.
16 struct _exf {
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. */
37 * XXX
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. */
45 int fd; /* File descriptor */
48 * Recovery in general, and these fields specifically, are described
49 * in recover.c.
51 #define RCV_PERIOD 120 /* Sync every two minutes. */
52 char *rcv_path; /* Recover file name. */
53 char *rcv_mpath; /* Recover mail file name. */
54 int rcv_fd; /* Locked mail file descriptor. */
56 #define F_DEVSET 0x001 /* mdev/minode fields initialized. */
57 #define F_FIRSTMODIFY 0x002 /* File not yet modified. */
58 #define F_MODIFIED 0x004 /* File is currently dirty. */
59 #define F_MULTILOCK 0x008 /* Multiple processes running, lock. */
60 #define F_NOLOG 0x010 /* Logging turned off. */
61 #define F_RCV_NORM 0x020 /* Don't delete recovery files. */
62 #define F_RCV_ON 0x040 /* Recovery is possible. */
63 #define F_UNDO 0x080 /* No change since last undo. */
64 u_int8_t flags;
67 /* Flags to db_get(). */
68 #define DBG_FATAL 0x001 /* If DNE, error message. */
69 #define DBG_NOCACHE 0x002 /* Ignore the front-end cache. */
71 /* Flags to file_init() and file_write(). */
72 #define FS_ALL 0x001 /* Write the entire file. */
73 #define FS_APPEND 0x002 /* Append to the file. */
74 #define FS_FORCE 0x004 /* Force is set. */
75 #define FS_OPENERR 0x008 /* Open failed, try it again. */
76 #define FS_POSSIBLE 0x010 /* Force could have been set. */
77 #define FS_SETALT 0x020 /* Set alternate file name. */
79 /* Flags to rcv_sync(). */
80 #define RCV_EMAIL 0x01 /* Send the user email, IFF file modified. */
81 #define RCV_ENDSESSION 0x02 /* End the file session. */
82 #define RCV_PRESERVE 0x04 /* Preserve backup file, IFF file modified. */
83 #define RCV_SNAPSHOT 0x08 /* Snapshot the recovery, and send email. */