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